Is it possible to store arrays in a custom field?

If I understand correctly, custom fields work like this:               key(string/int) => value(string/int)      Is it possible to define a custom field like this?               key(string/int) => value(array (string/int, string/int))      I want to use such a structure for storing a series of quotations in [quote, source] format, thinking that it would minimize potential input error compared with, say, str_splitting a single value.


Add suffix to uploaded images

I found this post what handles in a similar way my intention. But I´m not 100% sure how to expand the callback function with my options. So here my suit: I add an function to the functions.php to add some custom imagesizes.                   if ( function_exists( 'add_image_size' ) ) {              add_image_size( 'homepage-thumb1', 900, 9999 );         add_image_size( 'homepage-thumb2', 500, 9999 );         add_image_size( 'homepage-thumb3', 250, 9999 );     }      How can I add a add a specific suffix to this three images like this: For "homepage-thumb1" an -medium.jpeg, for "homepage-thumb2" an -small.jpeg and so on. I know that I can execute an callback function with add_filter. But how can I add an suffix to an image? Kind of behavior like this: if "homepage-thumb1" add suffix "-medium"


get_posts always returning the same number of posts = 5

I don't understand why the code below is always displaying the same number of returned post = 5. When I change the `$variable` value to another `post id` of a post with an author with another `author_id`, I always get 5 returned posts, even if the authors have tens of posts. What am I doing wrong?               $variable=328;     $post = get_post($variable);          $author = get_userdata($post->post_author);          $args = array(     'author' => $author->id );           global $post;          $myposts = get_posts( $args );     $count= count($myposts);          echo '
';     print_r($myposts);     echo '
';          echo $count;      Your help is really apprecieted.


What is a reasonable get_num_queries() result?

What is a reasonable number of results I should expect with get_num_queries()? I know it depends on the theme, and I know that smaller is better, but what is a ballpark figure? 10s? 100s?


Set post-thumbnail (with php)?

A site I have inherited uses custom fields to set a path for thumbnails. Ideally I'd like to switch this over to use the built in post-thumbnail. Is there a way to procedurally set the post-thumbnail? Thanks


Wordpress: How to make a subsubdirectory

**I have a multiple word press installations that I am trying to reduce to one.** Here is what it currently looks like:               Installation 1 = www.example.com     Installation 2 = www.example.com/foo     Installation 3 = www.example.com/foo/bar      How do I make it into one installation like this:               www.example.com/foo/bar      Where `/foo` and `/foo/bar` are two different pages. Optionally: How do I do this:               www.example.com/baz/bar      Where `/baz` does not do anything (like a 404) and `/bar` is the actual content. Thanks for the help!


how i can change wordpress post views?

i use a post view counter code in my website. here show like( 2 views ). i want it show like( 2 বার দেখা হয়েছে ) like bangla language . how i cant do it. i use this code . function.php               function getPostViews($postID){         $count_key = 'post_views_count';         $count = get_post_meta($postID, $count_key, true);         if($count==''){             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');             return "0 View";         }         return $count.' Views';     }     function setPostViews($postID) {         $count_key = 'post_views_count';         $count = get_post_meta($postID, $count_key, true);         if($count==''){             $count = 0;             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');         }else{             $count++;             update_post_meta($postID, $count_key, $count);         }     }      single.php               <?php               setPostViews(get_the_ID());     ?>      postinfo.php               <?php               echo getPostViews(get_the_ID());     ?>      my website http://techjagot.com


Translate a site based on different themes

This is my first question on the site. First of all I want to apologize for my bad English. I´m migrating a site to a WordPress theme, and I need a solution to translate the theme to _3 different languages_. I have the post translation on several custom post meta (title in Russian, title in Spanish, and so on). What i need is a simple solution to, based on a link, load a different theme so i can manage what to show on the site and URLs must to be viewed like `/en/` or `/es/`.


Does wp_mail work in frontend tempate file?

I am creating a function in a template that will send an email using wp_mail function. My question is if it can be used be not logged in users or not. I mean directly from a template file like (it's just an example, in my real example it's much more code):               <?php     /**      * Template Name: Custom Template      *      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */          get_header(); ?>          <?php                   $headers = 'From: Tester 1 <testmail@something.com>' . "\r\n";         $subject = 'Subject test' . "\r\n";         $message = 'Just a test stuff.';         wp_mail('testmail@something.com', $subject, $message, $headers );               ?>          <?php get_sidebar(); ?>     <?php get_footer(); ?>      If not, how can I simulate logged in user just for this thing? It's not working for me right now, so I was thinking that I need soem more permission maybe?


paginate_links and query vars

I have using the Wordpress `paginate_links()` to build a paginator on a custom archive template for a custom post type. My site uses permalinks:               <?php echo paginate_links(array(         'base' => get_pagenum_link(1) . '%_%',         'current' => max(1, get_query_var('paged')),         'format' => 'page/%#%',         'total' => $wp_query->max_num_pages,     )); ?>      This works fine until I try to add query string vars to build a custom search string when the paginator echoes:               .../entries?post_type=entry&s=testpage/1     .../entries?post_type=entry&s=testpage/2      Instead of:               .../entries/page/1?post_type=entry&s=test     .../entries/page/2?post_type=entry&s=test      and so on... How can I get the correctly formatted URLs?


How are Dynamic Sidebar Widgets rendered

I have been reading through the Wordpress Source, trying to get a better understanding of how dynamic sidebars are rendered. However, I am hitting a sticking point...               894 | do_action( 'dynamic_sidebar', $wp_registered_widgets[$id] );      I can't find where add_action('dynamic_sidebar', ... ) is defined. Without out that part, I am sort of lost in what happens. See the code here: https://github.com/WordPress/WordPress/blob/b7c13e27c255e1fc1f03ab2ab432f1652a0ac212/wp- includes/widgets.php#L894 And to give more context, I am trying to figure out how to grab an array of widgets, and then from there, how would you render each one. I need finer control than `dynamic_sidebar(...);` gives me


How do I add a link to the menu that has a charector (?) in it?

I'm trying to add a link to a drop-down menu but it gets lopped off every time. THe full address is https://www.ub- tonlinebank.com/onlineserv/HB/Login.cgi?runmode=REGISTRATION but is stops at ? and gives an error when pulled up via WordPress. I tried getting around this by creating a bit.ly link but still get the same problem. How can I link to the whole address? thanks!![enter image description here](http://i.stack.imgur.com/026jh.png)


How to copy and paste a picture found on the web to wordpress easily

Anyone knows how to do so? What about if you want to edit the pics a little bit before pasting. I am using windows.


Plugin used only on some pages - not widget

Im using 'Cool FB like' plugin which displays a css fixed facebook logo on the right. When we hover that logo, fan page box is showing up. The problem is that I need to change fanpage on some pages. Do you have any idea how to manage that? I have an idea - I can use one plugin on some pages and another - similar one, on others but this plugin isn't a widget so i can't set where to display plugin up. Maybe You have some other ideas? Cheers


changes to templates not showing on server

I have done some changes to woocommerce changes to its template in /MyTheme/woocommerce/templates, it shows fine on my localhost but when I upload the woocommerce to my server under my theme it doesn't show the changes and shows the original woocommerce plugin templates. The file structure is same but its not showing. What can be the reason? How to debug it?


Reusing the page name class that Wordpress adds to body tag

When viewing my blog in the browser, the body tag (on the index page) has the following class:               <body class="home">      On other pages (for this example, a page that pulls in posts that are within the category "project"), the body tag has even more classes:               <body class="archive category category-project category-3">      Both of these are rendered using the following code, contained within the html_header part:               <body <?php body_class(); ?>>      I was wondering whether there was a way in which I could isolate the page descriptive class (1st example - home, 2nd example - category-project) that this command targets and use within the page. Thanks


get_option error plugin development

Im creating a plugin with the following structure: > >     plugins (folder) >     - myplugin (folder) >      - myplugin_index.php (adminpanel file) >      - myplugin_ajax.php (loading data when user enters a form on the "start > page") >   >     themes (folder) >      - mytheme (folder) >       - template_my_own.php (this file have the form which calls the > myplugin_ajax.php) >   The plugin works just fine from the admin panel point of view. I have added data through the plugin from the admin panel. But when I try to access data through the form in the file `template_my_own.php` I get the following error: > >     PHP Fatal error:  Call to undefined function get_option() >     in /var/www/example.com/wwwroot/wp- > content/plugins/myplugin/myplugin_ajax.php >     on line 14, referer: http://example.com/ >   I have tried the solutions from both this site. None of them work though. My code lookes like this:               <?php     /*     Plugin Name: Myplugin     Plugin URI: http://example.com     */     ?>     <?php         $square = $_POST['square'];              //Get arrays and remove empty array values         $arrayFrom =            array_filter(get_option('from'), 'strlen');         $arrayTo =          array_filter(get_option('to'), 'strlen');         $arrayPrice =   array_filter(get_option('price'), 'strlen');                   //Sort arrays         asort($arrayFrom);         asort($arrayTo);         asort($arrayPrice);                   //Go through values until we find the one         foreach($arrayFrom as $index => $from)         {             if($from < $square && $arrayto[$index] > $square)             {                 echo $from;                 echo '<br>TESTTESTTEST';                 echo $to;             }         }        ?>      How should I solve this and what am I doing wrong?


Some custom taxonomy child terms not showing in admin. Caching problem?

I have a problem with some custom taxonomy terms. I am using "Types" plugin for creating custom post types and custom taxonomies. I successfully created my postype and hierarchical taxonomy and strated to add content. Everything worked great until I migrated the site from the dev server(Linux) into the live server (Microsoft IIS). Right now when I add a term as a child to another term in the taxonomy, it gets hidden from the custom taxonomy terms admin panel and I have to type it in the admin search in order to find that term. Also, these child terms don't show up in a hierarchical term navigation list on my site front-end. I tried:   * deleting the parent and child term and creating them again. Same thing, as soon as I assign the child term to the parent term, the child term disappears.    * Clearing cache with w3tc   * Optimizing DB with WP-DBManager   * Everything works normally in my outdated development site. I see a few people seem to have similar issue, but I don't see any clear solution. Some help would be appreciated. Thanks!


Embed iFrame in WordPress 3.0.1

I need to embed an iFrame into a post and it appears that tinyMCE or something is stripping it out when I go from HTML to Visual view while editing a post. I've found instructions for adding valid elements to tinyMCE but it only seems to apply to WordPress 2.8. No such file seems to exist under WordPress 3.0.1 (see Make WordPress WYSIWYG not strip out iframe's) None of the iFrame embedding plugins seem to support WP 3.0.1 either. Thanks for any tips.


Types plugin breaking because of server configuration

I have tested this on three different hosts, using a number of different versions of both Types and WordPress, and I believe I've narrowed it down to my host (Firehost) setup, which they recently changed a bit. Here are the modules they added (I believe) to Apache: mod_deflate mod_env mod_expires mod_headers mod_mime mod_rewrite mod_setenvif My issue is this: when I attempt to either add or edit a custom post type, I get to the point of pushing "Save Custom Post Type" ... and then I see a white screen, with a url similar to the following (stays the same as before I click the button, but displays a blank white page): http://mydomain.com/wp-admin/admin.php?page=wpcf-edit-type It should be displaying something like this: http://www.mydomain.com/wp-admin/admin.php?page=wpcf-edit-type&wpcf-post- type=news&wpcf-rewrite=1 Has anyone had an issue like this before, or know what might be happening? I don't believe that the issue is within Types, WordPress, or a theme or plugin. I've tested this on more than 10 sites, and every site hosted on Firehost does exactly the same thing (nothing), and every site on Bluehost or GoDaddy hosting (similar sites with the same base theme and plugins, but varying versions of Types and WordPress, going back to just the last version of each), creates the post type correctly. Please help! I'm in the middle of a project that has been shot to hell because I tried deleting and re-adding a post type before I was aware of the extent of the problem. I've now replicated the issue on a clean install with just the Types plugin installed as well.


How to do a MySQL dump from production site without using a search and replace script for local development?

I performed a MySQL dump of my WordPress production database to be imported into my local development environment. I plan on frequently performing this database dump and import. Is it possible for me to AVOID running a search & replace script or a MySQL query that updates all of the permalinks, site URLs, etc? Could I include something like the following in my wp-config.php to override the above said links:               define('WP_HOME',    'http://localhost.com:8888/example');     define('WP_SITEURL', 'http://localhost:8888/example');      My goal is to make it as EASY as possible to perform routine database dumps from my production site to local.


Do widget options need to be escaped widget()?

I was wondering if you really need to escape user submitted data (widget option fields) within the widget() and form() functions (from the widget class) ? I don't see a reason to do this, if the data is already escaped in the update() function. Or am I missing something?


Multisite setup on IIS with subdomains

I have Wordpress 3.4.2 set up on a Windows 2008 R2 server with IIS 7.5. I enabled multisite using subdomains and set up one additional site, call it child.example.com. I can browse to the main site at example.com just fine, but whenever I browse to child.example.com it tries to go to the default web site in IIS, which has ID 1 and currently points to an empty directory. The main Wordpress site is one that was manually added to IIS, and its ID is 3. I created entries in my hosts file on the server for the main site and the child site, and they seem correct (I don't have access to our DNS provider at the moment). In trying to figure this out, I keep coming back to these entries for wp- config.php:               define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);      These seem to tell Wordpress the ID of the site where it will live. My question is what does that number represent? Does it have any correlation to site IDs in IIS? If I change it from 1 to 3, would that tell Wordpress to use the proper site when accessing its subdomains? EDIT:   It seems that those numbers might refer to the values in the site_id and blog_id fields in the wp_blogs table, specifically for the record associated with the main site. I tried changing them to 3 in wp-config and bouncing IIS, but that had no effect. So now my question becomes, how can I get Wordpress to look to its own IIS site when a request comes in for a sub-site, versus looking at the site designated as the 'default' in IIS?


How Do I Add Product Pictures To Search Results Of A Custom Wordpress Theme Using A WooCommerce

I made a custom wordpress theme from scratch. I added WooCommerce for the shopping cart and store. When I search products in the store the search results do not show pictures. How do I make the pictures of the products visible in search results?


Uploading Media gives error "Missing a temporary folder."

After we upgraded to Wordpress 3.0.1 (from Wordpress MU 2.9.2) we began getting an error message whenever we tried to upload media. **"Missing a temporary folder"** Various articles around the web mention the php setting `upload_tmp_dir` needing to be set in `php.ini`. This is not actually a requirement. I know because it is not set in our test environment, and it was not set in our production environment before the deploy. In both cases uploads worked. So what changed? I have _an_ answer, but I'm not sure it's the definitive answer. I'll post mine.


Retrieving and Storing Images Linked from Other Domains on Local Server?

_( **Moderator's note:** The original title was "Copy and Paste picture in post without linking to original")_ When I copy and paste a picture from another editor window it appears nicely but it links to the original location. Is there a plugin which lets me copy and paste images in a post (like it happens in Windows Live Writer) so that the image gets uploaded to the uploads dir? Or is that impossible in a web environment? Reason: the one thing why I keep returning to Windows Live Writer for initial postings is the image functionality. If I could somehow make this process easier I could write some posts in the WordPress backend instead. **Update:** If it does NOT exist yet, I probably will write a plugin on a hook that fires after a new or update of a post, goes through the_content, finds all image url's that are not the same as the preferred root domain (for multisite) and if not, does a cross-load of the image (as e.g. in the swift theme) and then replaces the url with the newly uploaded image. However... since this is a basic thought someone must already have made this I just cant find it in the plugin directory (yet). **Update 2** : Let me try this one:   * http://blog.milandinic.com/wordpress/plugins/cache-images/ **Update 3** : The above plugin works perfectly even in my WordPress Multisite environment.


Removing Metabox for "Slug" without removing functionality

Here is an interesting question. I have recently noticed that if you utilize the code               remove_meta_box('slugdiv', 'post', 'normal');       you are actually unable to modify the slug when you click on the url slug under the page title. To clarify, when you use remove_meta_box for the slugdiv, the metabox and the screen options get removed however you are still able to click on the url under the post title to edit it... However, when you go to update/publish the post whatever modification you made does not take. My objective is to remove the same metabox from the post edit screen AND remove it from the screen options page BUT I want to ensure that when you edit the slug under the post title that this still works. Can anyone provide a solution to this problem? Thanks in advance.


What is the "Advanced" $context in add_meta_box?

In the codex it lists the parameter $context for the add_meta_box as having the following options:   1. normal   2. advanced    3. side  What does "advanced" do? I don't see any difference between it and "normal".


Applying roles to an admin sub-menu (eg Appearance -> Menus)

Long time lurker, but first time poster. I've searched Google extensively and just can't seem to come up with an answer on this problem. I use Justin Tadlock's excellent 'Members' plugin for roles and permissions on several client installations of WP. I've recently deployed a theme where the client should only have access to the Appearance -> Menus item, but none of the others sub-items in the Appearance menu of the admin. When enabled, the role 'edit_theme_options' enables the user to access 'Themes', 'Widgets', and 'Menus'. How would I go about filtering the submenu so that if the role 'edit_custom_menus' is assigned, the 'Menus' link will show?


Change the menu home link to something else

I'm using the built in menu system, and I wan't to change the text of the home menu link to something else, like "hjem", and i have tried placing this in the code:               <?php wp_page_menu( array( 'show_home' => 'Hjem', 'sort_column' => 'menu_order' ) ); ?>      But that did nothing but show the menu, with the home menu text "Home". What do I do?


How often does the RSS widget get updates?

I am asking since I am trying to understand if this widget is causing my server to overuse CPU or memory. But either way - it's interesting to know.


Pagination 404 Not Found child page

I have a page _Heemtijdinghen_ displaying custom posts (post_type=artikel) paginated. The page is a child page of page _Publicaties_ : `/publicaties/heemtijdinghen/` When navigating to e.g. page 2 a 404 Not Found is thrown: `/publicaties/heemtijdinghen/page/2/ => 404 Not Found` However, pagination does work correctly when I make the child page a parent page: `/heemtijdinghen/page/2/ => OK` I have no clue how to do the rewrite:               add_filter('init', 'plugin_name_add_rewrite_rules');          function plugin_name_add_rewrite_rules() {       add_rewrite_rule('publicaties/heemtijdinghen/(.?.+?)(/[0-9]+)?/?$', 'index.php?post_type=artikel', 'top');       add_rewrite_rule('publicaties/heemtijdinghen/([^/]+)(/[0-9]+)?/?$', 'index.php?post_type=artikel&paged=$matches[1]', 'top');     }      Help would be very much appreciated.


When trashing a post, also trash related comments

As it is now, when I trash a post, the related comments get deleted at once. Is this standard? Instead I'd like them to be moved to the trash bin, when I trash the post. How can I achieve this? I can't seem to find a solution.


Always keep a parameter in URL?

Is there any way that WordPress always keeps a custom parameter in every link it generates? Here's what I want to do. I want to create a debug mode by entering `?debug` as a URL parameter; and display some specific information or do some debug only coding if that URL parameter is available. I know what I need to get WP to work with custom URL parameters. I want to know how can I make WP to keep `debug` parameter in all the liks it generates; and this parameter keeps propagating to all the links I click on while navigating the entire site until I remove it.


Assign Custom classes to every Excerpt

I have Around 40 **Excerpts on my homepage** (I am using Gantry Framework) and I want to **style each of these Excerpts in a different Manner**. i.e Different Backgrounds, Font color For Every Excerpt. So How can I **add custom Class to each and every excerpt** which is there on my homepage...say in manner Excerpt1 , Excerpt2 .... Excerpt40. **This is what I have explored so far** : These Excerpts Are being called in a file content-blog.php like this!!
       <?php if( $gantry->get( 'blog-content', 'content' ) == 'excerpt' ) : ?>         <?php the_excerpt(); ?>       <?php else : ?>         <?php the_content( false ); ?>          <?php endif; ?>
      So If I do this:
         <?php if( $gantry->get( 'blog-content', 'content' ) == 'excerpt' ) : ?>
             <?php the_excerpt(); ?>
         <?php else : ?>           <?php the_content( false ); ?>         <?php endif; ?>
      A single class i.e `sameexcerpt` will be assigned to each excerpt. But if can somehow use a global variable or static variable. and keep incrementing that variable like this:               <div class="sameExcerpt<php echo ++globalvariable">       <?php the_excerpt(); ?>
       <?php else : ?>       <?php the_content( false ); ?>          <?php endif; ?>
      Then I think I can Assign a different Class to Every Excerpt. Any Help Will Be greatly Appreciated.


Adding a class to post title considering the title length

I searched for "title length" in questions but results were all about setting max length and limiting and.. What I want to do is to create an if-statement, to determine if the post title has more than 68 characters or not and if it had, add `smaller` class to it. I wrote the code like this:               <?php         $permaLength = strlen(the_title());     ?>     <h2 class="<?php if ($permaLength > 68) {echo 'smaller';} ?>">         <a href="<?php the_permalink() ?>">             <?php the_title(); ?>
      but it seems that `the_title()` function is not returning the value and instead it's echoing out. Is there an alternative way to fetch the title length?


How To Get Posts With A Specific Word

How to retrieve posts with a specific word in the loop. For example, I want to retrieve all posts with the title of the profile post (custom post type): http://www.wwefansnation.com/wrestler/dolph-ziggler/ I created profiles in my website, and I want to display all the posts which contains the word "Dolph Ziggler" or the name of the profile.


loop through all posts memory error

I have few thousands posts and need to list all of them in the admin. When I used WP_Query to get them all at once I got a memory error. Then I split it into several query calls and it worked just fine with 256 MB limit. Here is the code:               $limit = 200;     $offset = 0;     while (TRUE) {         $posts = new WP_Query(array(                 'posts_per_page'        => $limit,                 'offset'                => $offset,                 'post_type'     =>  $post_type,                 'orderby'       =>  'title',                 'order'         =>  'ASC',                 'post_status' => array('publish', 'private', 'draft', 'inherit'),         ));              if (!$posts->have_posts()) break;              while($posts->have_posts())         {                 $posts->the_post();                      # do some echoing with the $post         }              $offset += $limit;     } /*(TRUE)*/      So this works just fine on development server. But when moved to production, it throws memory error `Allowed memory size of 268435456 bytes exhausted (tried to allocate 64 bytes) ...` I tried lowering the `$limit` but it doesn't help (on dev it actually works just fine with `$limit = 500`. What else can I do to force it to release memory?


Exclude post formats in custom loop

I'm trying to exclude all post formats but standard from a page template loop that displays 4 latest posts. For some reason I can't get the query to work. This is my page template               global $paged, $wp_query, $wp;     $args = wp_parse_args($wp->matched_query);     if ( !empty ( $args['paged'] ) ) {     $wp_query->set('paged', $args['paged']);     $paged = $args['paged'];     }           $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      query_posts('cat=0&posts_per_page=4&paged='.$paged); //set your own query here      get_template_part( 'loop', 'portfolio' );           wp_reset_query();      This is the loop               <?php $num_cols = 4; // set the number of columns here          for ( $i=1 ; $i <= $num_cols; $i++ ) :         echo '
';         $counter = $num_cols + 1 - $i; ?>          <?php while (have_posts()) : the_post();         if( $counter%$num_cols == 0 ) :          // begin of core posts output ?>              <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                      POST STUFF         <?php //end of posts output              endif; $counter++;             endwhile;                 rewind_posts();             echo '
'; //closes the column div         endfor; ?>             <?php if (  $wp_query->max_num_pages > 1 || get_query_var('page')) : ?>                 <?php twentytwelve_content_nav( 'nav-below' ); ?>                        <?php endif;             wp_reset_query(); ?>      This is the query I've been trying to get to work with it               $args = array(         'tax_query' => array(             array(                 'taxonomy' => 'post_format',                 'field' => 'slug',                 'terms' => array( 'post-format-aside', 'post-format-image' ),                 'operator' => 'NOT IN'             )         )     );     $query = new WP_Query( $args );


Contact Form 7 - Populate Select List With Taxonomy

With contact form 7, is it possible to populate a DDL (Selection List) with Custom Taxonomy Values? I want the user to be able to click the category they want to refer to from my Custom Post Type.


Pasting images removes class attribute

When you paste an image with a `class` attribute in the Wysiwyg editor, the pasted image no longer has this `class` attribute. This makes it harder to copy and paste images that are aligned with the `alignleft` or `alignright` classes. This used to work in WordPress 2.7, but it no longer works in WordPress 2.8 and up. It also works in the "base" version of TinyMCE (tested with 3.2.7 and 3.3.9.3), so it is probably something that is added by WordPress. I tested this in Safari, Firefox 3.6 and Chrome on Mac OS X. This has been mentioned in a Trac ticket but the main item was dismissed as a browser issue - but I think the `class` issue is not. Has anyone else found a way to make this work?


esc_url removes white space. Can I change that to using '-'?

I'm using esc_url to sanitize my url. The only problem is that "my link" becomes "mylink". I wouldreally like it to become "my-link". Is there a way to change this?


Wordpress home page doesn't work, but other pages do. How to rectify?

http://blog.sanspace.in/ My blog home page is messed up. None of the plugins or sidebar widgets are working. Only the latest post is showed that too partially. However, other pages and posts (accessing through their URL) seems fine. http://blog.sanspace.in/contact/ [page] http://blog.sanspace.in/hello-world/ [post] I am not sure what exactly the problem is. Could anyone help me with this? Is there anything wrong with the wordpress settings? Else, something needs to be done with my server settings? **update** : I have hosted it with hostso in a shared hosting plan. I did not modify any WP files. My home page is a default WP home which shows the latest post. **update** _ _closed_ _ : The problem was with the json_last_error() method I used in the latest post. Somehow the method is no longer supported by my server it seems. It caused all the problems.


How to Get Next or Previous Post in a Specific Tag?

I'm trying to create links to the next and previous posts within a specific tag (on the post page itself), but I can't seem to find a plugin or source that does this. I want to be able to something like this, appearing below the post.               get_previous_link("tagname");     get_next_link("tagname");      Anybody know of a way to accomplish this? Otherwise I'll have to write something myself, which is fine, but I figured I wouldn't reinvent the wheel unless I have to.


In a loop of custom post type, display first custom taxonomy term

I would like to display just the first term from a custom post type custom taxonomy. Inside my loop I've been displaying all the terms using:               <?php echo get_the_term_list( $post->ID, 'traits', 'Physical Traits:', ''); ?>      but I would like to only display the first term. Thanks!


query statement containing variable won't execute

Very confused why the following code does not work.               function discount_State() {     if(is_page('cart')){     global $wpdb;           $current_user = wp_get_current_user();      $need = $current_user->ID;          $getID = $wpdb->get_var($wpdb->prepare("SELECT meta_value from table where user_id = $need AND meta_key = 'shipping_state'"));          echo $getID;            }     }          add_action('woocommerce_before_cart_table', 'discount_State');      The problem is that when I put the user_id as a variable in the sql statement, the code is not executed. If I input a number for the user_id, the code works. I have tried using gettype to confirm that the $need is a integer. I have assigned $need to a number, ie $need = 12, and the code executes. I can't figure out why the statement won't execute correctly the way it is written. I have tried writing the variable as '$need' and "'.$need.'" with no success. Any help is greatly appreciated!


jquery & ajax sending data to php

In my jquery script I have;               jQuery.ajax(             ajaxurl, {             action: 'lu_ajax',             status: 'enabled'             },             success: function (a) {             alert(a)             }      In my file.php i have;               add_action('wp_ajax_lu_ajax', 'lu_ajax');     add_action('wp_ajax_nopriv_lu_ajax', 'lu_ajax'); //for logged users     function lu_ajax() {              if($_GET['status'] != '') {                 $value = $_GET['status'];                 echo $value;                 setcookie("status", $value, time()+3600, "/");         }     }      I am including the file.php in the main plugin such as require_once('inc/file.php'); However, no cookie is being set or any value being echoed, can anyone tell me what the issue is please. initially the issue that I had is that I was calling the file directly and caused wp functions to be undefined so i was recommended to use ajaxurl and then the action to perform and the variables i wanted to send over to php, but nothing is happening now. ps. both jquery and php are in the same file.php i do not have a separate js file as it doesnt fit my purpose. **update new issue** As I am making the ajax call from jquery i am firing them up based on conditionals, the following is a sample;               var stat= true;                     jQuery.ajax({                         type: 'POST',                         url: ajaxurl,                         data: {action: 'lu_ajax', status: 'enabled'},                         success: function (a) {                             alert(a)                         }                     });             } else {                 var stat= false;                 jQuery.ajax({                         type: 'POST',                         url: ajaxurl,                         data: {action: 'lu_ajax', status: 'false'},                         success: function (b) {                             alert(b)                         }                     });                 }      however the cookie is always set to enabled, meaning that the first call is only being made, the problem is not in the condition as i test it by setting it to false manually.


Show latest posts on responsive theme

I've installed Responsive theme on my new blog. I want the home page to show my recent posts, so I configured `Settings->Reading` to show my 10 recent posts, instead of a static page. Alas, the static home page (with the "Call to Action button") remained. Any idea how to change it?


Is it possible to create a RSS feed containing all blog entries?

More specifically I have a blog at riduidel.wordpress.com for which I would like to create that feed, for it to be later consumed in a site backup solution called autoblog, which can create a site copy by simply reading a RSS feed. So is there such a tool available for wordpress.com sites (directly or not), or should I do a backup of my blog database then write a script generating that stream ?


WP_Query ignores post_type in category view

I have following query to select posts by my custom post-type. This works fine while being on the frontpage (the snippet is included in the sidebar). As soon it gets executed on a category page the `post_type` attribute is ignored and posts of the type "post" are returned. I guess this has to do with multiple loops but I have also tried to call `wp_reset_postdata();` and `wp_reset_query();` before and after.               $customPosts = new WP_Query( array(          'post_type' => 'mycustomtype',          'posts_per_page' => 12,          'orderby' => 'date',          'order' => 'DESC',          'post_status' => 'publish'     ));          while ( $customPosts->have_posts() ) : $customPosts->the_post();          $thumbnailUrl = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), "thumbnail");         if ( !empty($thumbnailUrl)) {           /* echo result */          }        endwhile;


Using query string on edit CPT page

I'm adding a query string on the edit CPT page so I can add different meta boxes depending on what type it is. We're doing profile types, and the choices are student, staff, alumni and external. The url looks something like this: http://www.website.com/profiles/wp-admin/wp- admin/post.php?post=2226&action=edit&profile_type=student profile_type=student is my custom bit. I'm wondering if anyone knows whether this is a good or bad idea? I have it set up and working, but I keep finding edge cases where the edit page is loaded without appending the query string. Now I'm thinking is it better to start again with a more wordpress standards way of doing it, or keep trying to plug the holes in as I find them. For example, the current problems are drafts don't work, and the edit post link in the admin bar doesn't pass the query sting through. I could hopefully just fix them, but I'm sure there will be many other sneaky cases where you can get onto the add / edit page without having my needed query string. Thanks


Auto-Tweet if Type is 'Status' using OAuth

Should be simple - I'd like WP to tweet the content of a post once (when it's published the first time) if the post format is 'status'. The code below isn't returning an error on publish, nor is it tweeting OR updating the post metadata, which leads me to believe I'm either using the hook incorrectly or there's something wrong with checking the post type as I have. This is currently living in my functions.php I'm using Matt Harris' tmhOAuth and have successfully tweeted from a standalone tweet.php using most of the function below. Keys and secrets removed for security.               function posse_twitter( $post ) {         // check post type if necessary         if ( $post->post_type != 'status' ) return;              $post_id = $post->ID;         $tweet_content = $post->post_content;              if ( !get_post_meta( $post_id, 'tweeted', $single = true ) ) {             // ...run code once             //Include Libraries             require 'libraries/tmhOAuth/tmhOAuth.php';             require 'libraries/tmhOAuth/tmhUtilities.php';             $tmhOAuth = new tmhOAuth(array(               'consumer_key'    => 'XXXXX',               'consumer_secret' => 'XXXXX',               'user_token'      => 'XXXXX',               'user_secret'     => 'XXXXX',             ));                  $code = $tmhOAuth->request('POST', $tmhOAuth->url('1/statuses/update'), array(               'status' => $tweet_content             ));                  if ($code == 200) {               tmhUtilities::pr(json_decode($tmhOAuth->response['response']));             } else {               tmhUtilities::pr($tmhOAuth->response['response']);             }             update_post_meta( $post_id, 'tweeted', true );         }     }          add_action( 'draft_to_published', 'posse_twitter' );


Gallery post images on homepage?

I have a post with image gallery, it has 10 images. Can I get the direct link to the images in the post, so that I can display first 5 images on the homepage?


WordPress.com podcast feed missing iTunes tags?

I recently published a podcast hosted on WordPress.com on iTunes and it says "Podcasts by Unknown". It seems like it is missing the author tag. My question is that how can I add the author tag to the RSS since I used the RSS widget to expose my RSS?


How to determine when my theme is deactivated?

I'm using the following code branch to execute some theme setup options...               $myTheme_initialized = get_option('myTheme_initialized');     if (is_admin() && !$myTheme_initialized && isset($_GET['activated'] ) ) {     //do setup stuff     }      What hook can I tap into when the theme is deactivated?


WPML custom post type - not translated

I just installed a WPML, but my custom post types is showing just in default language, if I am switching to other languages, it will show the same posts as default language, but in wordpress panel they are translated. Part of my code in function.php               $args = array(              'labels' => $labels,             'public' => true,             'publicly_queryable' => false,             'show_ui' => true,             'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => true,             'menu_position' => 5,             'supports' => array('title','thumbnail','taxonomy')      And to get those post types I am using :               query_posts('post_type=objekts');     ...


Display all WP Errors together during form validation

I have a custom front end page where users can post from. All works fine but the i want if more than one field is empty then the errors for all empty fields should show all together. Right now the code only show error for the first empty field it detects. The code is :                   $errors = new WP_Error();              if (isEmptyString($title_stripped))         $errors->add('empty_title', __('Please enter a title'));              if (isEmptyString($description_stripped))         $errors->add('empty_desc', __('Enter a breif description'));              if (isEmptyString($content_stripped))         $errors->add('empty_content', __('Please enter your article here'));              return $errors;      **Edit : Solved** Sorry to bother . It was one of my other functions which was limiting the error to echo only once. Here is the previous code :               function display_message( $message = false ) {         if( is_wp_error( $message ) ) {             echo '

' . $message->get_error_message() . '

';           }      It worked fine when i changed it too :               function display_message( $message = false ) {         if( is_wp_error( $message ) ) {             echo '

';             foreach ( $message->get_error_messages($code) as $error ) {             echo $error . "
\n";               }             echo '

';           }


Fail to compare dates in meta_query

This is the piece of code I use to get event posts whom date metadata is newer than today :                   <?php             query_posts( array(             'post_type' => 'concerts',             'meta_key' => 'numericdate',             'posts_per_page' => -1,             'orderby' => 'meta_value',             'order' => 'ASC',             'meta_query' => array(                 array(                     'key' => 'numericdate',                     'value' => date('dmY'),                     'compare' => '>=',                     'type' => 'date'                      )                )         ) );         if (have_posts()) : ?>      This returned no results. The "numericdate" field contains a "ddmmyyyy" string, so I expected comparing with a "dmY" today date value will work. I was wrong. Or there is some mistake in the code above. Thanks for your help !


what i am trying to do is create drop down menu in theme customizer from custom db i have created. db name "students". in the db i have only the id and the name. i want to show all students names in the drop down menu. and when the user will choose some of the students name and will click on the save button (i need to save his choose), and i want that next time the same name will be selected. in this drop down menu. i tried to make this work but without any results. thanks for help


Redirect after registration in BuddyPress

In Buddypress, after Registration first step, users are redirected to Change Avatar step. Im trying to find a way to redirect to an alternate page, for example: http://www.mysite.com/yeah Im using the following code, but Im continuously redirected to Change Avatar page.               function custom_filter_bp_signup() {              global $current_site;              return 'http://' . $current_site->domain . $current_site->path . 'yeah';          }           add_filter('wp_signup_location', 'custom_filter_bp_signup');      Any help is welcome, Thanks in advance.


Convert [xcode]foo[/xcode] to
foo

I'm converting vBulletin content to WP with the Crayon syntax highlighter. What is the best way to convert the content's `[xcode]foo[/xcode]` to `<pre class="lang:default decode:true ">foo</pre>` for Crayon? I see info about the Crayon legacy tags conversion but the screenshots are missing and I don't know how to enable "legacy tags" for Crayon.


Extending Twenty Eleven Theme

In WP 3.3, how can I extend the Twenty Eleven theme such that I can make some custom additions or modifications but still take benefit in the updates that WP pushes out for the theme? Sort of like 'overloading' in programming, I guess. For now, I would like to include a custom css file and jQuery in header.php, and add a js function to single.php.


wp_list_pages Format only on Recently Modified Pages

wp_list_pages can be a great tool for displaying a tree structure. You can specify the depth, child of, and show_date of when the page was last modified. However, if I want to only show the date for pages that were modified in the last...24 hours say...How can I specify this?


what is this HTTP error [plugin: Google Calendar Events]

I am getting this error on my Google Calendar Events plugin: > Feed 1: There are no HTTP transports available which can complete the > requested request. Please ensure your feed URL is correct. I have tested this plugin a a web hosting company and it works fine. But when I moved my wordpress site to a local hosting machine I get this error. My server runs IIS6 and server 2003. What could this error be? Does it have to do with google web extensions not installed?


Custom title widget / HTML encoding

I'm not the first person who has battled the matter of WordPress stripping HTML from widget titles. There are a number of custom widgets out there that allow you to add e.g. links to titles, but I specifically wanted the ability to add br and span tags. I came across this tutorial: http://ponderwell.net/2011/05/how-to-use-html-in- wordpresss-widgets-title/ which tells you how to create a custom widget file based on the native WP default-widgets.php. That gets me nearly there, but both with using his method directly, or adapting it to customize an existing widget (Enhanced Text Widget), I'm getting an output of <br> and <span> instead of proper HTML encoding. I saw that somebody in the comments mentions html_entity_decode() and have tried a few things, but honestly I don't know PHP well enough to get it to work. If I have to do this in functions.php plus a custom_widgets.php file, I'll make that work, but for portability's sake, I'd prefer to accomplish the task as a widget plugin. What do I need, specifically, to get those tags properly encoded now that I've come this far? I did find the solution offered by Chris here: Unfiltered html in widget title not working, but clearly am not putting that code in the correct place. (I did get Amy's own self-solution to work in the functions.php, but not sure if that's a great way of doing it....) TIA.


Registration Form Shortcode

Is There any way to create a shortcode for registration form using               <?php do_action('register_form'); ?>


How To Use Custom Fields With .mp3 Links

Hope it doesn't seem to shallow of a question, but I've searched the web as much as I've could and have not found anything similar yet. :: Creating a regular post; How can I place a .mp3 link in a "custom-field", have that "custom-field" wrap the .mp3 in `<a href=ex.mp3">Example</a>` and place it as a `<?php .. ?>` in the single.php file. It shouldn't be that difficult, at least from my perspective. Any help/tutorials will definitely be resourceful right now. ..................... Appreciate the reply @johnsardine . I pretty much went with the basics of WP's Codex on Custom Fields. This is what I ultimately came up with (Note: this is going in The Loop via single.php - as I only want this on posts) `<a class="htrack" tabindex="1" type="audio/mpeg" title="<?php the_title(); ?>" href="<?php $key="mp3link"; echo get_post_meta($post->ID, $key, true); ?>" rel="nofollow"><?php the_title(); ?></a>` **mp3link** is used for the "Custom Field" key and of course, a regular URL to a Mp3 link (ie. http://filehost[.]com/song.mp3) is the value. On the final end I'm wrapping it into Yahoo's Web Player (htrack, tabindex, etc.). All in all, the Custom Field/Link/Link Title/and Yahoo are all working well together, I just can't figure out how to get the img. The code above omits the `<img src=... />` because every option I've used to get the thumbnail of posts, have not worked. If you can help me out on that, it'd be much appreciated as well. Example of what I'm meaning:               <a class="htrack" tabindex="1" type="audio/mpeg" title="<?php the_title(); ?>" href="<?php $key="mp3link"; echo get_post_meta($post->ID, $key, true); ?>" rel="nofollow">     ****     <?php the_title(); ?>      Or Am I trying to include the image wrong all-together? Thanks in advance.


How to handle PHP parse errors?

I tried to execute the following code and I got a parsing error message (line:3). Here is the code on Pastebin http://pastebin.com/gC7rsJqw. I tried echoing but didn't seem to solve the problem. Maybe I missed something. What am I doing wrong? Please help.


get_category_link() is returning nothing

<?php      $categories=get_categories('taxonomy=galeriak');      foreach ($categories as $category) {     ?>
<a href="<?php echo get_category_link( $category->term_id ) ?>" title="<?php echo $category->name ?>"><?php the_term_thumbnail (  $category->term_id, $category->taxonomy, $size = 'thumbnail', $attr = '') ?><?php echo $category->name ?>
     <?php } ?>      I use this code to display the categories from the "galeriak" taxonomy. Everything is working, except the href part, its return nothing. I tried it with and without the echo, but nothing seems to work. Any ideas?


Error on Include php:/usr/share/pear

I'm trying to work with an old plugin http://wordpress.org/extend/plugins/wp- ecards/ (I'm not the plugin author) and I get this error in the php error log and a blank screen when trying to view the e-card on site:                Failed opening '' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')      in /home/public_html/demo/wp-content/plugins/wp-ecards/ft-wp-ecards.php on line 171      **I don't know what is happening. Is this plugin trying to load the pear library? Any ideas?** The function around line 171 is below (with line 171 marked as such) :               function init_wpecards_viewcard(){         global $wp_query;         if ( isset($wp_query->query_vars['ft_wpecards_view']) ){             if ( $ft_wpecards_parentpost = ft_wpecards_get_post_id($wp_query->query_vars['card']) ){                 if ( ft_wpecards_get_post_type($wp_query->query_vars['card']) == 'post' ) {                     query_posts("p=".$ft_wpecards_parentpost."&ft_wpecards_view=1&card=".$wp_query->query_vars['card']);                     include(get_single_template());                       //exit;                 }else{                   query_posts("page_id=".$ft_wpecards_parentpost."&ft_wpecards_view=1&card=".$wp_query->query_vars['card']);                         include(get_page_template()); //LINE 171                         //exit;                     }                 }else{                     include(get_404_template());                 }                 exit;             }             //die('tr');         }         add_action('template_redirect','init_wpecards_viewcard');


Include default functions and methods

I'm starting a new service for a customer consisting in adding a input API in their WP website. I started by creating a blank page on the root but then I realized I couldn't access all methods and function to insert datas in WP. Basically I need to insert strings and integers as custom post types and meta datas. What would be the best way to make default functions and methods accessible in my script? Thanks!


Post meta not updating

I am trying to make a voting system for WordPress. This is my code in `functions.php`:                 add_action("wp_ajax_add_votes_options", "add_votes_options");       add_action("wp_ajax_nopriv_add_votes_options", "add_votes_options");        function add_votes_options() {     if (!wp_verify_nonce($_POST['nonce'], 'voting_nonce'))         return;          $postid = $_POST['postid'];     $ip = $_POST['ip'];          $voter_ips = get_post_meta($postid, "voter_ips", true);     if(!empty($voter_ips) && in_array($ip, $voter_ips)) {         echo "null";         die(0);     } else {         $voter_ips[] = $ip;         update_post_meta($postid, "voter_ips", $voter_ips);     }             $current_votes = get_post_meta($postid, "votes", true);     $new_votes = intval($current_votes) + 1;     update_post_meta($postid, "votes", $new_votes);     $return = $new_votes>1 ? $new_votes." votes" : $new_votes." vote";     echo $return;     die(0);         }      This is how I place my vote button and vote count button:                   <?php     // This will display "0 votes" and increase as votes are added     $votes = get_post_meta($post->ID, "votes", true);     $votes = !empty($votes) ? $votes : "0";     if($votes == 1) $plural = ""; else $plural = "s";     echo '
'.$votes.' vote'.$plural.'
';     ?>          <?php     // This will display the vote button and disable it if a cookie has already     // been set. We also add the security nonce here.      $hasvoted = $_COOKIE['better_votes'];     $hasvoted = explode(",", $hasvoted);     if(in_array($post->ID, $hasvoted)) {     $vtext = "VOTED";     $class = ' class="disabled"';     } else {     $vtext = "VOTE";     $class = "";     }     ?>     <a href="javascript:void(0)" id="vote"<?php echo $class; ?>><?php echo   $vtext; ? >     <?php if(function_exists('wp_nonce_field')) wp_nonce_field ('voting_nonce', 'voting_nonce'); ?>      The problem is that it isn't updating the meta data. It shows 1 votes but doesn't update the meta data on click. I don't now what I am doing wrong.


Custom query (author is post_author or meta co_author) with Pagenavi pagination

I need to create a custom query for the author archive (where the author is post_author OR is a meta co_author), and it have to work with WP Pagenavi. The query is something like this (omitting $wpdb and usual clauses for clarity):               SELECT posts.*     FROM posts, postmeta     WHERE         posts.ID = postmeta.post_id AND         (posts.post_author = $author OR             (postmeta.meta_key = 'co_author' AND              postmeta.meta_value = $author)         )      I've already tried with no success:   * using LIMIT and OFFSET with `query_var($paged)` and `'posts_per_page'` option, but Pagenavi total pages are the same as the query was the default author archive one;   * adding a where filter (`' OR posts.post_author = $author'`) to a custom WP_Query checking for meta_key/value only, but Pagenavi completely disregards the filter;   * other stuff I actually cannot remember because I've tried them last night between 3 and 5 AM but I'm sure they didn't work... The actual problem is that I can't find a way to check "meta_query OR post_author" using just the WP_Query argument array, like:               $the_query = new WP_Query(array(         'post_author'    => $author,         /* OR */         'meta_query'     => array(             array(                 'key'    => 'co_author',                 'value'  => $author             )         )     ));      Unfortunately, I'm not really confident with query filters so I'm really really trying to find a simple workaround to make that work with Pagenavi. But, after plenty of hours on this issue, my mind isn't fresh anymore and I don't know how to proceed. Thank you all in advance.


get_query_var('paged') always returns empty

Putting this up after having hit a brick wall for possible solutions. Have a site with quite a few custom post types and associated custom taxonomies. To help make things easy, I'm using a unified `taxonomy.php` template. Within that template there are three loops. I would like all of them to run on the first page, after that, just the third loop. I understand how to make that work with `is_paged()` but there's a bigger problem that I just cannot resolve. In my `$args` I included `$paged` from                   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;           But `$paged` always returns as 1, now matter what page I am on. If I do a straight                   get_query_var('paged')      Then nothing is returned, no matter if I am on the first, second, third or etc page. I've read that you need to reset each loops for this to work, and that's a practice I've always followed. I won't include the whole page here, as this is a rather long and complex taxonomy. Instead I'll show the base set up of the two loops. **NOTE:** I can't use `pre_get_posts` for this page as it affects all loops. Each of these loops have separate `posts_per_page` requirements and other aspects that need to be kept separate. At the top of the template I have                   //this present duplication             $do_not_duplicate = array();                  global $wp_query;             $term = $wp_query->queried_object;      And I set up my loop after my args with `while ($new_query->have_posts()) : $new_query->the_post();` The third loop that I want paged has this code nearby                   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                                                      $args=array(                         'posts_per_page' => $total_posts,                         'post__not_in' => array_merge($do_not_duplicate, $unwanted_post_ids ),                         'paged' => $paged,                         'tax_query' => array(                                 array(                                     'taxonomy'  => $term->taxonomy,                                     'field'     => 'slug',                                     'terms'     => $term->slug,                                     )                                 )                         );                          // Re-run the query with the new arguments                     query_posts( $args );      I have been using `wp_query` rather than `query_posts`, but for my latest attempts that's what I've had there. Would prefer to change it back. Any ideas?


Setting up WordPress plugin's page

I recently published a WordPress plugin but all the links of plugin page (Description, Installation, FAQs, Screenshots etc) has same two line description I used in readme.txt. Although, I properly filled up the readme.txt template. But it is not picking up anything else except description. ![plugin description showing in changelog too](http://i.stack.imgur.com/U04bk.png)


After updating a 3.4.2 network install to 3.5, I receive Fatal error: Call to undefined function nocache_headers() in /wp- admin/admin.php on line 32 This happens in Chrome, and in Firefox (when I am not logged into admin). I have downloaded a 3.5 zip, and uploaded and overwritten /wp-admin, but the issue remains. I have also renamed plugins to plugins2, but the issue remains.


WP-e-commerce (getshopped) Hebrew language files - where can I get them?

I’m working on a dual language website (english+hebrew) the website uses wpml+wpec. I’m looking for the hebrew language files (mo/po) – where can i get them?


Remove edit post link from static front page

Checking for front page with either is_home() or is_front_page() still removes the edit link from all pages/posts. What's wrong with this?               add_filter( 'edit_post_link', 'foo_edit_post_link' );          function foo_edit_post_link() {            if (is_home()) {        return FALSE;       }     }


Space Not Being Generated in HTML Output?

I'm using a code called custom_link_pages to generate my multiple page post links, but I'm getting a space between my page numbers and previous link, but my next link is missing the same space. These need to be spaced equally so I would like to either add the necessary space or remove all spaces. For reference to what I'm talking about, view line 281 at: http://themeforward.com/demo2/?p=1813&page=2 I am assuming this could be from the custom code in my functions:                   // Custom Next/Previous Page     add_filter('wp_link_pages_args', 'wp_link_pages_args_prevnext_add');     /**      * Add prev and next links to a numbered link list      */     function wp_link_pages_args_prevnext_add($args)     {         global $page, $numpages, $more, $pagenow;              if (!$args['next_or_number'] == 'next_and_number')             return $args; # exit early              $args['next_or_number'] = 'number'; # keep numbering for the main part         if (!$more)             return $args; # exit early              if($page-1) # there is a previous page             $args['before'] .= _wp_link_page($page-1)             . $args['link_before']. $args['previouspagelink'] . $args['link_after'] . ''         ;              if ($page<$numpages) # there is a next page             $args['after'] = _wp_link_page($page+1)             . $args['link_before'] . $args['nextpagelink'] . $args['link_after'] . ''             . $args['after']         ;              return $args;     }      How I grab that code:               <?php     custom_link_pages(array(         'before' => '
' . __(''),         'after' => '
',         'next_or_number' => 'next_and_number', # activate parameter overloading         'nextpagelink' => __('Next'),         'previouspagelink' => __('Previous'),         'pagelink' => '%',         'echo' => 1 )     );     ?>


Custom Fields Not in Search Results

I noticed that the content of my custom fields is not in my search results. Is there a good remedy for this? I could just hardcode my content into page templates but I would like the content to be searchable. Thanks.


Memorizing syntax

I hope the following question is acceptable here. I rely entirely on copy/paste for most WP functions, however I guess WP veterans don't. Is it important to know by heart the common WP syntax, and if it is, do people actually make an effort to memorize them just like we memorize a piece of poetry or a quote?


How to process shortcodes in XML-RPC

Firstly, I know that XML-RPC is designed to send out the raw post data, but I need it to expand shortcodes out. I don't use it for posting so it won't be an issue there, but there are services that are grabbing posts from it and they're getting the shortcodes [] instead of the expanded shortcodes. I'd switch to RSS but I can't. I've expiremented but can't get do_shortcode to work in class-wp-xmlrpc-server.php Thanks.


Sorting posts by custom field value in array

I have a custom field value that is an array and it has date as one of the values:               a:3:{s:4:"date";s:10:"03/06/2013";s:6:"target";d:1000;s:8:"currency";s:3:"USD";}      I'm trying to sort posts with this date but I'm having trouble doing it. Here is my query:                  $args = array (                 'showposts' => -1,                 'post_type' => 'project',                 'orderby' => 'meta_value',                 'order' => 'ASC',                 'meta_query'  => array(                            array(                             'key' => 'date',                             'value' => date('m/d/Y'),                             'compare' => '>=',                             'type' => 'DATETIME',                             )                         ),                 'cat' => $cat_id);             $posts = get_posts( $args );


Avoiding using a loop to access a single post

Sometimes I want to access one particular CPT to extract something from it, for example a custom field value:               $group = new WP_Query( array(          'post_type' => 'group',         'p' => $group_id     ) );     while ( $group->have_posts() ) : $group->the_post();         $group_type = get_post_meta($post->ID, "group_type", $single = true);            endwhile;      However the purpose of a loop is to access more than one element so I dislike using a loop for a single post. Is there a way to do exactly the same thing (accessing this custom field value) without using a loop?


Making a specific page wordpress compatable that is not index

When I first created my website I overwrote the wordpress php and essentially made the website static. Now I want to make one specific page wordpress compatable (e.g. when i make posts from the dashboard they'll appear on the page), and it is not the index. Which files will I have to redownload and what do I have to do to achieve this?


Automatic links to grid references

I have grid references on my website for coordinating the start of events. I was wondering if anyone knew a way to get these to link to Street Maps and Google Maps without having to individually link these each time. Many thanks in advance.


Moving a WordPress site to a new server

I need to copy a WordPress site to a new server. I need this to go as quickly as possible. The URL won't change, but the absolute paths will. Here are the steps I thought of:   * Put a maintenance message on the site   * Copy the database   * Copy all the files (the hidden ones as well, like .htaccess), with permissions   * Check if there are no old absolute paths, and if so, update them   * Check if everything's working   * Update the DNS records   * Remove the maintenance message Am I forgetting something?


Taxonomy Custom Column - 'manage_{TAXONOMY}_custom_column' filter only passing 2 arguments

I am trying to add a custom column to the tables shown on the Tags & Categories admin pages in Wordpress. I have created a function, and added it as a filter using               add_filter( 'manage_post_tag_custom_column' , 'my_custom_column' , 10 , 2 );      My function is               my_custom_column( $out , $name , $term_id ){       switch( $name ){         case 'my_column_slug' :           echo '<pre>';var_dump( func_get_args() );echo '</pre>';           break;       }     }      My column is shown in the table, with the `<pre>...</pre>` content, but it seems that no `$term_id` is being passed to my function.               array(2) {       [0]=>       string(0) ""       [1]=>       string(12) "my_column_slug"     }      I have referred to a number of resources to confirm that there should be three arguments passed to the function (including this StackExchange article). Am I missing something here?


How do the default themes reference style.css?

I was expecting to see `get_stylesheet_uri()` called somewhere in the default header.php file for the default themes (2012-14), but anything like it is missing, which has me wondering how the reference is added. The default theme headers have something like this:               <head>         <meta charset="<?php bloginfo( 'charset' ); ?>">         <meta name="viewport" content="width=device-width">         <title><?php wp_title( '|', true, 'right' ); ?></title>         <link rel="profile" href="http://gmpg.org/xfn/11">         <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">         <!--[if lt IE 9]>         <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>         <![endif]-->         <?php wp_head(); ?>     </head>      Looking at the source for the themes, shows a proper link to the stylesheet in the header, so, how does it get there?


Using a style sheet for modern browsers and another for older browsers

This isn't about using IE conditionals, here is my problem I have a fixed width site, I'm using 960 grid and I like this, and it works in most browsers including ie8 and ie7. Now I like that old browsers like ie7 ie8 and use the **960 file fixed width** and default style.css wordpress and modern browsers use the **fluid version of 960 grid**. **Summarizing** a) In old browsers load fixed width 960. b) In modern browsers use the fluid version of 960 responsive to the site. Modern browsers can be detected and used a style sheet for them and in older browsers another style sheet? Is there any function in wordpress that allows loading a stylesheet if the browser is modern, and load another stylesheet if the browser is old?


Custom Background Image per Page

Is it possible to send an image url via custom fields to the get_background_image function?


WPMU If MU site has no administrator, deactivate site

So I been tinkering with this thought. Working w/ WooCommerce Subscriptions - if the user is a recurring paid member, they can create and manage their own subsite. However, say the recurring payments are over, than there user role from 'Administrator' will automatically be changed into 'Subscriber'. Since there will only be one Administrator per subsite, and that person's role changes into a Subscriber, is there a way I can link: if Subscriber, deactivate their site(s). else if Adminstrator, activate their site(s). I would love to get some feedback on this! Thanks! Roc.


gform_after_submission add list of form titles after the post content

Can you help me with the code where all I only want is to add the list of all submitters who submitted GF form on every post page right after the post content? Every post has its small CPT form on the bottom of the page and submitted forms goes to the custom post type portfolio page. I want to also display the list of clickable titles (the name of submitters with some fields already merged together by GF form) of the form with URL of that created page. image 1 before submition: ![enter image description here](http://i.stack.imgur.com/xnGRb.png) The post after 5 succesfull submitions, it should also be after the post content /div image 2 after: ![enter image description here](http://i.stack.imgur.com/VISF5.png) The code I would like to use is here:               <?php         add_action("gform_after_submission_7", "set_post_content", 10, 2);         function set_post_content($entry, $form){                  //getting post             $post = get_post($entry["post_id"]);                  //adding after the post content - how can I get something like this ?:                 ul               li                    a submitted portfolio URL                         div class"some class"                         submitted form title                        /div                      /a                    /li                  /ul                        //updating post             wp_update_post($post);         }         ?>


Display author box on just certain category posts?

I'm using this code to display a author box after my blog posts. The issue that I'm having is that it is showing up on all custom post types as well which I don't want. What I need is for it to show up on posts that are in the category of 'blog'. Anyone have any suggestions on what I need to do to accomplish this? Thanks in advance!               // creates the author bio after posts     function get_author_bio ($content=''){     global $post;          $post_author_name=get_the_author_meta("display_name");     $post_author_description=get_the_author_meta("description");           $html="
\n";     $html.="\n";     $html.="
\n";     $html.="
Author: ".$post_author_name."
\n";     $html.= $post_author_description."\n";     $html.="
\n";     $html.="

\n";     $content .= $html;          return $content;     }          add_filter('the_content', 'get_author_bio');


How to show metabox key to custom post?

is it possible to show all custom metabox key name and show it as dropdown list on my custom post with my custom metabox dropwdown list ? > this is custom metabox from another plugin/theme and how to get all metakey > from all input form ![test](http://i.stack.imgur.com/25Uo5.jpg) > and show all of them to my custom fields name, my custom fields is come from > my plugin that have custom post type function. ![enter image description here](http://i.stack.imgur.com/koXzm.jpg)


Trying to achieve row posts below category with multiple loops in custom tax

hoping someone here can help a noob. Ideally I'd like to get a featured post from a category 'Featured Club' to display above three posts from the same custom post type. I've got the following working but for one I'm using two loops where I'm sure one would work, and two, the results under the full width featured post, display in a column and I need them in a row. Additionally, I have another custom post type that I'd like to display on the same page under this block, with another 'Featured Category', and the way I'm going, I'll end up with four loops. Look forward to getting some help. Here's the code:
Jazz Clubs
                 <?php                     $args = array (                         'post_type'  => 'jazz clubs',                         'meta_query'             => array(                         array(                         'key'       => '_jazz_club_feature_club',                             ),                         ),                     );                     // The Query                     $jazzclubs = new WP_Query( $args );                     // The Loop                     if ( $jazzclubs->have_posts() ) {                         while ( $jazzclubs->have_posts() ) {                             $jazzclubs->the_post();                 ?>
<?php the_title() ?>
                     <?php the_post_thumbnail() ?>
<?php the_excerpt() ?>
                  <?php                         }                     } else {                         // no posts found                     }                            wp_reset_postdata();                 ?>

             <?php                        // WP_Query arguments                 $args = array (                     'post_type'  => 'jazz clubs',                     'orderby'    => 'date',                 );                 // The Query                     $jazzclubs = new WP_Query( $args );                     // The Loop                     if ( $jazzclubs->have_posts() ) {                         while ( $jazzclubs->have_posts() ) {                             $jazzclubs->the_post();             ?>

                     <?php the_post_thumbnail() ?>
<?php $terms = get_the_terms( $post->ID , 'city' );                                                             if ( $terms != null ){                                                             foreach( $terms as $term ) {                                                             print $term->name ;                                                             unset($term);                                                             } }                                                          ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

<?php the_date('F j Y'); ?>

<?php the_excerpt() ?>

                      <?php                         }                     } else {                         // no posts found                     }                     // Restore original Post Data                     wp_reset_postdata();                 ?>


Code needed to only show users own posts in a multi-user account

I am using WP3 and want to starting adding users (many users to a single blog) but when I give a new user an account, they can see all the posts in the admin including scheduled, drafts, pending review etc. I either need the users to ONLY view their own posts or only view their own published posts (but not scheduled, drafts, etc). The admin should be able to see everything. Here is a link I found on this issue with a code but the code is not working in my functions.php http://wordpress.org/support/topic/show-only-authors-posts-in-admin-panel- instead-of-all-posts


How to get the wpnonce value?

On using inspect element to check the 'href' attribute of 'Deactivate' links for the plugins listed on plugins.php page, I found that the url contains a wpnonce field with a certain value. I need to get this value. For eg,               Deactivate      How do I get this value '08a2b0d940' as in the above link ?


How to make a function occurs for one time?

I have the following code in the functions.php file in my theme                 function my_func(){         echo "foo";       }                add_action('admin_menu','my_func');      I assume this function "my_func" will be called once in the admin_menu action; however I have found that the function is being called many times -it will print the word "foo" in the top of every widget of the dashboard-!! for me this is a strange behavior!,how can I make the function runs for one time? I want it to run when creating the admin menu? Best Regards Thanks


Wordpress Hook for user account activation in normal Wp (not MU)

what is the action hook, if a user activates his profile? For the profile update, it is:               profile_update      for example. My goal is, to execute a function, if a user activates his profile. Something like this:               add_action( 'user_activate','my_function');


Trouble getting the Blog page to show up correctly

I'm having a completely new problem and can't figure it out so I'm hoping someone can help me. The website is http://www.talkingdogtemplates.com. It's a big site that uses WordPress as a CMS primarily, and I have the blog page set to http://www.talkingdogtemplates.com/blog.html. I'm using the .html on PAGES plugin to get the extension and I've never had this problem in the past with over 50 WordPress CMS/blogs. (not even sure that's the cause, probably not) So the problem is that the post DOES show up on the blog page but the link in the header does not link and none of the author and date info shows up. It's like each time I edit the index.php document and reload it it's just being ignored. So weird. Here's the main piece of the index.php doc:
              <?php if (have_posts()) : ?>                  <?php while (have_posts()) : the_post(); ?>                      <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', ''), the_title_attribute('echo=0')); ?>"><?php the_title(); ?>
                     <?php the_time(__('F jS, Y', '')) ?> by <?php the_author() ?>
                         <?php the_content(__('Read the rest of this entry »', '')); ?>

<?php the_tags(__('Tags:', '') . ' ', ', ', '
'); ?> <?php printf(__('Posted in %s', ''), get_the_category_list(', ')); ?> | <?php edit_post_link(__('Edit', ''), '', ' | '); ?>  <?php comments_popup_link(__('No Comments »', ''), __('1 Comment »', ''), __('% Comments »', ''), '', __('Comments Closed', '') ); ?>

                  <?php endwhile; ?>      I'm really hoping someone can help me. I've tried everything I can think of so I'm hoping a fresh set of eyes can solve this easily. Let me know if you need any more info. Thanks so much in advance!


Unclickable Menu Item Label in Custom Menu with Clickable Children

I need some help with a custom menu. I'm using WP 3.1.1. I need to create an unclickable placeholder in the nav menu. So, the children will be clickable, but the "title" in the nav bar is not. For example, let's say I have a Shovel Page, Trowel Page, and a Spade Page and I want them all to be accessible under the Tools section in the Custom Menu. In the menu, "Tools" isn't clickable, only the children are. I tried the solution outlined here: non-clickable placeholder in the menul . But, if I click the placeholder I get an Alert. Also, his opened Custom Link box looks different than mine. I only have options for URL, Navigation Label, and Title Attribute. I don't know if that has anything to do with why it doesn't work. Any suggestions? Thank you. -Laxmidi


Custom Post order for homepage

I would like to display a dropdown on the homepage which contains [most popular, most recent, trending] and when a user selects on of them the posts are page reloads and the posts are sorted in that order. Right now I am using query string to detect the sort order. For eg: `http://example.com/?sort=popular` or `http://example.com/?sort=trending`. Then in the `home.php` I check query string and edit the `wp_query` object's `orderby` clause. I want to ask if this is a correct approach or is there a better way to handle this case? Because I also want to handle pagination and other stuff. In home.php               /**      * check query for most popular.      */     function check_for_popular() {         return get_query_var('sort') == "popular";     }     function mp_home_loop() {     global $wp_query;         if( check_for_popular() ) {             $query = $wp_query->query_vars;             $wp_query = new WP_Query( wp_parse_args( array(                 'meta_key' => 'popularity_score',                 'orderby'  => 'meta_value_num',                 'order'    => 'DESC',                 ), $query ) );         }         include( CHILD_DIR . '/mp_home_loop.php' );     }       In functions.php               add_filter('query_vars', 'add_query_vars' );     function add_query_vars( $qvars ) {        $qvars[] = 'sort';        return $qvars;     }


How to Test a Blog Post for Update vs. Publish Status -- Unique

I want to perform an action when a blog post gets published for the first time only. I do not want to take action on any subsequent update. I wrote a plug-in to do this. However, it runs the function each time the post is updated, regardless of publish or update status. Here's is a snippet of my plugin:               function emailSubscribers( $new_status, $old_status, $post ) { // 2014-04-21 http://wordpress.stackexchange.com/questions/69772/execute-function-when-post-is-published            //error_reporting(E_ALL); ini_set('display_errors', 'On'); // don't use this -- it messes up page            //$post = get_post($post_ID);       //echo '
'; print_r($post); echo '
'; exit; // for testing purposes       //echo '
'; echo 'Published: ' . $post->post_date . '
' . 'Updated: ' . $post->post_modified; echo '
'; exit; // for testing purposes       $thisCategory = get_the_category($post/*->ID*/);       $blogTitle = get_the_title($post/*->ID*/); // must be done this way so the html entities get decoded properly            if ( 'publish' !== $new_status or 'publish' === $old_status ) return; // 2014-04-21 http://wordpress.stackexchange.com/questions/69772/execute-function-when-post-is-published       if ( 'post' !== $post->post_type ) return; // restrict the filter to a specific post type // 2014-04-21 http://wordpress.stackexchange.com/questions/69772/execute-function-when-post-is-published                /* the rest of my code which actually gets processed regardless of post status */              } // end emailSubscribers()         add_action( 'transition_post_status', 'emailSubscribers', 10, 3 );      Other answer(s) elsewhere in Stackoverflow do not solve this specific problem.


Include both default and Custom Post Type in query modified inside pre_get_posts

I want to include custom post type in the author arhive page. I tried the method discussed in this post: > Including post_type = 'wiki' in author archives               add_action( 'pre_get_posts', 'custom_post_author_archive' );     function custom_post_author_archive( &$query )     {         if ( $query->is_author )         {             $query->set( 'post_type', 'custom_name' );             remove_action( 'pre_get_posts', 'custom_post_author_archive' ); // run once!         }     }      But by this method, only the custom_name posts are queried. I want to query both the custom_name posts and the normal posts. What changes will I have to make?


Redirect users to a front end wp login page

My theme allows me to create a front-end login form in a normal blog page. Now, I wish to redirect all the users to that page and not to **wp- login.php**. I have used the below code snippet.               function redirect_login_page(){        $page_viewed = basename($_SERVER['REQUEST_URI']);        // Where we want them to go        $login_page  = 'http://localhost.com/login/';        if( $page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {          wp_redirect($login_page);          exit();        }     }     add_action('init','redirect_login_page');      But the problem is, it only redirects **wp-login.php** page. What if we place **wp-admin** , (e.g. http://localhost.com/wp-admin/) it does not redirect. Instead it takes to that **wp-login.php** page (which I do not want) Any suggestions?


Save something to global var in add_filter

I am here again with a strange question. First, I'm using ACF plugin for adding cistom fields. My code looks somethink like that:               global $testMe;     $testMe = 0;     function my_acf_update_value( $value, $post_id, $field ) {         global $testMe;         $testMe = $value;         return $value;     }     add_filter('acf/update_value/key=field_5308e5e79784b', 'my_acf_update_value', 10, 3);     echo $testMe; // -> print 0, not the $value!?      The problem is that I want, after the filter apply, $testMe to contain the value of $value. Any ideas where I'm wrong?


Enforcing password complexity

We need to enforce password complexity in a wordpress site, we used this article: http://www.webtipblog.com/force-password-complexity-requirements-wordpress/ We created the following in functions.php:               add_action('user_profile_update_errors', 'validateProfileUpdate', 10, 3 );     add_filter('registration_errors', 'validateRegistration', 10, 3 );     add_action('validate_password_reset', 'validatePasswordReset', 10, 2 );          function validateProfileUpdate( WP_Error &$errors, $update, &$user ) {         return validateComplexPassword( $errors );     }          function validateRegistration( WP_Error &$errors, $sanitized_user_login, $user_email ) {         return validateComplexPassword( $errors );     }          function validatePasswordReset( WP_Error &$errors, $userData ) {         return validateComplexPassword( $errors );     }          function validateComplexPassword( $errors ) {              $password = ( isset( $_POST[ 'pass1' ] ) && trim( $_POST[ 'pass1' ] ) ) ? $_POST[ 'pass1' ] : null;              if ( empty( $password ) || ( $errors->get_error_data( 'pass' ) ) )             return $errors;              $passwordValidation = validatePassword($password);              if ( $passwordValidation !== true ) {             $errors->add( "pass", "ERROR: " . $passwordValidation . "." );         }              return $errors;     }          function validatePassword($Password) {         //#### Check it's greater than 6 Characters         if (strlen($Password) < 6) {             return "Password is too short (" . strlen($Password) . "), please use 6 characters or more.";         }              //#### Test password has uppercase and lowercase letters         if (preg_match("/^(?=.*[a-z])(?=.*[A-Z]).+$/", $Password) !== 1) {             return "Password does not contain a mix of uppercase & lowercase characters.";         }              //#### Test password has mix of letters and numbers         if (preg_match("/^((?=.*[a-z])|(?=.*[A-Z]))(?=.*\d).+$/", $Password) !== 1) {             return "Password does not contain a mix of letters and numbers.";         }              //#### Password looks good         return true;     }      As you can see, we've made use of the `validate_password_reset` hook & used it to call our bespoke `validatePassword()` function that tests the password with a couple of simple regular expressions. However, this code just doesn't seem to be called at all when a user resets their password via `wp-login.php` - we know this because its still allowing us to enter the password "woof" (which is clearly invalid) and to double check we put some code in the `validateComplexPassword()` function to send us an email, again, no email was fired. Is there something wrong with our code? is the `validate_password_reset` action no longer called? Help :) **Edit:** we have noticed the following in the php error log - could this be the problem?               [12-Jun-2014 14:38:12 UTC] PHP Warning:  Parameter 1 to mycohens_validatePasswordReset() expected to be a reference, value given in C:\inetpub\wwwroot\www.cohenschemist.co.uk\wp-includes\plugin.php on line 470      **Edit 2:** Attempting to change our password via wp-admin/profile.php is working perfectly, the errors from our custom code are being returned by wordpress, its just the forgotten password reset that does not seem to be working.


pdf (25MB) - how to display and enable download?

I have tried to upload it simply through the media library ,but it didnt display correctly (very low resolution) and some users couldnt even see it (just an empty space) ,so I used an iframe tag in a page and uploaded the pdf directly to the server.               <iframe frameborder="1" height="200" name="frame1" scrolling="yes" src="/wp-content/themes/abc/images/catalog.pdf" width="550"></iframe>      now it displays correctly but takes a lot of time to load the pdf to the page. now for to users to dowmload the pdf I put a text "right-click for print or save as". I wish I could switch it with some kind of a button --download--. perhaps I shouldnt upoload the pdf as is (25MB) and just upload images of the catalog.pdf pages ?,it will sure weigh less.but what will I do with the download,it will really slow down the website if all the users will download 25MB file. I dont know if it is the right way to display and enable download for large pdf files,and try to minimize the use of plugins. what is the best way to do it ? thank you


Can't drag and expand meta boxes when adding post

When I try to add a post, I can't expand and drag meta boxes, however, when I try to edit posts, I can. I already have re-uploaded the original files of post-new.php and post.php Why is this happening?


How can I control what / how much text is in my RSS feeds?

Currently, my RSS feeds show the entire text from main text field. I only want to show parts of my text, preferrably my intro text, so that users have to visit my page to read the rest. I've customized my WP to act more as an CMS. Among the things I've done, is to remove the Excerpt field with `remove_meta_box('postexcerpt', 'post', 'normal')`. Then I've added my own meta boxes for intro text (excerpt) and short intro text. Because of this, my intro text is not shown and I'm not using `the_excerpt_rss()`. This is the code I use to show my intro text:               function the_intro($attr = null) {       $intro = get_intro($attr);       echo $intro;     }      Where the function `get_intro($attr);` is a bigger function to actually retrieve and return intro text. Looking at `wp-include/feed.php`, I see they use this:               echo apply_filters('bloginfo_rss', get_bloginfo_rss($show), $show);      Should I add this filter to my custom functions? I have not tested yet, just in case I break something :)


Checking for two categories in query_posts

How can I check two category_name values in the following query_post?                <?php query_posts('category_name=recent-work&posts_per_page=1');        if (have_posts()) : while (have_posts()) : the_post(); ?>      So that it reads something like this:                <?php query_posts('category_name=recent-work&&category_name=plumbing&posts_per_page=1');        if (have_posts()) : while (have_posts()) : the_post(); ?>      Many thanks. **EDIT:**               <?php             $querySimilarWork = new WP_Query( array(                 'tax_query' => array(                     array(                         'taxonomy' => 'categories',                         'field' => 'slug',                         'terms' => array( 'recent-work', 'plumbing' )                     )                 ),                 'posts_per_page' => 4             );         ?>      **EDIT:** If I now query this WP_query, it doesn't return anything?               <?php while ($querySimilarWork->have_posts()) : $querySimilarWork->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
      <?php endwhile; ?>


Passing error/warning messages from a meta box to "admin_notices"

I have a simple meta box that updates the post custom fields (using `update_post_meta()`). How can I send a error or warning message to the next page after the user publishes/updates the post and doesn't fill one of the meta box fields (or fills them with invalid data) ?


Black and White thumbnails

There are ways to convert color image to `black and white` on the client side with javascript. However, it won't work in all browsers and it's slow. Is there a way to convert Wordpress post-thumbnails to `black and white` on the `server side` automatically? This is what I would like to achieve:   1. Upload a color image   2. Have it displayed in black and white   3. On hover change to its original color


Contents are missing but shown when switching to another theme in wordpress

I was surprised this morning to hear that the contents on my WP site are erased, said my client. I tried disable all plugins one by one, but the problem still exists. I also changed the memory limit via the wp-config and that could not solve the problem either. Then I switched to another theme, twenty-eleven and twenty-twelve, they all show those missing contents. This is my first time building a WP site, and I've no idea why it occurs. http://www.dcaredental.com/news-event/tv-interviews/ Any help would be very much appreciated.


Custom Nav Menu items default to 'menu-item-type' => 'custom'. How to make a "page" menu item?

I'm using the code below to create custom menu items on the fly. Its working great, except all menus are created as "Custom". In the code below, setting the menu-item-type to 'page' appears to have no effect.                       foreach($thePages as $page){                 wp_update_nav_menu_item($menu->term_id, 0, array(                     'menu-item-title' => $page->post_title,                     'menu-item-type' => 'page',                      'menu-item-status' => 'publish')                 );                       }      wp-includes/nav-menu.php shows that the value is hard coded to "Custom". However, if I manually add a page to the menu, using the WP Menus manager, it lists it as "Page", not "Custom". What can I do to set the menu type to "Page"?


Confirmation box when submitting post for review

A very common issue that I experience with new authors is that they forget to complete a few essential tasks prior to submitting their post for review (even though I have a guide available for them). Is it possible to add a confirmation box that appear only when a contributor clicks on the "Submit for Review" button? Potentially a jQuery box like this: ![enter image description here](http://i.stack.imgur.com/JcjV0.png) I have come across a few confirm publish codes on the web and plugin archives but all of which trigger on _Publish_ (not _Submit for Review_ ) and prompts a Javascript alert window.


Check when the post type changes, and display content

The following code was provided in another question but doesn't seem to be working. Basically I have 4 post types (deals, accommodation, articles, attractions) and I would like to show a list of post types relating to a common taxonomy (destination) and use a header to seperate each taxonomy. Destination: London   London Attractions   xx   xx   xx      London Articles   xx   xx   xx      London Deals   xx   xx   xx Etc Any ideas on this? I have added this to taxonomy-destination.php but it seems to just hang.               <?php     $post_type = '';     while (has_posts()): the_post;          if (get_post_type() !== $post_type) {         // print the header for the post type         // maybe something like this...         echo '<h2>', esc_html(get_post_type_object(get_post_type())->label)), '</h2>';     }          // do stuff with the current post          $post_type = get_post_type();          endwhile;


Navigation list not correctly styled on pages with custom template (missing .current-menu-item)

My Wordpress site uses a custom front page (`home.php`). The blog page uses a template (`blog.php`). However when I visit the blog page the navigation bar does not highligt the current page. This is because the class `.current-menu-item` (and the class `.current_page_item`) are missing from the navigation `li`. This class is correctly included when I visit all other pages that use the default page template. Here is the template for the blog page:               <?php     /*     Template Name: Blog     */          // Which page of the blog are we on?     $paged = get_query_var('paged');     query_posts('cat=-0&paged='.$paged);          // make posts print only the first part with a link to rest of the post.     global $more;     $more = 0;          //load index to show blog     load_template(TEMPLATEPATH . '/index.php');          ?>      I've noticed that if I remove the call to `query_posts` then the nav bar styling works correctly, but the page is left blank. Any ideas?