title: How to reset canonical URLs / fix redirect loop

text: Couldn't find anything in the related questions, so here goes: I have a post which, when viewed on the site, is returning a redirect loop. The error page is showing an address for the post that originated when the post was added to a category that was subsequently deleted. www.macrowikinomics.com/innovation-communities/business-economics/will- facebook-be-your-crm-provider is the correct address, but it keeps redirecting to www.macrowikinomics.com/innovation-communities/guest-authors/will-facebook- be-your-crm-provider/. Guest-authors was the old category obviously. My thought was it might be the automatic canonical URL redirect feature. Despite adding the disable canonical url function (src = Mark Jaquith) it continues to redirect to this old address. Cleared the cache and cookies and still it goes. Tried it in another browser and I continue to get the error. There is also no cache plugin running on the site. Could it be something in the pretty permalinks? They're using the format /%category%/%postname%/ Many thanks for any thoughts you can provide.


title: Cache busting CSS files other than style.css

text: All right, so we're probably all familiar with the typical way to ensure that your main CSS file is refreshed when you load the page (busting the browser cache), right?               <link rel="stylesheet" type="text/css" media="all"       href="<?php echo get_stylesheet_uri();         echo '?'.filemtime( get_stylesheet_directory() . '/style.css'); ?>" />      I need to do the same thing on another CSS file. Yes, my style.css file has its own set of @import "css/myFile.css" which are working fine, but humor me, if you will. So, back to header.php, right after that first link, and before the call to wp_head():               <?php $cssFile = get_stylesheet_directory_uri().'/css/other.css'; ?>     <link rel="stylesheet" type="text/css" media="all"       href="<?php echo $cssFile; echo '?'.filemtime($cssFile); ?>" />      And this leads to a warning (as part of the href attribute of the link when the browser gets the page): > Warning: filemtime(): stat failed for http://localhost/wordpress/wp- > content/themes/my_theme/css/other.css the path to the file seems to be built correctly (and the other.css file is there), but filemtime (stat, actually) fails on it. How come? Other recommended ways to include the 'latest' version of a CSS file other than style.css? Should I go with wp_register_style instead? If so... how can I tell wp_register_style to bust the browser cache (ie: get me the latest version of the css file, even if the browser has it cached)? Thanks in advance


title: Pull Latest Forum Posts within WordPress

text: Hopefully this is the easiest question ever asked. I have a WordPress site with BBP installed. I want to be able to pull the latest BBP posts in a php query I can use throughout the site. What is easiest way of doing this? Any help would be greatly appreciated.


title: Disable Ajax for Spiders

text: We have a site on wpegnine that gets about 20k visits a day and heavily depends on ajax for our inbound marketing strategy (lead/visitor processing). These ajax calls are killing our server performance. I believe that a good way to alleviate our problem is to disable all AJAX calls to wp-admin for spiders. They don't need to see our dynamic calls to action and we don't need any visitor tracking on these spiders. How do we setup our robots.txt, or even better, code in a solution that will keep spiders from using these resources?


title: Need to change contact email depending where user is from

text: I work for a company that has multiple sites, but one of them has all of the content. I am using Contact-Form-7 for the little contact forms at the bottom of the page, but what I need is for them to send to different emails depending on which branch of the company they are affiliating with. My main issue is people who wish to contact our Columbian office use the same contact form, because our Columbian website just auto-redirects to the main site. Is there a way to detect if the user got redirected from the Columbian site, before sending the email? Comment if I am unclear. My ideas were to have the home page contain a widget that would make a cookie with the contents of `$_SERVER['HTTP_REFERER']`, and then make a plugin that would contain a shortcode to look at the cookie and thus change the contact form. Is this the way to go about this?


title: Page as a child of a Custom Post Type

text: I have a custom post type called "Professions", it contains different professions and info about them. To show them I simply use a `content- profession.php` -file. The thing is that I need subpages (childs) to those professions that contains info like salary, terms, where to find jobs, etc. They cannot be of the same type as the CPT Professions since that post type have a very specific layout. Is there any way to get a normal page as a child of a custom post type? This was previously discussed here: Page as child in custom post type slug? but with the solution of rewriting URLs which feels like a very "hacky" solution to the problem.


title: Changing username after registration to get around the issue of having duplicate emails?

text: I want to change username and email after a user has been created and sent an email. This is because I want!! (yes, you read correctly) to have duplicates in my database. In normal situations this is not a good option but this I just to have to at the moment.               //Workaround-Set registered unix-timestamp before each new user-login and user-email when saving new users      //so we can use duplicate usernames and emails     function save_user_fields($user_id) {         global $wpdb;         $wpdb->query(                  $wpdb->prepare(                          "                         UPDATE $wpdb->users                          SET user_email=CONCAT('registered-%s',user_email),user_login=CONCAT('registered-%s',user_login),                          WHERE ID = %s AND user_login LIKE 'VT2014%' AND user_email NOT LIKE 'registered%'                          LIMIT 1                          ",                         time(), time(),$wpdb->insert_id                 )         );     }     add_action('user_register', 'save_user_fields'); //When adding new users      I want them to be changed AFTER they have been saved and after an email- confrimation mail has been sent to actual type-in-mail by user. With above code Wordpress says that there are already an email adress in the database and stops there... ...and that is actuall what you want in most cases I've also tried this:               function changeusername($user_id) {         global $wpdb;         $wpdb->query(                  $wpdb->prepare(                          "                         UPDATE $wpdb->users                          SET user_email=CONCAT('registered-%s',user_email),user_login=CONCAT('registered-%s',user_login),                          WHERE ID = %s AND user_login LIKE 'VT2014%' AND user_email NOT LIKE 'registered%'                          LIMIT 1                          ",                         time(), time(),$wpdb->insert_id                 )         );     }         add_action('register_post', 'changeusername'); //Just before saving new user to database      _I want new users be changed AFTER they have been saved and after an email- confrimation mail has been sent to actual typed-in-mail by user._ **How could I solve that?**


title: Why can't I add a custom image in my navigation?

text:
Trying to add a navigation Home icon Failing to work. **Here's my nav:**
<?php _e( 'Menu', 'twentytwelve' ); ?>
             <a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?>             <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>               I've tried adding: `<img src="/home.png"/>` to the second line, still no success. **I have tried:** `<img src="http://fullpathtoimage/home.png" /><h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3>` Thanks


title: Change Permalink of attachment page

text: How to change permalink of attachment page. Current: domain.com/post-url/attachment-url/ What I want : domain.com/attachment-url/ Also, How to redirect old pages with new slug.


title: Calculate the sum of certain the_sub_fields

text: I am trying to calculate the sum total from two custom sub-fields using ACF. The custom field is called 'repeater' and the sub-field is called 'space_avail'. I've tried the code below but it just lists the numbers individually rather than adding them up to a total. Please help.               <?php        $total = 0;       while(the_repeater_field('repeater' )):            the_sub_field('space_avail' );           $total += get_sub_field('space_avail' );       endwhile;        echo $total;     ?>


title: How to avoid the <div> and <ul> which added when custon menu widget is used

text:
I need to remove the custom menu widget

      from appearing above the `<li>`. Because of this two lines my menus are not appearing correctly as I given. I need to display the `<li>` menu list just after `<ul class="my_custom_class">` but now the above lines are appearing in between the my_custom class and `<li>` list. If my explanation is not clear please forgive me & ask me for any further clarifications. source code:               register_sidebar(array(         'name' => 'Top Menu',         'id' => 'topmenu-sidebar',         'description' => 'Appears as the sidebar on the all pages',         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
',         ));      output:

....
      i need the output like below:[how i remove that div and ul. this is my issue]

....
      **the above question is resolved.**


title: Add column in WP user but it goes wrong

text: I add a column to users page, it goes wrong when checkbox is not in correct position. This is my code, can you help me to move checkbox to the correct position?               public static function user_register_columns( $columns ) {         // create a new array with account just after username, then everything else         $new_columns = array();         if ( isset($columns['username']) ) {             $new_columns['username'] = $columns['username'];             unset($columns['username']);         }         $new_columns['account'] = self::__( 'Account' );         $new_columns = array_merge($new_columns, $columns);         return $new_columns;     }     public static function user_column_display( $empty='', $column_name, $id ) {         $account = WP_ABC_Account::get_instance( $id );              if ( !$account )             return; // return for that temp post              switch ( $column_name ) {         case 'account':             $account_id = $account->get_ID();             $user_id = $account->get_user_id_for_account( $account_id );             $user = get_userdata( $user_id );             $get_name = $account->get_name();             $name = ( strlen( $get_name ) <= 1  ) ? '' : $get_name;                  //Build row actions             $actions = array(                 'edit'    => sprintf( ''.self::__( 'Manage' ).'', $account_id ),                 'payments'    => sprintf( ''.self::__( 'Payments' ).'', $account_id ),                 'gifts'    => sprintf( ''.self::__( 'Gifts').'', $account_id )             );                  //Return the title contents             return sprintf( self::__( '%1$s (account id:%2$s) (user id:%3$s)%4$s' ),                 $name,                 $account_id,                 $user_id,                 WP_List_Table::row_actions( $actions )             );             break;              default:             // code...             break;         }     }      Result look like this, checkbox is not in correct position. It must always on left. ![enter image description here](http://i.stack.imgur.com/Rphwp.png) Thank you


title: Get a raw value of excerpt

text: I am trying to print the post excerpt using the following code:               <?php echo $post->post_excerpt;  ?>       It works fantastic the only problem is that apparently I get also predefined styles and I cannot get rid of them. How can I get the raw text - is there a different function or maybe there is a php function that returns text only?


title: Custom post types problem

text: I have in my blog around 2k+ posts in 15 categories and around 1k tags. The problem now is that the website I bought the theme from decided to upgrade/update their themes infrastructure and now I need to export my normal posts into a custom post type. Ill explain below. To be able to use their portofolio grid template they have created a custom post type called portofolio and all posts created with that custom post type will be displayed in a portofolio grid style. Before the upgrade this was different, once you added a post category you could select the template you wanted to use for that category, but now they decided to create custom post type called "portofolio" and all posts in there will be displayed in the grid portofolio template. They turned around and said to me that i must start from square one since there is no way to export normal posts into the new custom post type. So what are my chances guys? The theme is called videogrid by themefuse


title: Is the 404 page automatically displayed if a loop returns nothing?

text: If you have an `index.php` with a loop such as:               if(have_posts()){         while(have_posts()){             the_post();         }     }      And nothing is returned, you would generally do a:               if(have_posts()){         while(have_posts()){             the_post();         }     }else{         //display message     }      However, what if you have a `404.php`? Will that page be displayed if nothing is returned in terms of the loop (assuming I have not written the else part of the loop)?


title: Getting img src from thumbnail_id using javascript

text: I'm using the JSON API and Multiple Featured Images plugins to try and display an image within a Google Map marker. The Multiple Featured Image plugin only stores the Thumbnail ID which I then retrieve from a JSON feed. Unfortunately I can't find a way of getting the image src from just the Thumbnail ID using javascript. The closest I can get is www.example.com/p=338 but this is of course just the dedicated webpage for displaying images and all I want is the img src. Is their an easy way to do this?


title: Add filter to blogroll widget

text: I'm trying to add `<i class="icon-ok"></i>` before the content inside the `<li>` of the blogroll widget. I'm assuming that's done through the link_title filter, but I can't find a suitable explanation as to how. Any thoughts?


title: How to define template directory in this widget code

text:
How can I define the template directory (So I can reference and image in the 'images' folder) from within this php widget code?               // WIDGET CODE GOES HERE     query_posts('posts_per_page=1&post_type=testimonial&orderby=rand');     if (have_posts()) :      echo "
";     while (have_posts()) : the_post();         the_post_thumbnail('widget-test-thumb');         echo "
\"";         $excerpt = get_the_excerpt();                 // IMAGE WOULD GO HERE         echo string_limit_words($excerpt,15);         echo "\"
";         echo "
".get_the_title()."
";     endwhile;     echo "
";     endif;      wp_reset_query();


title: Custom loop won't work, can't find problem

text:
I can't figure out why this custom loop isn't displaying for me:. I've tried removing the if statement and removing certain query parameters but it just won't display. If I delete the loop entirely the page displays the layout, so I know it's the loop itself, I just can't find the problem. Anyone with a sharp eye notice what I've done wrong?                   <?php /* Start the Loop */ ?>          <?php          query_posts(array(              'post_type' => 'events',             'showposts' => 10 ,             'meta_key' => 'event_datestart',             'orderby' => 'meta_value' ,             'order' => 'ASC' ,         ) );       ?>     <?php while (have_posts()) : the_post(); ?>              <?php          $raweventstart = get_field('event_datestart');         $raweventend = get_field('event_dateend');              $eventstart = strtotime("$raweventstart");         $eventend = strtotime ("$raweventend");         $now = strtotime("now");               //Check if event is in the future or past.              if ($eventstart >= $now) {     ?>

                                 <?php echo $raweventstart; ?>

                                 <?php if (get_field ('venue_name') ) { the_field('venue_name'); } ?>

                                 <?php if (get_field ('venue_address') ) { the_field('venue_address'); } ?>

                                 <?php if (get_field ('venue_phone') ) { the_field('venue_phone'); } ?>

                                 <?php if (get_field ('venue_website') ) { ?><a href="<?php echo get_field('venue_website'); } ?>">Venue Website

                                 <?php if (get_field ('event_description') ) { the_field('event_description'); } ?>

                 <?php } //end check to see if event is in the past?>     <?php endwhile;?>     <?php wp_reset_query(); ?>


title: Switch Theme Through Options Panel

text: Is it possible to allow users when logged in to switch the entire theme through a theme options panel? I don't want users to use the standard wordpress way, but instead just an option in their panel. Any ideas? EDIT: This is for a user on their own network site.


title: BuddyPress redirecting to home page on login

text: I have two sites (towermix.com and beta.towermix.com) running BuddyPress and both are doing the same thing. When a site admin (or contributor or author) logs in using the WordPress login page, they are redirected to the home page instead of Dashboard. I don't have any direction plugins on these sites.      How do I make it stop doing this?      I've tried the following:   * Deactivating plugins one-at-a-time and logging in afterwards. No change until I deactivated BuddyPress.   * Searched BuddyPress documentation and code - couldn't find any redirect code sending the user to the home page (unless the BP user account is being deleted)   * Replaced BuddyPress install with files downloaded from BP site - no change   * Replaced WordPress install with files downloaded from WP site - no change


title: get_posts multiple criterias

text: Hi I'm trying to get only posts from a certain category, but also all other posts that have a certain field value. for example: all posts in the "News" category. but also all posts marked as featured (custom field). I realize that this is wrong, but I'm not sure how to go about it...                   $args = array(             'numberposts' => 3,             'meta_query' => array(                                   'relation' => 'OR',                                   array(                                   'key' => 'post_featured',                                   'value' => '1',                                   ),                                   'category_name' => 'news' //this shouldn't belong here                 ));      the custom fields work, but I can't also pull up any posts in the news category. Thank you! **UPDATE** This is how I did it. if you have any better ways of doing it please share.                   <?php                   //first query             $blogposts = get_posts(array(                 'category_name' => 'news', //first taxonomy                 'post_status' => 'publish',                 'numberposts' => 3,                 ));                  //second query             $authorposts = get_posts(array(                 'numberposts' => 3,                 'meta_query' => array(                     'relation' => 'OR',                      array('key' => 'post_featured','value' => '1')                      )                 )             );             $mergedposts = array_merge( $blogposts, $authorposts ); //combine queries             $postids = array();             foreach( $mergedposts as $item ) {                 postids[]=$item->ID; //create a new query only of the post ids             }             $uniqueposts = array_unique($postids); //remove duplicate post ids             $posts = get_posts(array(                             'post__in' => $uniqueposts, //new query of only the unique post ids on the merged queries from above                             'post_status' => 'publish',                             'numberposts' => 3,                              ));         ?>


title: PHP editing Custom Login page plugin

text:
First post! I've got an issue I can't fix, being a designer rather than programmer. Hopefully someone can help. I'm using an old plugin for custom login pages: http://wordpress.org/extend/plugins/custom-login-pages/ I've edited it before to do a bespoke message through WP with Smart Blocks of text. The only problem is I can get a unique message for WP Login pages for the Login and Register pages but not for the Lost Password page. This is the bit of code I'm tweaking but the Lost Password page shows all three smart blocks of text. How can I modify this to only show the one I want?               echo '
'."\n";     if (isset($_GET['action']) && $_GET['action'] != 'login')                     echo do_shortcode('[smartblock id=883]');"\n";                 if (get_option('users_can_register') && $_GET['action'] !=     'register')                 echo  do_shortcode('[smartblock id=881]');"\n";                 if (get_option('users_can_register') && $_GET['action'] !=    'lost_password')                 echo  do_shortcode('[smartblock id=3669]');"\n";     echo '
'."\n";     }      The full code is rather long but can be downloaded from WP in the above link - the bit above is line 150ish. Thanks, Nicko.


title: NextGEN Gallery: Adding drop-down menu widget to gallery view without modifying plugin code

text: In NextGEN Gallery, I am able to add a dropdown menu that lets users filter a gallery to only show images that are tagged with a specific ngg_tag, simply by adding this to view/gallery.php in the NextGEN Gallery code:               the_widget('Taxonomy_Drill_Down_Widget', array(         'title' => '',         'mode' => 'dropdowns',         'taxonomies' => array( 'ngg_tag')     ));      However I want to be able to achieve this without modifying any of the the actual NextGEN gallery code. Adding this in my functions.php:                           add_action('ngg_render_template' , 'add_dropdown_widget' );                      function add_dropdown_widget(){                 the_widget('Taxonomy_Drill_Down_Widget', array(                         'title' => '',                         'mode' => 'dropdowns',                         'taxonomies' => array( 'ngg_tag')                 ));                 }      Almost gets me there but it renders the dropdown above the gallery itself. I actually want the dropdown to appear below the title of the gallery, but at that point the gallery has already started rendering.


title: Disable h1 and h2 from rich text editor combobox

text: In the Wordpress control panel, when writing a new post, I would like to disable the Header 1 and Header 2 from the text formatting combobox, because I already use them on my theme (h1 for blog name and h2 for post titles), and would like to keep all headers inside a post with h3 or higher. Is that possible? It doesn't matter for the case if the code can be edited in the HTML view. Also, I don't want to edit Wordpress internal files, so a hack for functions.php or a plugin would be great for this task, in order to preserve this change across future updates. Thank you!


title: Add update services on theme activation

text: I want add update services when I activate my theme, how to do this ? with an hook like enable_update_services_configuration ? Thanks in advance


title: How to localize built-in strings in a future-proof manner?

text: I need to amend the labels for name and email fields in the comments form in my localized (Czech) Wordpress this way:               Emailová adresa    =>  Email     Webová stránka     =>  Web      What I did is that I've opened `wp-content\languages\cs_CZ.po` in poEdit, located the strings and compiled the new version of `cs_CZ.mo`. It worked well. However, I imagine that when a new version of Wordpress comes out and the localization team releases new version of localization files, my changes will be overwritten, right? So the question is, **how to change the localized strings in a future-proof way**? I was thinking that maybe the comments mechanism provides some hooks to replace these two labels so I could create *.po and *.mo files in my theme directory but that doesn't seem to be generally applicable. What would be better would be to create a file like `cs_CZ-custom.mo` which would be able to override values already defined in the main language file but I'm not sure WordPress supports that. Any suggestions?


title: Upload media error: unable to create directory (windows hosting)

text: Trying to upload any kind of media on a new WP install is failing due to a messed up media folder path: > Unable to create directory D:\webs\bucmio\wp/wp-content/uploads. Is its > parent directory writable by the server? The reason why it's not working is obvious, but how can I correct it? I'm guessing I need to get the full path in the `Settings > Media` but how to find it? The host is Cbeyond.


title: What is the best way to customise admin files so they survive future upgrades?

text: I have a site with some custom post types, one of which doesn't have a title. When viewed in the admin section, the posts are listed like so ![](http://i.imgur.com/FgIy8.png) Which is less than ideal, for obvious reasons. I have edited one of the admin files `wp-admin/includes/class-wp-posts-list- table.php` to display the list as below ![](http://i.imgur.com/z0lT7.png) The problem is the customisation is overwritten by upgrades. What is the correct way to make customisations to the admin files so they survive upgrades?


title: Search: Only One Result Returned

text: I've nearly finished a blog that I'm working on but the search feature isn't working quite correctly. Searches that should return more than one result only return one. I guess I'm not really sure where to look to solve this issue as I'm not very experienced with Wordpress. The site is WP version 3.3.1 and uses search.php The template is a modified version of Wordfinder. Any tips or suggestions would be greatly appreciated.


title: wp_dropdown_categories in custom post type with custom taxonomy

text:
I have a custom post type with its own taxonomy, basically 'show venues' is the post type and venue-regions is the taxonomy. Seeing how a venue cant exsist in mutiple regions, I've removed the default metta box and added my own as a dropdown using `wp_dropdown_categories()`. The taxonomy items are being output and appear as I'd like them, BUT they are not being submitted and the dropdown list dosen't hold the selection after submit. I've tried as far as I am able to look at the various attributes of the origional metabox and tried to apply these to the drop down but so far I've not had any joy. I've looked at some the various posts on WPSE and havent been able to sus out where I'm going wrong. Can anyone elaborate as to what my next steps should be/what parts Im missing?               <?php     // remove the default taxononomy     add_action( 'admin_menu', 'tr_remove_meta_box');       function tr_remove_meta_box(){          remove_meta_box('venue-regiondiv', 'venue', 'normal');       }           //Add new taxonomy meta box        add_action( 'add_meta_boxes', 'tr_add_meta_box');             function tr_add_meta_box() {            add_meta_box( 'venue-region-dropdowndiv', 'What region is this venue in?','tr_venuesTaxonomydropdown_metabox','venue' ,'side','core');        }            //Callback to set up the metabox     function tr_venuesTaxonomydropdown_metabox( $post ) {         $taxonomy = 'venue-region';              //The name of the form           $name = 'tax_input[' . $taxonomy . '][]';           $id = $taxonomy.'dropdown';         //Get current and popular terms         $postterms = get_the_terms( $post->ID,$taxonomy );         $current = ($postterms ? array_pop($postterms) : false);         $current = ($current ? $current->term_id : 0);         ?>              <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">                          <div id="<?php echo $taxonomy; ?>-all" class="tabs-panel">                 <?php $args = array(                         'show_option_all'    => 'Choose a region',                         'show_option_none'   => '',                         'orderby'            => 'ID',                          'order'              => 'ASC',                         'show_count'         => 0,                         'hide_empty'         => 0,                          'child_of'           => 0,                         'exclude'            => '',                         'echo'               => 1,                         'selected'           => 1,                         'hierarchical'       => 1,                          'name'               => $name,                         'id'                 => $id,                         'class'              => 'form-no-clear',                         'depth'              => 0,                         'tab_index'          => 0,                         'taxonomy'           => $taxonomy,                         'hide_if_empty'      => true                 ); ?>                    <?php wp_dropdown_categories($args); ?>

         <?php     }


title: Which of WordPress's .php files need to be directly accessible via HTTP?

text: I'm trying to tighten up security on my WordPress installation, and one of the things that seems like it might be a good idea is preventing all of the internal-use .php files from being accessed directly via HTTP. For instance, `http://MYSITE/blog/xmlrpc.php` needs to remain directly accessible, but there's no reason why `http://MYSITE/blog/wp-load.php` shouldn't give a 404. The question is: Where do I get a _complete_ list of stock Wordpress .php files that can legitimately appear in URLs? Also, I use mod_rewrite to remove the top-level `index.php` from all my published URLs -- does that mean I can block direct use of `http://MYSITE/blog/index.php?whatever`?


title: Hook to main query with filters based on custom fields

text: I would like to do a filter that will hook to the main query and filter all the posts by some given taxonomy terms or custom fields. For now I have made the custom filters for the $query to only select the posts that have a custom value for certain taxonomy as follows:               foreach($data as $taxonomy => $terms):         $query->set($taxonomy,$terms);     endforeach;      and this solves it. But for example, I am having the following issue: I don't see how to provide instead of a taxonomy field, a custom field that has the value in a range; For example price is between 500-1000; where price is a custom field. I have tried anything I could and searched a lot on the codex but I can't figure it out.


title: Custom taxonomies making WP very slow - Way to fix?

text: I've set up three custom taxonomies within my theme for attachment post types within Wordpress 3.5.1. One taxonomy is non-hierarchical (i.e. tags) and has about 800 terms in it. (I'm using WP to build a quick & dirty stock photo site, and these taxonomy terms are akin to photo keywords. Yes, one could debate whether WP is the right tool for this...). Another of the taxonomies is flat as well and as yet has no terms in it. In short, my site has become _extremely_ slow. I'm not at all well-versed in MySQL or databases in general, but when I use the Blackbox plugin to get some insight into the underlying queries when pages load, I see that two queries in particular are adding _huge_ overhead to my pages. Page request times are taking several _seconds_ , and this wasn't happening prior to the creation of the taxonomies. One query alone (below) is taking on average 1.4 seconds. What's going on, and is there a way to stop this? Is there a reason WP needs to make these expensive taxonomy queries on every single page? Currently one query that WP is executing looks like:               SELECT t.*, tt.*, tr.object_id     FROM wp_terms AS t     INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id     INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id     WHERE tt.taxonomy IN ('myCustomTaxonomyName') AND tr.object_id IN (         list of 200+ post IDs     )     ORDER BY t.name ASC;      And the other looks similar, except with different taxonomy names:               SELECT t.*, tt.*, tr.object_id     FROM wp_terms AS t     INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id     INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id     WHERE tt.taxonomy IN ('attachment_tax1', 'attachment_tax2') AND tr.object_id IN (         list of 200+ post IDs     )      ORDER BY t.name ASC;


title: Order categories thumbnails?

text: I have a video portal website and I want to show subcategory names under each video thumbnail. The code I use is this one:               <?php     $category = get_the_category();      echo $category[0]->cat_name;     ?>      The problem is, on some thumbnails it shows the top level name of categories and on some others the sub level name. What I need to do?


title: Serve different layout via URL parameter

text: I'd like to be able to serve up an alternative layout for single posts via an URL parameter. For example, a user going to: http://domain.com/postname/ will get the post in the normal layout and a user going to http://domain.com/postname/?parameter will get the post in the alternate layout. I imagine I need to add some code in the single.php file. Something like:               if (parameter is present) {         serve alternate layout     } else {         serve normal layout     }      Is this doable? Any help would be appreciated


title: Why and how is twentythirteen adding a margin-top to my footer?

text: I'm using the twentythirteen theme with a child theme. I tried to solve the infamous overflowing sidebar problem this way: - made the content float left with a fixed width - made the sidebar float right with a fixed width - added a clearfix class to the parent div Everything seems about right. BUT, for some reason, I find that the theme is adding a margin-top to my footer that seems to be equal to the difference between the bottom of the sidebar (right div) and the bottom of the entry content (left div), so the margin-top value depends on which page is displayed and is random (i.e. it's not a value in the stylesheet). I could fix this by adding a `margin-top: 0` in the stylesheet but I really would like to understand what's causing this. You can see what I'm talking about here: http://mywptestsite.is-great.org/page-height-and-sidebar/ There's a margin-top of 641px on this page! `<footer id="colophon" class="site-footer" role="contentinfo" style="margin- top: 641px;">` Do you know where it's coming from? K. Edit: here's my custom CSS:               .sidebar .entry-header,      .sidebar .entry-content,      .sidebar .entry-summary,      .sidebar .entry-meta {         max-width: 620px;         padding: 0 20px 0 50px;     }          .site-main #primary {         float: left;         clear: none;         width: 620px;     }          .site-main #tertiary {         float: right;         clear: none;     }          .site-main .sidebar-container {         position: static;         width: 300px;         height: auto;     }           .site-main .widget-area {         padding: 30px 20px 0 0;     }


title: Woocommerce blank screen variable product attribute image thumbnail

text: I am using woocommerce, I have setup a variable product. Under each attribute, when I try to add a thumbnail image by clicking on the Insert Into Post button for the Media Uploader dialog, the dialog box becomes empty without any content. In the javascript console in Google Chrome, I get the following error: post.php:1310 Uncaught TypeError: Cannot call method 'replace' of undefined Any ideas? Thanks!


title: Displaying Single Future Posts in a specific Category or Taxonomy

text: I want posts that are tagged with a certain term and scheduled to be posted some time in the future to be publicly available. So if I create a post, assign it a special term (category, tag, custom taxonomy whatever), set the publish date to 01-01-3014 then when someone visits the URL http://www.example.com/3014/01/01/my-awesome-post/ should display the content and not a 404 page. However my other posts that are scheduled for the future and NOT associated with this special term should continue to display 404 pages until the time comes for them to be public. There are lots of examples out there for making all of your future posts public, but not for posts that meet a certain condition. What is the earliest place I can hook in to determine if the post is in a certain category? For what it's worth, I found modifying the global `$wp_post_statuses` object by setting the `future`'s public property to `true` does exactly what I need. At this rate I only have a handful of posts that this would apply to so it might make more sense to set something up when a post is scheduled to collect all of the slugs of future posts and store that as an array in the `wp_options` table. Then I can hook into the `pre_get_posts` action, see if the slug being requested is in the whitelisted slugs stored in my option and then go from there. Any better ideas?


title: Nginx rules for multi-site with fixed alias slugs

text: I had a working WP 3.5 site on apache2. We're moving to a new server and using Nginx. I have updated the files to WP 3.9 (latest current). Accessing `/wordpress/` directly lets me see the master wordpress blog, and I can login to it. But I need to figure out how to make the alias URLs that start with `/blog/`, `/about/`, etc work correctly. The structure is tricky and I can't find an example of how to configure Nginx for it online. Structure   * `/` - root is a non-wordpress site, passed to a non-wordpress index.php   * `/wordpress/` is the real folder where wordpress files actually exist. It hosts the multi-site master, but this path should be inaccessible from the browser.   * `/blog/` A hard-coded (into Nginx) alias for one of the blogs. It should silently pass through to `/wordpress/` with the correct directory set.   * `/about/` A hard-coded (into Nginx) alias for one of the blogs. It should silently pass through to `/wordpress/` with the correct directory set.   * `/*/` A regex that matches a single slug, only if no other rule matches first. Sent to a non-wordpress index.php   * `/*/*/` A regex that matches a double slug, only if no other rule matches first. Sent to a non-wordpress index.php The non-worpress part of the config is working completely:               location ~ ^/([a-zA-Z0-9\-\_]+)/$ {           try_files /cache/$1.html $uri $uri/ /NonWordpress.php?rt=$1;        }             location ~ ^/([a-zA-Z0-9\-\_]+)/([a-zA-Z0-9\-\_]+)/$ {           try_files $uri $uri/ /NonWordpress.php?rt=$1&action=$2;        }             location / {           try_files $uri $uri/ /index.html;        }                  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000        location ~ \.php$ {           # Zero-day exploit defence.                 try_files $uri =404;           fastcgi_split_path_info ^(.+\.php)(/.+)$;           fastcgi_index index.php;           include fastcgi_params;           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;           fastcgi_pass unix:/var/run/php5-fpm.sock;        }      but trying to get the multi-site pass through to work hasn't gotten me anywhere. I've tried stuff like:               location ~ ^/blog/([a-zA-Z0-9\-\_]+)$ {       try_files /wordpress/$1.html /wordpress/$1/;      } But I can't get to wordpress from the alias (blog, about) URLs. What rule(s) do I need to add to make these aliases pass through correctly?


title: Getting movie and serial on actor page

text:
I'm building a cinema site, I came with a problem, let me explain:   * Movies- are stored in Post's    * Actors- are stored in Post Type - persoane ( taxonomy= lista)   * Serials - are stored in Post Type - serial ( taxonomy= seriale) I use Advance Custom Field to link the Person to the movie - ![enter image description here](http://i.stack.imgur.com/kWhjT.jpg) AFC (http://www.advancedcustomfields.com/) How i add: I add new actor post to post type ( persoane), after i add the movie( in post's), in sidebar(post's, movie page) i link the actor (http://i49.tinypic.com/a8800.jpg). After i Link the actor on the actor page it display the movie's that actor play in ![enter image description here](http://i.stack.imgur.com/TO04G.jpg) I use this code to do that               <?php      //create new loop query for films by this actor     $movies = $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'distributie' AND meta_value LIKE '%".get_the_ID()."%'");     $the_query = new WP_Query( array( 'post__in' => $movies) );          // The Loop     while ( $the_query->have_posts() ) : $the_query->the_post();         echo '
';         ?>         <img class="actor-img" src="/scripts/timthumb.php?src=<?php the_field('img'); ?>&h=90&w=60&zc=1" alt="<?php the_title(); ?>"  title="<?php the_title(); ?>"/>              <?php the_title();         echo '
';     endwhile;          // Reset Post Data     wp_reset_postdata();     ?>      **The problem:** I create a Post Type - serial where I add the Serials (Ex: heroes,prisonbreak... ) > How can i display on the actor's page the serials that actor play in. The > custom_field for serials is "distributie_serial" - i change in that code but > no sucess, it did not work. The up code get me only the movies from post's, how can i get the movies from that PostType (serial). Can I put both together to get movies and serials? Or how can i display the serial's on actor page, and IF no movie or serial is atach retrive the text "No movies for this actor" Thanks in advance for those who help me.


title: Admin search post meta

text: I have currently built a property database using WordPress and am purely using the back-end for the whole job. I am listing all the properties and used a plugin called "Easy Filter" to add custom taxonomy filters, however, I also have custom meta that's added on the post and displayed on the `edit.php` page. I used a function to do a direct search and have the ability to pull all the custom meta. (see below code) I was wondering if anyone knew how I can change the value to be like an "includes" instead of a ==. Basically, if there is a building name called "Kam Fai Mansion" and I search the building name meta with the term "Kam" it would also show the results as right now it says nothing found because it is looking for an exact match for the building name instead of containing the word "Kam" within it.               //START SEARCH ADMIN     add_filter( 'parse_query', 'ba_admin_posts_filter' );     add_action( 'restrict_manage_posts', 'ba_admin_posts_filter_restrict_manage_posts' );     function ba_admin_posts_filter( $query )     {         global $pagenow;         if ( is_admin() && $pagenow=='edit.php' && isset($_GET['ADMIN_FILTER_FIELD_NAME']) && $_GET['ADMIN_FILTER_FIELD_NAME'] != '') {             $query->query_vars['meta_key'] = $_GET['ADMIN_FILTER_FIELD_NAME'];         if (isset($_GET['ADMIN_FILTER_FIELD_VALUE']) && $_GET['ADMIN_FILTER_FIELD_VALUE'] != '')             $query->query_vars['meta_value'] = $_GET['ADMIN_FILTER_FIELD_VALUE'];         }     }     function ba_admin_posts_filter_restrict_manage_posts()     {         global $wpdb;         $sql = 'SELECT DISTINCT meta_key FROM '.$wpdb->postmeta.' ORDER BY 1';         $fields = $wpdb->get_results($sql, ARRAY_N);     ?>     <select name="ADMIN_FILTER_FIELD_NAME">     <option value=""><?php _e('Filter By Custom Fields', 'baapf'); ?></option>     <?php         $current = isset($_GET['ADMIN_FILTER_FIELD_NAME'])? $_GET['ADMIN_FILTER_FIELD_NAME']:'';         $current_v = isset($_GET['ADMIN_FILTER_FIELD_VALUE'])? $_GET['ADMIN_FILTER_FIELD_VALUE']:'';         foreach ($fields as $field) {             if (substr($field[0],0,1) != "_"){             printf                 (                     '<option value="%s"%s>%s</option>',                     $field[0],                     $field[0] == $current? ' selected="selected"':'',                     $field[0]                 );             }         }     ?>     </select> <?php _e('Value:', 'baapf'); ?><input type="TEXT" name="ADMIN_FILTER_FIELD_VALUE" value="<?php echo $current_v; ?>" />     <?php     }     //END SEARCH ADMIN


title: Scheduled Posts and wp-cron - Why don't scheduled posts publish if too old?

text: I notice that the documentation for `wp_schedule_single_event` mentions the following:- > The action will fire off when someone visits your WordPress site, if the > schedule time has passed. However this does not seem to be true for scheduled posts. I notice that some posts can be missed if wp-cron is not run for a while (not sure of exact timeframe). The post then has the label 'Missed Schedule' in the admin panel. My questions are:- Is this just for scheduled posts or all scheduled events? What is the timeframe in which wp-cron must be run before scheduled post are missed? Where is this timeframe set in the code? I cannot seem to find it in wp- cron.php, cron.php or post.php.


title: Use WP_Query with have_posts()?

text: Is it possible to use               $items = new WP_Query( $query_args );       with               <?php if(have_posts()): ?>     <?php while (have_posts()) : the_post(); ?>      without changing the loop to be               <?php while ($items->have_posts()) : $items->the_post();      Thanks.


title: Frontend tagging for both default and custom post type in wordpress

text: Wordpress backend (post-editor-panel) offers such an excellent tagging tool wherein we can choose from already existing tags. Is it possible to bring this functionality to the frontend without fancy ajax. Just with some good ol php. All I need is just a list of tags to choose from in the frontend and save it. I will need the functionality for both post types, default wp post type as well as for custom-post-type. There is one similar question with an unaccepted answer. I tried to use the code in the suggested answer, but it is far from perfect and just returns empty radio-buttons. There is nothing on google on this topic, Please suggest the correction in the code. Thanks.               <?php     $taxonomies = array(          'wissen_tags'     );     $args = array(         'orderby' => 'name',         'order' => 'ASC',         'hide_empty' => false     );          $terms = get_terms($taxonomies,$args);          if (count($terms) > 0):     $i = 0;         foreach ($terms as $term): ?>             <div class="wissen_tag_list">                 <input type="radio" value="<?php echo $term->term_id; ?>" name="wissen_tags" class="wissen_tag_list_ckb" <?php if ( $i == 0 ) { ?>checked<?php } ?>>                 <label class="wissen_tag_list_ckbl">                     <?php echo $term->name; ?>                 </label>             </div>     <?php         $i++; endforeach;     endif; ?>


title: 404 (category, pages, archives) when using custom rewrite rules

text: I'm using www.domain.com/%POSTNAME%/CAR permalink structure (CAR is the variable i need to extract. After adding the code to the functions.php the other wordpress url's stopped working (category, archives, pages) and now its showing 404 everywhere the only thing are working are posts. This is the code:               /**      * create_custom_rewrite_rules()      * Creates the custom rewrite rules.      * return array $rules.      **/          function create_custom_rewrite_rules() {      global $wp_rewrite;          // Define custom rewrite tokens      $rewrite_tag = '%exampletag%';          // Add the rewrite tokens      $wp_rewrite->add_rewrite_tag( $rewrite_tag, '(.+?)', 'car=' );          // Define the custom permalink structure      $rewrite_keywords_structure = $wp_rewrite->root . "%postname%/$rewrite_tag/";          // Generate the rewrite rules      $new_rule = $wp_rewrite->generate_rewrite_rules( $rewrite_keywords_structure );          // Add the new rewrite rule into the global rules array      $wp_rewrite->rules = $new_rule + $wp_rewrite->rules;          return $wp_rewrite->rules;          } // End create_custom_rewrite_rules()          /**      * add_custom_page_variables()      * Add the custom token as an allowed query variable.      * return array $public_query_vars.      **/          function add_custom_page_variables( $public_query_vars ) {      $public_query_vars[] = 'car';          return $public_query_vars;               } // End add_custom_page_variables()          function flush_rewrite_rules() {          global $wp_rewrite;          $wp_rewrite->flush_rules();               }          add_action( 'admin-init', 'flush_rewrite_rules' );      add_action( 'generate_rewrite_rules', 'create_custom_rewrite_rules' );      add_filter( 'query_vars', 'add_custom_page_variables' );      I have 0 plugins activated so the error is in the code. The only way i got category working was changing them from /category/categoryname to /category/category/%categoryname% but i have no way to change pages and archives to make them work. So that why i need help. Thanks.


title: Function Suddenly Stopped Working

text:
I have a function which allows users to choose between pagination and next/previous links. In fact, I was provided the function on this site. I tested it today and it suddenly isn't working. I can't figure out the cause of this sudden interruption. It seems that the code will work if I choose the option I want, switch themes, save, then switch back! Absolutely no idea what is going on. In functions.php:               // Pagination     function my_theme_navigation()      {          global $shortname;              if( get_option( $shortname . '_next_prev_or_paginate' ) == 'Next' ) :              // the block for next-prev navigation             echo '
';             next_posts_link('Older');             echo '
';             echo '
';             previous_posts_link ('Newer');             echo '
';         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=%#%',             'end_size'     => 1,             'mid_size'     => 2,                     'current' => max( 1, get_query_var('paged') ),                      'total' => $wp_query->max_num_pages                 )             );          endif;      }      In my options panel:               array( "name" => "Paginate or next/previous links?",          "desc" => "Choose your option",          "id" => $shortname."_next_prev_or_paginate",          "type" => "select",          "options" => array("Next/Previous Links", "Pagination"),          "std" => "Next"),       In index.php:               <?php my_theme_navigation(); ?>


title: Pasting code into pre-formatted text in Visual Editor not working in 3.3.1

text: Pre-formatted text in the Visual Editor is not behaving like I'm used to. I've got an old installation (3.2.1), and when create pre-formatted text, all the line-breaks and spacing is preserved. In the latest version (3.3.1), the line breaks are interpreted as new paragraphs, and the code is broken across those paragraphs, leading spaces removed. Process:   1. Copy code from text editor.   2. Click on the "New Post" link.   3. Choose "Preformatted" from the format menu.   4. Paste (ctrl-v). ## 3.2.1 - Correctly formatted code ![screenshot of correctly formatted code](http://i.imgur.com/Q2IqF.png) ## 3.3.1 - Incorrectly formatted code ![screenshot of incorrectly formatted code](http://i.imgur.com/YnD7P.png) I know I can switch to code view and put tags in myself, but I'm not looking for a workaround.


title: How to build a directory with indexes in Wordpress

text: I am working on a site that is using posts as a way to manage glossary articles like the example site below. I would like to find a way to display articles alphabetically and grouped by a selected letter (such as the letter 'F' in the example). I would like the process to be reasonably automatic. Example of desired output: http://www.retirementdictionary.com/glossary/f **Can anyone suggest a way to do this?** _A plugin would be my first choice, but I'm open to other solutions._


title: Wordpress Browser Cache with W3-Total-Cache doesn't show new posts

text: I'm running the latest version of both Wordpress (3.5.1) and the always popular W3 Total Cache (0.9.2.8), but I'm having issues with the browser cache. Basically I can't figure out the settings to make it so that my homepage isn't being cached. Whenever I turn on the browser cache, it effectively caches my homepage and stops showing any new posts that I make. My inclination is to lower the HTML & XML Expires header lifetime down to something like 900 seconds (15 minutes), but I'm not 100% sure that would solve my problem here. Thanks in advance for any help on this!


title: Add a button to tinyMCE editor on Custom Post Type

text: How do I go about adding a simple button to tinymce on the default editor area of my new Custom Post Type? I'd like the button, when clicked, to ask for a text value. The script should then `lowercase` the input and replace spaces with hyphens, and insert `[glossary=value-entered]` into the editor. Thanks in advance,


title: Debugs/errors in oqey gallery

text: When i install this plugin (oQey gallery) i report some errors like: > 1) Notice: Undefined index: type in \wp-content\plugins\oqey- > gallery\gallcore.php on line 252 On line 252:               if($_GET['type'] == "oqeygallery"){ include ("insert_in_post.php"); }      > 2) Notice: has_cap was called with an argument that is deprecated since > version 2.0! Usage of user levels by plugins and themes is deprecated. Use > roles and capabilities instead. in C:\xampp\htdocs\website\wp- > includes\functions.php on line 2723 on line 2723:               trigger_error( sprintf( __('%1$s was called with an argument that is deprecated since version %2$s! %3$s'), $function, $version, $message ) );      > 3) Notice: Undefined index: page in \wp-content\plugins\oqey- > gallery\oqeygallery.php on line 346 on line 346:                if(is_admin() && ($_GET['page']=='oQeysettings' || $_GET['page']=='oQeyGalleries' || $_GET['page']=='oQeySkins' || $_GET['page']=='oQeyMusic' || $_GET['page']=='oQeyTrash' || $_GET['page']=='oQeyVideo' ) ){


title: How do I register/enqueue a custom CSS file?

text: Good Day. I am using a Wordpress theme and I want to add my own custom CSS. Now I have tried adding my own separate stylesheet after all the other php stylesheet calls in the header.php file. I tried editing the stylesheet in Appearance>Editor, and I even added !important to ALL my styles. But Wordspress keeps overwriting my styles with the default stylesheet. Now I read a bit about registering/enqueuing stylesheets in the functions.wp- styles.php but the code there is french to me...I do not know where to add my css... Here is the code in the functions.wp-styles.php page: Your help will be greatly appreciated!               <?php     /**      * BackPress styles procedural API.      *      * @package BackPress      * @since r79      */          /**      * Display styles that are in the queue or part of $handles.      *      * @since r79      * @uses do_action() Calls 'wp_print_styles' hook.      * @global object $wp_styles The WP_Styles object for printing styles.      *      * @param array|bool $handles Styles to be printed. An empty array prints the queue,      *  an array with one string prints that style, and an array of strings prints those styles.      * @return bool True on success, false on failure.      */     function wp_print_styles( $handles = false ) {         if ( '' === $handles ) // for wp_head             $handles = false;              if ( ! $handles )             do_action( 'wp_print_styles' );              global $wp_styles;         if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {             if ( ! did_action( 'init' ) )                 _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),                     'wp_enqueue_scripts', 'admin_enqueue_scripts', 'init' ), '3.3' );                  if ( !$handles )                 return array(); // No need to instantiate if nothing is there.             else                 $wp_styles = new WP_Styles();         }              return $wp_styles->do_items( $handles );     }          /**      * Adds extra CSS.      *      * Works only if the stylesheet has already been added.      * Accepts a string $data containing the CSS. If two or more CSS code blocks are      * added to the same stylesheet $handle, they will be printed in the order      * they were added, i.e. the latter added styles can redeclare the previous.      *      * @since 3.3.0      * @see WP_Scripts::add_inline_style()      */     function wp_add_inline_style( $handle, $data ) {         global $wp_styles;         if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {             if ( ! did_action( 'init' ) )                 _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),                     'wp_enqueue_scripts', 'admin_enqueue_scripts', 'init' ), '3.3' );             $wp_styles = new WP_Styles();         }              return $wp_styles->add_inline_style( $handle, $data );     }          /**      * Register CSS style file.      *      * @since r79      * @see WP_Styles::add() For additional information.      * @global object $wp_styles The WP_Styles object for printing styles.      * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.      *      * @param string $handle Name of the stylesheet.      * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.      * @param array $deps Array of handles of any stylesheet that this stylesheet depends on.      *  (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies.      * @param string|bool $ver String specifying the stylesheet version number. Set to null to disable.      *  Used to ensure that the correct version is sent to the client regardless of caching.      * @param string $media The media for which this stylesheet has been defined.      */     function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {         global $wp_styles;         if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {             if ( ! did_action( 'init' ) )                 _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),                     'wp_enqueue_scripts', 'admin_enqueue_scripts', 'init' ), '3.3' );             $wp_styles = new WP_Styles();         }              $wp_styles->add( $handle, $src, $deps, $ver, $media );     }          /**      * Remove a registered CSS file.      *      * @since r79      * @see WP_Styles::remove() For additional information.      * @global object $wp_styles The WP_Styles object for printing styles.      *      * @param string $handle Name of the stylesheet.      */     function wp_deregister_style( $handle ) {         global $wp_styles;         if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {             if ( ! did_action( 'init' ) )                 _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),                     'wp_enqueue_scripts', 'admin_enqueue_scripts', 'init' ), '3.3' );             $wp_styles = new WP_Styles();         }              $wp_styles->remove( $handle );     }          /**      * Enqueue a CSS style file.      *      * Registers the style if src provided (does NOT overwrite) and enqueues.      *      * @since r79      * @see WP_Styles::add(), WP_Styles::enqueue()      * @global object $wp_styles The WP_Styles object for printing styles.      * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.      *      * @param string $handle Name of the stylesheet.      * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.      * @param array $deps Array of handles (names) of any stylesheet that this stylesheet depends on.      *  (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies.      * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter      *  is used to ensure that the correct version is sent to the client regardless of caching, and so should be included      *  if a version number is available and makes sense for the stylesheet.      * @param string $media The media for which this stylesheet has been defined.      */     function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {         global $wp_styles;         if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {             if ( ! did_action( 'init' ) )                 _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),                     'wp_enqueue_scripts', 'admin_enqueue_scripts', 'init' ), '3.3' );             $wp_styles = new WP_Styles();         }              if ( $src ) {             $_handle = explode('?', $handle);             $wp_styles->add( $_handle[0], $src, $deps, $ver, $media );         }         $wp_styles->enqueue( $handle );     }          /**      * Remove an enqueued style.      *      * @since WP 3.1      * @see WP_Styles::dequeue() For parameter information.      */     function wp_dequeue_style( $handle ) {         global $wp_styles;         if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {             if ( ! did_action( 'init' ) )                 _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),                     'wp_enqueue_scripts', 'admin_enqueue_scripts', 'init' ), '3.3' );             $wp_styles = new WP_Styles();         }              $wp_styles->dequeue( $handle );     }          /**      * Check whether style has been added to WordPress Styles.      *      * By default, checks if the style has been enqueued. You can also      * pass 'registered' to $list, to see if the style is registered,      * and you can check processing statuses with 'to_do' and 'done'.      *      * @since WP unknown; BP unknown      * @global object $wp_styles The WP_Styles object for printing styles.      *      * @param string $handle Name of the stylesheet.      * @param string $list Optional. Defaults to 'enqueued'. Values are      *  'registered', 'enqueued' (or 'queue'), 'to_do', and 'done'.      * @return bool Whether style is in the list.      */     function wp_style_is( $handle, $list = 'enqueued' ) {         global $wp_styles;         if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {             if ( ! did_action( 'init' ) )                 _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),                     'wp_enqueue_scripts', 'admin_enqueue_scripts', 'init' ), '3.3' );             $wp_styles = new WP_Styles();         }              return (bool) $wp_styles->query( $handle, $list );     }


title: wp_get_nav_menu_items how to exclude sub level menu items?

text: I have the following function to output a custom menu in select format for a responsive design I'm working on. It's working exactly how I want it to apart from I would need to exclude sub menu items. At the moment it includes all levels. Does anyone know how I can tell `wp_get_nav_menu_items`to only display top level menu items please?               function jeMobileMenu( $args ) {                  // Set up defaults arguments             $defaults = array (                 'menuSlug'      =>  '',                 'placeholder'   =>  'Menu',                 'prefix'        =>  ' » ',                 'navID'         =>  'mobileNav',                 'navClass'      =>  ''             );                  // Parse incomming $args into an array and merge it with $defaults             $args = wp_parse_args( $args, $defaults );                  //Declare each item in $args as its own variable i.e. $menuSlug, $placeholder             extract( $args, EXTR_SKIP );                  // If no menu slug has been passed then lets bail             if ( empty($menuSlug) )                 return;                  // If the menu slug that has been passed doesn't correspond to an exisiting menu then lets bail             if ( !has_nav_menu( $menuSlug ) )                 return;                       $locations = get_nav_menu_locations();             $menu = wp_get_nav_menu_object( $locations[ $menuSlug ] );                  $menu_items = wp_get_nav_menu_items($menu->term_id);                  // Wrap the select in a nav element with passed id and classes             $menu_output = '<nav id="' . $navID . '" class="' . $navClass . '">';                  $menu_output .= '<select id="menu-' . $menuSlug . '" onchange="window.open(this.options[this.selectedIndex].value,\'_top\')">';                  // Add placeholder and home link             $menu_output .= '<option value="">' . $placeholder . '</option>';             $menu_output .= '<option value="' . home_url( '/' ) . '">' . $prefix . 'Home</option>';                  // Now loop through all the menu items and create them as options in the select list                     foreach ( (array) $menu_items as $key => $menu_item ) {                 $title = $menu_item->title;                 $url = $menu_item->url;                 $menu_output .= '<option value="' . $url . '">' . $prefix . $title . '</option>';             }             $menu_output .= '</select>';                  $menu_output .= '</nav>';                  echo $menu_output;         }


title: Sorting Attributes order when using get_the_terms

text: This code has worked to display product attributes on a page. How do I sort/order them by slug? They are currently sorted by name.                global $post;      $terms = get_the_terms( $post->ID, 'pa_size');      foreach ( $terms as $term ) {      echo "<li>" .$term->name. "</li>";      }


title: the-events-calendar, pagination with tribe_get_events()

text: i'm using the events calendar plugin and at some place i use the tribe_get_events() function to show the upcoming events. Point is, i need to create a pagination for those results. The `tribe_get_events` function is using wordpress' `get_posts()` and accepts some parameters like `posts_per_page`. I've tried adding some pagination parameters as i would with a `WP_Query()` request but without any success yet. Here goes the code:               <?php global $post;      $all_events = tribe_get_events(array( 'eventDisplay'=>'upcoming', 'posts_per_page'=> 3, ));     foreach($all_events as $post) {         setup_postdata($post); ?>              <?php the_title(); ?>          <?php } wp_pagenavi();  wp_reset_query(); ?>      The 'paged' => get_query_var('paged') does change anything. Am also using the WP-PageNavi plugin but if there's a way to get the navigation working here without it it'd be already fine.


title: How can I change the link in comment form "Log in to post a comment"?

text: Right now there is a link and I am using a plugin for a modal box and I would like to change the link in the code. Where is the html and php file with the code located? I have looked in my theme files, but comments.php do not contain the code I need to change. Can I hack it via functions.php hook?


title: Conditional add_filter for upload directory?

text: I have a custom media upload button (in the standard post edit page, alongside the standard media upload button), and need to change the upload directory dynamically if this button is clicked - using add_filter('wp_handle_upload_prefilter', 'my_function'). This post & answer: Conditional add_filter? seem to give the solution, but for some reason don't work for me - the additional parameter 'hexProtected' is not set & so add_filter is not called. My code is below... am I doing something stupid or does the solution posted not work?!               <?php     /* Custom Upload Directory for protected posts */                                              function hex_protected_media_button($context) {         global $post;         $media_button_image = 'http://www.example.com/wp-admin/images/media-button.png?ver=20111005';         $media_button = ' %s' . 'ID.'&TB_iframe=1&hexProtected=1" class="thickbox">';         return sprintf($context, $media_button);     }          add_filter('media_buttons_context', 'hex_protected_media_button');                                                                add_filter('wp_handle_upload_prefilter', 'hex_pre_upload');     add_filter('wp_handle_upload', 'hex_post_upload');          function hex_pre_upload($file){           if (isset($_GET['hexProtected'])) {            add_filter('upload_dir', 'hex_custom_upload_dir');         }         return $file;     }          function hex_custom_upload_dir($path){               if(!empty($path['error'])) { return $path; } //error; do nothing.            $path['path'] = str_replace($path['subdir'], '/protected'.$path['subdir'], $path['path']);         $path['url'] = str_replace($path['subdir'], '/protected'.$path['subdir'], $path['url']);                 $path['subdir']  = '/protected';             return $path;     }          ?>


title: problem with not displaying content on selected pages

text: My objective - Display some code on every page apart from 2 pages. Now this code works fine with only one page (if its not `is_home`, display code)...               <?php if (!is_home()) { ?>       (some content)     <?php ?>      ... but when I try to do it for two pages, the rule fails, and the code is displayed on both the pages where I do not want it visible...               <?php if( !is_home() or !is_archive()) { ?>      (some content)     <?php ?>      I am unsure why this fails, any help would be great. Thanks in advance.


title: How to redirect a page to subdomain?

text: I have a blog on wordpress say example.com with a page name "mypage" in it. When a user clicks on mypage I want him to redirect to mypage.example.com (a subdomain that I have already created) inspite of opening example.com/mypage. I want my page to redirect to my subdomain.   I am a user of wordpress and hence I dont know much about how to do it. Please help me out on it, I would be really thankfull.


title: Get post excerpt and title by specific post ID?

text:
I'm trying to get post excerpt and title by specific post ID. My post ID is 6 and my code as follows               <?php         $id = 6;         $post = get_post( $id );         $excerpt = get_excerpt( $id);         $excerpt = $post->post_excerpt;     ?>
<?php the_title(); ?>
          <?php echo get_excerpt(190); ?>      It shows the title of post ID 6, but the wrong excerpt... Also I've an excerpt length control code in my `functions.php`               // Changing excerpt length     function get_excerpt($count){         $permalink = get_permalink($post->ID);         $excerpt = get_the_content();         $excerpt = strip_tags($excerpt);         $excerpt = substr($excerpt, 0, $count);         $excerpt = substr($excerpt, 0, strripos($excerpt, " "));         $excerpt = $excerpt.'... Read More';         return $excerpt;     }      Any help will be appreciated...


title: Custom Post Types: Can you add more than one Variable to a Column?

text: _(Since my custom post type is a little long, I've for the sake of simplicity, copied over a dummy one)_ What I am trying to do is, say I describe a few "similar" variables, i.e. price1, price2, price3, etc. would I be able to stack those values in a single column (as opposed to showing it over 3 columns), i.e. `$price1<br />$price2<br />$price3` ? The reasons are purely aesthetic as the custom post type columns would get really crowded quickly otherwise. Thank you! (like said, the part below isn't the actual code I'm using, but I thought it would be good if someone else would be searching the same thing)               add_filter("manage_edit-product_columns", "prod_edit_columns");     add_action("manage_posts_custom_column",  "prod_custom_columns");          function prod_edit_columns($columns){       $columns = array(        "cb" => "<input type=\"checkbox\" />",        "title" => "Product Title",        "description" => "Description",        "price1" => "Price1",        "catalog" => "Catalog",       );            return $columns;     }          function prod_custom_columns($column){       global $post;       switch ($column)       {        case "description":         the_excerpt();         break;        case "price": // Now here I have to define the field, but how would I drag in other subsequent price fields?         $custom = get_post_custom();         echo $custom["price"][0];         break;        case "catalog":         echo get_the_term_list($post->ID, 'catalog', '', ', ','');         break;       }     }


title: How to delete orphan attachments?

text: I've been given the directive to "retire" about 1000 articles from a wordpress site I maintain. Deleting the posts from the DB is trivial, but how would one go about deleting the orphaned files from the uploads folder?


title: Is there any multiple filter/criteria plugin for wordpress?

text: I'm interested in a wordpress plug-in that is able to make from tags or categories multiple search criteria like left hand side of the following site system http://www.olx.com/dvd-cat-238 When one of the criteria filter is selected the content displayed should be displayed regarding that selection. If multiple criteria is selected the displayed content should contain all the selected filter simultaneously. Best regards


title: Passing and retrieving query vars in wordpress

text: I have two authors pages, one displays about 5 posts. Then I'm trying to setup another page that will be all of their posts. I have created a template called moreauthorposts.php and I'm trying to pass the author variable to this page. Problem is if i pass domain.com/more-author-posts?author=johndoe it gets stripped out. How can I retrieve this value? Is this even possible in wordpress? I know WP Rewrite is jacking my URL structure somehow I'm just not sure. I've tried:               get_query_var('author')      and tried reading this but didn't have any luck: http://codex.wordpress.org/Query_Overview Suggestions? Thanks.


title: How to create sub-menu in "Allure Real Estate Theme for Placester"?

text:
The below is the menu code used in the default WordPress theme of "Allure Real Estate Theme for Placester".                    `
Home

<a href="<?php echo @get_permalink(get_page_by_title('About')->ID); ?                  >">About

<a href="<?php echo @get_permalink(get_page_by_title('Search')->ID); ?               >">Search

<a href="<?php echo @get_permalink(get_page_by_title('Blog')->ID); ?                  >">Blog

<a href="<?php echo @get_permalink(get_page_by_title('Contact')->ID); ?               >">Contact

<a href="<?php echo @get_permalink(get_page_by_title('Testimonials')->ID);             ?">Testimonials`      How can I create a sub-menu in any one of the main menu items in the above code?


title: Issue on Adding Taxonomy to Custom Post Type Using Function

text: Using WordPress 3.7.1 and PHP 5.4.12, I am trying to add Custom Post Type and Taxonomy to my Theme, so far the custom post type method works but the Taxonomy is not adding to the Admin Dashboard. Here is the code I have:               <?php      function add_post_type($name, $args = array()) {         add_action('init', function() use($name, $args) {                 $upper = ucwords($name);                 $name = strtolower(str_replace(' ','_',$name));                 $args = array_merge(                 array(                 'public'=> true,                 'label' => "All $upper" . 's',                 'labels' => array('add_new_item' => "Add New $upper"),                 'support' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments')                 ),                 $args                 );                 register_post_type('$name', $args);             });     }          function add_taxonomy($name, $post_type, $args = array()) {         $name = strtolower($name);         add_action('init', function() use($name, $post_type, $args) {                 $args = array_merge(                     array(                     'label' => ucwords($name),                     ),                     $args                 );                     register_taxonomy($name, $post_type, $args);         });      }          add_post_type('book', array(                 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments')     ));     add_taxonomy('fun', 'book');     ?>      Can you please let me know what part I am doing wrong?


title: Highlight Syntax Inline

text: I'm looking for a plugin that is compatible up to the current version of WordPress (3.1.1 as of writing of this question) and that supports some kind of inline highlighting of programming language syntax. Basically, I want to be able to write a `function name` or a `variable name` or a quick `if statement` as part of a paragraph and have it look like `code`, much like what you get in the StackExchange editor with the `backticks`. There are several good plugins for highlighting programming language syntax in WordPress, but they don't seem to support inline syntax highlighting. jQuery.Syntax claims to have the inline capability, but I can't get it to work on Wordpress 3.1.1.


title: Plugin default settings hook

text: I am writing a plugin where I want it's default settings to change in accordance to the theme that is selected. I have it working, but would rather provide an action hook for this instead of writing the specifically named function as I have here. Is there a better method for this using `do_action` and `add_action` possibly? PLUGIN ADMIN PHP:               function bf_set_defaults(){       $default_settings = array(         // Header           'embers_header_nav_pos' => 'bottom',           'embers_header_leftcol' => '4',           'embers_header_middlecol' => '4',           'embers_header_rightcol' => '4',              // Full Width Content           'embers_full_width_contentcol' => '12',              // Content Sidebar           'embers_content_sidebar_contentcol' => '8',           'embers_content_sidebar_primarycol' => '4',              //Sidebar Content           'embers_sidebar_content_contentcol' => '8',           'embers_sidebar_content_primarycol' => '4',              // Content Sidebar Sidebar           'embers_content_sidebar_sidebar_contentcol' => '6',           'embers_content_sidebar_sidebar_primarycol' => '4',           'embers_content_sidebar_sidebar_secondarycol' => '2',              // Sidebar Sidebar Content           'embers_sidebar_sidebar_content_contentcol' => '8',           'embers_sidebar_sidebar_content_primarycol' => '4',           'embers_sidebar_sidebar_content_secondarycol' => '2',           'embers_sidebar_sidebar_content_contentsidebar' => '10',              // Sidebar Content Sidebar           'embers_sidebar_content_sidebar_contentcol' => '8',           'embers_sidebar_content_sidebar_primarycol' => '4',           'embers_sidebar_content_sidebar_secondarycol' => '2',           'embers_sidebar_content_sidebar_contentsidebar' => '10',         );            if (function_exists('bf_new_defaults')) {        return bf_new_defaults( $default_settings );       }else{        return $default_settings;       }          }          // Create the Admin Page     $this->create( $page_id, $menu_ops, $page_ops, $settings_field, bf_set_defaults() );      THEME functions.php:               function bf_new_defaults( $default_settings ) {      $default_settings['embers_header_nav_pos'] = 'top';      $default_settings['embers_header_leftcol'] = '8';      return $default_settings;     }


I'm using Wordpress v.3.4.2 and today I've tried to update to the v.3.7.1 using all possible ways but in all of them I got the following error "Can't estabilish database connection", and since I was using the configuration below in my wp-config.php for the current version (3.4.2) why it is not working in the new one (3.7.1)? Could someone please help me? See wp-config.php database info:               define('DB_NAME', 'wp_blog');     define('DB_USER', 'user');     define('DB_PASSWORD', 'pass');     define('DB_HOST', '/var/run/mysqld/mysqld.sock');


title: Options for logging events in WordPress

text: I am building a custom app in WordPress, so I need some means of logging my events. I searched and found this plugin - http://wordpress.org/extend/plugins/wp-logs/ which looks very convenient to use. It uses database to store logs and can display them in the backend itself. Another option for me is to learn WP filesystem (something which I haven't tried yet) and use it to write logs to file on disk. What do you think would be best considering the tradeoff between performance & convenience? Database write is equal to `I/O write` + some extra work. Thoughts?


title: How can I show full text, not summary for the homepage and in categories?

text: I'm using the 'de.pinque' wordpress theme and it doesnt have an option to show full text in the homepage. This is my site (test site) with the theme and you can see its showing a summary of text on the homepage http://test99.info/ I also would like to be able to get full text when I click on the categories in the navigation bar. As you can see here, when I click on the 'A' category it also shows an excerpts of the the article instead of the full text So how can i get the full text on both these. Below are my index.php, function.php, header.php, and category.php if you need to see them. Thanks edit: im having trouble pasting the codes, it says i can't post more than 2 links please help


title: Excerpt textarea missing on post editing page in admin panel

text: Why is that? It's a new installation. EDIT: I don't have plugins installed and I tried to restore default theme to Twenty Ten, but it didn't change anything.


title: Azure Management from Wordpress

text: Microsoft has up to 3 additional slots aside from "production" now for Azure websites. I wanted to write a management page in php for allowing content administrators to swap between staging and production environments. One issue is that Azure websites do not work the same as Azure services in that the shared certificate store isn't there (it's strictly for handling HTTPS SSL certs) and after reviewing the method createServiceManagementService described here: http://azure.microsoft.com/en-us/documentation/articles/cloud-services-php- how-to-use-service-management/#Connect It seems that not only do you have to have the private key certificate (.pem) on the file system, there is no provision for a password to secure it. Does anyone have any idea on how to resolve this ? Would it be possible to build a stream wrapper that would read from a pfx blob storage and supply temporarily to createServiceManagementService to avoid having to keep a non secure .pem on the file system? I have searched a bit and did not find anything.


title: Second foreach in the loop returns bool(false) though array is present

text:
In my code below the data is extracted correctly for the first `foreach`, but doesn't return anything for 2nd `foreach` although selected one present inside the 2nd `foreach`. I still get the error > Warning: Invalid argument supplied for foreach() for line `foreach > ($authorlist as $post)`... However the 2nd `foreach` returns data correctly as soon as I remove the first `foreach` loop. Below is my code               <?php          $all= get_posts(array('post_type' => 'books', 'numberposts' => -1,));          foreach ( $all as $post ) :  setup_postdata($post);              if (!empty($post))         {          $booklink = array();               $booklist = get_field('booklist');                     foreach ($booklist as $post) : setup_postdata($post);                         if (!empty($post))                             {                             $booklink[] = strip_tags(get_field('booklink',$post));                                                                    }                     endforeach;                     wp_reset_postdata();          echo $booklink[0];                 $authorname = array();               $authorlist = get_field('authorlist');                     foreach ($authorlist as $post) : setup_postdata($post);                         if (!empty($post))                             {                             $authorname[] = strip_tags(get_field('authorname',$post));                                                                    }                     endforeach;                     wp_reset_postdata();     echo $authorname[0];               }     endforeach;     ?>      I did `var_dump($authorlist)` and it returns `bool(false)` as long as `foreach ($booklist as $post)` loop is present. The moment I remove that loop then the dump shows the data of the `authorlist` correctly. How to get both the loops working together? You can see the output here added unset and change$post for each foreach still not working               <?php          $all= get_posts(array('post_type' => 'books', 'numberposts' => -1,));     echo "VAR_DUMP(all)
";     var_dump($all);     echo "
";     echo "
";     foreach ( $all as $post ): setup_postdata($post);              if (!empty($post))         {          $booklink = array();               $booklist = get_field('booklist');                     foreach ($booklist as $bookpost): setup_postdata($bookpost);                         if (!empty($bookpost))                             {                             $booklink[] = strip_tags(get_field('booklink',$bookpost));                                                                    }                  endforeach;             wp_reset_postdata();             unset($bookpost);                   echo "
";         echo "var dump for booklist";         echo "
";         var_dump( $booklist);         echo "
";         echo "
";          echo "booklink is - " . $booklink[0]."
";                 $authorname = array();               $authorlist = get_field('authorlist');                     foreach ($authorlist as $authorpost): setup_postdata($authorpost);                              if (!empty($authorpost))                             {                             $authorname[] = strip_tags(get_field('authorname',$authorpost));                                                                    }                          endforeach;             wp_reset_postdata();                             unset($authorpost);              echo "
";         echo "var dump for authorlist";        echo "
";         var_dump( $authorlist);         echo "
";        echo "
";           echo "authorname is - ".$authorname[0]."
";               }          endforeach;     wp_reset_postdata();     unset($post);     ?>


title: Infinite Pagination at Category Pages

text:
I'm use popular wp_infinitepaginate functionfor my WP theme.               function wp_infinitepaginate(){         $loopFile        = $_POST['loop_file'];         $paged           = $_POST['page_no'];         $posts_per_page  = get_option('posts_per_page');              # Load the posts              query_posts(array('paged' => $paged, 'post_status' => 'publish'));         get_template_part( $loopFile );              exit;     }               add_action('wp_ajax_infinite_scroll', 'wp_infinitepaginate');           // for logged in user     add_action('wp_ajax_nopriv_infinite_scroll', 'wp_infinitepaginate');    // if user not logged in                                   var count = 2;//for first load             $(window).scroll(function(){                     if  ($(window).scrollTop() == $(document).height() - $(window).height()){                        loadArticle(count);                        count++;                     }             });          $loop_paged = (get_query_var('page')) ? get_query_var('page') : $paged;          query_posts('orderby=date&order=ASC&paged=' . $loop_paged);                                      if ( have_posts() ) :                                     while ( have_posts() ) : the_post();                                         get_template_part( 'content', get_post_format() );                                     endwhile;                                     echo '

';                                                            endif;      All works fine, but at category pages infinite pagination loads next pages from main page. I.e. when scroller should load the second page of the category site.com/category/page2 it loads the second page of the main page site.com/page2. I'm not good at Ajax but I understand that need to fix something in this piece of code:                     Any suggestions to resolve the issue. Didn't find anything regarding this in Google.


title: How can I merge this function(s) that inserts terms to a custom taxonomy with this other that adds a custom taxonomy filter?

text: Few days ago I asked a question about How to show a custom taxonomy in a custom post type column (and insert some 'default' terms to the custom taxonomy). Then I saw an answer for Adding a Taxonomy Filter to Admin List for a Custom Post Type. (Both answered by MikeSchinkel) I would like to merge both features: to create a custom post type, a custom taxonomy, adding some terms in the custom taxonomy, displaying the custom taxonomy in the custom post type's column, and adding a taxonomy filter. I know it sounds long, they are all done in those two questions, just need to merge them. How that code would look like?


title: what is the wp_5_posts table in the database?

text: I'm wondering what all the `wp_2_*`, `wp_3_*`, `wp_4_*`, and `wp_5_*` tables are in the database. Does anyone know what they are? Some of them in my example are from plugins, but what does the `wp_#` prefix mean? and why are there then duplicates for some of the core database tables?               mysql> show tables;     +-----------------------------+     | Tables_in_example           |     +-----------------------------+     | wp_2_commentmeta            |     | wp_2_comments               |     | wp_2_links                  |     | wp_2_options                |     | wp_2_postmeta               |     | wp_2_posts                  |     | wp_2_term_relationships     |     | wp_2_term_taxonomy          |     | wp_2_terms                  |     | wp_3_commentmeta            |     | wp_3_comments               |     | wp_3_links                  |     | wp_3_options                |     | wp_3_postmeta               |     | wp_3_posts                  |     | wp_3_term_relationships     |     | wp_3_term_taxonomy          |     | wp_3_terms                  |     | wp_4_commentmeta            |     | wp_4_comments               |     | wp_4_contact_form_7         |     | wp_4_events                 |     | wp_4_events_categories      |     | wp_4_gwolle_gb_entries      |     | wp_4_gwolle_gb_log          |     | wp_4_links                  |     | wp_4_options                |     | wp_4_postmeta               |     | wp_4_posts                  |     | wp_4_quotescollection       |     | wp_4_term_relationships     |     | wp_4_term_taxonomy          |     | wp_4_terms                  |     | wp_5_commentmeta            |     | wp_5_comments               |     | wp_5_links                  |     | wp_5_options                |     | wp_5_postmeta               |     | wp_5_posts                  |     | wp_5_term_relationships     |     | wp_5_term_taxonomy          |     | wp_5_terms                  |     | wp_blog_versions            |     | wp_blogs                    |     | wp_commentmeta              |     | wp_comments                 |     | wp_domain_mapping           |     | wp_domain_mapping_logins    |     | wp_links                    |     | wp_options                  |     | wp_postmeta                 |     | wp_posts                    |     | wp_redirection_groups       |     | wp_redirection_items        |     | wp_redirection_logs         |     | wp_redirection_modules      |     | wp_registration_log         |     | wp_signups                  |     | wp_site                     |     | wp_sitemeta                 |     | wp_term_relationships       |     | wp_term_taxonomy            |     | wp_terms                    |     | wp_usermeta                 |     | wp_users                    |     | wp_woo_custom_nav_menus     |     | wp_woo_custom_nav_records   |     +-----------------------------+     67 rows in set (0.00 sec)


title: Custom post types - non-visible title and how it affects URL

text: I'm using WordPress as a customised CMS for my fishkeeping website. Currently I'm developing a Custom Post Type called species which produces an information sheet about a specific species of fish. With no intention of patronising anybody, just in case people aren't familiar with the classification of fishes, in the example below, I'll be referring to "Apistogramma panduro". "Apistogramma" is the "Genus" and "panduro" is the "Species". Both of these are fields in this Custom Post Type. For example, my Custom Post Type may produce a factsheet about Apistogramma panduro, containing details of how to keep it and breed it, etc. I'm wondering about the Title of the post because right now all of my posts are being given the Title "Auto Draft X" (X being a number) and as such the URL of "?species=auto-draft-9". I may be asking a three-pronged question here (the Title of the post, the URL of the post and any potential htaccess rewrites), but basically what I want to do is this: I'd like **all of my species profiles to have the Genus and Species in the URL** I'm not too bothered how it's laid out, but this would be ideal: **/species/apistogramma/panduro** Apologies if the post isn't best formed, it's 0100 and I've just spent hours with my "head in the code"..! Please don't hesitate to ask for clarity and I'll do my best when I wake up tomorrow.


title: Check for parent category

text: Code below is designed for testing to see if current post is in a category that is an ancestor (child/grandchild/greatgrandchild etc) of cat number 526               $cats = wp_get_post_categories();     if (cat_is_ancestor_of($cats[0],526)) {     echo "yes this works" ;     }      Not sure why this isnt working but likely something stupidly simple.... TIA


title: How to add submenu to Wordpress plugin in the same Directory of main Plugin?

text: I have created a plugin and now i want to add a third party plugin inside of the Main Plugin menu, so it can be submenu. How do you make the second plugin appear? **Directory Setup** : > /wp-content/plugins/main/ > > /wp-content/plugins/main/My_builder <----Second Plugin **What i have:**               function Main_admin_exist() {       add_menu_page('Main', 'Main', 'manage_options', 'main', 'Main_Dashboard', plugins_url( 'Main/images/icon.png' ));     } add_action('admin_menu', 'Main_admin_exist');          /*Add Sub Menu or Third Parties Plugin to Main*/     function mainThirdPartyPlugin(){         add_submenu_page('main', 'SecondPlugin', 'My Builder', 'manage_options' , 'SecondPlugin', 'SecondPlugin');     }add_action('admin_menu', 'mainThirdPartyPlugin');


title: How to disable or hide "collapse menu"

text: Is there a code in functions.php that I can add to disable or hide "collapse menu" button? The one that is on the left side of the admin menu in the dashboard. I'd need it for both admin, authors, contributors.


title: Use a separate custom table (not posts) to handle file upload data

text: **The Problem:** Website that has over 100 photos per post. Could possibly swell posts-table beyond 100K entries within a few years. **The Dilemma:** Would much rather stick to default WP UI for handling images/files with the built-in "Add Media" Uploader. I'd like to avoid using a separate File Gallery implementation if possible. **The Question:** Has anyone found a way to divert the saving of data away from the posts_table and to your own custom table to store the file-data? (without having to hack core files)