qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
36,120 | <p>On a custom post type, I want to remove the filters that show up on /edit.php (where all of the posts are listed out). </p>
<p>I have a custom taxonomy that shows up as a filter that I WANT to keep, but I want to REMOVE the 'Show all dates' and 'View all categories' filters. </p>
<p>Any ideas?</p>
| [
{
"answer_id": 36122,
"author": "Brian Fegter",
"author_id": 4793,
"author_profile": "https://wordpress.stackexchange.com/users/4793",
"pm_score": 4,
"selected": true,
"text": "<p>This is a very similar question to the one you posted here: <a href=\"https://wordpress.stackexchange.com/qu... | 2011/12/11 | [
"https://wordpress.stackexchange.com/questions/36120",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11016/"
] | On a custom post type, I want to remove the filters that show up on /edit.php (where all of the posts are listed out).
I have a custom taxonomy that shows up as a filter that I WANT to keep, but I want to REMOVE the 'Show all dates' and 'View all categories' filters.
Any ideas? | This is a very similar question to the one you posted here: [How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button](https://wordpress.stackexchange.com/questions/36118/how-to-hide-everything-in-publish-metabox-except-move-to-trash-publish-button) Please check my answer. You would simply need t... |
36,123 | <p>I am new to Wordpress theming and I would like to set up a Website that only has static content. Therefore would it make sense to disable posts and only use static pages? If so, is there an easy way to do that?</p>
| [
{
"answer_id": 36125,
"author": "krembo99",
"author_id": 13256,
"author_profile": "https://wordpress.stackexchange.com/users/13256",
"pm_score": 0,
"selected": false,
"text": "<p>posts / page are essentially the same - they are only different by definition of usage (and other minute thin... | 2011/12/11 | [
"https://wordpress.stackexchange.com/questions/36123",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9856/"
] | I am new to Wordpress theming and I would like to set up a Website that only has static content. Therefore would it make sense to disable posts and only use static pages? If so, is there an easy way to do that? | You can simply hide the posts menu by adding the following to your functions.php file:
```
function remove_posts_menu() {
remove_menu_page('edit.php');
}
add_action('admin_menu', 'remove_posts_menu');
```
WordPress does not permit the disabling of the actual post type with the `unregister_post_type()` function. ... |
36,132 | <p>Wordpress 3.3 has deprecated the add_contextual_help() functions and it's filters, so in order to continue supporting 3.0 - 3.2.1 and also comply with 3.3, I have done the following:</p>
<pre><code>global $wp_version;
if ($wp_version >= '3.3') {
// New method
add_action("load-$admin_page", 'CrayonSetting... | [
{
"answer_id": 36140,
"author": "chrisguitarguy",
"author_id": 6035,
"author_profile": "https://wordpress.stackexchange.com/users/6035",
"pm_score": 4,
"selected": true,
"text": "<p>I don't see anything wrong with your approach. But I'm going to take a different track: <strong>don't sup... | 2011/12/11 | [
"https://wordpress.stackexchange.com/questions/36132",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7701/"
] | Wordpress 3.3 has deprecated the add\_contextual\_help() functions and it's filters, so in order to continue supporting 3.0 - 3.2.1 and also comply with 3.3, I have done the following:
```
global $wp_version;
if ($wp_version >= '3.3') {
// New method
add_action("load-$admin_page", 'CrayonSettingsWP::help_scree... | I don't see anything wrong with your approach. But I'm going to take a different track: **don't support older versions of WP**.
The general impression I've gotten from the WP community is one of progress. By supporting the current version and forward you're helping to push the community towards using the most up to da... |
36,135 | <p>How can I list posts as sub-items of authors? It should look like:</p>
<pre><code><ul>
<li>Author</li>
<ul>
<li>Post1</li>
<li>Post2</li>
</ul>
</li>
</ul>
</code></pre>
<p>I have an array containing a... | [
{
"answer_id": 36139,
"author": "Philip",
"author_id": 2048,
"author_profile": "https://wordpress.stackexchange.com/users/2048",
"pm_score": 0,
"selected": false,
"text": "<p>you need a list of posts by author in the menu? or in a custom page? Please make this clear in your question. </p... | 2011/12/11 | [
"https://wordpress.stackexchange.com/questions/36135",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10904/"
] | How can I list posts as sub-items of authors? It should look like:
```
<ul>
<li>Author</li>
<ul>
<li>Post1</li>
<li>Post2</li>
</ul>
</li>
</ul>
```
I have an array containing author data including `$author->ID`.
My function looks like this:
```
function add_custom_me... | This is a simpler solution, if you want a total control over the code and don't want to use a query.
```
$authors = get_users('role=author');
if(isset($authors) && !empty($authors))
{
echo "<ul>";
foreach($authors as $author)
{
$posts = get_posts(array('author'=>$author->ID));
//if this a... |
36,138 | <p>I'd like to get all pages that are direct children of HOME_ID. Per <a href="http://codex.wordpress.org/Function_Reference/get_pages#Parameters" rel="nofollow">http://codex.wordpress.org/Function_Reference/get_pages#Parameters</a> (see 'parent' parameter), I think this should be done with get_pages:</p>
<pre><code>$... | [
{
"answer_id": 36145,
"author": "Rutwick Gangurde",
"author_id": 4740,
"author_profile": "https://wordpress.stackexchange.com/users/4740",
"pm_score": 0,
"selected": false,
"text": "<p>Assuming your homepage has title as 'Home'. Use this:</p>\n\n<pre><code><?php\n\n$home = get_page_by... | 2011/12/11 | [
"https://wordpress.stackexchange.com/questions/36138",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10690/"
] | I'd like to get all pages that are direct children of HOME\_ID. Per <http://codex.wordpress.org/Function_Reference/get_pages#Parameters> (see 'parent' parameter), I think this should be done with get\_pages:
```
$top_pages = get_pages(array('parent' => HOME_ID, 'sort_column' => 'menu_order'));
```
but this returns n... | Assuming that, by "HOME\_ID", you are referring to the **static Page used to display the Site Front Page**, then you want to use `get_option( 'front_page' )` to get the **ID** for this page:
```
<?php
$menu_wp_query_args = array(
'post_type' => 'page',
'post_parent' => get_option( 'front_page' ),
'orderb... |
36,149 | <p>My pages have a sidebar with too many widgets, and it looks bad when the content is short and the sidebar is too long.</p>
<p>I want to randomize the widgets I'm showing in the sidebar. Meaning I will add all the potential widgets to the sidebar, and it will randomly only display a few.</p>
<p>I would also like so... | [
{
"answer_id": 36145,
"author": "Rutwick Gangurde",
"author_id": 4740,
"author_profile": "https://wordpress.stackexchange.com/users/4740",
"pm_score": 0,
"selected": false,
"text": "<p>Assuming your homepage has title as 'Home'. Use this:</p>\n\n<pre><code><?php\n\n$home = get_page_by... | 2011/12/11 | [
"https://wordpress.stackexchange.com/questions/36149",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11026/"
] | My pages have a sidebar with too many widgets, and it looks bad when the content is short and the sidebar is too long.
I want to randomize the widgets I'm showing in the sidebar. Meaning I will add all the potential widgets to the sidebar, and it will randomly only display a few.
I would also like some control over t... | Assuming that, by "HOME\_ID", you are referring to the **static Page used to display the Site Front Page**, then you want to use `get_option( 'front_page' )` to get the **ID** for this page:
```
<?php
$menu_wp_query_args = array(
'post_type' => 'page',
'post_parent' => get_option( 'front_page' ),
'orderb... |
36,152 | <p>i'm just about to release a community plug-in and have a few last anoying issues.</p>
<p>First, whenever i visit a page that would not be valid for the plugin, www.mydomain.com/forms/tester it will take me to a different page. What should happen, is the plugin code try and use the path 'tester', find there is no su... | [
{
"answer_id": 38281,
"author": "helgatheviking",
"author_id": 6477,
"author_profile": "https://wordpress.stackexchange.com/users/6477",
"pm_score": 0,
"selected": false,
"text": "<p>doing something similar.... creating a portfolio post type plugin and am stuck in the same place. activa... | 2011/12/11 | [
"https://wordpress.stackexchange.com/questions/36152",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8921/"
] | i'm just about to release a community plug-in and have a few last anoying issues.
First, whenever i visit a page that would not be valid for the plugin, www.mydomain.com/forms/tester it will take me to a different page. What should happen, is the plugin code try and use the path 'tester', find there is no such file, a... | Have you tried `delete_option('rewrite_rules');` on deactivate? I came across the following when investigating this problem and it did the trick for me:
>
> Typically you register post types on init. Some time after that, you
> get the deactivation action. A responsible plugin would remove its
> rewrite rules by fl... |
36,160 | <p>I want to return ALL posts with <code>query_posts</code>. I tried setting <code>posts_per_page</code> to a really high number, but <code>query_posts</code> freaks out and doesn't return any posts. What is the correct way to query posts without a limit?</p>
<pre><code>$args = array(
'post_type' => 'pos... | [
{
"answer_id": 36170,
"author": "Rutwick Gangurde",
"author_id": 4740,
"author_profile": "https://wordpress.stackexchange.com/users/4740",
"pm_score": 8,
"selected": true,
"text": "<p>-1 is your answer! Look for <code>posts_per_page</code> <a href=\"https://developer.wordpress.org/refere... | 2011/12/11 | [
"https://wordpress.stackexchange.com/questions/36160",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11029/"
] | I want to return ALL posts with `query_posts`. I tried setting `posts_per_page` to a really high number, but `query_posts` freaks out and doesn't return any posts. What is the correct way to query posts without a limit?
```
$args = array(
'post_type' => 'post',
'cat' => '22,47,67',
'orderby... | -1 is your answer! Look for `posts_per_page` [here](https://developer.wordpress.org/reference/classes/wp_query/#pagination-parameters).
```
$args = array(
'post_type' => 'post',
'cat' => '22,47,67',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'depth' => 1,
'po... |
36,164 | <p>In a multisite, how can I get the ID of the owner of the current blog?</p>
<p>I know how to get the current blogs Id using get_current_blog_id(), so given that ID, how would I fetch the ID of the owner of that blog? (there's just one owner per blog.)</p>
| [
{
"answer_id": 36165,
"author": "mikkelbreum",
"author_id": 2071,
"author_profile": "https://wordpress.stackexchange.com/users/2071",
"pm_score": 3,
"selected": true,
"text": "<p>I came up with this solution for a direct query, but I'd still like to know if there's a template tag I've mi... | 2011/12/11 | [
"https://wordpress.stackexchange.com/questions/36164",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2071/"
] | In a multisite, how can I get the ID of the owner of the current blog?
I know how to get the current blogs Id using get\_current\_blog\_id(), so given that ID, how would I fetch the ID of the owner of that blog? (there's just one owner per blog.) | I came up with this solution for a direct query, but I'd still like to know if there's a template tag I've missed.
```
$blog_id = get_current_blog_id();
$querystring = "SELECT `user_id`
FROM `wp_usermeta`
WHERE (meta_key LIKE 'primary_blog' AND meta_value LIKE $blog_id)
... |
36,184 | <p>wordpress by default writes the the date on posts, but how can I transform it to : "x" time ago ?? like 3 days ago, or 5 minutes ago ??</p>
| [
{
"answer_id": 36185,
"author": "krembo99",
"author_id": 13256,
"author_profile": "https://wordpress.stackexchange.com/users/13256",
"pm_score": 3,
"selected": true,
"text": "<pre><code>function k99_relative_time() { \n $post_date = get_the_time('U');\n $delta = time() - $post_date... | 2011/12/11 | [
"https://wordpress.stackexchange.com/questions/36184",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | wordpress by default writes the the date on posts, but how can I transform it to : "x" time ago ?? like 3 days ago, or 5 minutes ago ?? | ```
function k99_relative_time() {
$post_date = get_the_time('U');
$delta = time() - $post_date;
if ( $delta < 60 ) {
echo 'Less than a minute ago';
}
elseif ($delta > 60 && $delta < 120){
echo 'About a minute ago';
}
elseif ($delta > 120 && $delta < (60*60)){
echo s... |
36,206 | <p>I have custom post type called <strong>staff</strong> that has custom taxonomy called <strong>departments</strong>. I wanted the frontpage of the staff (archive-staff.php) to not show ALL the staff members, but actually the first department (lets say there are 3 departments.)</p>
<p>My archive page starts like this... | [
{
"answer_id": 36185,
"author": "krembo99",
"author_id": 13256,
"author_profile": "https://wordpress.stackexchange.com/users/13256",
"pm_score": 3,
"selected": true,
"text": "<pre><code>function k99_relative_time() { \n $post_date = get_the_time('U');\n $delta = time() - $post_date... | 2011/12/12 | [
"https://wordpress.stackexchange.com/questions/36206",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7712/"
] | I have custom post type called **staff** that has custom taxonomy called **departments**. I wanted the frontpage of the staff (archive-staff.php) to not show ALL the staff members, but actually the first department (lets say there are 3 departments.)
My archive page starts like this:
```
global $wp_query;
$args = arr... | ```
function k99_relative_time() {
$post_date = get_the_time('U');
$delta = time() - $post_date;
if ( $delta < 60 ) {
echo 'Less than a minute ago';
}
elseif ($delta > 60 && $delta < 120){
echo 'About a minute ago';
}
elseif ($delta > 120 && $delta < (60*60)){
echo s... |
36,222 | <p>I've been searching around for a fix to this and while I definitely have a much better understanding of my issue (thanks to similar queries posted by others) I am still not sure of the solution.</p>
<p>I am writing a shortcode as follows:</p>
<pre><code>function cup_bc_shortcode(){
$html = file_get_contents('/htm... | [
{
"answer_id": 36224,
"author": "Joshua Abenazer",
"author_id": 10251,
"author_profile": "https://wordpress.stackexchange.com/users/10251",
"pm_score": 0,
"selected": false,
"text": "<p>Why don't you place the code of that file inside the <code>cup_bc_shotcode()</code> function directly ... | 2011/12/12 | [
"https://wordpress.stackexchange.com/questions/36222",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11047/"
] | I've been searching around for a fix to this and while I definitely have a much better understanding of my issue (thanks to similar queries posted by others) I am still not sure of the solution.
I am writing a shortcode as follows:
```
function cup_bc_shortcode(){
$html = file_get_contents('/html/cup_bc_layout.php',... | The problem is that you are using `file_get_contents()` which only gets the content of the file (hence the name)
if you need to render(evaluate and process the php file) then just use `include()`.
But also if your `cup_bc_layout.php` file echo's out something then you should put the include inside an object buffer ... |
36,226 | <p>Here's the scenario.</p>
<p>Assume I have a site, wordpress.site, which has the following Permalink structure: <code>/%postname%</code></p>
<p>Assume I then set up the following posts:</p>
<ul>
<li>/post1</li>
<li>/post2</li>
<li>/post3</li>
</ul>
<p>If someone were to type in "wordpress.site/post1/" (extra slas... | [
{
"answer_id": 36232,
"author": "Simon",
"author_id": 9458,
"author_profile": "https://wordpress.stackexchange.com/users/9458",
"pm_score": 0,
"selected": false,
"text": "<p>i did not used it, but i heard a lot about this plugin <a href=\"http://wordpress.org/extend/plugins/redirection/\... | 2011/12/12 | [
"https://wordpress.stackexchange.com/questions/36226",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11048/"
] | Here's the scenario.
Assume I have a site, wordpress.site, which has the following Permalink structure: `/%postname%`
Assume I then set up the following posts:
* /post1
* /post2
* /post3
If someone were to type in "wordpress.site/post1/" (extra slash), Wordpress will automatically 301 redirect the user to "wordpres... | Use **[flush\_rewrite\_rules()](http://codex.wordpress.org/Function_Reference/flush_rewrite_rules)**:
```
add_action( 'init', 'my_rewrite_func' );
function my_rewrite_func() {
add_rewrite_rule( 'post4/$', 'index.php?p=12', 'top' );
flush_rewrite_rules();
}
```
and / or whichever rewrite rules you use, you co... |
36,233 | <p>I need to add the following .htaccess code through a function</p>
<pre><code> <IfModule mod_deflate.c>
# Insert filters
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLAT... | [
{
"answer_id": 36237,
"author": "Michal Mau",
"author_id": 2110,
"author_profile": "https://wordpress.stackexchange.com/users/2110",
"pm_score": 2,
"selected": false,
"text": "<p>Just a quick tip - you should get a basic idea by looking on how it's done in WordPress core:</p>\n\n<p><stro... | 2011/12/12 | [
"https://wordpress.stackexchange.com/questions/36233",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7376/"
] | I need to add the following .htaccess code through a function
```
<IfModule mod_deflate.c>
# Insert filters
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
Ad... | ```
/**
* Inserts an array of strings into a file (.htaccess ), placing it between
* BEGIN and END markers. Replaces existing marked info. Retains surrounding
* data. Creates file if none exists.
*
* @param array|string $insertion
* @return bool True on write success, false on failure.
*/
function add_htaccess($... |
36,235 | <p>When i post something with an image, its also displayed over homepage..
And my post has image some images inside the content of the post.. and I am not using any featured image..</p>
<p>How can we display on the custom fields on home screen.. like
I want to display 'Post title' and 'Post Date' and some 'post conten... | [
{
"answer_id": 36243,
"author": "Rutwick Gangurde",
"author_id": 4740,
"author_profile": "https://wordpress.stackexchange.com/users/4740",
"pm_score": 1,
"selected": false,
"text": "<p>This should help you..</p>\n\n<pre><code><?php\nfunction remove_images( $content )\n{\n //Run onl... | 2011/12/12 | [
"https://wordpress.stackexchange.com/questions/36235",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11052/"
] | When i post something with an image, its also displayed over homepage..
And my post has image some images inside the content of the post.. and I am not using any featured image..
How can we display on the custom fields on home screen.. like
I want to display 'Post title' and 'Post Date' and some 'post content' without... | This should help you..
```
<?php
function remove_images( $content )
{
//Run only on the front page, in your case the homepage
if(is_front_page())
{
//Remove the images
$postOutput = preg_replace('/<img\b[^>]++>/i','', $content);
//Get the first 200 characters only, you can change t... |
36,244 | <p>This question is very similar to the one below however it requires a different solution.</p>
<p><a href="https://wordpress.stackexchange.com/questions/35037/dont-display-html-if-custom-field-is-empty">Don't display html if custom field is empty</a></p>
<p>I'm using the plugin Related Posts Thumbnails but i'm u... | [
{
"answer_id": 36249,
"author": "Geert",
"author_id": 4936,
"author_profile": "https://wordpress.stackexchange.com/users/4936",
"pm_score": 3,
"selected": true,
"text": "<pre><code><?php\nglobal $related_posts_thumbnails;\nif ($related_posts_thumbnails->get_html()) { ?>\n\n &... | 2011/12/12 | [
"https://wordpress.stackexchange.com/questions/36244",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9218/"
] | This question is very similar to the one below however it requires a different solution.
[Don't display html if custom field is empty](https://wordpress.stackexchange.com/questions/35037/dont-display-html-if-custom-field-is-empty)
I'm using the plugin Related Posts Thumbnails but i'm using the template tag in my temp... | ```
<?php
global $related_posts_thumbnails;
if ($related_posts_thumbnails->get_html()) { ?>
<div id="relatedproducts">
<h1>Related Products</h1>
<?php get_related_posts_thumbnails() ?>
</div>
<?php } ?>
```
A quick look at the `get_related_posts_thumbnails()` shows that it is simply echoing ... |
36,273 | <p>I am trying to synchronize development between a Windows user (WAMP) and a Mac user (Regular Apache).</p>
<p><strong>Windows User (me)</strong>
Since I use IIS I need my port 80 so I have changed the ports on WAMP to :666.</p>
<p>So the url to the Wordpress is <a href="http://localhost:666/projectname/" rel="nofol... | [
{
"answer_id": 36281,
"author": "Danial",
"author_id": 11067,
"author_profile": "https://wordpress.stackexchange.com/users/11067",
"pm_score": 0,
"selected": false,
"text": "<p>Edit: Ignore this answer.</p>\n\n<p>The constants have already been defined. It's not possible to redefine cons... | 2011/12/12 | [
"https://wordpress.stackexchange.com/questions/36273",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11065/"
] | I am trying to synchronize development between a Windows user (WAMP) and a Mac user (Regular Apache).
**Windows User (me)**
Since I use IIS I need my port 80 so I have changed the ports on WAMP to :666.
So the url to the Wordpress is <http://localhost:666/projectname/>
**Mac user**
He has the site on a non-alias, ju... | You need to have 2 sets of settings one for if file\_exists and one for else:
```
if ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) {
include( dirname( __FILE__ ) . '/local-config.php' );
define( 'WP_LOCAL_DEV', true );
} else {
define('WP_HOME', 'http://localhost:666/projectname/');
define('WP_... |
36,280 | <p>I noticed that if I code a custom WP_Query, sticky posts don't show first in the list. So I was wandering how to achieve that. I've almost done it with 3 subsequent queries, but I guess there must be a more elegant solution for this.</p>
<p>One thing I thinked involved at least 2 query: </p>
<ul>
<li><p>first buil... | [
{
"answer_id": 36320,
"author": "Luca Reghellin",
"author_id": 10381,
"author_profile": "https://wordpress.stackexchange.com/users/10381",
"pm_score": 0,
"selected": false,
"text": "<p>Ok, no answers. Anyway, just to share, for now my (working) solution is something like this:</p>\n\n<pr... | 2011/12/12 | [
"https://wordpress.stackexchange.com/questions/36280",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10381/"
] | I noticed that if I code a custom WP\_Query, sticky posts don't show first in the list. So I was wandering how to achieve that. I've almost done it with 3 subsequent queries, but I guess there must be a more elegant solution for this.
One thing I thinked involved at least 2 query:
* first build a simple function to ... | Further upgrade: just built a class to place in functions.php or maybe in a plugin.
I did that mainly because I want almost always have sticky posts, probably in more loops per page. So got a lot of duplication. Therefore here is a basic class, that certainly can be exapanded/perfectioned some way, but for my needs jus... |
36,282 | <p>Amongst technical devs, it's pretty straightforward to get everyone running their own local dev server, get TortoiseSVN running, and then commit changes periodically to the repository. We can then update the version of the test site on the shared server from this repo and everyone is happy.</p>
<p>Except the design... | [
{
"answer_id": 36320,
"author": "Luca Reghellin",
"author_id": 10381,
"author_profile": "https://wordpress.stackexchange.com/users/10381",
"pm_score": 0,
"selected": false,
"text": "<p>Ok, no answers. Anyway, just to share, for now my (working) solution is something like this:</p>\n\n<pr... | 2011/12/12 | [
"https://wordpress.stackexchange.com/questions/36282",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3687/"
] | Amongst technical devs, it's pretty straightforward to get everyone running their own local dev server, get TortoiseSVN running, and then commit changes periodically to the repository. We can then update the version of the test site on the shared server from this repo and everyone is happy.
Except the designers who ar... | Further upgrade: just built a class to place in functions.php or maybe in a plugin.
I did that mainly because I want almost always have sticky posts, probably in more loops per page. So got a lot of duplication. Therefore here is a basic class, that certainly can be exapanded/perfectioned some way, but for my needs jus... |
36,306 | <p>I'm making a custom theme. It's a highly specialized theme to make WordPress into like an application rather than a CMS system or blog. For instance, a Dental Office Scheduling System (with CMS and widget capabilities), as an example. </p>
<p>Because my theme needs pretty URLs to work properly, something I really n... | [
{
"answer_id": 37010,
"author": "Volomike",
"author_id": 13,
"author_profile": "https://wordpress.stackexchange.com/users/13",
"pm_score": 3,
"selected": false,
"text": "<pre><code>function change_permalinks() {\n global $wp_rewrite;\n $wp_rewrite->set_permalink_structure('/%pos... | 2011/12/13 | [
"https://wordpress.stackexchange.com/questions/36306",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13/"
] | I'm making a custom theme. It's a highly specialized theme to make WordPress into like an application rather than a CMS system or blog. For instance, a Dental Office Scheduling System (with CMS and widget capabilities), as an example.
Because my theme needs pretty URLs to work properly, something I really need is for... | To fully enable permalinks, you also need to ensure that .htaccess is also created. To do that, you need to set an option and flush the rules with a Boolean.
```
global $wp_rewrite;
//Write the rule
$wp_rewrite->set_permalink_structure('/%postname%/');
//Set the option
update_option( "rewrite_rules", FALSE );
//... |
36,331 | <p><strong>EDIT 12/19/2011</strong></p>
<p>Thank you again Ijaas. Everything is working except for the order of the days. It is ordering the groups of days by the publish order. If an older post has a newer date in its meta_key then it is before a newer published post with an older meta_key. It sorts the events on... | [
{
"answer_id": 36327,
"author": "phantom.omaga",
"author_id": 9796,
"author_profile": "https://wordpress.stackexchange.com/users/9796",
"pm_score": 0,
"selected": false,
"text": "<p>to restrict unregistered users use the <a href=\"http://wordpress.org/extend/plugins/registered-users-only... | 2011/12/13 | [
"https://wordpress.stackexchange.com/questions/36331",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10209/"
] | **EDIT 12/19/2011**
Thank you again Ijaas. Everything is working except for the order of the days. It is ordering the groups of days by the publish order. If an older post has a newer date in its meta\_key then it is before a newer published post with an older meta\_key. It sorts the events on one day properly but it ... | One way to make the Log In page your landing page is to go to Dashboard > Settings > Reading and find:
Front Page displays ( ) Your latest posts
(x) A static page
Select your "home page" (which will be the Log In page) and your blog page appropriately in the drop down menus.
Regarding buddypress tab/menu structure... |
36,337 | <p>I must be doing something wrong here. I want to display the custom fields <strong>"pw_featured_note"</strong> & <strong>"pw_featured_price"</strong></p>
<p>Here is my code so far</p>
<pre><code>function featured() {
query_posts('post_type=property&posts_per_page=2');
if (have_posts()) :
while (hav... | [
{
"answer_id": 36340,
"author": "PrivateUser",
"author_id": 5074,
"author_profile": "https://wordpress.stackexchange.com/users/5074",
"pm_score": 1,
"selected": false,
"text": "<p>You need to define something like this in your header.php file.</p>\n\n<pre><code><?php\nif ( is_user_log... | 2011/12/13 | [
"https://wordpress.stackexchange.com/questions/36337",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7999/"
] | I must be doing something wrong here. I want to display the custom fields **"pw\_featured\_note"** & **"pw\_featured\_price"**
Here is my code so far
```
function featured() {
query_posts('post_type=property&posts_per_page=2');
if (have_posts()) :
while (have_posts()) : the_post();
echo "<div class=\"sin... | I've created the menu using the admin and placed that menu in a theme location. The menu items i want to hide are in this menu.
Thanks for the 2 answers below, but neither achieve what i'm after. |
36,372 | <p>Curiously, Akismet is deleting old spam comments after a period of time (I'm guessing within a week).</p>
<p>This box is <strong>NOT</strong> checked:</p>
<blockquote>
<p>Auto-delete spam submitted on posts more than a month old.</p>
</blockquote>
<p>I've sent a message to Akismet support more than a week ago b... | [
{
"answer_id": 50678,
"author": "Sparky",
"author_id": 11092,
"author_profile": "https://wordpress.stackexchange.com/users/11092",
"pm_score": 1,
"selected": true,
"text": "<p>Firstly, there is no setting for not deleting spam comments. My confusion was caused by ambiguous wording on th... | 2011/12/13 | [
"https://wordpress.stackexchange.com/questions/36372",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11092/"
] | Curiously, Akismet is deleting old spam comments after a period of time (I'm guessing within a week).
This box is **NOT** checked:
>
> Auto-delete spam submitted on posts more than a month old.
>
>
>
I've sent a message to Akismet support more than a week ago but I've not yet received a reply.
I do not want Aki... | Firstly, there is no setting for not deleting spam comments. My confusion was caused by ambiguous wording on the Akismet configuration page...
>
> Auto-delete spam submitted on posts more than a month old.
>
>
>
*"more than a month old"* is referring to *"posts"* that are more than a month old, not *"spam submitt... |
36,396 | <p>So I'm adding descriptions to my site's main menus. Checked the box, added the text. Dropped in a custom walker in functions.php. Dropped in a wp_nav_menu call in header.php to call the custom walker. Added text to the descriptions. </p>
<p>All good... but then I decided I wanted to add breaks via HTML... Dammit th... | [
{
"answer_id": 36408,
"author": "t31os",
"author_id": 31073,
"author_profile": "https://wordpress.stackexchange.com/users/31073",
"pm_score": 1,
"selected": false,
"text": "<p>The problem is not the DB doesn't contain the HTML, the filter seems to work at getting the information saved, t... | 2011/12/13 | [
"https://wordpress.stackexchange.com/questions/36396",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2624/"
] | So I'm adding descriptions to my site's main menus. Checked the box, added the text. Dropped in a custom walker in functions.php. Dropped in a wp\_nav\_menu call in header.php to call the custom walker. Added text to the descriptions.
All good... but then I decided I wanted to add breaks via HTML... Dammit they're be... | in a new wordpress version, the remove\_filter isn't enough, cause the desc is stripped hardcoded from post\_content ...
this will do the trick:
```
remove_filter('nav_menu_description', 'strip_tags');
add_filter( 'wp_setup_nav_menu_item', 'cus_wp_setup_nav_menu_item' );
function cus_wp_setup_nav_menu_item($menu_item... |
36,398 | <p>I've managed to add my own menu to the admin bar. I want the first menu item to link to my theme's options page. </p>
<p>For example, is this 100% bulletproof or is there a direct method?</p>
<pre><code>echo '<a href="'.get_admin_url().'admin.php?page=functions.php">Theme Options</a>';
</code></pre>
| [
{
"answer_id": 36400,
"author": "Rutwick Gangurde",
"author_id": 4740,
"author_profile": "https://wordpress.stackexchange.com/users/4740",
"pm_score": 0,
"selected": false,
"text": "<p>How about this:</p>\n\n<pre><code>echo \"<a href='\".admin_url('/admin.php?page=functions.php).\"'&g... | 2011/12/13 | [
"https://wordpress.stackexchange.com/questions/36398",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/366/"
] | I've managed to add my own menu to the admin bar. I want the first menu item to link to my theme's options page.
For example, is this 100% bulletproof or is there a direct method?
```
echo '<a href="'.get_admin_url().'admin.php?page=functions.php">Theme Options</a>';
``` | Assuming the installation will never have a plugin register a page with that same name it should be safe, i'd suggest giving your registered page a uniquely prefixed name, and secondly if the page name refers to your theme's functions file wouldn't it then be calling the file directly(you shouldn't ever be calling the ... |
36,402 | <p>I have tried various versions of this here:</p>
<pre><code>unset($wp_meta_boxes['dashboard']['normal']['high']['dashboard_wp_welcome_panel']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_wp_welcome_panel']);
unset($wp_meta_boxes['dashboard']['normal']['core']['wp_welcome_panel']);
unset($wp_meta_... | [
{
"answer_id": 36404,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 3,
"selected": true,
"text": "<p>If you're using multisite, there's a plugin you can network activate to disable the welcome panel on all new sites. I... | 2011/12/13 | [
"https://wordpress.stackexchange.com/questions/36402",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8337/"
] | I have tried various versions of this here:
```
unset($wp_meta_boxes['dashboard']['normal']['high']['dashboard_wp_welcome_panel']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_wp_welcome_panel']);
unset($wp_meta_boxes['dashboard']['normal']['core']['wp_welcome_panel']);
unset($wp_meta_boxes['dashboa... | If you're using multisite, there's a plugin you can network activate to disable the welcome panel on all new sites. It's aptly named "[Hide Welcome Panel for Multisite](http://wordpress.org/extend/plugins/hide-welcome-panel-for-multisite/)."
If you just want to do this for a typical (single site) installation, it's al... |
36,409 | <p>I am using my own child theme for twentyeleven, and I've made some changes to some plugin's css classes in my child style.css. The problem I'm having is that if I add a new css attribute to a class from the plugin's css, then it will make the change. But, if the attribute is already declared in the plugin's css, it... | [
{
"answer_id": 36411,
"author": "Michael Rader",
"author_id": 10666,
"author_profile": "https://wordpress.stackexchange.com/users/10666",
"pm_score": 3,
"selected": true,
"text": "<p>I suggest that you use specificity to do this. Right now both rules are of equal value. What div holds th... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36409",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11106/"
] | I am using my own child theme for twentyeleven, and I've made some changes to some plugin's css classes in my child style.css. The problem I'm having is that if I add a new css attribute to a class from the plugin's css, then it will make the change. But, if the attribute is already declared in the plugin's css, it rel... | I suggest that you use specificity to do this. Right now both rules are of equal value. What div holds the div "product?" If the Div is called "wrapper" your code could look like this:
```
body div.product div.images img {
......
}
``` |
36,418 | <p>Say you have custom menus enabled with your WP theme. Is there any action associated with saving a menu once you've arranged it accordingly? To further clarify: say you've arranged a menu with some links and some posts, how might you get the titles of the posts in said menu upon saving (clicking the "Save Menu" butt... | [
{
"answer_id": 36427,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 1,
"selected": false,
"text": "<p>There is no dedicated action for your needs, but you can misuse the <code>'check_admin_referer'</code> hook. See the <... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36418",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11112/"
] | Say you have custom menus enabled with your WP theme. Is there any action associated with saving a menu once you've arranged it accordingly? To further clarify: say you've arranged a menu with some links and some posts, how might you get the titles of the posts in said menu upon saving (clicking the "Save Menu" button)... | At least in 3.4.1, there is an action for that: wp\_update\_nav\_menu
See [here](http://core.trac.wordpress.org/browser/tags/3.4.1/wp-admin/nav-menus.php#L379).
Then you can get the items in your menu with something like:
```
add_action('wp_update_nav_menu', 'my_get_menu_items');
function my_get_menu_items($nav_menu... |
36,421 | <p>Related to my <a href="https://wordpress.stackexchange.com/questions/36420/how-do-i-create-a-custom-post-type-for-a-training-cms-in-wordpress">How do I create a custom post type for a training CMS in WordPress?</a> question, I would like to know how I can create a private comments section for a custom post type (or ... | [
{
"answer_id": 36427,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 1,
"selected": false,
"text": "<p>There is no dedicated action for your needs, but you can misuse the <code>'check_admin_referer'</code> hook. See the <... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36421",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7268/"
] | Related to my [How do I create a custom post type for a training CMS in WordPress?](https://wordpress.stackexchange.com/questions/36420/how-do-i-create-a-custom-post-type-for-a-training-cms-in-wordpress) question, I would like to know how I can create a private comments section for a custom post type (or any post type ... | At least in 3.4.1, there is an action for that: wp\_update\_nav\_menu
See [here](http://core.trac.wordpress.org/browser/tags/3.4.1/wp-admin/nav-menus.php#L379).
Then you can get the items in your menu with something like:
```
add_action('wp_update_nav_menu', 'my_get_menu_items');
function my_get_menu_items($nav_menu... |
36,423 | <p><strong>Issue?</strong><br>
Whenever I use the term 'CSS' in a post title, the rest of the title (after the term 'CSS'), is inserted at the top of the single post page.</p>
<p><strong>What steps will reproduce the problem?</strong><br>
1. Create a new post.<br>
2. Type 'CSS' somewhere in the post title.<br>
3. Prev... | [
{
"answer_id": 36425,
"author": "PrivateUser",
"author_id": 5074,
"author_profile": "https://wordpress.stackexchange.com/users/5074",
"pm_score": 0,
"selected": false,
"text": "<p>Use the style.css for css related codes. \nAnd don't hard code your title. I mean don't insert any css tags ... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36423",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10783/"
] | **Issue?**
Whenever I use the term 'CSS' in a post title, the rest of the title (after the term 'CSS'), is inserted at the top of the single post page.
**What steps will reproduce the problem?**
1. Create a new post.
2. Type 'CSS' somewhere in the post title.
3. Preview/publish the post.
**What is the exp... | Disable all plugins. One of them puts all words with capital letters in a `<span class="caps">` container. In
```
<meta property="og:title" content="test <span class="caps">CSS</span> title" />
```
… this closes the `<head>` section automatically because output is not allowed in `<head>`.
If you have found the plu... |
36,430 | <p>I have the method below to try and build a URL for a script I wish to load:</p>
<pre><code>class WPSM_SuperMail {
public static function scriptUrl($scriptPath) {
return plugin_dir_url ( __FILE__ ) . '/js/' . $scriptPath;
}
}
</code></pre>
<p>However, the <code>WPSM_SuperMail</code> class is locate... | [
{
"answer_id": 36433,
"author": "Rutwick Gangurde",
"author_id": 4740,
"author_profile": "https://wordpress.stackexchange.com/users/4740",
"pm_score": 1,
"selected": false,
"text": "<p>Does this help?:</p>\n\n<pre><code>return plugins_url('/js/'. $scriptPath, '__FILE__');\n</code></pre>\... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36430",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7268/"
] | I have the method below to try and build a URL for a script I wish to load:
```
class WPSM_SuperMail {
public static function scriptUrl($scriptPath) {
return plugin_dir_url ( __FILE__ ) . '/js/' . $scriptPath;
}
}
```
However, the `WPSM_SuperMail` class is located in the *code* sub-folder of my plug... | Does this help?:
```
return plugins_url('/js/'. $scriptPath, '__FILE__');
```
OR
```
return plugins_url('/code/<your php file name here>', '__FILE__');
```
Try the [Codex for `plugins_url`](http://codex.wordpress.org/Function_Reference/plugins_url) as well. |
36,452 | <p>Using the following code I experienced some problems: Login works but every link in the dashboard I will click will follow into the 404 not found page. It seems that there won't be a working session created?</p>
<pre><code>$username="admin";
$password="admin";
$url="http://www.yourdomain.com/";
$cookie="cookie.txt"... | [
{
"answer_id": 36458,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 3,
"selected": true,
"text": "<p>Not sure its a session issue, i think it has to do with the fact that WordPress Dashboard uses relative links.... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36452",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10983/"
] | Using the following code I experienced some problems: Login works but every link in the dashboard I will click will follow into the 404 not found page. It seems that there won't be a working session created?
```
$username="admin";
$password="admin";
$url="http://www.yourdomain.com/";
$cookie="cookie.txt";
$postdata =... | Not sure its a session issue, i think it has to do with the fact that WordPress Dashboard uses relative links.
A quick hackish fix would be to add
```
curl_setopt($ch,CURL_COOKIEFILE, ''); // Enables session support
```
Then, add this after closing the curl handler redirect to the actual dashbard location:
```
c... |
36,453 | <p>I would like to implement something like "recent posts" in a static page:</p>
<p><a href="http://themes.codehunk.me/insignio/" rel="noreferrer">http://themes.codehunk.me/insignio/</a> (at the footer)</p>
<p>How I would be able to do this without a widget?</p>
| [
{
"answer_id": 36455,
"author": "Anto",
"author_id": 11121,
"author_profile": "https://wordpress.stackexchange.com/users/11121",
"pm_score": 1,
"selected": false,
"text": "<p>Wordpress provides a function for that kind of request: <a href=\"http://codex.wordpress.org/Function_Reference/q... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36453",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7552/"
] | I would like to implement something like "recent posts" in a static page:
<http://themes.codehunk.me/insignio/> (at the footer)
How I would be able to do this without a widget? | I usually use this approach:
**wrong approach**
```
<?php query_posts( array(
'category_name' => 'news',
'posts_per_page' => 3,
)); ?>
<?php if( have_posts() ): while ( have_posts() ) : the_post(); ?>
<?php the_excerpt(); ?>
<?php endwhile; ?>
<?php else : ?>
<p><?php __('No News'); ?></p>
<?php e... |
36,456 | <p>I'm trying to install Jetpack after a successful install, but Jeckpack throws an error about site not being publicly accessible:</p>
<blockquote>
<p>site_inaccessible</p>
<p>Error Details: The Jetpack server was unable to communicate with your site [IXR -32300: transport error: http_request_failed Operation timed ou... | [
{
"answer_id": 37162,
"author": "Sheri Bigelow",
"author_id": 10377,
"author_profile": "https://wordpress.stackexchange.com/users/10377",
"pm_score": 4,
"selected": true,
"text": "<p>You may not have enough processes running.</p>\n\n<p>To test, try creating a file sleeper.php: </p>\n\n<p... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36456",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2160/"
] | I'm trying to install Jetpack after a successful install, but Jeckpack throws an error about site not being publicly accessible:
>
> site\_inaccessible
>
>
> Error Details: The Jetpack server was unable to communicate with your site [IXR -32300: transport error: http\_request\_failed Operation timed out after 15001... | You may not have enough processes running.
To test, try creating a file sleeper.php:
```
<?php
sleep(5);
echo "Working fine\n";
```
And then run this from the cli:
```
curl -m 6 http://example.com/sleeper.php & curl -m 6 http://example.com/sleeper.php & wait
```
If there is only one process it will print out so... |
36,476 | <p>I'm very confused regarding the have_posts(). It returns an empty result even though I have one post that match the query.</p>
<p>The below code is used in a widget which should display exactly one post, if it exists. I use wordpress 3.3...</p>
<pre><code>$singleargs = array('p' => 2040, 'post_type' => 'even... | [
{
"answer_id": 36535,
"author": "Gerben van Dijk",
"author_id": 11150,
"author_profile": "https://wordpress.stackexchange.com/users/11150",
"pm_score": 0,
"selected": false,
"text": "<p>Doesn't </p>\n\n<pre><code>'post_status' => array('any')\n</code></pre>\n\n<p>Break the query?</p>... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36476",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9167/"
] | I'm very confused regarding the have\_posts(). It returns an empty result even though I have one post that match the query.
The below code is used in a widget which should display exactly one post, if it exists. I use wordpress 3.3...
```
$singleargs = array('p' => 2040, 'post_type' => 'event', 'post_status' => array... | Can you try changing your query to this?
```
$singleargs = array('post_type' => 'event');
```
It looks like that's what you're going for. The rest of the parameters limits your result to zero or 1.
Also, make sure that the post type name is spelled correctly in your query. |
36,479 | <p>I am using WordPress to develop a coupon site. Merchant <code>pages</code> are somewhat similar to <a href="http://www.promotionalcodes.org.uk/accountz/" rel="nofollow">this</a>. I am using shortcodes in these <code>pages</code> for Facebook Like, Google +1, Customer Review, Codes from similar stores etc. The thing ... | [
{
"answer_id": 36482,
"author": "AndrettiMilas",
"author_id": 5205,
"author_profile": "https://wordpress.stackexchange.com/users/5205",
"pm_score": 0,
"selected": false,
"text": "<p>Forget shortcodes for this.</p>\n\n<p>Use one of these services:</p>\n\n<p>Addthis: <a href=\"http://www.a... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36479",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6076/"
] | I am using WordPress to develop a coupon site. Merchant `pages` are somewhat similar to [this](http://www.promotionalcodes.org.uk/accountz/). I am using shortcodes in these `pages` for Facebook Like, Google +1, Customer Review, Codes from similar stores etc. The thing I want to ask is: is this a good way of doing all t... | Lucas Wynne linked some good plugins for such functionalities (I have used Addthis multiple times), however if you're looking for a plugin-free solution, i'd more likely filter the content in my functions.php file instead of using a shortcode :
some pseudo-code
```
function add_content( $content ){
$content .= ... |
36,493 | <p>I know how to <em>set</em> the size of a post thumbnail image using the WP Admin <a href="https://en.support.wordpress.com/settings/media-settings/" rel="nofollow noreferrer">Media Settings</a> or using <a href="https://codex.wordpress.org/Function_Reference/set_post_thumbnail_size" rel="nofollow noreferrer">this fu... | [
{
"answer_id": 36497,
"author": "Mihael",
"author_id": 11132,
"author_profile": "https://wordpress.stackexchange.com/users/11132",
"pm_score": -1,
"selected": false,
"text": "<p>What you need is this function: <strong>wp_get_attachment_image_src</strong></p>\n\n<p>Codex: <a href=\"http:/... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36493",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2071/"
] | I know how to *set* the size of a post thumbnail image using the WP Admin [Media Settings](https://en.support.wordpress.com/settings/media-settings/) or using [this function](https://codex.wordpress.org/Function_Reference/set_post_thumbnail_size):
```
set_post_thumbnail_size( 150, 150 )
```
But how would one get the... | When an image size is added either by WordPress(`add_image_size`), or by a plugin or your own custom code it gets added into the `$_wp_additional_image_sizes` global, i can't find a similar function for pulling data from that global, but you could certainly just look inside the global to determine what width and height... |
36,494 | <p>I'm searching a social connect plugin which allows users to register/login using the following sites and support MULTISITE
1)Facebook
2)Twitter
3)Google
4)Yahoo
5)Others (optional)</p>
<p>I've tried many plugin but none of them met my requirements.
Plugins that support facebook,twitter,google,yahoo has security is... | [
{
"answer_id": 36497,
"author": "Mihael",
"author_id": 11132,
"author_profile": "https://wordpress.stackexchange.com/users/11132",
"pm_score": -1,
"selected": false,
"text": "<p>What you need is this function: <strong>wp_get_attachment_image_src</strong></p>\n\n<p>Codex: <a href=\"http:/... | 2011/12/14 | [
"https://wordpress.stackexchange.com/questions/36494",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5074/"
] | I'm searching a social connect plugin which allows users to register/login using the following sites and support MULTISITE
1)Facebook
2)Twitter
3)Google
4)Yahoo
5)Others (optional)
I've tried many plugin but none of them met my requirements.
Plugins that support facebook,twitter,google,yahoo has security issues.
I'v... | When an image size is added either by WordPress(`add_image_size`), or by a plugin or your own custom code it gets added into the `$_wp_additional_image_sizes` global, i can't find a similar function for pulling data from that global, but you could certainly just look inside the global to determine what width and height... |
36,508 | <p><strong>Edit 12/15/2011 Added Radio Button print code</strong></p>
<pre><code> // Add meta boxes to admin panel only needs to be added once
add_action('admin_menu', 'plib_add_box');
//Add meta boxes to post types
function plib_add_box() {
global $meta_box;
foreach($meta_box as $post... | [
{
"answer_id": 36525,
"author": "jocken",
"author_id": 11145,
"author_profile": "https://wordpress.stackexchange.com/users/11145",
"pm_score": 0,
"selected": false,
"text": "<p>It looks like you are calling the wrong fields.</p>\n\n<p>try <code>print_r($event_custom_meta);</code> to see ... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36508",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10209/"
] | **Edit 12/15/2011 Added Radio Button print code**
```
// Add meta boxes to admin panel only needs to be added once
add_action('admin_menu', 'plib_add_box');
//Add meta boxes to post types
function plib_add_box() {
global $meta_box;
foreach($meta_box as $post_type => $value) {
... | The main problem with your code is that you only store the value and not the venue name a simple fix would be to change your vlaue to hold the venue name as well ,
something like:
```
array(
'name' => 'Venue',
'desc' => 'Venue of Event',
'id' => $prefix . 'event_venue',
'type' => 'radio',
'options'... |
36,511 | <p>Are widgets meant to be used outside of sidebars?</p>
<p>My case: I have this html block which I want to use every time I display a post with category of "Story". I was going to make a widget to reduce duplicate code. Is there a better way to apply this html block to every displaying of a "Story" post?</p>
| [
{
"answer_id": 36525,
"author": "jocken",
"author_id": 11145,
"author_profile": "https://wordpress.stackexchange.com/users/11145",
"pm_score": 0,
"selected": false,
"text": "<p>It looks like you are calling the wrong fields.</p>\n\n<p>try <code>print_r($event_custom_meta);</code> to see ... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36511",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9142/"
] | Are widgets meant to be used outside of sidebars?
My case: I have this html block which I want to use every time I display a post with category of "Story". I was going to make a widget to reduce duplicate code. Is there a better way to apply this html block to every displaying of a "Story" post? | The main problem with your code is that you only store the value and not the venue name a simple fix would be to change your vlaue to hold the venue name as well ,
something like:
```
array(
'name' => 'Venue',
'desc' => 'Venue of Event',
'id' => $prefix . 'event_venue',
'type' => 'radio',
'options'... |
36,521 | <p>I'm running wordpress multisite, and when I connect to my domain at domain.com I get the error "Greetings Site Administrator! You are currently allowing “none” registrations. To change or disable registration go to your Options page."</p>
<p>Should I create a 301 redirect from non www to www.domain.com or is there ... | [
{
"answer_id": 36526,
"author": "rexposadas",
"author_id": 413,
"author_profile": "https://wordpress.stackexchange.com/users/413",
"pm_score": 2,
"selected": false,
"text": "<p>you can make that happen in the .htaccess file. just add these lines:</p>\n\n<pre><code>RewriteEngine On\nRewri... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36521",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10413/"
] | I'm running wordpress multisite, and when I connect to my domain at domain.com I get the error "Greetings Site Administrator! You are currently allowing “none” registrations. To change or disable registration go to your Options page."
Should I create a 301 redirect from non www to www.domain.com or is there a way to c... | you can make that happen in the .htaccess file. just add these lines:
```
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
```
this will do a 301 from non-www to www of your domain. |
36,528 | <p>I have created some pages and some pages have children.When i go to the wp admin menu,i create new menu and drag all the pages,including ones with children pages.I notice that the menus are all displayed without the cool drop downs i had hoped to see.</p>
<p>Does it mean that menus created in the wp admin cannot h... | [
{
"answer_id": 36526,
"author": "rexposadas",
"author_id": 413,
"author_profile": "https://wordpress.stackexchange.com/users/413",
"pm_score": 2,
"selected": false,
"text": "<p>you can make that happen in the .htaccess file. just add these lines:</p>\n\n<pre><code>RewriteEngine On\nRewri... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36528",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11125/"
] | I have created some pages and some pages have children.When i go to the wp admin menu,i create new menu and drag all the pages,including ones with children pages.I notice that the menus are all displayed without the cool drop downs i had hoped to see.
Does it mean that menus created in the wp admin cannot have drop do... | you can make that happen in the .htaccess file. just add these lines:
```
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
```
this will do a 301 from non-www to www of your domain. |
36,531 | <p>I am writing a plugin for Wordpress and am wondering how to add an extra button to the media uploader that says something like "add to album". I can't seem to find info on how other developers have managed to get this done. Thanks :)</p>
| [
{
"answer_id": 36538,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 1,
"selected": false,
"text": "<p>When i needed to do something similar i used the <code>admin_print_scripts-media-upload-popup</code> hook\nto... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36531",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11150/"
] | I am writing a plugin for Wordpress and am wondering how to add an extra button to the media uploader that says something like "add to album". I can't seem to find info on how other developers have managed to get this done. Thanks :) | I managed to get it done this way:
Adding JS to the media uploader:
```
function mediabutton(){
wp_register_script( 'mediabutton', ''.WP_PLUGIN_URL.'/magic-gallery/js/mediabutton.js', null, null);
wp_enqueue_script( 'mediabutton');
}
add_action('admin_print_scripts-media-upload-popup','mediabutton'); // Ad... |
36,551 | <p>I need to create a dropdown menu with "<strong>posts</strong> from a custom post type" as option.</p>
<p>This dropdown will be placed as custom meta box.</p>
<p>For example, I want all posts with the custom type "Video" as option in the select.</p>
<pre><code><select>
<option>post title n°1<opti... | [
{
"answer_id": 36623,
"author": "krembo99",
"author_id": 13256,
"author_profile": "https://wordpress.stackexchange.com/users/13256",
"pm_score": 1,
"selected": false,
"text": "<p>If you already know how to make the custom meta box, you can use </p>\n\n<pre><code> wp_dropdown_categories(... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36551",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2000/"
] | I need to create a dropdown menu with "**posts** from a custom post type" as option.
This dropdown will be placed as custom meta box.
For example, I want all posts with the custom type "Video" as option in the select.
```
<select>
<option>post title n°1<option>
<option>post title n°2<option>
....
</select>
... | Here is the code I'm using in a project I'm working on.
```
function generate_post_select($select_id, $post_type, $selected = 0) {
$post_type_object = get_post_type_object($post_type);
$label = $post_type_object->label;
$posts = get_posts(array('post_type'=> $post_type, 'post_status'=> 'publis... |
36,567 | <p>I am working on a BuddyPress plug-in for a client that requires users to be able to add content from the front end - they never see the back end for security reasons. I have the plug-in written and it works perfectly but it is missing one thing: a rich text editor so that users can customize their content (within re... | [
{
"answer_id": 37037,
"author": "Jamal Jama",
"author_id": 2474,
"author_profile": "https://wordpress.stackexchange.com/users/2474",
"pm_score": 0,
"selected": false,
"text": "<p>The following code should work for you. Just make sure that the <code>textarea</code> id is all lower-case an... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36567",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8554/"
] | I am working on a BuddyPress plug-in for a client that requires users to be able to add content from the front end - they never see the back end for security reasons. I have the plug-in written and it works perfectly but it is missing one thing: a rich text editor so that users can customize their content (within reaso... | note that `wp_editor` will *echo* to output, not put it in a variable.
If you want to put it in a variable, just do
```
ob_start();
wp_editor($content, 'textarea_rich', $args);
$html = ob_get_contents();
ob_end_clean();
```
and you have what you need in `$html`.
You can also see <https://plugins.svn.wordpress.org/in... |
36,568 | <p>I have asked this question about a year ago and I am hoping there is some type of simple solution which will allow me achieve my objective. So here it goes:</p>
<p>I often utilize shortcodes within the Admin Editor but when I turn this over to client they often don't understand how they work.</p>
<p>What I am look... | [
{
"answer_id": 40687,
"author": "Matthew Boynes",
"author_id": 12324,
"author_profile": "https://wordpress.stackexchange.com/users/12324",
"pm_score": 5,
"selected": true,
"text": "<p>It's actually not too bad to do what you're asking. This should take you about an hour to do your first ... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36568",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/479/"
] | I have asked this question about a year ago and I am hoping there is some type of simple solution which will allow me achieve my objective. So here it goes:
I often utilize shortcodes within the Admin Editor but when I turn this over to client they often don't understand how they work.
What I am looking for is a solu... | It's actually not too bad to do what you're asking. This should take you about an hour to do your first one, and 10 minutes to do subsequent ones.
Ultimately what you're going to do is create a TinyMCE plugin. Here's what you should arm yourself with to start:
1. [General guide to creating a tinymce plugin](https://w... |
36,570 | <p>i am trying to remove the header from one page (actually all the pages exept the Home page)
i did some research i found this code #post-xx .entry-title{display:none;}
whereas the xx is the page ID . but it doesn t work for me
do you know the exact code and exact place (and what s the page ID), or any other way...
a... | [
{
"answer_id": 36578,
"author": "ptriek",
"author_id": 9134,
"author_profile": "https://wordpress.stackexchange.com/users/9134",
"pm_score": 2,
"selected": true,
"text": "<p>To remove the header image of the Twenty Eleven theme on other pages then your homepage, change the following code... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36570",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11165/"
] | i am trying to remove the header from one page (actually all the pages exept the Home page)
i did some research i found this code #post-xx .entry-title{display:none;}
whereas the xx is the page ID . but it doesn t work for me
do you know the exact code and exact place (and what s the page ID), or any other way...
any ... | To remove the header image of the Twenty Eleven theme on other pages then your homepage, change the following code in header.php (in wp-content/themes/twentyeleven)
**Before:**
```
<?php
// Check to see if the header image has been removed
$header_image = get_header_image();
if ( ! empty( ... |
36,574 | <p>In my image.php I am using this code to grab the image caption of each image. The problem is a paragraph tag ( <code><p></code> ) is being added around it and I don't want one to be. Could somebody tell me how to strip this tag?</p>
<pre><code><?php if ( !empty($post->post_excerpt) ) the_excerpt(); ?&... | [
{
"answer_id": 36578,
"author": "ptriek",
"author_id": 9134,
"author_profile": "https://wordpress.stackexchange.com/users/9134",
"pm_score": 2,
"selected": true,
"text": "<p>To remove the header image of the Twenty Eleven theme on other pages then your homepage, change the following code... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36574",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5205/"
] | In my image.php I am using this code to grab the image caption of each image. The problem is a paragraph tag ( `<p>` ) is being added around it and I don't want one to be. Could somebody tell me how to strip this tag?
```
<?php if ( !empty($post->post_excerpt) ) the_excerpt(); ?>
``` | To remove the header image of the Twenty Eleven theme on other pages then your homepage, change the following code in header.php (in wp-content/themes/twentyeleven)
**Before:**
```
<?php
// Check to see if the header image has been removed
$header_image = get_header_image();
if ( ! empty( ... |
36,589 | <p>I have created multiple post types and now want to create multiple custom fields for each post type. I am not entirely how to but more specifically I believe I am doing something wrong when trying to save the meta field data.</p>
<p>I've based my project form this tutorial: <a href="http://wefunction.com/2008/10/t... | [
{
"answer_id": 36605,
"author": "Brent",
"author_id": 10972,
"author_profile": "https://wordpress.stackexchange.com/users/10972",
"pm_score": 2,
"selected": true,
"text": "<p>I just jumped in deep on the last two WordPress projects that I've built getting immersed on both custom post typ... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36589",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7739/"
] | I have created multiple post types and now want to create multiple custom fields for each post type. I am not entirely how to but more specifically I believe I am doing something wrong when trying to save the meta field data.
I've based my project form this tutorial: <http://wefunction.com/2008/10/tutorial-creating-cu... | I just jumped in deep on the last two WordPress projects that I've built getting immersed on both custom post types and custom fields, which are frequently implemented using metaboxes on the back end.
On this last project I went all out with the use of [WP Alchemy metabox class](http://www.farinspace.com/wpalchemy-me... |
36,600 | <p>I have a custom meta box for a custom post type that my client wants placed between the title/permalink section and the post editor in the admin panel. Is this possible and if so is there a hook/filter/etc that I would need to use?</p>
| [
{
"answer_id": 88103,
"author": "Andrew",
"author_id": 27923,
"author_profile": "https://wordpress.stackexchange.com/users/27923",
"pm_score": 7,
"selected": true,
"text": "<ul>\n<li>Simply add a meta box using the <em>advanced</em> context, and <em>high</em> priority</li>\n<li>Then, lat... | 2011/12/15 | [
"https://wordpress.stackexchange.com/questions/36600",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11170/"
] | I have a custom meta box for a custom post type that my client wants placed between the title/permalink section and the post editor in the admin panel. Is this possible and if so is there a hook/filter/etc that I would need to use? | * Simply add a meta box using the *advanced* context, and *high* priority
* Then, latch on to the `edit_form_after_title` hook
* Print your meta boxes out there, then remove it so it doesn't appear twice.
```
// Move all "advanced" metaboxes above the default editor
add_action('edit_form_after_title', function() {
... |
36,626 | <p>I am a beginner to wordpress (and to php for that matter). </p>
<p>I am trying to understand some of the basics, and building a little e-commerce store using a plugin called "Jigoshop."</p>
<p>I'm reading through the source files and seeing a bunch of useful functions- things like a "is_featured" function that ret... | [
{
"answer_id": 36635,
"author": "Box",
"author_id": 130,
"author_profile": "https://wordpress.stackexchange.com/users/130",
"pm_score": 3,
"selected": false,
"text": "<p>Yes, you can use functions from plugins in your theme. Please use the function_exists() function to make sure that the... | 2011/12/16 | [
"https://wordpress.stackexchange.com/questions/36626",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11167/"
] | I am a beginner to wordpress (and to php for that matter).
I am trying to understand some of the basics, and building a little e-commerce store using a plugin called "Jigoshop."
I'm reading through the source files and seeing a bunch of useful functions- things like a "is\_featured" function that returns true if the... | Yes, you can use functions from plugins in your theme. Please use the function\_exists() function to make sure that the function does exit. I used the Breadcrumbs Plus in one of the themes like this:
```
<?php
if (function_exists('breadcrumbs_plus'))
{
$breadcrumb_options = array(
'prefix' => '<div id=... |
36,657 | <p>I'm embedding the_editor on a admin page:</p>
<pre><code><?php the_editor(get_option('options_name'),'options_name'); ?>
</code></pre>
<p>And everything works fine, at least in back-end:</p>
<p><a href="https://i.stack.imgur.com/lcXtE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lcXt... | [
{
"answer_id": 37028,
"author": "bILLY",
"author_id": 11320,
"author_profile": "https://wordpress.stackexchange.com/users/11320",
"pm_score": -1,
"selected": false,
"text": "<p><a href=\"http://wordpress.org/extend/plugins/use-google-libraries/\" rel=\"nofollow\">http://wordpress.org/ext... | 2011/12/16 | [
"https://wordpress.stackexchange.com/questions/36657",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1869/"
] | I'm embedding the\_editor on a admin page:
```
<?php the_editor(get_option('options_name'),'options_name'); ?>
```
And everything works fine, at least in back-end:
[](https://i.stack.imgur.com/lcXtE.png)
BUT on the front-end side I'm always getting inline output, th... | I installed w3 total cache plugin and cleared my browser cache. Wish I had of done this pre deleting some forms! |
36,672 | <p>Why don't shortcodes work when a post is view on Home page but they do when viewing single post.
You can see the issue <a href="http://india.thefalljourney.com/" rel="nofollow">here</a>.</p>
<p>There are suppose to be two element's above the image - generated by JW Player and a custom shortcode, and one shortcode b... | [
{
"answer_id": 36674,
"author": "kramdraw85",
"author_id": 8089,
"author_profile": "https://wordpress.stackexchange.com/users/8089",
"pm_score": 2,
"selected": false,
"text": "<p>Is the homepage pulling in the_excerpt() ? If so you will have to add this to your functions.php</p>\n\n<pre... | 2011/12/16 | [
"https://wordpress.stackexchange.com/questions/36672",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10187/"
] | Why don't shortcodes work when a post is view on Home page but they do when viewing single post.
You can see the issue [here](http://india.thefalljourney.com/).
There are suppose to be two element's above the image - generated by JW Player and a custom shortcode, and one shortcode below the image - generated by Lightb... | Is the homepage pulling in the\_excerpt() ? If so you will have to add this to your functions.php
```
add_filter('the_excerpt', 'do_shortcode');
```
This will work if you are putting in manual excerpt. It shouldn't be stripping out the shortcode if you are using the\_content() in your homepage template. |
36,681 | <p>I'm looking to measure how fast my site is processed. Is there any software out there that can do this?</p>
<p>If it depends on the server, is there any way to monitor the speed from my localhost (purely CPU load?)</p>
| [
{
"answer_id": 36674,
"author": "kramdraw85",
"author_id": 8089,
"author_profile": "https://wordpress.stackexchange.com/users/8089",
"pm_score": 2,
"selected": false,
"text": "<p>Is the homepage pulling in the_excerpt() ? If so you will have to add this to your functions.php</p>\n\n<pre... | 2011/12/16 | [
"https://wordpress.stackexchange.com/questions/36681",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10099/"
] | I'm looking to measure how fast my site is processed. Is there any software out there that can do this?
If it depends on the server, is there any way to monitor the speed from my localhost (purely CPU load?) | Is the homepage pulling in the\_excerpt() ? If so you will have to add this to your functions.php
```
add_filter('the_excerpt', 'do_shortcode');
```
This will work if you are putting in manual excerpt. It shouldn't be stripping out the shortcode if you are using the\_content() in your homepage template. |
36,684 | <p>Is it possible to execute the gallery shortcode before any other content no matter where the shortcode is in the post HTML? </p>
| [
{
"answer_id": 36709,
"author": "jot",
"author_id": 11277,
"author_profile": "https://wordpress.stackexchange.com/users/11277",
"pm_score": 3,
"selected": true,
"text": "<pre><code>function gallery_first( $content) {\n $expr = '/\\[gallery(.*?)\\]/i';\n return preg_replace_callback... | 2011/12/16 | [
"https://wordpress.stackexchange.com/questions/36684",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1613/"
] | Is it possible to execute the gallery shortcode before any other content no matter where the shortcode is in the post HTML? | ```
function gallery_first( $content) {
$expr = '/\[gallery(.*?)\]/i';
return preg_replace_callback( $expr, create_function('$matches', 'return do_shortcode($matches[0]);'), $content);
}
add_filter( 'the_content', 'gallery_first', 6); // prio 6 executes this function previous to all other filter functions
``` |
36,698 | <p>I have a registered post type with 'rewrite' set as slug=>cpt_name, with_front=>true.</p>
<pre><code>register_post_type( 'objection_handling',
array(
'rewrite' => array(
'slug' => 'objection_handling',
... | [
{
"answer_id": 36702,
"author": "ferenyl",
"author_id": 11034,
"author_profile": "https://wordpress.stackexchange.com/users/11034",
"pm_score": 1,
"selected": false,
"text": "<p>You should change the slug for the taxonomy. </p>\n\n<p>But it seems that you are trying to create a archive? ... | 2011/12/16 | [
"https://wordpress.stackexchange.com/questions/36698",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10099/"
] | I have a registered post type with 'rewrite' set as slug=>cpt\_name, with\_front=>true.
```
register_post_type( 'objection_handling',
array(
'rewrite' => array(
'slug' => 'objection_handling',
... | You should change the slug for the taxonomy.
But it seems that you are trying to create a archive? Then you should create a new template file with the taxonomy name instead. But then you are loosing the ability to add a description to the page. |
36,707 | <p>Not sure if this is possible, but what Id like to do is have the ability to output/add a class to an anchor tag depending on what tag I choose when creating the post. </p>
<p>My reasoning behind this is to be able to call up different background images via CSS depending on the tag that will be chosen for each speci... | [
{
"answer_id": 36708,
"author": "CookiesForDevo",
"author_id": 10908,
"author_profile": "https://wordpress.stackexchange.com/users/10908",
"pm_score": 3,
"selected": true,
"text": "<p>Sounds like you'd want to use this: <a href=\"http://codex.wordpress.org/Function_Reference/wp_get_objec... | 2011/12/17 | [
"https://wordpress.stackexchange.com/questions/36707",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3567/"
] | Not sure if this is possible, but what Id like to do is have the ability to output/add a class to an anchor tag depending on what tag I choose when creating the post.
My reasoning behind this is to be able to call up different background images via CSS depending on the tag that will be chosen for each specific post.
... | Sounds like you'd want to use this: <http://codex.wordpress.org/Function_Reference/wp_get_object_terms>
If you're using a custom taxonomy, add that where it says "post\_tag".
```
unset($tags);
foreach(wp_get_object_terms($post->ID, 'post_tag') as $tag) :
$tags .= ' ' . $tag->name;
endforeach;
```
And then add i... |
36,767 | <p>This code is fine but if I try to copy the last 3 lines and add a new custom page with a new custom header class, it doesn't work. I just want to add 2 new pages to my WP site with different headers from the front page and the rest of the site (which is set to use wrapper8 for the rest of the site pages which don't ... | [
{
"answer_id": 36769,
"author": "CookiesForDevo",
"author_id": 10908,
"author_profile": "https://wordpress.stackexchange.com/users/10908",
"pm_score": 0,
"selected": false,
"text": "<p>It's applying wrapper8 to any new page because it isn't the front page as per the first if/else stateme... | 2011/12/18 | [
"https://wordpress.stackexchange.com/questions/36767",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11237/"
] | This code is fine but if I try to copy the last 3 lines and add a new custom page with a new custom header class, it doesn't work. I just want to add 2 new pages to my WP site with different headers from the front page and the rest of the site (which is set to use wrapper8 for the rest of the site pages which don't hav... | Your site seems to be not having a page named Sitemap. When I am saying this, it does mean to check your code, just check your site's dashboard.
Under the Pages section, click All Pages link. This will show you all pages of your site. There you can see if you have a page with titled 'Sitemap' or not. If not, then crea... |
36,771 | <p>I've created a custom post type:</p>
<pre><code>register_post_type('campaign',
array(
'labels' => array(
'name' => __("Campaigns"),
'singular_name' => __("Campaign"),
),
'rewrite' => array(
'slug' => 'campaigns',
'with_front' => FALSE,
... | [
{
"answer_id": 36775,
"author": "Norcross",
"author_id": 403,
"author_profile": "https://wordpress.stackexchange.com/users/403",
"pm_score": 2,
"selected": true,
"text": "<p>Two things:</p>\n\n<ol>\n<li><p>You shouldn't be using 'category' as a slug, since it's already built into WP and ... | 2011/12/18 | [
"https://wordpress.stackexchange.com/questions/36771",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6616/"
] | I've created a custom post type:
```
register_post_type('campaign',
array(
'labels' => array(
'name' => __("Campaigns"),
'singular_name' => __("Campaign"),
),
'rewrite' => array(
'slug' => 'campaigns',
'with_front' => FALSE,
),
'public' => TRUE,
... | Two things:
1. You shouldn't be using 'category' as a slug, since it's already built into WP and thus is reserved (<http://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms>)
2. Pretending for a moment that it isn't reserved, the base URL structure wouldn't contain the post type in front of it.
... |
36,772 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://wordpress.stackexchange.com/questions/14305/caption-in-page-adding-unwanted-10px-to-width">Caption in Page adding unwanted 10px to width</a> </p>
</blockquote>
<p>This is a screen capture from a post. I have given .wp-caption a black bac... | [
{
"answer_id": 36774,
"author": "Norcross",
"author_id": 403,
"author_profile": "https://wordpress.stackexchange.com/users/403",
"pm_score": 1,
"selected": false,
"text": "<p>Fancybox (or some other javascript / jQuery element) is setting the width of the image in your markup. If you loo... | 2011/12/18 | [
"https://wordpress.stackexchange.com/questions/36772",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5205/"
] | >
> **Possible Duplicate:**
>
> [Caption in Page adding unwanted 10px to width](https://wordpress.stackexchange.com/questions/14305/caption-in-page-adding-unwanted-10px-to-width)
>
>
>
This is a screen capture from a post. I have given .wp-caption a black background so the extra 10px margin on the right can be... | Here's the answer, in functions.php
```
function wpse14305_img_caption( $empty_string, $attributes, $content ){
extract(shortcode_atts(array(
'id' => '',
'align' => 'alignnone',
'width' => '',
'caption' => ''
), $attributes));
if ( empty($caption) )
return $content;
if ( $id ) $id = 'id="' ... |
36,800 | <p>Does someone perhaps know a plugin or snippet (besides Yoast's WordPress SEO) to accomplish this perhaps? <a href="http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html" rel="noreferrer">Pagination with rel=“next” and rel=“prev”</a></p>
<p>The only thing I've come across seems ... | [
{
"answer_id": 36806,
"author": "Niraj Chauhan",
"author_id": 1743,
"author_profile": "https://wordpress.stackexchange.com/users/1743",
"pm_score": -1,
"selected": false,
"text": "<p>Ok then this will be a good solution:</p>\n\n<pre><code>$('YOUR_PAGINATION_A_ID').attr('rel', 'next');\n$... | 2011/12/18 | [
"https://wordpress.stackexchange.com/questions/36800",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | Does someone perhaps know a plugin or snippet (besides Yoast's WordPress SEO) to accomplish this perhaps? [Pagination with rel=“next” and rel=“prev”](http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html)
The only thing I've come across seems to be an 3-month old [Trac](https://co... | Try putting this snippet in your functions.php
```
<?php
function rel_next_prev(){
global $paged;
if ( get_previous_posts_link() ) { ?>
<link rel="prev" href="<?php echo get_pagenum_link( $paged - 1 ); ?>" /><?php
}
if ( get_next_posts_link() ) { ?>
<link rel="next" href="<?php echo g... |
36,812 | <p>I have designed a custom menu and would like to be able to style the individual li dependent whether it is the current page or not? I believe this is normally pretty straightforward using a class such as current-menu-item. I however am also using a walker in my nav to show an extra description field - this appears t... | [
{
"answer_id": 36917,
"author": "patnz",
"author_id": 4093,
"author_profile": "https://wordpress.stackexchange.com/users/4093",
"pm_score": 0,
"selected": false,
"text": "<p>You're unsetting the default class names so they're not being added.</p>\n\n<pre><code>//this code empties the cla... | 2011/12/18 | [
"https://wordpress.stackexchange.com/questions/36812",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11251/"
] | I have designed a custom menu and would like to be able to style the individual li dependent whether it is the current page or not? I believe this is normally pretty straightforward using a class such as current-menu-item. I however am also using a walker in my nav to show an extra description field - this appears to d... | A belated answer but figured I'd contribute as this page was near the top of Google when searching for a solution to this issue. I too had overlooked the fact that WP adds the current page menu item by default (thanks patnz for pointing that out).
However I'm not happy with how bloated the markup is when including the... |
36,844 | <p>So I'm working on designing a Wordpress theme with lots of extra widgets. The ones I have added are in separate files, and called in the functions.php I have lots of css on the widgets themselves and the div classes are in the $before_widget and $after_widget etc in functions.php. My problem is that for certain widg... | [
{
"answer_id": 36852,
"author": "Brooke.",
"author_id": 2204,
"author_profile": "https://wordpress.stackexchange.com/users/2204",
"pm_score": 0,
"selected": false,
"text": "<p>That's what <code>$before_widget</code> is all about. You would do <code>array('before_widget' => '<span c... | 2011/12/19 | [
"https://wordpress.stackexchange.com/questions/36844",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11211/"
] | So I'm working on designing a Wordpress theme with lots of extra widgets. The ones I have added are in separate files, and called in the functions.php I have lots of css on the widgets themselves and the div classes are in the $before\_widget and $after\_widget etc in functions.php. My problem is that for certain widge... | There are 2 ways to allow separate styles on each widget. The first is to add separate classes to the widgets like this:
First Method
------------
```
register_sidebar(array('name'=>'sidebar1',
'before_widget' => '<ul class="black-bg"><li>',
'after_widget' => "</li></ul>",
'before_title' => '<h2 class="widgettitle... |
36,847 | <p>I have a blog on shiplu.mokadd.im. After installing wordpress I see upgrade notice time to time. Sometimes its core upgrade and sometimes its plugin or theme upgrade. Each time I try to upgade any of them I see wordpress asks for ftp credential. To resolve this I have created ftp account. But somehow wordpress fails... | [
{
"answer_id": 36852,
"author": "Brooke.",
"author_id": 2204,
"author_profile": "https://wordpress.stackexchange.com/users/2204",
"pm_score": 0,
"selected": false,
"text": "<p>That's what <code>$before_widget</code> is all about. You would do <code>array('before_widget' => '<span c... | 2011/12/19 | [
"https://wordpress.stackexchange.com/questions/36847",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11263/"
] | I have a blog on shiplu.mokadd.im. After installing wordpress I see upgrade notice time to time. Sometimes its core upgrade and sometimes its plugin or theme upgrade. Each time I try to upgade any of them I see wordpress asks for ftp credential. To resolve this I have created ftp account. But somehow wordpress fails to... | There are 2 ways to allow separate styles on each widget. The first is to add separate classes to the widgets like this:
First Method
------------
```
register_sidebar(array('name'=>'sidebar1',
'before_widget' => '<ul class="black-bg"><li>',
'after_widget' => "</li></ul>",
'before_title' => '<h2 class="widgettitle... |
36,873 | <p>I've been experimenting with the <a href="http://wordpress.org/extend/plugins/plugin-options-starter-kit/" rel="nofollow">plugin options starter kit</a> but can't find a way to save multiple rows of similar data using the Settings API. Example of what I'm trying to save:</p>
<pre><code>_____________________________... | [
{
"answer_id": 36881,
"author": "t31os",
"author_id": 31073,
"author_profile": "https://wordpress.stackexchange.com/users/31073",
"pm_score": 3,
"selected": true,
"text": "<p>These are the best two articles i've read(i'm sure there are others to) on creating multiple options using the Se... | 2011/12/19 | [
"https://wordpress.stackexchange.com/questions/36873",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10923/"
] | I've been experimenting with the [plugin options starter kit](http://wordpress.org/extend/plugins/plugin-options-starter-kit/) but can't find a way to save multiple rows of similar data using the Settings API. Example of what I'm trying to save:
```
_________________________________________
|____Order#____|___Image UR... | These are the best two articles i've read(i'm sure there are others to) on creating multiple options using the Settings API, one covers usage inside a theme and the other inside a plugin, but essentially both actuall cover doing the same thing(registering a page and having some savable fields inside that page).
* Them... |
36,877 | <p>Not sure if this is possible without some form of hard-coding but I have a custom post-type called 'city'. Within the 'city' post-type I have some parent post (e.g. England, America and China) and some child posts (London, Washington DC and Beijing).</p>
<p>I have a query that displays all of the posts under 'city'... | [
{
"answer_id": 36881,
"author": "t31os",
"author_id": 31073,
"author_profile": "https://wordpress.stackexchange.com/users/31073",
"pm_score": 3,
"selected": true,
"text": "<p>These are the best two articles i've read(i'm sure there are others to) on creating multiple options using the Se... | 2011/12/19 | [
"https://wordpress.stackexchange.com/questions/36877",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5883/"
] | Not sure if this is possible without some form of hard-coding but I have a custom post-type called 'city'. Within the 'city' post-type I have some parent post (e.g. England, America and China) and some child posts (London, Washington DC and Beijing).
I have a query that displays all of the posts under 'city'. But for ... | These are the best two articles i've read(i'm sure there are others to) on creating multiple options using the Settings API, one covers usage inside a theme and the other inside a plugin, but essentially both actuall cover doing the same thing(registering a page and having some savable fields inside that page).
* Them... |
36,896 | <p>I'm looking for a plugin or an idea that would allow a user to add a mini-post to a page. Each post would contain a .pdf, and a mini description.</p>
<p>I found Custom Field Template.. but I think once you fill it out once, you can't fill out another one for the same page.</p>
<p>Thanks!</p>
| [
{
"answer_id": 36897,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 3,
"selected": true,
"text": "<p>I actually wrote a plugin to accomplish this very thing ...</p>\n\n<p><a href=\"http://wordpress.org/extend/plugins/wp... | 2011/12/19 | [
"https://wordpress.stackexchange.com/questions/36896",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8798/"
] | I'm looking for a plugin or an idea that would allow a user to add a mini-post to a page. Each post would contain a .pdf, and a mini description.
I found Custom Field Template.. but I think once you fill it out once, you can't fill out another one for the same page.
Thanks! | I actually wrote a plugin to accomplish this very thing ...
[WP Publication Archive](http://wordpress.org/extend/plugins/wp-publication-archive/) is a plugin for WordPress that specifically adds the ability to create objects like this. It introduces a custom post type for documents/publications that feature a download... |
36,907 | <p>I am having a heck of a time trying to retrieve the title (or handle?) of my custom post meta fields.</p>
<p>I am using the slmple fields plugin. <a href="http://wordpress.org/extend/plugins/simple-fields/" rel="nofollow noreferrer">http://wordpress.org/extend/plugins/simple-fields/</a>
(as I understand it, this ... | [
{
"answer_id": 36911,
"author": "Zach Lysobey",
"author_id": 5846,
"author_profile": "https://wordpress.stackexchange.com/users/5846",
"pm_score": 4,
"selected": true,
"text": "<p>in your css you could try something like: <code>body.logged-in{margin-top:20px;}</code> or if this doesnt wo... | 2011/12/19 | [
"https://wordpress.stackexchange.com/questions/36907",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5846/"
] | I am having a heck of a time trying to retrieve the title (or handle?) of my custom post meta fields.
I am using the slmple fields plugin. <http://wordpress.org/extend/plugins/simple-fields/>
(as I understand it, this just makes use of 'normal' post-meta stuff.
I have tried the `simple_fields_get_post_group_values()`... | in your css you could try something like: `body.logged-in{margin-top:20px;}` or if this doesnt work some other code using the `.logged-in` class |
36,929 | <p>I know there are many questions and articles about displaying post thumbnail (i.e. featured image) as a thumbnail for Facebook sharing but I'm still having trouble with it.</p>
<p>I'm using AddThis plugin for Wordpress and have a toolbox that shows FB share, Twitter share, G+, Digg, StumbleUpon. When I want to shar... | [
{
"answer_id": 36930,
"author": "Rob Vermeer",
"author_id": 11135,
"author_profile": "https://wordpress.stackexchange.com/users/11135",
"pm_score": 3,
"selected": true,
"text": "<p>Put this in your head</p>\n\n<pre><code><?php $fb_image = wp_get_attachment_image_src(get_post_thumbnail... | 2011/12/19 | [
"https://wordpress.stackexchange.com/questions/36929",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10187/"
] | I know there are many questions and articles about displaying post thumbnail (i.e. featured image) as a thumbnail for Facebook sharing but I'm still having trouble with it.
I'm using AddThis plugin for Wordpress and have a toolbox that shows FB share, Twitter share, G+, Digg, StumbleUpon. When I want to share through ... | Put this in your head
```
<?php $fb_image = wp_get_attachment_image_src(get_post_thumbnail_id( get_the_ID() ), 'thumnail'); ?>
<?php if ($fb_image) : ?>
<meta property="og:image" content="<?php echo $fb_image[0]; ?>" />
<?php endif; ?>
```
To test it out, you don't have to create a new post, just paste your URL ... |
36,939 | <p>I have a custom post type called <code>albums</code> and a custom field therein called <code>tracklist</code> which is an array containing <code>song_title</code> and <code>duration</code>. I would like to print a list of the songs on each album.</p>
<p>It's helpful for me to think of the array hierarchy like so:</... | [
{
"answer_id": 36940,
"author": "Rutwick Gangurde",
"author_id": 4740,
"author_profile": "https://wordpress.stackexchange.com/users/4740",
"pm_score": 0,
"selected": false,
"text": "<p>Try this...</p>\n\n<pre><code>$albums = get_posts(array(\n 'post_type' => 'album',\n '... | 2011/12/20 | [
"https://wordpress.stackexchange.com/questions/36939",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11296/"
] | I have a custom post type called `albums` and a custom field therein called `tracklist` which is an array containing `song_title` and `duration`. I would like to print a list of the songs on each album.
It's helpful for me to think of the array hierarchy like so:
```
albumlist
album
tracklist
track
... | If you change
```
foreach($tracklist as $track) {
echo $track . "<br>"; // Displays "12" (there are 12 tracks on this album)
}
```
to
```
foreach($tracklist as $key => $value ) {
echo "$key => $value ('tracklist')<br />"; // Displays "12" (there are 12 tracks on this album)
}
```
then what you get? |
36,968 | <p>I've inherited a Wordpress site that my company built before I started working here. I would go and ask this question of the guy who built it, but he has now left the company.</p>
<p>My query relates to custom templates for wordpress categories. I know that you're able to create a template file called category-.php... | [
{
"answer_id": 50907,
"author": "eddiemoya",
"author_id": 51,
"author_profile": "https://wordpress.stackexchange.com/users/51",
"pm_score": -1,
"selected": false,
"text": "<p>I wrote a <a href=\"http://wordpress.org/extend/plugins/category-template-hierarchy/\" rel=\"nofollow\">plugin</a... | 2011/12/20 | [
"https://wordpress.stackexchange.com/questions/36968",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11307/"
] | I've inherited a Wordpress site that my company built before I started working here. I would go and ask this question of the guy who built it, but he has now left the company.
My query relates to custom templates for wordpress categories. I know that you're able to create a template file called category-.php, and when... | I found the answer - this was in the function.php file - I just needed to update the category ID (long story):
```
function inherit_template()
{
if (is_category())
{
$catid = get_query_var('cat');
$cat = &get_category($catid);
$parent = $cat->category_parent;
$cat = &get_categor... |
36,977 | <p>I've done some research and tried different solutions but this snippet gets me the actual post content in sidebar, when on a single/article page, from the category the post belogs to.</p>
<p>But I need to show the excerpt instead of the whole text and also a thumbnail and can't figure out how to add them.</p>
<p>A... | [
{
"answer_id": 50907,
"author": "eddiemoya",
"author_id": 51,
"author_profile": "https://wordpress.stackexchange.com/users/51",
"pm_score": -1,
"selected": false,
"text": "<p>I wrote a <a href=\"http://wordpress.org/extend/plugins/category-template-hierarchy/\" rel=\"nofollow\">plugin</a... | 2011/12/20 | [
"https://wordpress.stackexchange.com/questions/36977",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9718/"
] | I've done some research and tried different solutions but this snippet gets me the actual post content in sidebar, when on a single/article page, from the category the post belogs to.
But I need to show the excerpt instead of the whole text and also a thumbnail and can't figure out how to add them.
Any suggestions pl... | I found the answer - this was in the function.php file - I just needed to update the category ID (long story):
```
function inherit_template()
{
if (is_category())
{
$catid = get_query_var('cat');
$cat = &get_category($catid);
$parent = $cat->category_parent;
$cat = &get_categor... |
37,000 | <p>On my current project, I have to create 2, distinct templates to receive 2 distinct search results of the same site.</p>
<p>Both researches are coming from different forms on different templates/pages.</p>
<p>Thing is, there is only one search.php file in Wordpress, and I don't think it's possible to create anothe... | [
{
"answer_id": 37006,
"author": "AndrettiMilas",
"author_id": 5205,
"author_profile": "https://wordpress.stackexchange.com/users/5205",
"pm_score": 0,
"selected": false,
"text": "<p>As far as I know it's not possible to run two separate searches using WP. What you could do is categorize... | 2011/12/20 | [
"https://wordpress.stackexchange.com/questions/37000",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8895/"
] | On my current project, I have to create 2, distinct templates to receive 2 distinct search results of the same site.
Both researches are coming from different forms on different templates/pages.
Thing is, there is only one search.php file in Wordpress, and I don't think it's possible to create another one. (like sear... | You could make a page template <http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates>
And then you could post some data via $\_GET /search2/?search=xxx to that page and do a custom wp\_query where you use 's=' . $\_GET['search']
<http://codex.wordpress.org/Class_Reference/WP_Query>
Something like this:
... |
37,013 | <p>I've registered a couple of custom taxonomies to go with a couple of custom post types but I'm having some trouble getting a template file to work.</p>
<p>I've tried taxonomy.php, taxonomy-[termname].php, taxonomy-[taxonomyname].php but none seem to register and the link reverts to index.php</p>
<p>You can see an ... | [
{
"answer_id": 37018,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 3,
"selected": false,
"text": "<p>If you want to apply some legal restrictions to your product and stay in line with GPL practices of WordPress your b... | 2011/12/20 | [
"https://wordpress.stackexchange.com/questions/37013",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7999/"
] | I've registered a couple of custom taxonomies to go with a couple of custom post types but I'm having some trouble getting a template file to work.
I've tried taxonomy.php, taxonomy-[termname].php, taxonomy-[taxonomyname].php but none seem to register and the link reverts to index.php
You can see an example of this h... | In addition to the other two suggestions, there is another possible approach: move all of your custom-app functionality *out of the Theme*, and into a *hosted web service*, to which the Theme connects via **API key**. That way, redistribution of the Theme itself does not impact your custom app-based business model, bec... |
37,015 | <p>Basically, I want to add a function that executes half way through the_content();</p>
<p>I want to add a message/ad block whatever in the middle of all of my content without having to go in to each individual page and add the block.</p>
<p>Is this even possible?</p>
| [
{
"answer_id": 37017,
"author": "Brooke.",
"author_id": 2204,
"author_profile": "https://wordpress.stackexchange.com/users/2204",
"pm_score": 0,
"selected": false,
"text": "<p>Of course it's possible, you'll just want to write a function that finds the middle of the content then ads your... | 2011/12/20 | [
"https://wordpress.stackexchange.com/questions/37015",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10946/"
] | Basically, I want to add a function that executes half way through the\_content();
I want to add a message/ad block whatever in the middle of all of my content without having to go in to each individual page and add the block.
Is this even possible? | Use this function `ad_content()` in replace of `the_content()` in your template.
```
function ad_content() {
$content = apply_filters ( 'the_content', get_the_content () );
$content = explode ( "</p>", $content );
$half_way = ( count($content) / 2);
for ( $i = 0; $i < count( $content ); $i ++ ) {
if ( $i =... |
37,023 | <p>When going to <a href="http://craigmdennis.com/articles/" rel="nofollow">http://craigmdennis.com/articles/</a> Wordpress uses the index.php template.</p>
<p>When you go to <a href="http://craigmdennis.com/2010/05/" rel="nofollow">http://craigmdennis.com/2010/05/</a> Wordpress uses the same template (markup below) b... | [
{
"answer_id": 37017,
"author": "Brooke.",
"author_id": 2204,
"author_profile": "https://wordpress.stackexchange.com/users/2204",
"pm_score": 0,
"selected": false,
"text": "<p>Of course it's possible, you'll just want to write a function that finds the middle of the content then ads your... | 2011/12/21 | [
"https://wordpress.stackexchange.com/questions/37023",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3766/"
] | When going to <http://craigmdennis.com/articles/> Wordpress uses the index.php template.
When you go to <http://craigmdennis.com/2010/05/> Wordpress uses the same template (markup below) but shows the same posts.
I have tried:
* Disabling all plugins - no change
* Changing the permalinks back to default
* Using an a... | Use this function `ad_content()` in replace of `the_content()` in your template.
```
function ad_content() {
$content = apply_filters ( 'the_content', get_the_content () );
$content = explode ( "</p>", $content );
$half_way = ( count($content) / 2);
for ( $i = 0; $i < count( $content ); $i ++ ) {
if ( $i =... |
37,047 | <p>I am using paginate_links on my custom page query.</p>
<p>What I have already works sweet and this is the code I have so far...</p>
<pre><code><?php
global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', get_p... | [
{
"answer_id": 37055,
"author": "Joseph Leedy",
"author_id": 8554,
"author_profile": "https://wordpress.stackexchange.com/users/8554",
"pm_score": 0,
"selected": false,
"text": "<p>Question 1: Use <code>__</code> (double underscore) instead of <code>_e</code>.</p>\n\n<p>Question 2: There... | 2011/12/21 | [
"https://wordpress.stackexchange.com/questions/37047",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11327/"
] | I am using paginate\_links on my custom page query.
What I have already works sweet and this is the code I have so far...
```
<?php
global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
... | The function paginate\_links() can return "plain", "list" and "array" (<http://codex.wordpress.org/Function_Reference/paginate_links>). Just define the type as array then you'll be to display it as you want:
```
<?php
global $wp_query;
$big = 999999999; // need an unlikely integer
$paginate_links = pagin... |
37,057 | <p>I want to search a post based on the date it was posted. Example, in the search box, I would place there November 22, 2011 and all posts during November 22, 2011 would be displayed. Im desperate on how to do this. Any help would be very much appreciated. I am using a theme and it's search.php goes something like th... | [
{
"answer_id": 37067,
"author": "Rob Vermeer",
"author_id": 11135,
"author_profile": "https://wordpress.stackexchange.com/users/11135",
"pm_score": 3,
"selected": true,
"text": "<p>You can make a custom page template for this specific search page <a href=\"http://codex.wordpress.org/Page... | 2011/12/21 | [
"https://wordpress.stackexchange.com/questions/37057",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11330/"
] | I want to search a post based on the date it was posted. Example, in the search box, I would place there November 22, 2011 and all posts during November 22, 2011 would be displayed. Im desperate on how to do this. Any help would be very much appreciated. I am using a theme and it's search.php goes something like this. ... | You can make a custom page template for this specific search page <http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates>.
Then set some $\_GET variables (using a form with method GET).
And do a custom query for these $\_GET values:
```
$date_query = new WP_Query( 'year=' . $_GET['year'] . '&monthnum=' .... |
37,058 | <p>I would like to check if the tag name is the title of a post. And load that post page instead of a tag page.</p>
<p>I have post_type "Cities" and suppose that users will tag normal posts with city names. And when user selects a tag, I would like to check if a "Cities" post exists with this tag name. And show this p... | [
{
"answer_id": 37067,
"author": "Rob Vermeer",
"author_id": 11135,
"author_profile": "https://wordpress.stackexchange.com/users/11135",
"pm_score": 3,
"selected": true,
"text": "<p>You can make a custom page template for this specific search page <a href=\"http://codex.wordpress.org/Page... | 2011/12/21 | [
"https://wordpress.stackexchange.com/questions/37058",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9351/"
] | I would like to check if the tag name is the title of a post. And load that post page instead of a tag page.
I have post\_type "Cities" and suppose that users will tag normal posts with city names. And when user selects a tag, I would like to check if a "Cities" post exists with this tag name. And show this post if it... | You can make a custom page template for this specific search page <http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates>.
Then set some $\_GET variables (using a form with method GET).
And do a custom query for these $\_GET values:
```
$date_query = new WP_Query( 'year=' . $_GET['year'] . '&monthnum=' .... |
37,063 | <p>I've found tweaking some of the text in WordPress to be pretty easy by adding in the following function (in lieu of using a separate plugin):</p>
<pre><code>add_filter( 'gettext', 'of_site_translations', 9999, 2 );
function of_site_translations( $translation, $text ) {
if ( $text == 'Posts' )
return 'News P... | [
{
"answer_id": 37067,
"author": "Rob Vermeer",
"author_id": 11135,
"author_profile": "https://wordpress.stackexchange.com/users/11135",
"pm_score": 3,
"selected": true,
"text": "<p>You can make a custom page template for this specific search page <a href=\"http://codex.wordpress.org/Page... | 2011/12/21 | [
"https://wordpress.stackexchange.com/questions/37063",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9605/"
] | I've found tweaking some of the text in WordPress to be pretty easy by adding in the following function (in lieu of using a separate plugin):
```
add_filter( 'gettext', 'of_site_translations', 9999, 2 );
function of_site_translations( $translation, $text ) {
if ( $text == 'Posts' )
return 'News Posts';
return ... | You can make a custom page template for this specific search page <http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates>.
Then set some $\_GET variables (using a form with method GET).
And do a custom query for these $\_GET values:
```
$date_query = new WP_Query( 'year=' . $_GET['year'] . '&monthnum=' .... |
37,070 | <p>I have a problem adding a custom script to my functions.php file:</p>
<pre><code>add_action('wp_print_scripts', 'load_AJAX_URL__');
function load_AJAX_URL__() {
wp_localize_script( 'ajax_URL', 'MyAjax', array( 'ajaxurl' => admin_url('admin-ajax.php') ) );
}
</code></pre>
<p>Why is not working? any ideas?</p... | [
{
"answer_id": 37074,
"author": "Kevin Langley Jr.",
"author_id": 9968,
"author_profile": "https://wordpress.stackexchange.com/users/9968",
"pm_score": 3,
"selected": true,
"text": "<p>The function <code>wp_localize_script()</code> is used to send variables to a script that has already b... | 2011/12/21 | [
"https://wordpress.stackexchange.com/questions/37070",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3294/"
] | I have a problem adding a custom script to my functions.php file:
```
add_action('wp_print_scripts', 'load_AJAX_URL__');
function load_AJAX_URL__() {
wp_localize_script( 'ajax_URL', 'MyAjax', array( 'ajaxurl' => admin_url('admin-ajax.php') ) );
}
```
Why is not working? any ideas? | The function `wp_localize_script()` is used to send variables to a script that has already been registered and enqueued. Do you have a js file that has been registered and enqueued and has the handle of 'ajax\_URL'? If not, then that explains why it isn't working.
Also, ajaxurl is already a js variable that is access... |
37,077 | <p>I am using Jigoshop to build an e-commerce site.</p>
<p>The end goal is for the front page to have a <em>featured products</em> section. </p>
<p>Jigoshop provides a shortcode, but the shortcode defaults to the medium image size. I would like to use the large image size, and so I did a WP_query conditionally to che... | [
{
"answer_id": 37105,
"author": "Squadrons",
"author_id": 11167,
"author_profile": "https://wordpress.stackexchange.com/users/11167",
"pm_score": 2,
"selected": false,
"text": "<p>Okay, I managed to figure it out (after far too many hours...):</p>\n\n<p>Here is the code, feel free to let... | 2011/12/21 | [
"https://wordpress.stackexchange.com/questions/37077",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11167/"
] | I am using Jigoshop to build an e-commerce site.
The end goal is for the front page to have a *featured products* section.
Jigoshop provides a shortcode, but the shortcode defaults to the medium image size. I would like to use the large image size, and so I did a WP\_query conditionally to check for featured images,... | Okay, I managed to figure it out (after far too many hours...):
Here is the code, feel free to let me know if it's ugly, as I'm new to both wordpress and php:
```
//Query the wordpress database for product posts
$my_products = new WP_Query(
array(
'post_type' => 'product',
)
);
//... |
37,086 | <p>I would wish to add a filter to <code>_e()</code> and <code>__()</code> functions. The filter is <strong>FilterTextOfEmail()</strong>. This will basically detect any emails and add anti-spam method to it.</p>
<p>I assume, the function for filtering should look like:</p>
<pre><code>function my_wp_text_email_filteri... | [
{
"answer_id": 37087,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 2,
"selected": false,
"text": "<p>You have to filter <code>'gettext'</code>. See <a href=\"https://wordpress.stackexchange.com/questions/3578/change-the... | 2011/12/21 | [
"https://wordpress.stackexchange.com/questions/37086",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7712/"
] | I would wish to add a filter to `_e()` and `__()` functions. The filter is **FilterTextOfEmail()**. This will basically detect any emails and add anti-spam method to it.
I assume, the function for filtering should look like:
```
function my_wp_text_email_filtering ($content) {
return FilterTextOfEmail($content)
}... | The filter name is `gettext`, and you would add it like this:
```
add_filter( 'gettext', 'my_wp_text_email_filtering', 10, 3 );
function my_wp_text_email_filtering( $translated, $text, $domain ) {
return FilterTextOfEmail( $translated );
}
```
The **$text** argument is there also in case you want to access the ... |
37,097 | <p>I'd like to edit the front page posts query to be slightly more advanced. Right now it excludes all posts in the Featured category. I'd like it to exclude the first 5 posts (or first n posts, really), but include the rest in the results.</p>
<p>Here is the current call:</p>
<pre><code><?php query_posts("cat=-".... | [
{
"answer_id": 37087,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 2,
"selected": false,
"text": "<p>You have to filter <code>'gettext'</code>. See <a href=\"https://wordpress.stackexchange.com/questions/3578/change-the... | 2011/12/22 | [
"https://wordpress.stackexchange.com/questions/37097",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7229/"
] | I'd like to edit the front page posts query to be slightly more advanced. Right now it excludes all posts in the Featured category. I'd like it to exclude the first 5 posts (or first n posts, really), but include the rest in the results.
Here is the current call:
```
<?php query_posts("cat=-".$GLOBALS['ex_feat'].",-"... | The filter name is `gettext`, and you would add it like this:
```
add_filter( 'gettext', 'my_wp_text_email_filtering', 10, 3 );
function my_wp_text_email_filtering( $translated, $text, $domain ) {
return FilterTextOfEmail( $translated );
}
```
The **$text** argument is there also in case you want to access the ... |
37,101 | <p>I'm using WordPress as a customised CMS for my fishkeeping website.</p>
<p>Currently I'm developing a Custom Post Type called species which produces an information sheet about a specific species of fish.</p>
<p>With no intention of patronising anybody, just in case people aren't familiar with the classification of... | [
{
"answer_id": 37280,
"author": "turbonerd",
"author_id": 6344,
"author_profile": "https://wordpress.stackexchange.com/users/6344",
"pm_score": 1,
"selected": true,
"text": "<p>OK, I've made a few subtle changes which have helped me to solve the problem.</p>\n\n<p>Firstly, a function to ... | 2011/12/22 | [
"https://wordpress.stackexchange.com/questions/37101",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6344/"
] | I'm using WordPress as a customised CMS for my fishkeeping website.
Currently I'm developing a Custom Post Type called species which produces an information sheet about a specific species of fish.
With no intention of patronising anybody, just in case people aren't familiar with the classification of fishes, in the e... | OK, I've made a few subtle changes which have helped me to solve the problem.
Firstly, a function to change the Title of the post.
```
function custom_post_type_title ( $post_id ) {
global $wpdb;
if ( get_post_type( $post_id ) == 'species' ) {
$genus = strip_tags(get_post_meta($post_id, 'genus', true)... |
37,135 | <p>I find the 3.3 Tooltips annoying when I'm upgrading many live and dev sites. How do I disable them via functions.php? Unenqueue wp-includes/js/wp-pointer.js ?</p>
| [
{
"answer_id": 37136,
"author": "onetrickpony",
"author_id": 1986,
"author_profile": "https://wordpress.stackexchange.com/users/1986",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, just dequeue the script (and the styles):</p>\n\n<pre><code>add_action('admin_enqueue_scripts', 'no_po... | 2011/12/22 | [
"https://wordpress.stackexchange.com/questions/37135",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/268/"
] | I find the 3.3 Tooltips annoying when I'm upgrading many live and dev sites. How do I disable them via functions.php? Unenqueue wp-includes/js/wp-pointer.js ? | You could also remove the pointer script and style from their respective arrays just after they have been registered using this method.
```
// Remove javascript
add_action( 'wp_default_scripts' , 'remove_pointer_script' );
function remove_pointer_script( $wp_scripts ) {
$wp_scripts->remove('wp-pointer');
}
// Rem... |
37,142 | <p>I'm working on a WordPress site that automatically displays an <code>h2</code> on the page as what the page/post is titled. I want to manually create <code>h1</code> for some pages and have the <code>h2</code> to be hidden if the <code>h1</code> appears. </p>
<p>Is there a way to do that?</p>
| [
{
"answer_id": 37145,
"author": "Tom",
"author_id": 1014,
"author_profile": "https://wordpress.stackexchange.com/users/1014",
"pm_score": 2,
"selected": false,
"text": "<p>There are two ways to do this, though one is arguably better than the other.</p>\n\n<p><strong>Use JavaScript (Works... | 2011/12/22 | [
"https://wordpress.stackexchange.com/questions/37142",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11359/"
] | I'm working on a WordPress site that automatically displays an `h2` on the page as what the page/post is titled. I want to manually create `h1` for some pages and have the `h2` to be hidden if the `h1` appears.
Is there a way to do that? | There are two ways to do this, though one is arguably better than the other.
**Use JavaScript (Works, but not optimal)**
The first way to do this is by using JavaScript. I'm not a fan of using this approach because it requires a web browser to perform the toggling. This negatively impacts SEO because, to search engin... |
37,144 | <p>I use WordPress for a private site where users upload files.
I use the "Private WordPress" to prevent access in to the site if the user is not logged in.</p>
<p>I would like to do the same to the files uploaded in the uploads folder.</p>
<p>So if a user its not logged in they wont be able to access to :
<a href="h... | [
{
"answer_id": 37743,
"author": "hakre",
"author_id": 178,
"author_profile": "https://wordpress.stackexchange.com/users/178",
"pm_score": 8,
"selected": true,
"text": "<p>Only checking if the cookie exists, is not much of a strict protection.</p>\n\n<p>To get a stronger protection, you c... | 2011/12/22 | [
"https://wordpress.stackexchange.com/questions/37144",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4130/"
] | I use WordPress for a private site where users upload files.
I use the "Private WordPress" to prevent access in to the site if the user is not logged in.
I would like to do the same to the files uploaded in the uploads folder.
So if a user its not logged in they wont be able to access to :
<https://xxxxxxx.com/wp-con... | Only checking if the cookie exists, is not much of a strict protection.
To get a stronger protection, you can pass or "proxy" all requests to the uploaded folder (exemplary `uploads` in the following example) through a php script:
```
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^wp-content/uploads/(.*)$ dl-file.ph... |
37,163 | <p>What is the proper way to define the post date when submitting a post from the front end using <a href="http://codex.wordpress.org/Function_Reference/wp_insert_post" rel="noreferrer">wp_insert_post</a> (<a href="http://core.trac.wordpress.org/browser/tags/3.3/wp-includes/post.php#L2378" rel="noreferrer">Trac</a>)?</... | [
{
"answer_id": 37164,
"author": "Rob Vermeer",
"author_id": 11135,
"author_profile": "https://wordpress.stackexchange.com/users/11135",
"pm_score": 6,
"selected": true,
"text": "<p>If you don't add a post_date then WordPress fills it automatically with the current date and time.</p>\n\n<... | 2011/12/22 | [
"https://wordpress.stackexchange.com/questions/37163",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1057/"
] | What is the proper way to define the post date when submitting a post from the front end using [wp\_insert\_post](http://codex.wordpress.org/Function_Reference/wp_insert_post) ([Trac](http://core.trac.wordpress.org/browser/tags/3.3/wp-includes/post.php#L2378))?
My snippet now is publishing with the mysql time...
```
... | If you don't add a post\_date then WordPress fills it automatically with the current date and time.
To set another date and time `[ Y-m-d H:i:s ]` is the right structure. An example below with your code.
```
$postdate = '2010-02-23 18:57:33';
$new_post = array(
'post_title' => $title,
'post_content' => ... |
37,179 | <p>I'm trying to add a class to anchor links of children element in wp_nav_menu both for pages and posts.
Is there a way to modify the Nav Menu Walker and do so?</p>
<p>Basically my custom walker looks like this:</p>
<pre><code>class Main_Nav extends Walker_Nav_Menu {
function start_lvl(&$output, $depth)... | [
{
"answer_id": 37181,
"author": "tamilsweet",
"author_id": 10701,
"author_profile": "https://wordpress.stackexchange.com/users/10701",
"pm_score": 0,
"selected": false,
"text": "<p>If the items used are from the table <code>{$wpdb->prefix}posts</code>, then you can query for posts wit... | 2011/12/23 | [
"https://wordpress.stackexchange.com/questions/37179",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7307/"
] | I'm trying to add a class to anchor links of children element in wp\_nav\_menu both for pages and posts.
Is there a way to modify the Nav Menu Walker and do so?
Basically my custom walker looks like this:
```
class Main_Nav extends Walker_Nav_Menu {
function start_lvl(&$output, $depth) {
$indent ... | I was able to add a "parent" CSS class to the anchor tag of menu items who have children by following this answer: [Add 'has\_children' class to parent li when modifying Walker\_Nav\_Menu](https://wordpress.stackexchange.com/questions/16818/add-has-children-class-to-parent-li-when-modifying-walker-nav-menu)
Here's an ... |
37,202 | <p>I got a set of meta boxes on a custom post type. Two of them are simple input/text-type fields, that should have autocompleted input:</p>
<ul>
<li>A) Another Custom Post Type</li>
<li>B) Users</li>
</ul>
<p>Now I have the problem that I need to somehow trigger the autocomplete event. So far I have this pretty simp... | [
{
"answer_id": 37272,
"author": "Rob Vermeer",
"author_id": 11135,
"author_profile": "https://wordpress.stackexchange.com/users/11135",
"pm_score": 1,
"selected": false,
"text": "<p>In your autocomplete source file (you can put a autocomplete.php file in your theme) put <code>include_onc... | 2011/12/23 | [
"https://wordpress.stackexchange.com/questions/37202",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/385/"
] | I got a set of meta boxes on a custom post type. Two of them are simple input/text-type fields, that should have autocompleted input:
* A) Another Custom Post Type
* B) Users
Now I have the problem that I need to somehow trigger the autocomplete event. So far I have this pretty simple definition:
```
jQuery( documen... | Use jQuerys `getJSON` in the autocompletes source method and use WordPress' admin-ajax.php to handle the request, to avoid having to find wp-load.php (which may have been moved) and would load WordPress on every request.
**First of all: get the ajax url of your WordPress blog:**
This is simple:
```
admin_url( 'admin... |
37,206 | <p>I've added some extra $curauth fields to the user profile page via ths method:</p>
<pre><code>function change_contactmethod( $contactmethods ) {
$contactmethods['twitter'] = 'Twitter URL';
// more $contactmethods go here
return $contactmethods;
}
add_filter('user_contactmethods','change_contactmethod',10,1);
<... | [
{
"answer_id": 37211,
"author": "CookiesForDevo",
"author_id": 10908,
"author_profile": "https://wordpress.stackexchange.com/users/10908",
"pm_score": 1,
"selected": false,
"text": "<p>get_post_meta is used for posts and won't retrieve author information.</p>\n\n<p>You'll need to use get... | 2011/12/23 | [
"https://wordpress.stackexchange.com/questions/37206",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/268/"
] | I've added some extra $curauth fields to the user profile page via ths method:
```
function change_contactmethod( $contactmethods ) {
$contactmethods['twitter'] = 'Twitter URL';
// more $contactmethods go here
return $contactmethods;
}
add_filter('user_contactmethods','change_contactmethod',10,1);
```
And they ... | Use the empty() check on them.
```
if ( !empty( $curauth->twitter ) ) {
// do stuff
}
```
This is best practice since empty avoids the property not existing error. |
37,221 | <p>When I add lines 3 - 19 to the top of functions.php, then try to update image.php <strong>I get the error "Warning: Cannot modify header information - headers already sent" when I try to update my image.php.</strong></p>
<p>The code on lines 3 - 19 creates custom next/previous links for my image gallery and rediret... | [
{
"answer_id": 37223,
"author": "Dave Romsey",
"author_id": 2807,
"author_profile": "https://wordpress.stackexchange.com/users/2807",
"pm_score": 3,
"selected": false,
"text": "<p>Lines 3-19 are not placed within a function, so that code is being executed when functions.php is loaded. Yo... | 2011/12/24 | [
"https://wordpress.stackexchange.com/questions/37221",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5205/"
] | When I add lines 3 - 19 to the top of functions.php, then try to update image.php **I get the error "Warning: Cannot modify header information - headers already sent" when I try to update my image.php.**
The code on lines 3 - 19 creates custom next/previous links for my image gallery and redirets the last one to a "mo... | I've seen in the pastebin the problem and merged the whole code together again. Put this first part completely into your functions.php.
```
/**
* Display previous image link that has the same post parent.
*
* @since 2.5.0
* Original version in /wp-include/media.php
* @param string $size Optional, default is 'thu... |
37,230 | <p>I'm using <code>wp_handle_upload</code> to allow users upload <code>.csv</code> files in the front end and it's working fine. I was wondering how can I limit this to only allow <code>.csv</code> files though since currently it accepts a wide variety of file types. According to the doc this should be possible by over... | [
{
"answer_id": 37232,
"author": "brandwaffle",
"author_id": 11372,
"author_profile": "https://wordpress.stackexchange.com/users/11372",
"pm_score": 2,
"selected": false,
"text": "<p>The filter you'll want to use is 'upload_mimes' <a href=\"http://xref.yoast.com/trunk/_functions/get_allow... | 2011/12/24 | [
"https://wordpress.stackexchange.com/questions/37230",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3893/"
] | I'm using `wp_handle_upload` to allow users upload `.csv` files in the front end and it's working fine. I was wondering how can I limit this to only allow `.csv` files though since currently it accepts a wide variety of file types. According to the doc this should be possible by overriding the `$overrides` param but I'... | Got it, looking at the source code I came up with this:
```
wp_handle_upload($file_input, array('test_form' => false, 'mimes' => array('csv' => 'text/csv')));
```
To override the mime types just pass `mimes` as an array wit the key being the file extension and the value as the mime type. |
37,256 | <p>I want wp_link_pages (mutli-page posts) to display the page numbers, the word "previous" before those numbers, and a "next" after those numbers. It would look like this:</p>
<p><strong>Prev 1, 2, 3, 4 Next</strong></p>
<p>I'm attempting to do this <em>without</em> a plugin. Here's what I've tried so far, but it ... | [
{
"answer_id": 37286,
"author": "Mat_",
"author_id": 9122,
"author_profile": "https://wordpress.stackexchange.com/users/9122",
"pm_score": 1,
"selected": false,
"text": "<p>I don't get what's the problem... Do you have any error?</p>\n\n<p>This should work:</p>\n\n<pre><code><?php $ar... | 2011/12/24 | [
"https://wordpress.stackexchange.com/questions/37256",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5205/"
] | I want wp\_link\_pages (mutli-page posts) to display the page numbers, the word "previous" before those numbers, and a "next" after those numbers. It would look like this:
**Prev 1, 2, 3, 4 Next**
I'm attempting to do this *without* a plugin. Here's what I've tried so far, but it isn't working, it is only displaying ... | The function you're using, [`wp_link_pages`*Codex*](http://codex.wordpress.org/Function_Reference/wp_link_pages), does not have the feature you're looking for by default.
However you can easily extend it by using a callback function, registered as a *filter* on that functions arguments:
```
add_filter('wp_link_pages... |
37,285 | <p>I have a hierarchical custom taxonomy which I can display using <code>print_r(get_the_terms( $post->ID, 'taxonomic_rank' ));</code>:</p>
<pre><code>Array
(
[46] => stdClass Object
(
[term_id] => 46
[name] => Aplocheilidae
[slug] => aplocheilidae
... | [
{
"answer_id": 37363,
"author": "Michal Mau",
"author_id": 2110,
"author_profile": "https://wordpress.stackexchange.com/users/2110",
"pm_score": 4,
"selected": true,
"text": "<p>There are probably some better ways to do this but you can always do a three simple <code>foreach</code> loops... | 2011/12/25 | [
"https://wordpress.stackexchange.com/questions/37285",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6344/"
] | I have a hierarchical custom taxonomy which I can display using `print_r(get_the_terms( $post->ID, 'taxonomic_rank' ));`:
```
Array
(
[46] => stdClass Object
(
[term_id] => 46
[name] => Aplocheilidae
[slug] => aplocheilidae
[term_group] => 0
[term... | There are probably some better ways to do this but you can always do a three simple `foreach` loops.
I wrote an example function that does the job well and should serve you as a good starting point:
```
function print_taxonomic_ranks( $terms = '' ){
// check input
if ( empty( $terms ) || is_wp_error( $terms... |
37,292 | <p>When you activate a wordpress theme, it's always a hassle to find out which file to go to change things.
Any idea how to simplify things? </p>
<p>But on the other hand, considering the get_template_part functionality, this may be impossible. What do you say?</p>
| [
{
"answer_id": 37294,
"author": "Community",
"author_id": -1,
"author_profile": "https://wordpress.stackexchange.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>One very simple thing I do is to insert an HTML comment identifying the template file in each relevant file of the... | 2011/12/24 | [
"https://wordpress.stackexchange.com/questions/37292",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14967/"
] | When you activate a wordpress theme, it's always a hassle to find out which file to go to change things.
Any idea how to simplify things?
But on the other hand, considering the get\_template\_part functionality, this may be impossible. What do you say? | Hook onto `template_include`, set a global to note the template set by the theme then read that value back into the footer or header to see which template is being called for a given view.
I spoke about this filter hook before in [Get name of the current template file](https://wordpress.stackexchange.com/questions/105... |
37,312 | <p>Already searched on here and couldn't find question so forgive me if it's been asked. <em>I'm trying to use dynamic images on a homepage so my client can maintain the images.</em> I've seen tutorials where one person uses post_thumbnails while another uses custom fields. Do I need to create a post for each image an... | [
{
"answer_id": 37294,
"author": "Community",
"author_id": -1,
"author_profile": "https://wordpress.stackexchange.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>One very simple thing I do is to insert an HTML comment identifying the template file in each relevant file of the... | 2011/12/26 | [
"https://wordpress.stackexchange.com/questions/37312",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11137/"
] | Already searched on here and couldn't find question so forgive me if it's been asked. *I'm trying to use dynamic images on a homepage so my client can maintain the images.* I've seen tutorials where one person uses post\_thumbnails while another uses custom fields. Do I need to create a post for each image and display ... | Hook onto `template_include`, set a global to note the template set by the theme then read that value back into the footer or header to see which template is being called for a given view.
I spoke about this filter hook before in [Get name of the current template file](https://wordpress.stackexchange.com/questions/105... |
37,317 | <p>My header looks like this.</p>
<p><img src="https://i.stack.imgur.com/5yjzv.png" alt="enter image description here"></p>
<p>I chnaged my author base from "author" to "user"</p>
<p>So the user profile url looks like this.</p>
<p><a href="http://example.com/user/username" rel="nofollow noreferrer">http://example.c... | [
{
"answer_id": 37318,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 0,
"selected": false,
"text": "<p>Do you search for <a href=\"http://codex.wordpress.org/Function_Reference/get_author_posts_url\" rel=\"nofollow\"><cod... | 2011/12/26 | [
"https://wordpress.stackexchange.com/questions/37317",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5074/"
] | My header looks like this.

I chnaged my author base from "author" to "user"
So the user profile url looks like this.
<http://example.com/user/username>
What is the php function to get this url.
I'm using like this
```
<a href="<?php echo esc_ur... | For all author meta details you can use `the_author_meta`
<http://codex.wordpress.org/Template_Tags/the_author_meta>
```
<a href="<?php the_author_meta('user_url', $current_user->ID);?>"><?php the_author_meta('display_name', $current_user->ID);?></a>
```
If its for user meta use `get_user_meta`
<http://codex.wordp... |
37,325 | <p>I'm building a menu for my website. The static is looking like this:</p>
<pre><code><nav>
<ul id="menu">
<li class="item_1"><a href="#">Item 1</a></li>
<li class="item_2"><a href="#">Item 2</a></li>
<li class="item_3"><a ... | [
{
"answer_id": 37327,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 5,
"selected": true,
"text": "<p>Use a <a href=\"https://wordpress.stackexchange.com/questions/14037/menu-items-description/14039#14039\">custom walker<... | 2011/12/26 | [
"https://wordpress.stackexchange.com/questions/37325",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11434/"
] | I'm building a menu for my website. The static is looking like this:
```
<nav>
<ul id="menu">
<li class="item_1"><a href="#">Item 1</a></li>
<li class="item_2"><a href="#">Item 2</a></li>
<li class="item_3"><a href="#">Item 3</a></li>
<li class="item_4"><a href="#">Item 4</a></li>
... | Use a [custom walker](https://wordpress.stackexchange.com/questions/14037/menu-items-description/14039#14039), remove anything you don’t need and add your classes. Here is a walker I use to get a list with clean markup: [T5\_Nav\_Menu\_Walker\_Simple](https://gist.github.com/1053467).
Your could also filter `'nav_menu... |