title: How to make top level menu think it has a current item

text: This question has always tripped me up, but it seems like there should be an easy solution. I have created a couple pages in a hierarchy as follows.               About Us         - History         - Mission          Events         - Field Day         - Labor Day Picnic      I have also created three menus in Wordpress. A "Main" Menu that holds:               About Us     Events      This menu is displayed horizontally across the top of the website. I also have two secondary menus, "AboutUsMenu" which just holds the following two pages:               History     Mission      The third menu, "EventsMenu" which holds the other two sub pages:               Field Day     Labor Day Picnic      I added a meta box on the page editor which let's me associate one of the two sub menus with every page. This allows me to show my "Main" menu across the top of the website, and then on each page, I can dynamically figure out which sub menu to show on any page. The problem occurs when the user visits a sub page, say /about-us/mission. Since I'm on the mission page, "Main" menu does not give the About Us page a css class of current_page_item. Technically, it's not the current page, but I would like to be able to style it as the current page since it is the active section as far the user is concerned. Main menu doesn't know anything about the sub page so Wordpress can't add the current_page_item or current_page_ancestor CSS class. I'm using wp_nav_menu to write all menus. Can anyone tell me an easy way to link all of this together so the menus will understand they are the current menu items.


title: Splash screen in htaccess, now links are not working

text: I wanted to use an already made html page for my wp site in root. Didnt want to move all wp inside a folder so I used the answer here using htaccess. Problem is, now if I write /wp-admin I got to the parent directory without redirecting to wp-admin/index.php. Also, If I am into mysite.com/blog.php and write wp-admin, I get a redirect into the same blog. I can see the admin bar on top but cant get into the dashboard from blog.php I have to write mysite.com/wp-admin/index.php or mysite.com/wp-admin/ and click on index.php Help please D: Here's my htaccess:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress          DirectoryIndex splash.php directorio.php


title: Trying to use wp_set_object_terms while supplying an array for both term id, and texonomies

text: I'm trying to use `wp_set_object_terms` ref : http://codex.wordpress.org/Function_Reference/wp_set_object_terms while passing array for both the terms and taxonomy for some reason i keep getting : `Warning: Illegal offset type in isset or empty in /home1/stodeckc/public_html/clicktranslate/wp-includes/taxonomy.php on line 231` this is how i am trying to set it:               parents[] = array(         'item_id' => 15,         'app_name' => 'justanotherone'     );          foreach($parents as $parent){         $cat_ids[$parent['item_id']] = (int)$parent['item_id'];         $taxonomies[$parent['item_id']] = $parent['app_name'];     }     wp_set_object_terms( 42, $cat_ids,$taxonomies);      am i missing something ? Thanks


title: How to stop Wordpress Search form from searching only in current page?

text:
My wordpress search form (code below) appends the query string to current page only. For example if I go to `http://Website/unknown-page` and then use the form to search for some content the query string looks like this `http://Website/unknown-page?s=Search` and only searches within the current page. It should be searching from the root like this: `http://Website/?s=Search` How do I fix this?                                    <form class="form-inline" role="search">
                                         Search:                                         <input type="text" name="s" class="form-control" placeholder="Search">
                                       <button type="submit" class="btn btn-default">Submit</button>                                 </form>


title: wordpress - add a custom admin section with fields for name, address, city,state, and photo upload

text: Am attempting to create a custom post type and have it contain very specific info. Name, address, city, state, zip and photo - as a post. Need to have the admin section show form fields named as what these items are. Yes, I could use custom fields, however want to do it right and setup form input boxes (or meta boxes) for each specific piece of data. Having the post creation dialog have a specific file upload input for the photo would be pretty smooth. Will use plugins if necessary, however would rather code it in, as it is very specific (and should stay that way). Looking for suggestions or tutorials that would cover this specific need, or plugins that anyone has used that do this.


title: if(!is_user_logged_in()) returns true when 404

text: I'm running a closed website for registered users only. For doing so I check in if user is logged in               // no non-authenticated users allowed     if( !is_user_logged_in() ) {         wp_redirect('/wp-login.php');         //auth_redirect();         exit;     }      But sometimes It just logged me out, and I could not understand where to seek the problem. it happened ocassionally and so it was really hard to debug. Now: with different function I found that `if( !is_user_logged_in() )` returns true on 404 page. I'm still debugging but I want to hear your opinion, is this normal or intended? Could you confirm if this is same with your installaton? I'm running latest version of Wordpress * * * Update: still cant undestand, in footer.php               if(!is_user_logged_in()) {         echo '123';     }      echos 123 but my function does not redirect.. but its still strange and have problem with another plugin because of this. plugin looks like this:               add_action("wp_footer","bpln_store_ids");     function bpln_store_ids(){         if(!is_user_logged_in())             return;      ?>      <div id="bpln-notification-ids" style="display:none;">      <?php echo join(",",bpln_get_all_notification_ids(bp_loggedin_user_id()));?>      </div>     <?php     }      since check returns true, the actual content will never be displayed


title: Showing just the menu toggle next to logo in twenty fourteen

text: For mobile, I want to eliminate the black menu bar, search box/icon and move the menu toggle up so that on mobile, my site just has the logo and the menu toggle. This gives a bit more room for content.


title: How to set a category by day name?

text: I have a category for each day. Sunday, Monday, Tuesday, etc. I want to show this category fixed depending on the day of the week. I'll also have other categories to filtering. So, the category `day` will be fixed, and the other ones can be added or not, depending on the user input. What is the best approach to achieve this?


title: order by numeric value for meta value

text: I have read countless posts on ordering data by numeric value ( as opposed to string - it i have a numeric meta value and it gets ordered like this 1 11 12 2 233 etc as opposed to the way i want it I am using WP_Query have tried using meta_query => 'NUMERIC' but i'm not sure if that's what it's actually supposed to do eg               $args =  array(         'meta_query' => array(                 array(                       'type' => 'NUMERIC'                 )         ),         'orderby' => 'meta_value',         'meta_key' => '_date',         'post_type' => 'events',         'posts_per_page' => 5,         'order' => 'ASC'      );


title: Get author total post votes from post meta

text: In author.php, i have the list with the posts written by the author.   I'm trying to get the total number of votes, from the author posts.   All posts have a post_meta with a numbered value. i need to count the total votes from all the posts that made from this user/author. Is that possible? is a query available, that can handle this request? thanks a lot!


title: How to Create Custom Post Type with Multiple Color Options?

text:
Can you please let me know what is the best choice to create a Custom Post type like "Pen" which has Taxonomy called "Brand" now each of these post has definitely Black color which I will use as Custom Post Meta but some of Pen has more than 3 or 4 colors.Now I am kind of confuse to how to do that? Besides I need to print out the available color of the pan(if available) and link to them. **Update:**               <?php     // Register Custom Post Type     function custom_post_type_pens() {     $labels = array(         'name'                => 'Pens',         'singular_name'       => 'Pen',         'menu_name'           => 'Pen',         'parent_item_colon'   => 'Parent Product:',         'all_items'           => 'All Pens',         'view_item'           => 'View Product',         'add_new_item'        => 'Add New Pen',         'add_new'             => 'Add Pen',         'edit_item'           => 'Edit Pen',         'update_item'         => 'Update Product',         'search_items'        => 'Search Pens',         'not_found'           => 'No Pen Found',         'not_found_in_trash'  => 'No products found in Trash',     );     $args = array(         'label'               => 'Pens',         'description'         => 'Product information pages',         'labels'              => $labels,         'supports'            => array( ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'menu_icon'           => '',         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'capability_type'     => 'page',     );     register_post_type( 'pens', $args );          }          // Hook into the 'init' action     add_action( 'init', 'custom_post_type_penss', 0 );          // Register Custom Taxonomy     function custom_taxonomy_pen()  {              $labels = array(             'name'                       => 'Brands',             'singular_name'              => 'Brand',             'menu_name'                  => 'Brands',             'all_items'                  => 'All Brands',             'parent_item'                => 'Parent Brand',             'parent_item_colon'          => 'Parent Brands:',             'new_item_name'              => 'New Brand Name',             'add_new_item'               => 'Add New Brand',             'edit_item'                  => 'Edit Brands',             'update_item'                => 'Update Brand',             'separate_items_with_commas' => 'Separate Brands with commas',             'search_items'               => 'Search Brands',             'add_or_remove_items'        => 'Add or Remove Brand',             'choose_from_most_used'      => 'Choose From the Most Used Brands',         );         $args = array(             'labels'                     => $labels,             'hierarchical'               => true,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => true,         );         register_taxonomy( 'brand', 'pens', $args );          }       // Hook into the 'init' action     add_action( 'init', 'custom_taxonomy_pen', 0 );          add_action( 'add_meta_boxes', 'cd_meta_box_add' );       function cd_meta_box_add()       {           add_meta_box( 'my-meta-box-id', 'Pen Details', 'cd_meta_box_cb', 'pens', 'normal', 'high' );       }            function cd_meta_box_cb()       {           ?>           Price           <input type="text" name="my_meta_box_text" id="my_meta_box_text" />           Sale On           <input type="checkbox" name="my_meta_box_text" id="my_meta_box_text" />           Sale Price           <input type="text" name="my_meta_box_text" id="my_meta_box_text" />          Color Optins           <input type="checkbox" name="my_meta_box_text" id="my_meta_box_text" />
       <?php            // $post is already set, and contains an object: the WordPress post           global $post;           $values = get_post_custom( $post->ID );           $text = isset( $values['my_meta_box_text'] ) ? $values['my_meta_box_text'] : '';           $selected = isset( $values['my_meta_box_select'] ) ? esc_attr( $values['my_meta_box_select'] ) : '';           $check = isset( $values['my_meta_box_check'] ) ? esc_attr( $values['my_meta_box_check'] ) : '';                // We'll use this nonce field later on when saving.           wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );          ?>
              Text Label              <input type="text" name="my_meta_box_text" id="my_meta_box_text" value="<?php echo $text; ?>" />

              Color              <select name="my_meta_box_select" id="my_meta_box_select">                  <option value="red" <?php selected( $selected, 'red' ); ?>>Red</option>                  <option value="blue" <?php selected( $selected, 'blue' ); ?>>Blue</option>              </select>

           Featured post:              Color              <select name="my_meta_box_select" id="my_meta_box_select">                  <option value="red" <?php selected( $selected, 'red' ); ?>>Red</option>                  <option value="blue" <?php selected( $selected, 'blue' ); ?>>Blue</option>              </select>          Remove

              <input id="adder" type="button" class="button-primary" value="Add More Color Options"></button>

              <input type="checkbox" id="my_meta_box_check" name="my_meta_box_check" <?php checked( $check, 'on' ); ?> />               Do not check this
           <?php                }      ?>


title: Theme Splash Image within the "Appearance -> Themes" control panel

text: I have created a theme, and its all working fine. Within the WordPress control panel under **"Appearance -> Themes"** , you can see the available themes _(Twenty Fourteen, Twenty Thirteen etc etc)_ and they all have a splash image demonstrating what your blog could look like. My theme just shows a blank canvas. Is there a way of adding an image or something to represent my theme? I bet I have missed something really obvious. :/


title: wp_ prefix changed. What is the way to change so any prefix is understood?

text: I have a plugin with a line calling wp_capabilities. This works with the default prefix. If someone changes the prefix to something else (bluehost scripts do this), how do I fix this code? Can you also explain why? I can hard code it for the individual site but how do I make it 'universal'? Change:               $current_user->data->wp_capabilities[$role_name];      To:               $current_user->data->wp_xyz_capabilities[$role_name];      I understand (and use) {$wpdb->prefix} in an SQL statement works fine. I've looked at $table_prefix as well as $wpdb->prefix but the combinations I've tried in PHPStorm state expecting semicolons or red lines appear stating there is a problem. Thank you for your time and explanation.


title: wp_customize_image_control default value

text: I am trying to create a custom theme using Wordpress 3.4's customization options. I would like to create an option to change the theme's logo, but I would like to also display a default logo image. I am using the following code in my function.php page:               $defaultbranding = "get_bloginfo('template_directory') . '/images/logo.png";              $wp_customize->add_setting( 'change_branding', array(             'default' => get_bloginfo('template_directory') . '/images/logo.png',         ) );              $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'change_branding', array(             'label'   => 'Image Control',             'section' => 'theme_settings',             'settings'   => 'change_branding',         ) ) );      And in the theme's header.php page:               src='<?php echo get_theme_mod( 'change_branding' , 'default' ) ?>'      I would like the 'default' value on the front end to be:               get_bloginfo('template_directory') . '/images/logo.png'      Is there some way I can achieve this? Thanks in advance for any help.


title: List taxonomies with thumbnails

text: I've added an extra field to a taxonomy called "albums" via this function:               add_action( 'albums_edit_form_fields', 'albums_taxonomy_edit_meta_field', 10, 2 );     function save_taxonomy_custom_meta( $term_id ) {     if ( isset( $_POST['term_meta'] ) ) {         $t_id = $term_id;         $term_meta = get_option( "taxonomy_$t_id" );         $cat_keys = array_keys( $_POST['term_meta'] );         foreach ( $cat_keys as $key ) {             if ( isset ( $_POST['term_meta'][$key] ) ) {                 $term_meta[$key] = $_POST['term_meta'][$key];             }         }         // Save the option array.         update_option( "taxonomy_$t_id", $term_meta );     }     }      The metadata is saving fine and now I'd like to list or query my taxonomies in a page by displaying next to the taxonomy's name the value of the metadata attached to every taxonomy (in this case, the image). Anybody knows how to do it ?


title: How to i18n text coming from the db or from an external source

text: I'm writing a plugin and i wanted to i18n correctly text which i'm storing in the db or in an external file. How should i do that?As of now we are generating pot files with wordpress and so all the Translatable text is in calls               __( 'text', 'plugin_name');      But there is some text i would like to store in the db or in another format and that i don't know how to put into the POT files. The only thing that come to my mind is to use arrays for these data structures so that i can translate the values, but are there other options?


title: How Can I Centralize Content Usage and Approval in a WordPress Multi-Site installation

text: I am working with a non-profit client that runs several charities under one umbrella. A good metaphor would be to think of the United Way (but it's not the United Way). Can a WordPress multi-site installation do the following: Share content between sites. E.g., if site A has a section called "Advocacy", can that same content also be shown in site B? This would need to include text, photos, etc. How centralized can administration be made? For example, can draft posts from all websites be approved in one location? I'm sure there are other things I need to ask, but I'm still in the investigation phase.


title: WordPress Rewriting the DOM?

text:
WordPress 3.9.1, Bones Theme. I'm setting up an archive page for regular 'ol blog posts. The theory is to wrap each post's information in a permalink. Such as:               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <a class="blog-article-permalink" href="<?php the_permalink() ?>">             <article id="post-<?php the_ID(); ?>">

<?php the_title(); ?>

<?php the_excerpt(); ?>

...

              <?php endwhile; ?>      When I load the page in any browser, I get:               ...
         ...
             ...
                                     Byline Info

...

...

...

      etc... So basically, some part of WordPress is rearranging my carefully coded archive and outputting the link three times as it's own block-level-element and not allowing it to wrap the rest of the article information as intended. I have 6 custom post types set up this way, and their archive pages look and work beautifully with get_posts(). I really want to use the generic loop for the blog, and not hack it up, because why would I? I've read answers such as changing the valid children setting for the TinyMCE, and tried thinking that it may affect the loop somehow, but that didn't work. I guess it makes sense that it would invalidate block-level elements within an `<a>` link tag in html4, but we're using html5 now, where it's perfectly legal. What am I missing here?


title: Most efficient way to add javascript file to specific post and/or pages?

text: I am wondering what the most efficient method is to add a javascript file specifically for a post and/or page. Here are a few solutions I came up with:   * Switch to HTML editing view and post your JavaScript in there (pretty bad solution)   * Custom fields with the specific JavaScript for that post/page in the key & value pairs   * In footer.php, load JavaScript files depending on which page you're on (this leads to a lot of conditionals though) On a side note, none of the JavaScript files will be shared between pages - it will literally be specific to what you're currently viewing. Any thoughts?


title: network site domain mapping still applied after being removed

text: I have a sub-domain network installation on `www.example.com` One of the sites is `rabbit.example.com` This site used to have a domain mapping to `www.rabbit.com`. I removed this mapping. However, when I go to `http://rabbit.example.com/wp-admin`, it forwards me to `http://www.rabbit.com/wp-admin` I have checked the site settings for `rabbit.example.com`, and the base URL and home URL are set to `rabbit.example.com`. I have double-checked the domain mapping is no longer there. I do not have a caching plugin installed. The site's database table, `wp_10_options`, has the site URL as `rabbit.example.com` Any ideas?


title: Advanced Taxonomy Queries Wordpress

text: I am working with wordpress and business listings. I have about 5000 business listing all over the usa. Each business listing has a custom field for state, county and city and brands. My business listings are car dealers and each dealer is loaded into my wordpress database under a custom post type called dealers. I have created two taxonomies called geography (logical structure = states ->county->city) and brands (ie. Honda, Toyota) to be able to view dealers by different queries options. It is my understanding I can query between the geography and brands taxonomy with parameters and it appears to be working. For instance, www.xyz.com/dealers/?geography=alabama&brands=toyota. This query would list a category page of all dealers in my database in the state of Alabama with a brand of Toyota. I now need to create dynamic category pages for hundreds of different query options by geography and brands. Here are the options:   1. All dealers by each state in the USA   2. All dealers by each county in USA   3. All dealers by each city in USA   4. All dealers by each brand   5. All dealers by each brand and state in the USA   6. All dealers by each brand and county in USA   7. All dealers by each brand and city in USA I assume I can have a programmer create a category template in wordpress for each of the above option and rewrite the urls to friendly to query the various options in my db. Can someone provide me some guidance if the above approach appears wise or is there a better approach that would be more efficient? My concern is the above approach might not work and also I spend a lot on programming and then a future release of wordpress changing the permalink structure and my solution does not work anymore. Your assistance is very much appreciated.


title: Show comments fields in two columns

text: I am using comment_form(); in loop-single.php file to show the comment form. I have the following fields in it: Name, Email, Website, Title, Comment. Currently all these form fields show underneath each other. I tried to modify the form in such a way so that all textbox values appear in left column & only the textarea appears in the right column. I tried to use comment_notes_after, comment_notes_before, comment_form_top, etc. so far but met with no success. So how can I achieve this (Any working code will be greatly appreciated)?


title: Efficiency of wp_options vs a new table

text: I'm building a WordPress theme framework, that will likely have many options as development progresses. I found a related question: When is it appropriate to create a new table in the WordPress database?, which indicates that a new table would be more efficient, but I'd like to know more. It makes sense that if it's faster to use a new table for a thousand entries, it must also be faster for tens or hundreds of entries. What's more, the wp_options table can become very cluttered. What are the differences in query execution time, memory usage, and other factors between these two options?


title: muliple wordpress installs (network) on different databases

text: I've installed a network for the main domain and the sub.domain.com It works, but I do prefer to maintain in separate databases, how do I do this? Thanks


title: Facebook like button that redirects?

text: Basically, here is an idea: I am starting a daily blog, and in order to gain access to sunday's posts, the user needs to share the site. I have figured out how to redirect once someone presses the +1 button, and how to redirect once someone tweets, but I have yet to figure out how to redirect after a facebook like. If anyone can help with this, I'll be very thankful. For the record, I plan on doing this as whitehat-edly as possible. Basically, the post will say that I'm trying to gain popularity for the site, that I could really use some shares, I'll point out that they get six posts a week without asking for anything, and I'll tell them that I'm fine with them deleting the post if they really don't want to share it. One other thing, I don't really care if they post it on facebook or not. Like, the code doesn't need to check their facebook page to make sure it worked. I just want it so that when they click the button, it posts, and redirects them. The page won't be hidden, if someone had the direct URL they could get to it without sharing. I just want it to be simple, as I'm an amateur, but I also want to use this to get more traffic and a more engaged audience. Thanks in advance, Liam


title: Disable comments on all posts/pages

text: Is there a quick way to disable all comments on all posts and pages. I know that you can go into the dashboard under posts, click edit, and Do Not Allow, under comments. Is that the only way?


title: non-clickable placeholder in the menu

text: well, I really would like one & more of my top-level menu items (parent menu items that has child menu items) to be non-clickable, so that visitors can only click on the child menu items...could be very nice for a horizontally positioned menu. any plugin out there that can do the trick (or trick or hack or....)?


title: What is a good jQuery content slider plugin?

text: I'm looking for a plugin that will let me easily place a jQuery based (because I want to avoid the hassle of multiple javascript libraries) slider on my site in various places. I'd like it to be able to handle images as well as html. I'm aware of the Featured Content Gallery plugin, but I would like to find an alternative (partly because of this tweet by Brad Williams, whose opinion I trust). Ideally, I'd like something that can automatically create a 'slideshow' based on categories, tags, recent posts, etc., but that can also let me manually create a 'slideshow' with whatever post, image, or other content I want to use. Edit: I'm looking for a WordPress plugin, not just a jQuery plugin.


title: How do I insert CSS into a function?

text: I have a custom function which allows users to choose between next/previous links and pagination and I'm attempting to add CSS classes to the next/previous links. I've tried this multiple ways and keep crashing my theme. How do I insert CSS classes into the previous and next link?               // Pagination     function my_theme_navigation()      {          global $shortname;              if( get_option( $shortname . '_next_prev_or_paginate' ) == 'Next' ) :              // the block for next-prev navigation              previous_posts_link ('Newer');             next_posts_link('Older');         else :              // the block for pagination             global $wp_query;              $big = 999999999; // need an unlikely integer                    echo paginate_links(                  array(                      'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),                      'format' => '?paged=%#%',                      'current' => max( 1, get_query_var('paged') ),                      'total' => $wp_query->max_num_pages                  )              );          endif;      }      For an example, check the bottom of this page: http://themeforward.com/demo2/


title: How remove Wordpress Impression from my website

text: I am developing one wordpress theme for client. I completed the theme. But he is asking about remove the wordpress theme impression. Here impression means when i try to see view page source i am able to see like wp-content like that. I need to remove that. Is it possible to hide this url.?


title: How can I obscure the fact my site uses WordPress?

text: Is there anything I can do to prevent somebody from knowing my site is using WordPress by looking at the source code of the front page and trying to access the login page? I am referring to people who scan sites using software that detects the software used to run the website to be able to attack it using any known weak point. If it is not possible to completely hide the fact that the site is using WordPress, is it at least possible to confuse them?


title: Linking between custom post types as if they where taxonomies?

text: Let's say we create an IMDB like website. So (for example) we can have two types of custom post types:   * movies   * actors We would like to see in each movie page all of it's actors. And in each actors page all of the movies he played in. Can this cross linking be done using custom post types? If not, is it expected to be possible in the future? If not, is there an alternative (in WP) for doing this? Thanks


title: Upgrading WordPress and Plugins; any Tips to Avoid Trouble?

text: Going to upgrade WordPress 2.7.1 to 3.0.1 along with all plugins, any tips to do without trouble? **Edit: 7 September** Dashboard is showing "New version available" for both, WordPress version and for some plugins. So i want to upgrade everything. then what should be upgraded first, WordPress or plugins? And which update would be best for both automatic through dashboard or manually through FTP


title: Comma seperated list of ID's as an array?

text: I have the following code that prints a comma separated list which I need in the form of an array, how do I get the list of id's into an array called $excluded_categories with contents as per below?               $categories = get_categories(array('taxonomy'=>'projects_category', 'exclude'=>7, 'orderby'=>'id'));     if ( !empty( $categories ) ) :     foreach($categories as $term){         echo $term->term_id.', '; // prints: 1,2,3,4,5,6,8,9,         }     endif;          $excluded_categories would be an array containing: 1,2,3,4,5,6,8,9


title: Code to determine WP version check

text: I'm unable to devine what's causing my theme to crash in WP 2.9.2, although I know its something in my query statement below, so I need to do a version check for (version) < 3 to branch it. What is the method to get the currently installed WP version? - I'm just using "wp_version" as a stand in :)               if(wp_version < 3)         $myqueryTopMenu = '';     else         $myqueryTopMenu = new WP_Query();$myqueryTopMenu->query(array('cat' => "$cat,-$catHidden",'post_not_in' => get_option('sticky_posts')));


title: How to fix pagination after rewriting url? ie. www.site.com/players/type/pro/page/3/

text: I have a custom post type of `players`, and archive-players.php lists them all at an address such as `www.site.com/players`. I'm then using a url like `www.site.com/players?type=pro` to list another page of just the pro players (modified wp_query based on custom user role, hence why I don't just do this with a taxonomy). I decided I should rewrite the url so it's `www.site.com/players/pro`. The page itself works fine, but my question is: how can I now fix the pagination when the url is something like `www.site.com/players/type/pro/page/3/`? at the moment I'm getting page not found. I'm using wp page-navi for the pagination. In fact, pagination doesn't work when I have it as just `?type=pro` either. The code I have for the rewrite is below. Is it better to rewrite using wordpress or mod_rewrite? I have no experience with either. Am I going about this the right way? I've read some other questions and posts all over the place, but the whole thing just confuses me.               function add_query_vars($aVars) {     $aVars[] = "type";     return $aVars;     }          add_filter('query_vars', 'add_query_vars');          function add_rewrite_rules($aRules) {     $aNewRules = array('players/type/([^/]+)/?$' => 'index.php?post_type=players&type=$matches[1]');     $aRules = $aNewRules + $aRules;     return $aRules;     }          add_filter('rewrite_rules_array', 'add_rewrite_rules');


title: Permanent names of attached files required

text: Simple: How to delete uploaded file ? Secondary: How to replace uploaded file and to keep its filename (inclusive the path) and all links (inclusive on the whole internet!!!) the same?


title: How do I get a single page navigation depending on the previous page?

text: I figured this would be a fairly comon thing. But I can't seem to find out how to do it. Or I'm just not using the correct search terms. I've got a website with a hompage that lists all my posts, and 3 menu items that each list a category. When I click on a post via a category, then I want the next|prev navigation to stay in that category. When I click on a post via the homepage, I want the next|prev navigation to be chronolonical. This is de navigation code which is in my single.php `<?php next_post_link('%link', '< Previous ', FALSE); ?> <?php previous_post_link('%link', '| Next >', FALSE); ?>` This is the correct setupt for navigating there from the homepage, but not when I get there via a category. Please help, I've been banging my head on this for hours now! Kind regards.


title: Want image captions to be from img ALT tags not title tags

text: Okay,here's my challenge. My client doesn't like how when you roll over an image in the gallery a tooltip shows up with the image's descritpion, which is taken from it's title tag. But he still wants the image description to show up as the caption when you click on the image and enlarge it. Here is a link to a page in the site, if you roll over the first image in the gallery, you'll see what I'm talking about and hopefully it'll make sense. http://mbigelowphotographer.com/wp/engagements I've tried to find ways on hiding browser default tooltips but I've had no luck. So I thought of placing the image's description in the images alt tag instead of the title tag. Which is fine, I took care of that in the gallery.php file. But now I can't figure out where in the shutter-reloaded.js, for the image caption to pull the alt tag instead of the title tag. I'm hoping its a simple solution that I'm just overlooking since I am only vaguely familiar with javascript. Or maybe I'm way off and it's not in that js file. Any help would be appreciated. Thanks in advance. I am sure I'm being vague in my description here, don't hesitate to ask for more details. http://wordpress.org/extend/plugins/nextgen-gallery/


title: $_GET & $post_ID

text: I got a set of meta boxes containing different form fields. All of them are build inside a set of classes. Now I have the problem that I have to hook the construction of the fields early enough to hook the needed scripts & styles. Everything is fine - I can display them, styles & scripts appear & work, saving the data works - but I can't retrieve the post meta data to fill the values of the fields. Point is that the fields get hooked at `admin_menu`, which is too early to get the `$post_id`. Now I saw that I could also use `$_GET['post']` to retrieve the ID. What speaks against this?


title: Having trouble generating pagination links on custom query

text:
I'm using a custom query on a page after the initial loop to list some posts from a category I'm associating with that page. Im doing this:                   query_posts(array(            'category_name' => $name,            'orderby' => 'date',            'order' => 'DESC',            'posts_per_page' => 1,            'paged' => $paged));      I've also tried using `get_query_var('paged')` in place of $paged btw. then I do my loop and it shows the correct number of posts, 1. I actually am getting links generating on the page if I use `previous_posts_link()` or `next_posts_link()`, however, if I use `echo paginate_links()` after or even in my loop, no links are generated and where as I have 2 posts in that category currently so I expect to see at least a link to page 2. It seems like there is a lot of info out there about passing the correct info to query_posts for this instance but not what function to use to actually render the pagination links so i'd appreciate any insight. Thanks. Edit:(full code)
     <?php          if (have_posts()) : while (have_posts()) : the_post(); ?>              <article class="post" id="post-<?php the_ID(); ?>">
<?php the_title(); ?>
             <?php //include (TEMPLATEPATH . '/_/inc/meta.php' ); ?>
                 <?php the_content(); ?>                 <?php //wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
             <?php edit_post_link('Edit this entry.', '
', '
'); ?>
         <?php endwhile; endif;              $name = '';         if(isset($pagename))         {             $name = $pagename;         }         if($name == '5a' || $name == '4a' || $name == '3a' || $name == '2a')         {             echo '
';             query_posts(array('category_name' => $name, 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => 1, 'paged' => $paged));                  if (have_posts()):                 while (have_posts()):                     the_post(); ?>                               <article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
                     <?php include (TEMPLATEPATH . '/_/inc/meta.php' ); ?>
                         <?php echo substr(strip_tags(get_the_content()), 0, 280).'...';?>                         <a class="quick_link" href="<? the_permalink()?>">(read more...)

                 <?                 endwhile;                 echo paginate_links();                 ?>
<?php previous_posts_link('« Previous') ?>

<?php next_posts_link('More »') ?>
                 <?             endif;             echo '
';              }         ?>


title: Gravatar Size Via Theme Functions?

text: Currently, to call comments I am simply using:               <?php wp_list_comments(); ?>      in comments.php. This is calling up gravatars, which I would like to be able to set the size of. How can I set the size of gravatars in my comments.


title: Filter RSS feed for custom post type to events for next 7 days only

text: I'm trying to create a custom RSS feed that shows posts from the custom post type 'events' for the next 7 days ahead only. The feed is already sorted by event start date order rather than published date through the plugin, I just can't figure out how (as a beginner in PHP!) how to limit the feed to only the 7 days ahead. This is the query I have so far, which works fine until I try to filter the feed against a date and then it returns no posts :-( Any pointers much appreciated!               date = date("d-m-Y");     $date = strtotime($date);     $date = strtotime("+7 day", $date);          $args = array(         'post_type' => 'event',         'showposts' => 10,         'meta_key' => 'st_date',         'meta_type' => 'date',         'value' => $date,         'compare' => '<'         );          query_posts($args);


title: Widget on the right side of the page overlaps with the left side

text: I added the mailchimp widget to the right column of my blog. But for some reason, it overlaps with the main content of the blog. Here is a screenshot of what happens![enter image description here](http://i.stack.imgur.com/USPoR.png) Would anyone know why this happens and how to stop it from happening? Thank you!


title: NextGen Gallery Slideshow Positioning Issue

text: I have been having an issue with the non-flash version of the NextGen Slideshow on my website. The slideshow seems to initially load the first slide about 5px below the desired position. The slide then moves up about a second or 2 later into the correct position. I have tried putting the slideshow in other widget areas and all result in the same positioning error. The page in question in here: www.ukjiayuan.com So far have been unable to get any support, but would really appreciate it if anyone can reccomend a solution. Many Thanks


title: Taxonomy Parent Name

text: Was just wondering how I would modify this piece of code:               <?php     $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );     echo $term->parent;     ?>      ...to display the parent name, rather than just an integer? Currently it returns the ID. Thanks.


title: Is it usual to have a non-Feedburner feed on a WordPress blog?

text: Is it usual or beneficial to have a non-feedburner feed on the site? At the moment I have only a feedburner feed. My blog is WordPress with a custom template. Which of these links would I use to create a Feed?: > http://blog.wordfruit.com/?feed=rss > > http://blog.wordfruit.com/?feed=rss2 > > http://blog.wordfruit.com/?feed=rdf > > http://blog.wordfruit.com/?feed=atom Or would it be one of these (for when using custom permalinks)?: > http://blog.wordfruit.com/feed/ > > http://blog.wordfruit.com/feed/rss/ > > http://blog.wordfruit.com/feed/rss2/ > > http://blog.wordfruit.com/feed/rdf/ > > http://blog.wordfruit.com/feed/atom/ Or a different link? Also, how do I create the Feed -- with the use of a plugin?


title: How do I turn off the Admin Bar for all Subscribers?

text: Maybe this is a stupid question. When a user logins to my Wordpress site with the Subscriber role, they have the WP Admin Bar appearing at the top of the page. The user can go into their dashboard and turn this off themselves. But how can I turn this off by default for all existing and new users?


title: Include text in echoed hyperlink

text: I´d like to include an extra two words into an echoed hyperlink. I have no PHP knowledge so far. Could anyone put me in the right direction?               <p class="excerpt"><strong> Bekijk meer van <?php echo get_the_term_list ( $post->ID, 'store' , '' )   ?>      It gives Bekijk meer van **storename**. I want it to show something like Bekijk meer van **extra1 storename extra 2**.


title: Odd page behaviour after removing sidebar

text: One of my web pages is displaying odd behaviour, after selecting a no sidebar template for the page. The sidebar has disappeared, but elements within the sidebar, now show in the bottom right-hand corner of the page Here is the PHP for the no sidebar template.               <?php     /*     Template Name: Page without sidebar     */     ?>          <?php     global $inove_nosidebar;     $inove_nosidebar = true;     include('page.php');     ?>      Here is a link to a image of the how the page looks at present. http://www.thedash.org.uk/wp-content/uploads/2013/03/Sidebar.jpg Any ideas or suggestions would be greatly appreciated. Thanks.


title: Twenty Eleven theme, how to change style to a specific "format"

text: My question is: it is possible to change the background color (for exemple) to an article who is categorized under "quote" format. (or whatever format like Aside or Link)? I want that an article in Quote format appears different from others, with a specific font color, or specific background color. Is that possible? The theme is Twenty Eleven Thank you!


title: Connect LDAP with Wordpress-Login

text: I have a wordpress-page where i offer webapps, mostly for free. Now, I want to connect this page with my LDAP-directoy from my first page. I tried several Plug-Ins but they did not work, yet. I am a bit sceptical how it should work with this plugins, but however, i gave it a try. I need this LDAP connect for the former costumers, so that it is still saved, which app they already downloaded and how the rated it. Furthermore i want to replace the rating by the wordpress comments, so that the page is even more based on wordpress. Now i am wondering what to do next. Has is more sense to build a special front-end-login for the users, so that wordpress itself does not connect with LDAP or is there any plugin that delivers this servers? Or should i try to connect LDAP and wordpress by myself?


title: What is the right way to code links for Wordpress pages?

text: this is really a two part question, neither of which I can find the direct answer to. (1) What's the correct way to link assets like buttons or include files like JS? Currently, the src attr for things like this is set to:               src="<?php bloginfo('template_url'); ?>/path/to/my/file.xxx"      Is that correct for deploying my site to production? In other words, it shouldn't really matter if it's www.mysite.com or www.mysite.dev because the PHP snippet will render to whatever the site URL is, right?. Currently it's in a staging environment with that top-level (but fake) .dev domain. (2) For navigation and other text links, is it okay that I use relative paths in the href attr? Is there a reason I should use absolute paths instead? Is there a SEO reason? I ask because right now my development URL (as mentioned above) is www.mysite.dev, so if I use absolute paths, I will have to go through and change each one to .com before deploying to production, which I don't want to do. Note: In case you're wondering, I am using DesktopServer from ServerPress as my Wordpress dev environment.


title: if/else on custom query gives 200 OK when condition not met?

text: **What?** I am modifying my theme to show comments of a post on a separate page. **How?** Mostly based on this answer but with improved checks and code. So this is what my page-comments.php (kinda) looks like: **(The code is very easy to scan through, trust me!)**               <?php get_header(); ?>          <?php         /*          * (Example URL: example.com/comments/?original_post=ID)          *          * Check if HTTP variable (original_post) exists in queried URL,          * AND that it is set to some value (ID), AND that the value (ID) is a number.          */         if( array_key_exists( 'original_post', $_GET ) && isset( $_GET['original_post'] ) && ctype_digit( $_GET['original_post'] ) ) {                  $query_original_post = new WP_Query( array(                 'posts_per_page' => 1,                 'p'              => $_GET['original_post'],                 'post_type'      => 'any',             ) );                  if( $query_original_post->have_posts() ) {                      while ( $query_original_post->have_posts() ) : $query_original_post->the_post();                          // [...]                      endwhile;                 wp_reset_postdata();                  } else {                      /*                  * Return 404 error if there are no posts                  */                 global $wp_query;                 $wp_query->set_404();                 status_header( 404 );                 nocache_headers();                 get_template_part( '404', 'archive' );                 //exit();                  }              } else {                  /*              * Return 404 error if the HTTP variable (original_post) doesn't              * exist in queried URL, OR it isn't set to any value (ID),              * OR the value (ID) isn't a number.              */             global $wp_query;             $wp_query->set_404();             status_header( 404 );             nocache_headers();             get_template_part( '404', 'archive' );             //exit();              }     ?>          <?php get_footer(); ?>      _(The code I use to return a 404 error is based onthese two solutions.)_ As you can see I am doing two checks in the code ( **at least that's what I intended to do** ):   1. Check if HTTP variable (original_post) exists in queried URL, AND that it is set to some value (ID), AND that the value (ID) is a number. OTHERWISE, return a 404 error with appropriate headers.   2. Check if the custom WordPress query (`$query_original_post`) has any results to loop over. OTHERWISE, return a 404 error with appropriate headers. **Problem:**   1. Is that the right way to do it? (or at least, can it be any simpler?)   2. _(If yes to #1)_ It appears to work, but returns 200 OK header when I go to an URL like: `example.com/comments/?original_post=NUMBER`, where NUMBER is any positive integer over 4 digits long (e.g. 14532). I don't understand the relation. Why'd something like ``example.com/comments/?original_post=14532` return 200 OK header when I am logged-into WordPress, and 404 error (which it should) when I am not?


title: Display MP3 as media using an URL from a custom field

text: I created custom field and placed this inside the loop:               <?php echo get_post_meta($post->ID, 'ses', true); ?>      But now the link is all text. I would like it to be like my theme does when I use this shortcode:               [media url="http://www.example.com/songname.mp3"]


title: random reason on refresh

text: I am editing the sidebar widgets and have added one for users who are not logged in or registered. the widget requests that users register or login and I am wanting to add a random reason (quote) as to why they should join which will change after every reload of the page. I have chosen to use the "text" in the site which does not seem to load any of the JavaScript codes that I enter. It obviously does not read them. does anyone know of how I can do this? If i'm using the wrong widget type then which one will read and display the JavaScript code? or is there a none JavaScript way of doing this? thank you. Site link: PLEASE CLICK HERE


title: Why is querying posts messing up my pages?

text: I am working on a theme at the moment and I have set up a post template. This post template is linked to some custom post types. When I query_posts for my post type on the actual post template itself it makes the content disappear for some reason? Is there something I am missing here? Thanks, Mark My loop is as follows:               <?php         $query = 'posts_per_page=10&post_type=articles';         $queryObject = new WP_Query($query);              // The Loop...         if ($queryObject->have_posts()) {             while ($queryObject->have_posts()) {                 $queryObject->the_post(); the_title(); the_content();             }         }     ?>


title: FYI: How to make Time.ly all-in-one event calendar mobile friendly

text: This is much more of an **FYI/How-to** than a question. I just wanted to share something cool with everyone. Enjoy! Time.ly puts out a great WordPress Events Calendar plugin with free and pro versions. However, seeing as how the default calendar view is "month" for a lot of people _and_ that "month" on mobile looks terrible, I wrote up a little blurb of my experience with the calendar and mobile devices on my website. I walk through the process of creating an "if ... then" statement of sorts to determine if a visitor is on a mobile device or not; depending on the device, the agenda view or the month view will be displayed! Hope this helps someone! In the answers section below is the walkthrough from my write up. * * * **//edit:** if someone would create the following tags on this post, that'd be great, thanks!               <timely> <all-in-one-events-cal>


title: Returning an image url from its attachment ID using a custom post type plugin

text: I'm using a custom post type plugin that returns an uploaded file's attachment ID instead of its url. I've been able to get the image to display using wp_get_attachment_image_src as outlined in the codex here http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src but my problem is getting it to play nicely with the code on the template page used to call the information from the custom post type set up using the [WCK Custom Fields Creator][1] plugin. Stripping it down to the basics, this is what calls the custom post type info from the template page:               <?php          $slideshowplatform = get_post_meta($post->ID, 'slideshowplatform', true);         foreach($slideshowplatform as $slide) {             echo '';         }     ?>      I'm having difficulty reconciling this with what the codex provides:               <?php          $attachment_id = 8; // attachment ID         $image_attributes = wp_get_attachment_image_src( $attachment_id ); // returns an array     ?>          <img src="<?php echo $image_attributes[0]; ?>">      It seems like something like the following should work, but I'm obviously missing something with the php syntax               <?php          $slideshowplatform = get_post_meta($post->ID, 'slideshowplatform', true);         foreach($slideshowplatform as $slide) {             $image_attributes = wp_get_attachment_image_src( $slide['slide'] );             echo '<img src="<?php echo $image_attributes[0]; ?>" />';         }      ?>      Any thoughts would be appreciated, thanks.


title: Way to show content of a post, but if exceeds character limit revert to excerpt?

text:
So I am working on a site for a client of mine. We have about 50+ posts filed in a category called "Articles". I created a custom page template that has a custom query to display all the posts in a bullet list on this page, and if you click on it you can go directly to the post to read more or open a PDF directly. Where I am hitting a road block is we have 2 specific articles that are more then just PDF's, they are about 3-6 paragraphs instead. SO I wanted to know if it is possible to display all the posts in the list like I am now, and if it exceeds around 100 characters then revert to the excerpt we made for those posts specifically. Currently my code looks like this:                               <?php                 //for each child of category 16 (articles), show title of posts                 $cat_args=array('child_of' => 16, 'orderby' => 'name', 'order' => 'DESC');                 $categories=get_categories($cat_args);                   foreach($categories as $category) {                     $args=array('showposts' => -1, 'category__in' => array($category->term_id), 'caller_get_posts'=>1);                     $posts=get_posts($args);                       if ($posts) {                         echo '
term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'
 ';                         foreach($posts as $post) {                           setup_postdata($post); ?>

<?php echo get_the_content(); ?>

                           <?php                         } // foreach($posts                       } // if ($posts                     } // foreach($categories                 ?>      Thank you! Been pulling my hair out for days on this one.


title: post_password_required() not recognizing cookie set with correct password

text:
Using the below code:               <?php if ( post_password_required() ) { ?>         <form method="post" action="/wp-pass.php">
This content is password protected. To view it please enter your password below:
             <input type="password" style="margin:10px 0;" size="20" id="pwbox-<?php the_ID(); ?>" name="post_password"/>
             <input type="submit" value="Submit" name="Submit"/>
         </form>     <?php } else { ?>         // echo out all of the post content     <?php } ?>      worked to hide specific content behind the Wordpress password protected functionality. However, this has stopped working. The cookie is still being set and I can see it in the browser settings, but the function has stopped recognizing that the correct cookie is present and just reloads the page asking for the password again. I don't use this functionality a lot, so it's hard to say wehen it stopped working exactly, but it could be related to upgrading Wordpress to the most recent release. Would that make sense? **UPDATE** : Here's the exact cookie content:               Name:   wp-postpass_xxxxxxxxxxxxxxxxxxxxx     Content:    secret     Domain: www.domain.com     Path:   /     Send for:   Any kind of connection     Accessible to script:   Yes     Created:    Monday, June 25, 2012 11:55:26 AM     Expires:    Thursday, July 5, 2012 11:55:25 AM      As you can see, the cookie contains the correct password content but the function has stopped recognizing this as being correct or valid. **UPDATE #2** Removed the testing URL now that the solution has been posted.


title: Show multiple tax_query from 2 or more post_type in a single code

text: i've been trying with no success to show 2 custom taxonomies from 2 post_type, here's my code:               <?php                     /**                      * Display a list of the most recent news in 'Avisos'                      *                      */                     $avisos_query = new WP_Query( array(                         'post_type' => array('noticia','comunicado'),                         'posts_per_page' => 5,                         'tax_query' => array(                             'relation' => 'AND',                             array(                                 'taxonomy' => 'clasificacion',                                 'field' => 'slug',                                 'terms' => 'avisos'                             ),                             array(                                 'taxonomy' => 'anos',                                 'field' => 'slug',                                 'terms' => '2011'                             )                         )                     ) );                     // Display the custom loop                     if ( $avisos_query->have_posts() ):                  ?>      I've been searching around here and WP but nothing. Thank you!


title: Checking url from plugin

text: I'm trying to change the login url from wp-login.php to simply 'login'. I'd been looking through another plugins source to find ways of doing it. Some of the applicable parts that I've got so far:               register_activation_hook( __FILE__, 'my_plugin_activate' );     register_deactivation_hook( __FILE__, 'my_plugin_deactivate' );          add_action( 'init', 'my_plugin_rewrite' );     add_action( 'login_init', 'my_plugin_login_init' );     add_action( 'template_redirect', 'my_plugin_display' );          function my_plugin_activate() {         add_rewrite_tag( '%login%', '([^/]+)');         add_permastruct( 'login', '/%login%' );         flush_rewrite_rules();     }          function my_plugin_login_init() {         if ( '/wp-login.php' == $_SERVER['PHP_SELF'] ) {             header( 'HTTP/1.0 404 Not Found' );             global $wp_query;             $wp_query->set_404();             require TEMPLATEPATH . '/404.php';             exit;         }     }          function my_plugin_display() {         global $wp_query;         switch( $wp_query->query_vars['pagename'] ) {             case 'login' :                 include( ABSPATH . '/wp-login.php' );                 exit;                 break;         }     }      The problem I'm having is in the "my_plugin_display" function. `$wp_query->query_vars['pagename']` happens to be empty. How can I test if the url is at `/login`? Is this the right hook to use?


title: Tough Custom query: archive page with custom meta_value_num

text: I trying to add parameters to the query string of an archive page. So I verified that the following method works: `query_posts($query_string . '&order=ASC&meta_key=mykey&orderby=meta_value_num')` My problem is thus: My meta-value as-is can't be sorted properly; it first has to be altered via the php substr() function. But that breaks the query. Any ideas how to get this done? I've seen solutions posted where the database is queried directly, but aside from that obviously not being ideal, I also couldn't figure out how to page that. Any help would be immensely appreciated :)


title: Avoiding "headers already sent" in Wordpress

text: I've created quite a few custom websites but I've come across this problem with various addons/plugins or just general code. How can I avoid the "headers already sent" error? I've tried to put the code as far up in the header.php file as possible but have never managed to get around the error. Is there an easier way to avoid it? My latest bit of code that's getting the error is using the html2pdf script. It always happens in the header.php file, I've removed all extra spaces etc and made sure it's unicode-8 etc but just cannot get rid of the problem in the header.php file.


title: Admin Bar below footer as unstyled list of links

text: My admin bar is showing at the bottom as an unstyled list of links, you can see it on http://advocaateindhoven.net I'm using WP version 3.2.1. Already tried deactivating every plugin to see if something changed but it didn't. Does anyone know what the problem is? Help appreciated!


title: Custom Post Type Template Insert not working properply

text: I am trying to insert Custom Template file through the plugin that handle a custom post type. Rest of the plugin working great except the template including part.               class ClassName{              public function __construct() {             add_action( 'template_redirect', array( $this, 'uniThemeRedirect') );         }                   public function uniThemeRedirect(){                  global $wp_query;             global $wp;                  // Specific Custom Post Type             if( $wp->query_vars["post_type"] == "videos" ){                 $templateFilename = "single-videos.php";                      if( file_exists( TEMPLATEPATH . '/' . $templateFilename ) ){                     $return_template = TEMPLATEPATH . '/' . $templateFilename;                 }                 else {                     $return_template = UNISLIDER_TEMPLATES . $templateFilename;                 }                      $this->doThemeRedirect( $return_template );             } else {                 echo 'not working';             }              }                   public function doThemeRedirect( $template_url ){             global $post, $wp_query;             if( have_posts() ){                 echo $template_url;                 require_once ( $template_url );             }             else{                 $wp_query->is_404 = true;             }              }          }          $handle = new ClassName();      I am following this http://stackoverflow.com/questions/4647604/wp-use-file-in- plugin-directory-as-custom-page-template#answer-4975004 example. But when i visit on the http://www.domain.com/videos where videos is my custom post type. i get the 'not working' means no template include.   **Can anyone please help me what wrong i have done??** **UPDATE: This is how i register the Custom Post Type**               $labels = array(                  'name'=>__('UniVideos', 'unislider'),                   'singular_name'=>__( 'Videos', 'unislider' ),                   'add_new'=>__( 'Add New', 'unislider' ),                   'add_new_item'=>__( 'Add New Video' ),                   'edit_item'=>__('Edit Video'),                   'new_item'=>__('New Video'),                   'view_item'=>__('View Videos Images'),                   'search_item'=>__('Search Slide'),                   'not_found'=>__('Noting Found'),                   'not_found_in_trash'=>__('Nothing found in Trash'),                   'parent_item_colon'=>''              );                   $args = array(                  'labels'=>$labels,                   'public'=>true,                   'has_archive'=>true,                   'publicly_queryable'=>true,                   'show_ui'=>true,                   'query_var'=>true,                   'menu_icon'=>'',                   'rewrite'=>true,                   'capability_type'=>'post',                   'hierarchical'=>false,                   'menu_position'=>NULL,                   'supports'=>array( 'title' )              );                   register_post_type( 'videos', $args );


title: Display PHP within HTML values

text: What is the correct way to display a value in a link using php? The (Advanced Custom Fields) php works correctly outside of the html.               Book on Expedia.com <a class="alignright" href="<?php the_field( 'expedia' ); ?>" target="_blank" ><input class="resume_contact_button" type="button" value="<?php the_field( 'low_rate' ); ?>">


title: How to change the gravatar image from front end?

text: How can user change the own gravatar image from front end? for the back-end there are lot of plugins (like user photo etc.), by which user can easily change the gravatar image?


title: Plot location on Google map using full address specified in custom field

text: Is there an easy way to plot a location on a Google map using an address specified in a custom field? For example, if a post has the following address specified; 1600 Pennsylvania Avenue, NW Washington, DC 20500 A Google map will automatically be displayed on the page with with a marker on this exact location? Surely it can't be that difficult. I've looked at the API but nothing sprung out at me


title: why the archive of custom taxonomy term shows nothing?

text:
I have a custom post type for which I have created a custom taxonomy called 'tag'. `taxonomy-tag.php` file looks like this:               <?php get_header(); ?>          <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
<?php echo $term->name; ?> Archives
                <?php if (have_posts()) : ?>             <?php while (have_posts()) : the_post(); ?>
                        <a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>">                     <?php the_title(); ?>
                  <?php endwhile; ?>           <?php endif; ?>               <?php get_footer(); ?>      When this code is executed, it displays only things outside the loop. The loop find no result even if I have many posts of the specific custom post type bind to many terms of the custom taxonomy. Have you faced such issue? I am stuck and your help is highly invaluable.


title: Plugin settings checkbox

text: I am creating catagory checkbox select. My code to render the category checkbox is:               // CHECKBOX - Name: plugin_options[chkbox2]     function setting_chk2_fn() {              $options = get_option('plugin_options');         $categories = get_categories('orderby=name');           $wp_cats = array();                foreach( $categories as $category_list ) {               $wp_cats[$category_list->cat_ID] = $category_list->cat_name;           }                foreach( $wp_cats as $v ) {             echo "<input type='checkbox' name='plugin_options[chkbox2]' value='{$options['chkbox2']}' />";             echo $v;             echo '<br>';         }     }      All catagories are rendered properly but it is not saving in database. Thanks for reading


title: Wordpress custom taxonomy

text:
I'm using a custom taxonomy called 'product_cat' and post type called 'product', I'm trying to display all parent terms, child terms and grandchild terms within the taxonomy. So I get a list like this, But I only want the grandchild terms to be displayed if I'm on the child page.               Courses (parent)     - Industry (child)     -- Industry One (grandchild)     -- Industry Two (grandchild)     -- Industry Three( grandchild)     - Trade (child)     -- Trade One (grandchild)     -- Trade Two (grandchild)     -- Trade Three (grandchild)          Essential Packages (parent)     - Construction (child)     -- Construction One (grandchild)     -- Construction Two (grandchild)     -- Construction Three (grandchild)      I'm currently using this snippet to try and help me but its not working the way I'm wanting it to.               <?php         $taxonomyName = "product_cat";            $parent_terms = get_terms($taxonomyName, array('include' =>'67', 'orderby' => 'slug', 'hide_empty' => false));            echo '
';             foreach ($parent_terms as $pterm) {                 echo '
';                     echo ''.$pterm->name.''; // Child                      $terms = get_terms($taxonomyName, array( 'child_of' =>'67', 'orderby' => 'slug', 'hide_empty' => false));                     echo '
';                         foreach ($terms as $term) {                             echo '
name, $taxonomyName ) . '">'.$term->name.''.$term->count.'
';  // GrandChild                         }                     echo '
';                  echo '
';              }         echo '
';     ?>      If anyone could help me out and point me into the right direction I'd really appreciate all the help.


title: Display an icon based on post type

text: I have a defined set of seven different post types and would like to display an icon for each one in the search results list. I've got the following code to display the post type but have no idea how to extend it into an if               <?php $post_type = get_post_type_object( get_post_type($post) );     echo $post_type->label ; ?>      Any help appreciated.


title: is_home() returns true while it shouldn't

text: I have a problem with `is_home()`. It is placed in my `footer.php` and it returns `true` when it shouldn't. I have a page template on which I perform a query with `query_posts()`. When I pass the following as the argument,               array( 'cat' => $lekarz_page_cat_id, 'paged' => get_query_var('paged') )      it returns `false` which is ok, but when the argument is               array('post__in' => $pz_posts, 'paged' => get_query_var('paged'))      it returns `true` when it shouldn't. Can someone tell me why this is so?


title: How can I alter the visible menu according to which level I am on

text: I want to be able to alter what is visible in the menu according to which level in the site structure I am on, for example on top level page:- Home Level 1 page (Current) -Level 2 page               -Level 2 page          -Level 2 page      Level 1 page Level 1 page Level 1 page etc on level 2 page: Home Level 1 page (Current page parent)               -Level 2page (Current)               -- Level 3 page (child of current)               -- Level 3 page (child of current)               -- Level 3 page (child of current)          -Level 2page          -Level 2page          -Level 2page      on level 3 page Level 1 page               -Level 2page (parent)              --Level 3 page (current)      Is this possible and how do I do it? Many thanks


title: theme or plugin or server is outputting html before the init hook fires, how is it possible to prevent this

text: I have a plugin that detects the useragent of a request made during the init hook and if it matches my desired value, I set a flag so that my own xml content is sent during the found_posts filter instead of the html that the theme sends. the problem is that on a few rare sites, the theme is sending some of it's content before my plugin can send it's own which causes the the external site that is calling to have an xml error because there is non xml code before the bit my plugin sends. I've tried installing the theme to my local server but the problem doesn't happen there, everything is ticketyboo! so I can only imagine that it is something to do with the server that the site is hosted on. It only seems to happen when someone has set their theme to use a custom homepage. What could be causing this? I can show what happens if I use the useragent switcher plugin for firefox and set it to use a new useragent of "Commentluv" and visit http://willtaft.com which shows the xml error . viewing the source of the page shows that my plugin didn't send it's content until most of the theme content had already been output if I view http://willtaft.com/blog/ using the firefox set to send the 'Commentluv' useragent then everything is working as it should and I can see the xml my plugin sends. This is driving me crazy! I can't replicate the problem on any of my sites, it only happens on a very few sites and then, only with sites using a custom home page. I've even tried using an output buffer at the init stage if it detects that the Commentluv useragent is requesting the page and clearing it before my plugin sends the xml but even that wont work on the problem sites. I'd love to hear any suggestions


title: Query to import data from one MultiSite table to another (pages/sub-pages)

text: I'm updating a standard install with about 500 (eek!!) pages to a MultiSite for easier sub-site management. I basically want to take a sub-page and its children from the root site and copy the data to a new/fresh MultiSite-site. The WordPress import/export option doesn't work for this so I've had to do it using a MySQL query but I'm completely stumped? The source table is 'wp_posts' destination is 'wp_2_posts', any ideas?


title: How-to show last 5 posts

text: How-to show last 5 posts that are published after current post? Explained on image below: IMAGE FOR EXPLAINE


title: Retrieve post info within AJAX helper function

text: I have a button within a post which a user can click. Once clicked, an AJAX call is made. My question is, within my PHP AJAX helper function (located in my theme's function.php) how can I retrieve, for instance, the ID of the post that the request was sent from. I can get the ID from the markup and pass it in the AJAX call but it seems messy, i.e.               <article id="post-12">     <!-- article content -->     </article>               // JS     var postID = $("article").attr("id");      Is there a better way? Some kind of global that is accessible perhaps?


title: Problem Keeping Permalink Structure

text: I have just set up my WP blog on heroku and have one minor problem. I have set the permalink structure in Settings to be postname (/%postname%/). Whenever I come back to the blog after a while I get an error for root.com/blog and all other simple pages I have set up. Going back and hit on save in the permalink settings, gets the links back to work again. So something is not saving these settings right. Instead of postname, it uses the default settings which is probably something like ?p=123 What can I do? Is there a way I could force these settings through a function or similar? Thanks for all the suggestions. Appreciate it.


title: What are the Best Practises When Using AJAX in Plugin Development?

text: I am in the middle of creating a plugin and everything works fine with the AJAX calls but one question I can't seem to find the answer to is about best practise. I route the AJAX calls through `/wp-admin/admin-ajax.php` and have my php functions in the theme `functions.php` script. However, I've just thought that this doesn't seem such a good idea because what do you do when the user activates your plugin, do you need to create a function to write your code to functions.php on activation? Similarly, what if the user changes theme? Therefore, I was just wondering if there are other ways to do it or what is the common approach for this type of thing.


title: How can I add "posted by 'author'" to each post?

text: With a multi-user blog, how can I add a _posted by Some Author_ line, or something similar, at the top of each post, as in this blog? I assumed this should be something very basic, and there should be a setting for it, but I can't seem to find it anywhere.


title: What is the best way to make a custom page from a plugin?

text: After hours seeking through the WordPress sources it I was unable to find ANY reasonable method of creating a front end page from a plugin. My goal was simple, I wanted http://mysite.com/friends to show a page generated by my plugin. This is a multi-site installation and I do not want blog owners to be able to eliminate this page. My final implementation doesn't involve users blogs but it could. wp-includes/theme.php: I added this function               function get_extension_page_template() {         $page = get_queried_object();         $templates = array($page->ID.'.php');         return get_query_template($page->ID,$templates);     }      wp-includes/template-loader.php: I added this just ofter the if(is_404() line(near line 8)               elseif ( is_extension_page() && $template = get_extension_page_template()) :      wp-includes/query.php: I added two functions               function set_extension_page($page,$object) {         global $wp_query;         return $wp_query->set_extension_page($page,$object);     }          function is_extension_page() {       global $wp_query;         return $wp_query->is_extension_page();     }      wp-includes/query.php: I added two properties to the WP_Query class               var $extension_page = null;     var $extension_page_object = null;      wp-includes/query.php: I added two methods to the WP_Query class                 function set_extension_page($page,$object) {           $this->extension_page_object = $object;           $this->extension_page = $page;       }       function is_extension_page() {          return isset($this->extension_page);       }      wp-includes/query.php: I changed the get_queried_object method in the WP_Query class               function get_queried_object() {             if ( isset($this->queried_object) )                 return $this->queried_object;              if (isset($this->extension_page_object)) {             return $this->extension_page_object;         }             $this->queried_object = NULL;             $this->queried_object_id = 0;                  if ( $this->is_category || $this->is_tag || $this->is_tax ) {                 $tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' );                      $query = reset( $tax_query_in_and );                      if ( 'term_id' == $query['field'] )                     $term = get_term( reset( $query['terms'] ), $query['taxonomy'] );                 else                     $term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );                      if ( $term && ! is_wp_error($term) )  {                     $this->queried_object = $term;                     $this->queried_object_id = (int) $term->term_id;                          if ( $this->is_category )                         _make_cat_compat( $this->queried_object );                 }             } elseif ( $this->is_post_type_archive ) {                 $this->queried_object = get_post_type_object( $this->get('post_type') );             } elseif ( $this->is_posts_page ) {                 $page_for_posts = get_option('page_for_posts');                 $this->queried_object = & get_page( $page_for_posts );                 $this->queried_object_id = (int) $this->queried_object->ID;             } elseif ( $this->is_singular && !is_null($this->post) ) {                 $this->queried_object = $this->post;                 $this->queried_object_id = (int) $this->post->ID;             } elseif ( $this->is_author ) {                 $this->queried_object_id = (int) $this->get('author');                 $this->queried_object = get_userdata( $this->queried_object_id );             }                  return $this->queried_object;         }      wp-includes/class-wp.php: I changed the handle_404 method to the following               function handle_404() {             global $wp_query;                  if ( !is_admin() && ( 0 == count( $wp_query->posts ) ) && !is_404() && !is_robots() && !is_search() && !is_home() ) {                 // Don't 404 for these queries if they matched an object.                 if ( ( is_extension_page() || is_tag() || is_category() || is_tax() || is_author() || is_post_type_archive() ) && $wp_query->get_queried_object() && !is_paged() ) {                     if ( !is_404() )                         status_header( 200 );                     return;                 }                      $wp_query->set_404();                 status_header( 404 );                 nocache_headers();             } elseif ( !is_404() ) {                 status_header( 200 );             }         }      The final result is that I can create an object in plugins on patched sites and test for certain conditions, such as $blogpage = $this->ID and then call set_extension_page($this->ID,$this); to register the page to be displayed. The theme must also have a template setup for that plugin which is named (first parameter of set_extension_page).php but its better than nothing. I admit this is just an ugly hack, but it works. It would be nice to see a feature like this added to wordpress in the future.


title: How to upload multiple files/images when developing a wordpress plugin?

text: I decided to learn how to develop wordpress plugins and I am totally confused and frustrated. I've already read some good tutorials and I guess I am already familiar with the basics. Now, I want to start developing my first plugin and I decided to start with a javascript image slider. At this stage I know how to set up an admin page with all the settings I need (e.g. slider name, slider themes, which transitions to use, which pagination type etc..). I also know how to create a custom type for my slider, how to register scripts and styles, how to generate shortcodes and template tags etc.. What I am confused is how to go on with adding the images itself. I have seen some of the existing plugins but none seems to follow a common solution for this. In some one has to upload each image individually (the image being the post type itself), others use the wp file uploader but only one image can get uploaded at a time etc.. The one I like the most is Nivo Slider, which adds the meta_box_upload with the plupload multiple file uploader script. My question is, which options do I have here? Also, I can't seem to find any good tuts on this either (maybe cause of my lack of experience?). Any hints would be much appreciated. Thanks!


title: Circumventing the normal image upload process

text:
I have a page that I would like to work on little techniques and then show them off. I built a scrolling banner that uses images and then scrolls them in order. I have successfully built this with static HTML but I have never done so in Wordpress. I have uploaded the images to my MAMP server and I call them in their respective s. It all works except the images don't load. Also, while troubleshooting I loaded an image by itself on the same page and it did not display either. How can I load images in for an individual page? Techicnally, they aren't to be used outside of that page. Hmm. -Josh                   <?php         /*              Template Name: scrolling headers                   */              get_header(); ?>

                        <?php get_footer(); ?>


title: Creating a Dynamic Path to wp-blog-header.php

text: Created a class in an external script which is dependent on the Wordpress environment. Since it's a class I intend to use on various projects, I decided to dynamically create a path to wp-blog-header.php and here's what I came up with. It currently works for me, but I need to ensure that its foolproof.               $docRoot = $_SERVER['DOCUMENT_ROOT'];     $scriptName = $_SERVER['SCRIPT_NAME'];     $queryArray = explode("/", $scriptName);     $queryLength = count($queryArray);          require_once($docRoot . ($queryLength > 2 ? "/".$queryArray[$queryLength - 2] : "" ) . '/wp-blog-header.php');      Does anyone have a better solution or is this good enough to rely on, regardless of script location or WP installation setup?


title: Advice on setting up private site

text: I've developed a wordpress site which is only to be made available to around 30 people, whose email addresses I have in a spreadsheet. I want to allow these people to be able to register/login and then set their own password. What would be the best process for going about this? Thank you for any answers!


title: How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?

text: I have the following problem developing a WordPress theme and I am here to ask you if this solution could be a good solution or if exist some better way to do. I have a custom WP theme and into this theme there is a main menu. The website is multilanguage (italian and english) so I have to load the Italian main menu (contains the menu item in Italian language) if the visitor is italian and the main menu have to been loaded in the English version if the user is not italian. So I have found this solution: In the WP backend I create 2 different menus: **Menu 1** and **Menu 2** (the first one having voices in Italian language and the second one in English language) Then inside my theme (into the **header.php** file) I declare something like it:   1. First I detect the user language tacking it from **$_SERVER['HTTP_ACCEPT_LANGUAGE']**   2. Then, I use this value to show Menu 1 if the **$lang** value is **it* or * _Menu 2 if the *_ $lang** value is **en** Something like this:               <?php          $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);         //echo "Language is $lang";  IT SEEMS TO WORK: MY LANGUAGE IS CORRECTLY RECOGNIZED AS it              if($lang == it){      // If the user is Italian load Italian menu                  wp_nav_menu(array(             'menu' => 'Menu 1',              'theme_location' => 'primary',              'depth' => 2,             'container' => 'div',              /*'container_class' => 'navbar navbar-default',*/             'menu_class' => 'nav navbar-nav',              'fallback_cb' => 'wp_bootstrap_navwalker::fallback',              'walker' => new wp_bootstrap_navwalker())         );          }          else{            // If the user is not italian load English menu             wp_nav_menu(array(             'menu' => 'Menu 2',              'theme_location' => 'primary',              'depth' => 2,             'container' => 'div',              /*'container_class' => 'navbar navbar-default',*/             'menu_class' => 'nav navbar-nav',              'fallback_cb' => 'wp_bootstrap_navwalker::fallback',              'walker' => new wp_bootstrap_navwalker())         );          }     ?>      I think that in this way have to correctly work (I have to try) but, is it a good solution or could I do better in some other way?


title: Loss of sharpness in jpg imported as header in twentyeleven

text: When importing a jpg into the header position (jpg created in indesign at 1000 px wide) for the twentyeleven theme, the photos are not sharp. what is causing this and how do I fix it?


title: Importing 10 Years of Media into the WP Database

text: I've been running the same website for 10 years now, and whenever I would create a news story, I would manually upload and store all my news images in a "news" folder via FTP and then manually write the HTML to call up each of those images (yes, it was always a pain). Each month has a folder within that news folder named MMYY (0613, for example). Well, now I want to actually use Wordpress's upload and insert features instead of doing everything manually. And with help from this wonderful website, someone was able to help me set Wordpress to upload all future images into the folder structure I've had for the past 10 years (/news/0613 instead of Wordpress's default wp- content/uploads/2013/06). But now my problem is this: if I want to use all the other images and media stored in those 10 years of folders whenever I make a new news story, how do I pull them all into Wordpress? I could just insert the images manually by looking up their URLs, or insert them into Wordpress through the same way, but it would be nice to actually have them all stored in WP's database for easy look-up and inserting, all while using the existing files themselves in their stored locations (which, as I mentioned before, is now in the same folder structure that WP will be using to upload future images). I've looked everywhere and cannot find how to do this though or how to even approach something like this. I've looked through dozens of plugins as well. So I'm not sure if I'm using the correct terminology when I'm searching for my solution. Does anyone know what I can do or have tips for how I would even go about approaching this? Thank you! :)


title: Use wp_nav_menu to dynamically generate child menus

text: The goal: use wordpress's wp_nav_menu to generate a menu where child pages were dynamically added while keeping the correct submenu classes. **Before:**   1. Installations   2. Habits **After:**   1. Installations      * Roof     * Garden   2. Habits Basically, I have a wp_nav_menu set up to show some pages (i.e. "Installations" & "Habits"). Either of those pages could have several child pages associated with them and I wanted my navigation to dynamically add those child pages into the menu, without using wp_list_pages. In my case, the nav was pulling from a custom post type ("actions"), but this can be customized.


title: Infinite Scroll plug in on Ebuy theme

text: So Ebuy does not support infinite scroll, and my coding knowledge is minimal. I'm looking for some guidance as to how i can manually get in there and make infinite scroll work. Ive already got the plug in activated, but i am unsure as to what to put in the content selector, nav selector, next selector, item selector, and call back fields. http://soballer.com/product/accessories/ thats what it looks like now. it shows 10 items, then you have to click on "older entries". if anyone could help me set this up, id appreciate it! thanks


title: Use get_terms to get post_tags but limit to a taxonomy

text:
So I'd like to get the top 5 post_tags by count. But I have an additional taxonomy that I use to further organize posts called Issue. So I want to be able to get the top 5 post tags used by posts in a certain taxonomy. I can currently get the top 5 posts tags by count system wide thats not a problem.               $taxonomies = array(          'post_tag'     );          $args = array(         'orderby'       => 'count',          'order'         => 'DESC',         'hide_empty'    => true,          'exclude'       => array(),          'exclude_tree'  => array(),          'include'       => array(),         'number'        => '5',          'fields'        => 'all',          'slug'          => '',          'parent'         => '',         'hierarchical'  => true,          'child_of'      => 0,          'get'           => '',          'name__like'    => '',         'pad_counts'    => false,          'offset'        => '',          'search'        => '',          'cache_domain'  => 'core'     );          $terms = get_terms ($taxonomies, $args);          $count = count($terms); $i=0;     if ($count > 0) {         $cape_list = '
';         foreach ($terms as $term) {             $i++;             $term_list .= 'slug . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '">' . $term->name . '';             if ($count != $i) $term_list .= ' · '; else $term_list .= '
';         }         echo $term_list;     }      Thats the easy part. Any ideas on how to limit this to posts that are inside a specific taxonomy?


title: Unable To Login With Correct Credentials?

text: Me and my users can't login even using the correct credentials. We type in the correct username and password but then this error message comes up (it's been coming up for a while now, but I usually just ignore it press the backspace and I'm logged in): > Catchable fatal error: Object of class WP_User could not be converted to > string in /hermes/bosoraweb097/b2086/ipg.mysite.com1/wp-content/plugins/wp- > customer-reviews/wp-customer-reviews.php on line 241 Does anyone know why this is happening and how I can get back into my account?


title: Test if a Category contains certain Custom Post Types

text: I have several Custom Post Types and several Categories. Within my `pre_get_posts` hook (in `functions.php`), I'm changing the chronological order for very specific Custom Post Type archive pages.               function get_custom_posts( $query ) {         if ( ! is_admin() && $query->is_main_query() && empty($query->query_vars['suppress_filters']) ) {              if ( ($query->get('order') == '') && (in_array($query->get('post_type'), array( 'books', 'foo' ))) ) {                 $query->set('order','ASC');  // ascending order             }             if ( is_home() ) {                 return $query->set( 'post_type', array( 'post', 'books', 'foo', 'bar' ) );             } else if ( is_search() ) {                 return $query->set( 'post_type', array( 'post', 'page', 'books', 'foo', 'bar' ) );             } else if ( is_category() ) {                 return $query->set( 'post_type', array( 'post', 'books', 'foo', 'bar' ) );             }            }      }            add_action( 'pre_get_posts', 'get_custom_posts' );        * I am developing a child theme of Twenty Thirteen.   * For Category archives, it's properly using the parent template, `category.php`.   * For Custom Post Type archives, it's properly using custom templates in the child theme, `archive-books.php`, `archive-foo.php`, etc. **Questions/Issues:** 1) My code is working for the Custom Post Type archive pages... they load in ascending order like I want. However, I also need ascending chronological order on Category archive pages, but **_only if_** they contain one or more posts from my specified Custom Post Types. How can I do this? I'd only like to call out the Custom Post Types in my code... I prefer not to call out specific Categories as these may occasionally change, and these category archives may contain posts from multiple Post Types. 2) When I reverse the chronological order, as in my code above, the default pagination is labeled incorrectly. i.e., the oldest post is on the top of the first page and when I scroll to the bottom, the link is labeled `"Older posts"` but this link really takes you to the newer posts. When chronology is changed, I was expecting the pagination to automatically follow; did I miss something simple in my code?


title: Empty excerpt using wp_get_recent_posts

text:
I have this simple shortcode to display the last posts with it's title and except:               add_shortcode('latest3', function(){         $recent_posts = wp_get_recent_posts(                 array(                     'numberposts'   => 3,                     'orderby'       => 'post_date',                     'order'         => 'DESC',                     'post_type'     => 'post',                     'post_status'   => 'publish'                 ), ARRAY_A);              $output = '
Latest posts
';         foreach ( $recent_posts as $recent ) {             $output .= '
'.$recent["post_title"].'
';             $output .= $recent["post_excerpt"];         }         return $output;     });      But for some reason the excerpt output is empty. `print_r($recents)` shows that there is indeed an array key called `post_excerpt` but is shown always empty.


title: List users except current user using wp_dropdown_user?

text: I am creating a plugin where I need to select other users except me(current user who is logged in).               $user_id = get_current_user_id();          wp_dropdown_users(array(         'name' => 'user',         'exclude' => '$user_id,1',         'show' => 'user_login'     ));      is not providing required result. How to overcome this issue?