remove a single post_meta

I created a plugin that has multiple meta boxes. One meta box saves a single record by using `update_post_meta()`. Another meta box saves multiple record by using `add_post_meta()`. I do not have revisions turned on in the post_type. How would you `delete_post_meta()` a single specific record in the meta box that uses `add_post_meta()`? Best practice advise is needed. If you're going to send the whole `$post->ID` and it will get the array of records, how can I detect the specific `meta_key` set to be deleted? Here is the code on github: https://github.com/fritzdenim/stec- events/blob/62d5c641622f75a610da09462260f09713f0abab/index.php


Add menu item to edit specific page

I have pages setup and want a top level menu item to direct to editing a specific page. I'm reading through add_menu_page and it doesn't list how to get to specific pages or posts edit page. ie `post.php?post=FOO&action=edit`. Is this possible?


Expected snippet value not showing

I have a code snippet like this one,

                                                                                Home                             Any Description Here Manual/Auto

      And Im getting the list of menu items from this php code               <?php wp_nav_menu('menu=header_menu&container=false'); ?>      But the resultant of that cod is somehow like this,

                  Home

      So, what im missing here is the id="container" inside the tag and after the anchor tag the . I dont really know how to put those I have a reference               http://codex.wordpress.org/Function_Reference/wp_nav_menu      But the thing is I still cant understand as to how to add what the things Im missing from the snippet.


Get the index of post outside the loop

I'm trying to find out the index of the post which is currently viewed (single post page). I have an overview of the articles in the same category in a sidebar. But when a user navigates to a post which is located on page 2, the articles should now show up the articles of page 2, even when in single post page. This is the code for the sidebar to show posts from the actual page:
         <?php              $offset = 0;              //THIS IS THE PROBLEMATIC PART              if (is_single()) {             $modulo = $wp_query->current_post % 6; // $wp_query->current_post somehow ever returns 0             $offset = $wp_query->current_post - $modulo;         }              if (is_tag()) {             $args = array(                 'posts_per_page'   => 6,                 'tag'              => get_query_var('tag') );         }         else {             $args = array(                 'posts_per_page'   => 6,                 'category'         => $cat_id,                 'offset'           => $offset );         }              $myposts = get_posts( $args );         $i = 0;         foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
                 <?php if (is_blog()) { ?>                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                 <?php } else { ?>                 <a href="#" onclick="goTo(<?php echo $i; ?>);return false;"><?php the_title(); ?>                 <?php } ?>
         <?php $i++; endforeach; ?>
      As in the comments, $wp_query->current_post always returns 0, which I think is because it is outside a loop. How can i solve that issue?


unable to display the image meta value as background

I want to use meta url as background image.But the fact that I do not want to show "background-image:url('_')" this way because if my meta value is empty.What I thought to end up in this way.               $bgimage= get_post_meta( $post->ID, 'settings_image', true );     < div style="<?php echo 'background-image: url(".wp_get_attachment_url( $bgimage )")';?>">      I think this is best way since I do not want to put extra conditional block here.Did I make mistake in catenation?


input radio 'checked' saves, but select option 'selected' doesn't

So I followed a tutorial on how to create a meta box w/ the taxonomy terms shown in radio buttons. (Tutorial here for others if interested: http://wp.tutsplus.com/tutorials/creative-coding/how-to-use-radio-buttons- with-taxonomies/) My main goal is to create it to be a drop down. However, when converting the input radio styles to select option, the selected option does not save. Here is the code comparing the two:                     <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">                                <div id="<?php echo $taxonomy; ?>checklist" class="list:<?php echo $taxonomy?> categorychecklist form-no-clear">                                             <select id="select-taxonomy">                         <?php foreach($terms as $term){                            $id = $taxonomy.'-'.$term->term_id;                             $value= (is_taxonomy_hierarchical($taxonomy) ? "value='{$term->term_id}'" : "value='{$term->term_slug}'");                         echo "<option id='in-$id' name='{$name}'".selected($current,$term->term_id,false)." {$value} />$term->name</option>";                       } ?>                     </select>
                     <?php foreach($terms as $term){                        $id = $taxonomy.'-'.$term->term_id;                         $value= (is_taxonomy_hierarchical($taxonomy) ? "value='{$term->term_id}'" : "value='{$term->term_slug}'");             echo "";             echo "<input type='radio' id='in-$id' name='{$name}'".checked($current,$term->term_id,false)." {$value} />$term->name
";                           echo "";                   } ?>

      The only thing I can think of that is causing the selection not to save is change the input radio to an element, or it may be changing ".checked" to ".selected" Any help would be appreciated. Thanks, Roc.


Put CSS on TOP, how?

I have this mission, that regards setting my existing CSS on HEAD. I've tried to make a search on if there was any kind of plugin or code to automatically set the CSS code directly in Head. The main purpose is to follow YSlow recomendations such as "Put CSS on Top" How can i do that? Is there a code for it? a plugin? Does someone believes that can help me with this? My domain is http://findout-macau.com


Custom attribute values in drop down menu

I'm trying to modify the WOOCOMMERCE product search widget in a way that it can contain 3 drop down fields. Now these drop down fields need to be populated with custom attribute values that I've added to each product. In a pursuit to do this I saw a post: drop down list taxanomy problem On pasting the code in that post I got the following error. I'm absolutely new to wordpress. Any help will be highly appreciated. > Catchable fatal error: Object of class WP_Error could not be converted to > string in C:\wamp\www\sotcnri\wp-content\themes\mystile\product- > searchform.php on line 47               Call Stack     #TimeMemoryFunctionLocation     10.0015367840{main}(  )..\index.php:0     20.0024371528require( 'C:\wamp\www\sotcnri\wp-blog-header.php' )..\index.php:17     30.489432052608require_once( 'C:\wamp\www\sotcnri\wp-includes\template-loader.php' )..\wp-blog-header.php:16     40.491632067296include( 'C:\wamp\www\sotcnri\wp-content\themes\mystile\template-fullwidth.php' )..\template-loader.php:47     50.640632543096get_footer(  )..\template-fullwidth.php:56     60.640632543472locate_template(  )..\general-template.php:63     70.640832543608load_template(  )..\template.php:383     80.641232577544require_once( 'C:\wamp\www\sotcnri\wp-content\themes\mystile\footer.php' )..\template.php:407     90.642332578432woo_sidebar(  )..\footer.php:39     100.642332578432dynamic_sidebar(  )..\admin-sbm.php:8     110.642832580664call_user_func_array     (  )..\widgets.php:893     120.642832580896WP_Widget->display_callback(  )..\widgets.php:893     130.642932581296WC_Widget_Product_Search->widget(  )..\widgets.php:182     140.643132583384get_product_search_form(  )..\class-wc-widget-product-search.php:61     150.643432595944require( 'C:\wamp\www\sotcnri\wp-content\themes\mystile\product-searchform.php' )..\woocommerce-template.php:1490


Widget area does not show any contents for specific users in admin interface. How to go about debugging?

I use a custom theme on a WP-Multisite instance which also uses WPML plugin. I am pretty technical and I can read PHP code but I do not have any WP experience. The theme has three custom widget areas - footer left, footer center and footer right. As a network admin I can properly put content in all the widget areas. But users, who are admins on only the actual sites they want to edit can only edit the content in the center and right content area. When trying to edit the content in the left footer area as site admin without network admin permissions, however, the content does not show up. What's worse, when I edit the content in the center or right footer area as as a site-admin, then the content in the left (which I can't see) gets deleted. Any idea how to go about this issue? I can't really disable any of the plugins as this is a production system. Should I satrt building a staging system, or does anyone have an idea what the issue is?


Wordpress Theme Update Action?

I've done quite a bit of searching. I'm looking for hook/action called after a theme update. I know the initialization one - but a basic update? Cannot seem to find. If one does not exist, how can you run a function after auto-updating?


"Current" class on a singular page menu item with custom post types?

I'm struggling to get a "current" class for the corresponding menu item when I'm on a singular (child) page of a custom post type. These are the arguments I used when registering the post type with register_post_type:                   array(             'labels' => array(...),             'public' => true,             'has_archive' => true,             'capability_type' => 'post',             'hierarchical' => true,             'menu_position' => 5,             'supports' => array('title', 'editor', 'thumbnail'),             )      On the archive page everything is working fine and I do get the "current-menu- item" class for the current post types menu item. What can I do to make it work? I'm using wp_nav_menu(); to generate the menu.


Autosort uploads in galleries by filename

A client of mine wishes to not have to sort images uploaded into a post gallery, but instead rely on its filename for sorting (e.g. "01_sample.jpg", "02_sample.jpg"). This would save a lot of time for the client, and I'm wondering if this is possible to achieve using WP 3.5+ and the recent changes to Add Media?


Gravity forms - Can I have multiple custom spinners?

I wish to change the default ajax loader for gravity forms. I have done this using the following code (link found here):               add_filter( 'gform_ajax_spinner_url', 'cwwp_custom_gforms_spinner' );             /**        * Changes the default Gravity Forms AJAX spinner.        *        * @since 1.0.0        *        * @param string $src The default spinner URL        * @return string $src The new spinner URL        */              function cwwp_custom_gforms_spinner( $src ) {              return get_stylesheet_directory_uri() . '/assets/img/css/newsletter-loader.gif';          }      This seems to work fine. What I would like todo is set **another** custom ajax spinner for a different form on a different page. The design of the page is different and I would like to set a different spinner. Any ideas how I do this?


Primary navigation menu & footer not showing in category / tag page

I tried to find a solution for primary navigation not showing in some pages, ie. archive.php. I found one from here but it's still giving me notices. I'm using `Reverie Theme` in `WordPress 3.6-alpha-23288` This is my code after implementing the fix **Plugins/MyMainPlugin.php**               add_filter( 'getMainMenu',  array( $this, 'getMainMenu'),           10, 1);     function getMainMenu( $menuLocation ) {         $locations          = get_nav_menu_locations();              if ( empty( $menuLocation ) ) {             $menuLocation   = 'primary_navigation';         }              $menuItems          = wp_get_nav_menu_items( $locations[ $menuLocation ] );         if ( empty( $menuItems ) ) {             return false;         } else {             wp_nav_menu( array(                 'theme_location'    => $menuLocation,                 'container'         => false,                 'menu_class'        => '',                 'echo'              => true,                 'before'            => '',                 'after'             => '',                 'link_before'       => '',                 'link_after'        => '',                 'depth'             => 0,                 'items_wrap'        => '
%3$s
',                 'walker'            => new reverie_walker() ) );             return true;         }     }      **Theme/header.php**               if ( !apply_filters( 'getMainMenu', 'primary_navigation' ) ) {         $backup     = $wp_query;         $wp_query   = NULL;         $wp_query   = new WP_Query( array( 'post-type' => 'post' ) );         apply_filters( 'getMainMenu', 'primary_navigation' );         $wp_query   = $backup;     }      **Notices** > Notice: is_category was called incorrectly. Conditional query tags do not > work before the query is run. Before then, they always return false. Please > see Debugging in WordPress for more information. (This message was added in > version 3.1.) in /var/www/customers/xxx/public_html/wp- > includes/functions.php on line 2981 Notice: is_tag was called incorrectly. > Conditional query tags do not work before the query is run. Before then, > they always return false. Please see Debugging in WordPress for more > information. (This message was added in version 3.1.) in > /var/www/customers/xxx/public_html/wp-includes/functions.php on line 2981 Any ideas how to solve this, and might be causing this? I have no idea what's causing that. **Update**   This actually affects to footer as well. So, I don't see any footer on my archive.php page either.


Most Wordpress sites causing realpath errors

recently installed some debugging software on our server and realised that most errors are coming from realpath() in Wordpress sites.               realpath() [function. realpath]: open_basedir restriction in effect. File(/var/www/vhosts/ xxx. com) is not within the allowed path(s): (/var/www/vhosts/ xxx. com/httpdocs/:/tmp/)      The sites are working OK but these are bugging me. Mostly because its hard to see any serious errors coming up! Would errors like this also affect performance?


How to detect if a Shortcode is being called on a page?

I'm trying to push some variables to google analytics and would like to be able to detect if a shortcode has been included on a page at all. Anybody know a smart way going about this? Thank you! Noel


Display smilies in Sidebar, too?

I want the smilies to be generated in my sidebar (where it shows the recent posts, comments etc.) and not being displayed as text only. I've been searching through the Wordpress Codex, Google and here, but couldn't find any answers. Is this possible at all anyways? How would I do it for recent comments that I display in the sidebar?               <?php   $comments = get_comments('status=approve&number=5'); ?>     <?php foreach ($comments as $comment) { ?>

<?php             $title = get_the_title($comment->comment_post_ID);             echo get_avatar( $comment, '45' );     echo strip_tags($comment->comment_author); ?> commented on <a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php echo $comment->comment_ID; ?>" rel="external nofollow" title="<?php echo $title; ?>"> <?php echo $title; ?>: <?php echo wp_html_excerpt( $comment->comment_content, 45 ); ?> (...)

     <?php }  ?>      Thanks in advance.


Using Relevanssi outside search with cpt/custom taxonomy

I'm trying to use Relevanssi to generate related articles using this example script. It does the job but I would need to modify it and I'm not all that familiar with query_vars. All my articles are in an `article` custom post type with a custom category taxonomy `article_category` and what I want to do is to limit the results to one `article_category` (there are three different top categories and I want to avoid having the results mixed between those, I would use `get_ancestors()` to find what top category to use ). I would also like to know how to limit the results to the `article` custom post type - though this will sort itself out automagically if I can limit the results to a category of my custom taxonomy. You're supposed to be able to add query_vars but, sadly, I have no idea what those are other than in this context, but the variables from the example aren't part of that - e.g. where does a variable like the `operator` bit come from in this `$query->query_vars['operator']`?


Tagcloud: different color for different text size

I'm using `<?php wp_tag_cloud( $args ); ?>` to create a tag in my sidebar. With the "args" you can style it quite a bit, even the different text size, but it doesn't seem to be possible to apply different colors. What I did is a plain CSS solution which looks somewhat like this:               #tagcloud ul .tag-link-8 {     color:#666;     }          #tagcloud ul .tag-link-7 {     color:#7EA7C9;     }          #tagcloud ul .tag-link-9 {     color:#6A9EA5;     }      It works okay, but this is a hassle. I have to apply the colors manually and once I have 50 tags or so this will be kind of ridiculous. I was wondering if there is a way to connect e.g. the text-size to a specific color (like some tagcloud plugins seem to do anyways) (size:8 = red etc.)? Anybody any ideas? Thanks a lot in advance!


Is there a way to create a meta box that can be added multiple times to a post dynamically?

This shouldn't be that difficult (I wouldn't think) ... I just want to have a section of my theme (directors) that has the name of the director / their bio in the title and post respectively (done). _But_ , I would also like to have a meta-box on their post for their work (title / client / date / video link / thumb ) and I would like to be able to **add** or **remove** instances of this meta box as needed ... i.e. director A) has 3 videos ... director B) has 5 videos. How do I create a meta box (or is there something else in WP) that can be dynamically added / removed (like the way the menu system works) where I have a menu and I can add as many or as few items to the menu as i want / need.


WooCommerce wp_insert_post action firing on every save

function initial_product_data ( $post_id ) {     // lets get out of here if this is not a new product     if ( 'product' != $_POST['post_type'] )         return;          // make sure the post isn't automagically featured     // WTF WooCommerce??!!     update_post_meta( $post_id, '_featured', 'no' );          // automatically set the swatch     update_post_meta( $post_id, '_swatch_type', 'pickers' );         update_post_meta( $post_id, '_swatch_type_options', unserialize('a:1:{s:7:"pa_size";a:4:{s:4:"type";s:12:"term_options";s:6:"layout";s:7:"default";s:4:"size";s:19:"swatches_image_size";s:10:"attributes";a:3:{s:7:"x-large";a:3:{s:4:"type";s:5:"color";s:5:"color";s:7:"#FFFFFF";s:5:"image";s:1:"0";}s:23:"x-large-toplarge-bottom";a:3:{s:4:"type";s:5:"color";s:5:"color";s:7:"#FFFFFF";s:5:"image";s:1:"0";}s:23:"x-small-topsmall-bottom";a:3:{s:4:"type";s:5:"color";s:5:"color";s:7:"#FFFFFF";s:5:"image";s:1:"0";}}}}') );     }          add_action( 'wp_insert_post', 'initial_product_data' );      The code works fine and _almost_ does what its supposed to do. However, it seems like it fires _every time_ a product is saved and the user can't alter the values set on the initial product creation. Any suggestions? Or is this a WordPress bug?


Perform internal redirect in WordPress?

Let say I have an existing page named "bar", e.g. http://www.example.com/bar I want to write a plugin, which when called, will load the content exactly same as bar (not just post_content, but the whole page such as menu, sidebar and footer) Something like..               if ($_SERVER['REQUEST_URI'] == '/foo') {       // Perform internal redirect to /bar     }      Any idea?


Run a Wordpress function inside a wp_query loop result

I have a search results page that displays multiple results in a multi column layout. I am trying to run a function via a button/link that will allow users to add that post to a "favorites list". The function works 100% perfectly on the first result, but gets ignored when I try do any others. I am sure this has something to do with non-dynamic forms/id's as all the results are identical - but even after adding unique id to the forms and buttons the same thing happens. Any suggestions? Here is the code:   1. We get wp_query from filters: wp_query: https://gist.github.com/stankobrin/f0d19b2bdc5f0f77b8e4   2. Inside the results we call the apf_post_form to add to favourites: apf_post_form function: https://gist.github.com/stankobrin/975b24c7d7a780b82fc8   3. AJAX refreshes the page updates the response and resets the fields Any help would be highly appreciated!


include other content type post ID not working

I am calling content type portfolio in a page but i want to show some pages by id with portfolio content type, below code only retrieve the portfolio posts.                    $args = array( 'post_type' => 'portfolio', 'include' => '73,71' ,          'posts_per_page' => 30, 'order' => 'ASC', 'paged' => get_query_var('paged'));         $loop = new WP_Query( $args );         while ( $loop->have_posts() ) : $loop->the_post();      Note: include Id 73,71 content types are 'page'


Styling Active Links Within Wordpress

I wish to style the active link (ie. when home page is selected that the home page link be a different colour)               .current-menu-item a { color: #36c; }      My test site is : www.milknhny.co.uk/ShopTest I placed this in the CSS as i believe this was the class that i wished to change, however it does not appear to have worked. Could i please ask where i have gone wrong on this? thanks


How to echo a different field if another field is empty?

I succeeded in getting both images and video to echo into a bootstrap carousel. However, I run into a problem when the post contains no images. If there are no images then there is no class="item active" so the bootstrap carousel won't show. Here is my workaround I feel like I'm almost there, can someone give me a hand?               <?php $myCarousel = get_order_field('projectdetails_image'); // use the Custom Group name              if( !empty( $myCarousel )) {                     foreach($myCarousel as $carousel){                                 if ($counter == 0) {                                     echo "
";                                     echo '';                                     echo "
";                                 }                                 else{                                     echo "
";                                     echo '';                                     echo "
";                                 }                                 $counter++;                          $videos = get_order_field('video_vimeo');                     foreach($videos as $video){                         if ( get('video_vimeo',TRUE) ) {                                 echo "

";                                 echo get('video_vimeo',1,$video);                                 echo "

";                         }                         else {}                     }                     }                }             else{                                 $videos = get_order_field('video_vimeo');                     foreach($videos as $video){                         if ( get('video_vimeo',TRUE) ) {                                 echo "

";                                 echo get('video_vimeo',1,$video);                                 echo "

";                         }                         else {}                     }                }?>      Got it finally:                   <?php $myCarousel = get_order_field('projectdetails_image'); // use the Custom Group name      if( !empty( $myCarousel )) {             foreach($myCarousel as $carousel){             $myimg = get('projectdetails_image',1,$carousel);             if ( !$myimg ) {             $videos = get_order_field('video_vimeo');             foreach($videos as $video){                 if ( get('video_vimeo',TRUE) ) {                         echo "

";                         echo get('video_vimeo',1,$video);                         echo "

";                 }                 else {}             }                }             if ( $myimg ) {                 echo "
";                 echo '';                 echo "
";                 $counter++;                      $videos = get_order_field('video_vimeo');                 foreach($videos as $video){                 if ( get('video_vimeo',TRUE) ) {                     echo "

";                     echo get('video_vimeo',1,$video);                     echo "

";                 }}             }         }     }     else{                         $videos = get_order_field('video_vimeo');             foreach($videos as $video){                 if ( get('video_vimeo',TRUE) ) {                         echo "

";                         echo get('video_vimeo',1,$video);                         echo "

";                 }                 else {}             }        }?>


Unable to browse WP plugin directory within WP's admin panel

This is kind of a weird problem. I upgraded all my WP installations to the latest 3.8 version and in one of them I seem to have lost the ability to browse through the plugin directory. When I click on "Add New" to install a new plugin and try to search for something, no matter what I type on the search box I always get this: _No plugins match your request._ Clicking on Featured, Popular etc. gives nothing as well. I tried reinstalling WP, deactivating installed plugins but nothing changed. Permissions to the wp-content and the plugins folder seem to be ok and I have 3 more separate WP installations in the same server without this problem. Is there anything else I could try? Has anyone else had this problem?


How to Display Custom Taxonomies in an Un-ordered HTML List

Having a Custom Taxonomy function like below, can you please let me know how I can list all of my Taxonomies in an unordered html list               enter code here     function create_conference_taxonomy() {      $topiclabels = array(      'name' => 'Topic',      'singular_name' => 'topic',      'search_items' => 'Search topics',      'popular_items' => 'Popular topics',      'all_items' => 'All topics',      'parent_item' => null,      'parent_item_colon' => null,      'edit_item' => 'Edit topic',      'update_item' => 'Update topic',      'add_new_item' => 'Add new topic',      'new_item_name' => 'New topic name',      'separate_items_with_commas' => 'Separate topics with commas',      'add_or_remove_items' => 'Add or remove topics',      'choose_from_most_used' => 'Choose from common topics',      'menu_name' => 'Conference topics',       );       register_taxonomy( 'conference_topics', 'conference_session',         array(       'hierarchical' => false,       'labels' => $topiclabels,       'query_var' => true,       'update_count_callback' => '_update_post_term_count',       'rewrite' => array('slug' => 'topics' )        )       );      }      Thanks


RSS Feed in Custom Field

I have a custom field intended for a rss feed. It is simpley a URL in the field, how do I take that url entered and output it into the correct section in the template?               <?php include_once(ABSPATH . WPINC . '/rss.php');wp_rss('<?php echo get_post_meta($post->ID, 'wpcf-rss', true); ?>', 3); ?>      Does not work


Make 'Post 2 Post' Connection mandatory

As the title states, I need to make a P2P connection a required field when creating new posts. The only mention of such a feature that I've found is here, but I'm not sure how to implement it.


Wordpress backup(on another server)leading to old server addy and WP

So long story short, someone told me about BACKUPBUDDY and how good it is, etc, and it is...now long story short, one of my clients, wants to move their site from FATCOW to HOSTGATOR. I went in, created the backup with BACKUPBUDDY on the old site(fat cow), then went to the new site and migrated the info.(into hostgator) now obviously for testing and other edits they want made,etc i log into the server or view the new site on the browser with their IP address.(host gator the new one)...and i havent pointed the domains to new site yet.... now that said, i noticed that when i use for example, "ip address / wp- login.php" it logs me in but then when i look up in the address bar, it says the FATCOW(old server) name/domain instead of the IP. so instead of seeing "ip addy /wplogin " i see " full name of site/wp-login " So my quesiton is , whats happening? if i cant fix this, i cant really test to make sure all is okay b4 pointing the nameservers. Any ideas as to whats going on? im a bit of a WP noob so... Thanks in advanced.


Removing plugin settings from database

I am developing a little plugin that has couple options. For that i use this code:               add_action('admin_init', array($this, 'pa_register_settings'));     function pa_register_settings()     {         register_setting('pa_options', 'pa_settings');         register_setting('pa_options', 'pa_metrics');         register_setting('pa_options', 'pa_token');     }      I would like to know what is the proper way to remove those settings from database when plugin is uninstalled?


Want Page Descendants when using query_posts post_parent or child_of

I'm trying to use query_posts to list all descendants of a page ID. Using post_parent only lists the first-level children. This Trac ticket seems to address it: http://core.trac.wordpress.org/ticket/5742, but I don't understand it -- post_parent only lists the first-level children.               <?php         query_posts( array(         'post_parent' => 58, // Only shows posts that are direct children of the Machinery page. I want all descendants.         //'child_of' => 58, // When used, shows posts filterd by taxonomy and term, but not filtered by child of ID 58. Acutally omits direct child of 58 but shows grandchild.         'post_status' => 'any',         'post_type' => 'any',         'taxonomy' => 'industries',         'term' => 'dairy'         ));      ?>     <?php if ( have_posts() ) : ?>
Dairy Machinery

             <?php while (have_posts()) : the_post(); ?>
                     <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
             <?php endwhile; ?>
     <?php endif; wp_reset_query(); ?>      How do I get query_posts to list all descendants of a page ID?


WP User Avatar preview for users

I have downloaded WP User Avatar plugin, to add the functionality to create your own avatars for users. I was wondering if it is possible to show for each user the avatar in my theme markup. How can I do this?


Why don't my custom menus show up in WPtouch Pro?

I'm using WPtouch Pro to create a mobile theme for my wordpress installation. I've activated it, but the custom menus I've created don't show up in menus drop down. Note that I'm using a different database table prefix than the default wp_. How can I get them to show up?


Best way to enqueue extremely popular scripts like bootstrap and font awesome

Scripts and Styles like bootstrap and font awesome are used on hundreds/thousands of plugins. Whats the best way to check for this? If two scripts aren't registered with exact same name they'll both get loaded. This is most frustrating when a plugin includes font-icons from ico-moon or somewhere similar that change the icon codes so all the icons will get loaded with the wrong images. Is there a good way to remove adding scripts/styles? : My guess would be something like using `wp_script_is()` and checking an array of files that would match ones like bootstrap and font awesome, but that sounds pretty heavy/ tedious. If there isn't a way to ensure this doesn't happen, what is the best practices for naming your scripts? Sorry if this is repeat, it seems like something that's probably been asked just couldn't find it.


wp-pagenavi getting 404 page not found

Wordpress WP-PageNavi plugin gettinf 404 error. here is my code.                <?php  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;             query_posts(array(         'posts_per_page' => 3,         'paged' => $paged        )       ); ?>         <?php if(have_posts()) : while(have_posts()) : the_post(); ?>          <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>          <?php the_title('
', '
'); ?>           <?php endwhile;  if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>             <?php wp_reset_query(); else : ?>
<?php _e('Sorry, no posts matched your criteria', 'example');
            <? php endif; ?>


What variables from the main query do I take over to make an archive load a page out of the loop?

My question is a little confusing, I realize, but I'm not sure how else to word it -- sorry! I might be going about this the wrong way but I want to do with a CPT archive what WordPress does with the 'post' post_type and how you associate it with a specific page from the Settings > Readings section (so when you land on page "blog" it acts like the "post" archive). The reason for this is that I want it to recognize the featured image and metadata for that specific page. I figure I have to hook into pre_get_post and make sure it's the main query but I'm not sure which variables to hijack to make it act this way. Any ideas?


add login and signup popup form in header

I use `<?php wp_register(); ?> <?php wp_loginout(); ?>` to show a link to the wordpress login and sign up screen. It opens up another page. My question is how do I make it so that when the user clicks the link a pop up will appear. Like using jQuery. But on these php codes. thanks you for your help


can I add a custom format to the format option in the text panel?

In the text editor, where you can set headings and other settings, is it possible to add your own styles for clients to use? and even remove the unnecessary ones?


Removing <li> from Comment

I'm making a custom comment template, and I do not wish to use a list to display comments. By default, WordPress puts the following at the end of every comment:
      I know I could hack the core `wp-includes/comment-template.php`, but that would leave me to not be able to update normally. Is there a way to remove this? Here's my functions callback:               <section id="li-comment-<?php comment_ID(); ?>">         <article id="comment-<?php comment_ID(); ?>" class="comment <?php if ($comment->comment_author_email == get_the_author_email()) { echo 'author-comment'; } ?>">
                                      <?php echo get_avatar($comment, '50'); ?>                                  <?php comment_text(); ?>

Posted by : <?php echo get_comment_author(); ?>

On <?php the_time('l, F jS, Y') ?>  at <?php the_time() ?>

                     <?php comment_reply_link( array_merge( $args, array( 'reply_text' => 'Reply to Comment', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>


"Add Media" button in custom plugin

I'm writing a custom plugin and i would like to add the "Add Media" button. I just need to upload media, not to retrieve any content/data from the uploaded file. How can I add this button? Thanks


Pagination with WP_Query is buggy - working for some pages, but not the others

I'm having a very peculiar bug with pagination :( I'm trying to display 4 posts per page for a category with slug "lastest-news". The pagination function seems to work correctly. There are 33 posts. The pagination gets constructed correctly with 9 pages and links of following format: /category/lastest-news/page// The interesting thing is that it works correctly (displaying 4 posts per page) from page 1-4 including. However, for pages 5-9 it doesn't work at all. It doesn't even seem to serve the template... the only error that I could spot is of the page saying "Nothing found for Category Lastest-news Page 5". I would understand if it won't work at all, but for randomly 4 pages and not more? I would really really appreciate any help! I've spend about over 4 hours trying to figure out what's wrong and it's bugging me. Thanks for help :) I'm using the following code for query:               <?php      $page = get_query_var('paged');     $posts_on_page = new WP_Query("posts_per_page=4&category_name=lastest-news&paged=".$page);          //loop to display every one of 4 posts          //pagination     pagination($posts_on_page->max_num_pages);     ?>      I'm using pagination function from this post: http://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination- without-plugin Here is the function (which seems to work fine):               function pagination($pages = '', $range = 2){        $showitems = ($range * 2)+1;             global $paged;      if(empty($paged)) $paged = 1;           if($pages == '')      {          global $wp_query;          $pages = $wp_query->max_num_pages;          if(!$pages)          {              $pages = 1;          }      }              if(1 != $pages)      {          echo "
";          if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "«";          if($paged > 1 && $showitems < $pages) echo "‹";               for ($i=1; $i <= $pages; $i++)          {              if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))              {                  echo ($paged == $i)? "".$i."":"".$i."";              }          }               if ($paged < $pages && $showitems < $pages) echo "›";            if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "»";          echo "
\n";      }     }


How to display the page title/content in the Posts page?

I made a home.php file and called it Blog. It set it to be the Posts page, but I would like to add a title that will be displayed in that page (the title of page or content). e.g:               Posts page:              Page title         (Maybe page content)              == Posts ==              Post Title         Post Content          Post Title and so on


What's the section of code (or loop) which retrieves the Page title and description?

What's the code of the loop which retrieves the Page title and description? I checked the code inside page.php of the Starkers theme (I guess is the same as the TwentyTen theme):               <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>               <?php if ( is_front_page() ) { ?>
<?php the_title(); ?>
          <?php } else { ?>
<?php the_title(); ?>
          <?php } ?>                    <?php the_content(); ?>           <?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'twentyten' ), 'after' => '' ) ); ?>           <?php edit_post_link( __( 'Edit', 'twentyten' ), '', '' ); ?>              <?php comments_template( '', true ); ?>      I looks identical to the loop which retrieves the main (blog) posts. What's the difference? Which is the part which retrieves the title and content of the current Page?


Favorite post when post is updated

I want to auto-favorite a post (using wp favorite posts) when a post is updated. I tried this :               function myfunction($post_id)     {     wpfp_add_favorite($post_id);     }     add_action( 'save_post', 'myfunction' );


Move out of sync posts from one database to another

I have an issue where the following has occurred: WP install is pointing to database server 1. Database server 1 is backed up. Database from DB server 2 is restored onto DB server 1. I need to get all the posts that exist in the post from DB backup 1 that do not exist in DB server 2. What is the easiest way to do this? I am currently manually comparing the mysqldump files, but this is a 30+ site multisite installation, and I would prefer to not make things worse.


Top ten tags ala Delicious

How would I create a list that only shows the ten most used tags for my site? Kind of how Delicious organizes tags. Any ideas?


Hoe to add rel="nofollow" to wp_list_pages

I'd like to use the wp_list_pages as a navigation bar, but I don't want the links to be followed. This is the simple version of the code I'm using `<?php wp_list_pages('hierarchical=1&title_li=&depth=1'); ?>` but I have no idea how to add the "nofollow" to the links.


add_theme_support('my-custom-feature')

According to the codex, there is no way that I can see to define a custom theme support feature. Ideally, I'd like to set a feature in my child theme that the parent theme could check for. Does an equivalent function exist that would be appropriate to use in this context? For example, I'd like the parent theme to have a new sidebar in the header area, but since I'm introducing this sidebar area late, its presence could break previously created child theme layout look and feel. So, for new child themes created after this addition, I'd like to be able to call something like:               add_theme_support('header-sidebar');      Then, in my parent theme, where I register the default sidebars available to any child theme, I'd like to use:               if(current_theme_supports('header-sidebar')){      /* create a sidebar for the header area */      register_sidebar(...)     }


Multi-level ordering in Wordpress

I have a collection of posts and first I want to order them by 'name' in ASC order and then order by 'date' in ASC order. How does one go about doing this?


How to "pair" two widgets side by side in one sidebar

Currently I use the Pinboard theme with 2 sidebars. In each sidebar I place one kind of widget several times. The point is that 2 widgets of a row (1 of each sidebar) belong together regarding the content. What I really want is that I could place the 2 different widgets (belonging together) side by side in one sidebar and repeat this for the others in the same sidebar. I found the extensible widgets plugin (http://wordpress.org/plugins/extensible-widgets/) but it isn't maintained anymore for 3 years. So I didn't install it. Furthermore, I found some discussions about solving similar problems with tables or with css anyhow. For better understanding you can see my WP instance here: http://turbine.reimone.net/ My problem is that each widget in a "widget pair" must be configured. The first widget is an event widget which comes from the All-in-One Event Calendar by Timely plugin and the second widget just is a text widget containing simple html. A "widget pair" is meant to be 2 widgets belonging together by content. Both widgets of a pair should be aligned side by side in the layout. I hope that both upper edges (one of each widget) in a pair are on the same vertical level so that visitors can determine better which widgets belong together. Can you help me to solve this?


Custom Page redirects after user registers

I'm using the "Theme My Login" plugin and basically I needed to make it so if the user fills out the registration form on page "X", they get taken to page "Y". I have done this with the help of a plugin called "Peter's Login Redirect". The issue is I need to make it conditional, e.g. if the registration form is filled out on page "A", go to page "B", and if it was filled out on page "C", go to "D". The client keeps adding extra features to the site, which if I knew about from the start, I would never have recommended WordPress. It's too late now and the site is live. They just need to add this feature for a big promotion they are running.


How to check if a page exists by url?

I need to display certain content depending on whether or not a page URL exists. I don't want to check by title, because certain pages will have the same title, and just different parent pages. For example one page may be               http://example.com/analysis/firstNamelastName     http://example.com/exercise/firstNamelastName       I just need to know if one of these URL exists or not.


Wordpress.com hosting question

I'm recently newbie using WP. My website idea consist in fast and easy/direct video uploading, which is possible using my premium WordPress.com subscription (13gb storage and "unlimited" bandwidth). The issue is that, my website core will consist in a large amount of video bandwidth (the videos size around 5-10 mb, but with multiple visualizations). My biggest fear is that the WordPress server may have problems with that and the website video's performance may be reduced. Moreover, i read several articles not recommending hosting in wordpress.com due to bandwidth limitations but to have a independent host service. Unfortunately, this possibility doesn't allow the essential fast and easy/direct video upload that i need for my website. My question is, considering the requirements for my website, does wordpress.com server guarantee the optimum video visualization? Is there a way to use a independent hosting service like bluehosting but yet still upload the videos in a direct way like in wordpress.com? Thank you for your time and patience Cheers, R.C:


how do I get the tag name from tag id?

I have the tag ID, in integer format. I want to convert this to the tag name. e.g. "cars" How do I do this?


Plugin and theme script load order

I'm building a plugin that adds scripts to the page using `wp_register_script` and `wp_enqueue_script`. However, when the page loads, it's loading the plugin scripts before the theme's scripts. This is causing some errors because the theme is loading jQuery, which needs to be loaded first. Is there a way of making the plugin script load last, so that the theme script is loading first in the page?


How can I make my domain work with my site?

I host & run self-installed WP blogs, but in this instance I'm desperate for some help. I have a virtual server, via Digital Ocean setup running the latest version of WordPress. Here's my environment; Digital Ocean Ubuntu 14.04LTS droplet VPS PHP Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies mySQL Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64) using readline 6.3 The site binds correctly via its IP, and I've setup Permalinks to be in the format domain/sample-post I also have a domain set up via Digital Ocean, and that directs to the blog, so mariodecristofanosblog.com correctly points to the WP install. So what I want to do now is to ensure the site fully resolves via domain name, and not IP. So posts and such like change from 178.62.47.214/my-post to mariodecristofanosblog.com/my-post. I'm technical. But I'm missing something, I'd really love some help. I modified the wp-posts sql database via PHPMyadmin to replace all instances of the IP with the full domain name. I used an online tool, to avoid serialization issues and I made sure to only touch the wp-posts database. I then changes the site URL and home URL settings (General > Settings) to be mariodecristofanosblog.com as opposed to the IP Finally, I then FTP'ed in and moved the files from the root (www) into a folder called mariodecristofansblog.com The above is basically a short summary of all the online guides which are available to achieve this. I'm doing something wrong or I'm missing something because I just can't get this to work. Could someone please please please help!?


Wordpress running on rasppi not displaying themes correctly

I have a Raspberry pi that I set up to be a webserver, and it works great. As far as I can tell, my only issue is that the themes do not display right. (The text seems to be okay, but its like the HTML never saw the CSS) I have the theme set to "Finch" and its displaying as plain HTML page. Being new to Wordpress, I would assume I am doing something wrong. I just don't know what. Has anyone had/resolved this problem for yourself?


Export Users and their Advanced Custom Fields

I've google it but i am still looking for a solution. Is there a plugin or method to export wordpress users with their advanced custom fields? I don't want to export ACFs structure but users' data.


have_posts is empty on category.php

All the applicable code is in this gist. I have a really simple `category.php` template. I have 3 posts, each belonging to the same parent category, and 2 belonging to one child category and the third belonging to the other child category. When I use `wp_list_categories` to generate the category links, it works fine. But when I click the link to look at any of the categories, I get the `else` from the `have_posts` `if` statement.


how to give a user a role?

How possible give a user the 'adminstrator' role? for example I made a user with wp_insert_user(array(..., 'role' => 'Administrator') but it doesn't effect on role of user. thanks.


Why I am not able to direct user to my blog section without login?

function wpse_41699_wp(){         if( is_page('Login')||is_page('register')||is_page('Blog')||is_page('blog') ){             return;         }else{             if(!is_user_logged_in()){                 $url = get_bloginfo('home').'/login';//ACW-login location need to be specified                 header('HTTP/1.1 403 Forbidden');                 header("Location: $url");                 exit;             }         }     }      In the function.php, I added above code, I used above code to disable user access to my site without login, but I want to make regular use able to access blog section which is a page named Blog. but I do not konw why still, I will be direct to login page, while register page is been successufully unblocked from been request to login. Can anyone help me on this one? Thanks!


Using a front controller in a Wordpress plugin, any suggestions?

My idea was to use a front controller in our plugin. has anyone done that already? The responsibilities of the controller should be   * initiate router class;    * provide access to objects registry, which will be responsible for finding and initializing other classes (possibly through factories);    * initiate class responsible for binding WordPress actions. I was thinking about following the standard martin fowler example but if someone has already tried it I might want to learn from him.


Move Multiple WP Installs on a single domain to WP Multisite

I have a domain with 18 WP Sites installed on it - all under different directories domain.com/site1 domain.com/site2 domain.com/site3 I want to try and get all of the sites migrated to a single WP Multisite Blog All the instructions I can find on this appear to be moving WP sites from different domains or sub domains First step : Go through all of the 18 sites and make a back-up Second step : Convert the WP site within root to WP Multiuser Third step (For each of the 18 sites) : Set up new "site" with MU Admin Fourth Step (For each of the 18 sites) : Import data from back-up The problem I have is how do I then check that everything has been migrated over correctly when the old site will no longer be visible ? Also, will MU let me set up a site on the same path if a site already exists, for example if old site was on path domain.com/site1 - I would want new site within MU to be also "site1" Hope this make sense Any tips and advice would be appreciated Thanks. David


Delete a custom post function value

I'm having an issue with custom functions at the moment, once a value has been added to the database I can not delete the value, what's the best way to solve this? Basically I've created a custom post type for a games database, when adding a game there are several custom post functions; game developer, publisher, review score and a review URL, now if I enter a test URL it will save that but when I try to delete it, it still appears and wont save the deleted value. Here is the code I'm using:               <?php     function display_games_database_meta_box( $games_database ) {     // Retrieve information from the game     $game_publisher = esc_html( get_post_meta( $games_database->ID, 'game_publisher', true     ) );     $game_developer = esc_html( get_post_meta( $games_database->ID, 'game_developer', true ) );     $game_rating = intval( get_post_meta( $games_database->ID, 'game_rating', true ) );     $game_review_link = esc_html( get_post_meta( $games_database->ID, 'game_review_link', true ) );     $game_release = esc_html( get_post_meta( $games_database->ID, 'game_release', true ) );     ?>

             Game Publisher	             <input type="text" size="80" name="games_database_game_publisher" value="<?    php echo $game_publisher; ?>" />

             Game Developer	             <input type="text" size="80" name="games_database_game_developer" value="<?php echo $game_developer; ?>" />

             Game Rating	                              <select style="width: 100px" name="games_database_rating">                 <option value="No Score">No Score</option>                 <?php                 // Generate all items of drop-down list                 for ( $rating = 10; $rating >= 1; $rating -- ) {                 ?>                     <option value="<?php echo $rating; ?>" <?php echo selected( $rating, $game_rating ); ?>>                     <?php echo $rating; ?>/10<?php } ?>                      </select>

             Review Link (Use the full URL)	             <input type="text" size="80" name="games_database_review_link" value="<?php echo $game_review_link; ?>" />

             Game Release Date (Format: June 26th 2013)	             <input type="text" size="80" name="games_database_game_release" value="<?    php echo $game_release; ?>" />

     <?php     }     ?>     <?php     // Adds and saves the game to the database     add_action( 'save_post', 'add_games_database_fields', 10, 4 );     function add_games_database_fields( $games_database_id, $games_database ) {     // Check post type for games     if ( $games_database->post_type == 'games_database' ) {         // Store data in post meta table if present in post data         if ( isset( $_POST['games_database_game_publisher'] ) && $_POST['games_database_game_publisher'] != '' ) {             update_post_meta( $games_database_id, 'game_publisher', $_POST['games_database_game_publisher'] );         }         if ( isset( $_POST['games_database_game_developer'] ) && $_POST['games_database_game_developer'] != '' ) {             update_post_meta( $games_database_id, 'game_developer', $_POST['games_database_game_developer'] );         }         if ( isset( $_POST['games_database_rating'] ) && $_POST['games_database_rating'] != '' ) {             update_post_meta( $games_database_id, 'game_rating', $_POST['games_database_rating'] );         }         if ( isset( $_POST['games_database_review_link'] ) && $_POST['games_database_review_link'] != '' ) {             update_post_meta( $games_database_id, 'game_review_link', $_POST['games_database_review_link'] );         }         if ( isset( $_POST['games_database_game_release'] ) && $_POST['games_database_game_release'] != '' ) {             update_post_meta( $games_database_id, 'game_release', $_POST['games_database_game_release'] );         }     }     }      Can you see where I'm going wrong?


Change post date for testing purposes

Is there a way I can change a post date to preferably a different month and a year for testing purposes?


Which part of the plugin to change so the updater won't register the next version?

I have made a change in WP qTip plugin so only a specific `a.something[title]` instead of `a[title]` is affected. It's just a small plugin, but if there is a new version and my client wll update this plugin the changes will be lost. My question is what in the plugin should I change so the update will be not possible and plugin not recognized? Will be changing the name enough? E.g. from: `Plugin Name: WP jQuery qTip` to som thing like: `Plugin Name: WP jQuery qTip - No Update` ? Or I need to make additional changes in the plugin too?


How do I retrieve multiple values from a multidimensional array in wp_options?

I'm just starting to store data in multi-dimensional arrays in wp_options and I need some help to retrieve some data... My data is below and is stored as option_name "my_category_fields" I need to pull a string of category ids in which the my_cat_hide is set to true. I've stubbed my function here. How do I complete it?               function get_hidden_cats()     {     $my_cats = get_option('ce4_category_fields');         //how do I capture the list of category ids where my_cat_hide is 'true'?         $my_hidden_cats = ?         return $my_hidden_cats;     }      my_category_fields:               a:17:{         i:20;a:1:{s:13:"my_cat_title";s:30:"Black Tea is Good for the Soul";}         i:9;a:1:{s:13:"my_cat_title";s:58:"Herbal Chinese Tea is a spectacular blend of herbs and tea";}         i:44;a:1:{s:13:"my_cat_title";s:24:"This is my 9th category!";}         i:7;a:1:{s:13:"my_cat_title";s:0:"";}         i:19;a:1:{s:13:"my_cat_title";s:0:"";}         i:4;a:2:{s:13:"my_cat_title";s:28:"My test Title for Chai Tea 4";s:12:"my_cat_hide";N;}         i:37;a:1:{s:13:"my_cat_title";s:0:"";}         i:16;a:1:{s:13:"my_cat_title";s:0:"";}         i:5;a:2:{s:13:"my_cat_title";s:0:"";s:12:"my_cat_hide";N;}         i:6;a:1:{s:13:"my_cat_title";s:0:"";}         i:8;a:1:{s:13:"my_cat_title";s:0:"";}         i:3;a:1:{s:13:"my_cat_title";s:0:"";}         i:10;a:1:{s:13:"my_cat_title";s:59:"Iced Tea: The Great Southern Choice for Cooling Refreshment";}         i:36;a:1:{s:13:"my_cat_title";s:28:"Full title for this category";}         i:38;a:2:{s:13:"my_cat_title";s:0:"";s:12:"my_cat_hide";s:4:"true";}         i:39;a:2:{s:13:"my_cat_title";s:0:"";s:12:"my_cat_hide";s:4:"true";}         i:40;a:2:{s:13:"my_cat_title";s:0:"";s:12:"my_cat_hide";s:4:"true";}     }


Color palet in the Wordpress' front-end?

Recently I've been seeing a lot of premium wordpress themes that includes a palet to change background colors, like this one: http://pexeto.com/dandelion_wp/ and this one: http://kaptinlin.com/themes/striking/ Is the colour being saved in the database or is just changes in the current session? ### UPDATE (Copied from duplicate) Basically, I would like to add this color picker: ![enter image description here](http://i.stack.imgur.com/fDpnR.png) To a custom "Theme Options" to let the client pick, for instance, the color of links or company identity colors (maybe some divs' background). and how the code that modifies the CSS would look like? How to do that?


Javascript Solution Remove Specific Tag but leave the rest in a specific DIV

I have a div structure that looks like this...

      This is done in the Wordpress Admin for the post and gets displayed when I use
<?php the_content(); ?>
      What I want to do is remove the `<a>` tags that show up ONLY between div class "gallery_lightview" and leave the `<img>` tag. So once its all stripped out it would look like...

      Basically making this a non clickable image. Is this possible? Its going on a Mobile site and I don't want this to be in the header. Really wanted it to be a self contained Javascript that sat above the `"the_content"` Wordpress call (which is where the `"gallery_lightview" div` code is. I choose to not use a jQuery because, since its mobile it would add to the load. And literally the only thing the library would be doing was removing the `<a>` tag. Any ideas? I wanted the Javascript to live in the .php page template so I didn't have to go into every single post and add the Javascript as well. Is this possible? **ADDITION** I basically want to deactivate any `<a>` tag in "`gallery_lightview`" so that just the "`img`" tag is left and displayed


trying to update post meta in bulk

I have been trying to arrange my site so that my URL structure is set to domain.com/collection/%collection%/%product-group% Where %collection% is a taxonomy term, collection is the index, and %product- group% is the product in question (its a group cause each group will list many product variations) Anyway, wordpress seems unable to handle this simple task, so I am switching methods in order to get my permalink structure correct. I am simply going to create the collection, product, and variant pages all under the same custom post type with no taxonomies to deal with. Then each will display a page template depending on the value of a custom field (collection, product, or variant) Well, since I already have the products and variants already uploaded to their respective custom post types, I don't want to go through all the data again to set featured images and content. (If it werent for that, I would just re import all the data.) So I created a function to switch post types in the data base for me. It works except for one part. here is the code               function change_post_type($from,$to,$value)     {     global $wpdb;          //change metadata     $post_id = $wpdb->get_results ('SELECT ID FROM wp_hyhg_posts WHERE post_type=pods_product_grps' , object);                    foreach ($post_id as $id){     $table='wp_hyhg_postmeta';     $data= array(         'post_id' => $id,         'meta_key' =>'input_type',         'meta_value' => $value     );          $wpdb->insert( $table, $data );                }           //UPDATE           $data2= array(               'post_type' => $to,                );            $where =array('post_type' => $from );                 $wpdb->update('wp_hyhg_posts', $data2, $where);                }                change_post_type ('pods_product_grps', 'uc-product', 'product');      So, I was able to get the post type to switch from 'pods_product_grps to uc- product easily enough, but I also need to add a meta value 'input_type' to every product I just switched. Since it is already changed, I can simply add input_type=>product to all products currently labeled as uc-product But I also need to run this code where the function is: change_post_type ('product_variant', 'uc-product', 'variant'); So I need to get the meta data figured out for the ones I just converted, before I add the new set of data to the mix. The product and Variants input type both have additional sets of meta data that are displayed conditionally based on the value selected. Products will have a field called group_id and variants will have a field (product sku) which contains the group_id plus a number So I need another query that finds all post marked 'product', gets the post_id, then compares the group_id to product_sku and updates the parent_id field to the cooresponding parent relationship. That is probably confusing. In other words, a product variant is a child of a product if group_id is in product_sku So I'd like to make a query that populates the parent field of the post table based on that condition. Hope someone can help with this one. Select group_id from


Is there a way for a plug-in to get it's own version number?

Is there an API I can call, inside my plug-in, to determine the plug-in's version? I just want to have my plug-in emit a html comment with it's own version number ... for diagnostic purposes.


Select two sums with single get_var statement

I am trying the following               global $wpdb;     $sum = $wpdb->get_var("select sum(first), sum(second) from table where id > 1");      I am unable to get the values from each request. I have tried               echo $test->sum(first);      I have tried to change the sql statement to include AS                $sum = $wpdb->get_var("select sum(first) as firstRequest, sum(second) as secondRequestfrom table where id > 1");          echo $test['firstRequest'];      I have tried a `foreach` statement               foreach($test as $tester){       echo $tester['sum(first')];     }      and               foreach($test as $tester){       echo $tester['firstRequest'];     }      How can I retrieve the sum of multiple rows from a single `get_var` statement? If not possible, and I need the sum of 5 different rows, would I have to create 5 separate `get_var` statements? Would this decrease the querying speed, if so, is it even noticeable?


Unregister post type from child theme

I'm trying to unregister a post type from a child theme but I haven't been able to do so, the code in the funcions.php file on the parent theme is something like this:               add_action( 'init', 'mc_projects' );     function mc_projects() {         register_post_type( 'project', array(             // Default options....         ) );          }      What I tried to do in my child theme was to remove the mc_project action from the init hook like this:               remove_action('init', 'mc_projects', 11);      But it didn't work, even when I set the priority to some higher value, am I doing something wrong?


General Settings for Wordpress Subdomain

I recently updated to the latest version of WP. One of my bloggers mentioned that the Preview link wasn't working for her anymore. I'm unsure whether the recent upgrade stopped it from working or if it was something else. So, I did some research and someone suggested making sure that the WordPress URL and the Blog URL matched in the General Settings http://wordpress.org/support/topic/post-preview-not-working-1 Mine did not... They were denschool.com/blog and blog.denschool.com. So, I changed the WordPress URL to blog.denschool.com. My blog stopped loading correctly. I changed it back in the database, but it's still not working. How do I fix this?


Links after moving my site to another domain

I'm going to move my site from development/staging environment (i.e. dev.example.com) to production environment (example.com). Probably, existing links in my pages and posts will still point to the old url, i.e. dev.example.com. how do i deal with this issue? is it possible correct all the links in one go? any suggestions? thanks!


Wordpress Custom File Permalink

Guys i have a custom file that is not part of the wordpress and its not a part of the plugins. How can i add it to the permalink solution? For example: Custom file name - example123.php Permalink solution - http://mysite.com/example


Using Taxonomies with Vote It Up plugin chart

I am using the Vote Me Up plugin http://wordpress.org/extend/plugins/vote-it- up/ on my site. I have the MostVotedAllTime function showing the top 10 posts. Currently this displays the Post Title only. I am wondering if it is possible to display a custom taxonomy associated with the post here. for example it is a chart showing music albums where the post title is the album title. I have a taxonomy called artist which i would also like to display in the chart. Does anybody know if this is possible or if there are any better plugins for this? Here is the code for the MostVotedAlltime() function               function MostVotedAllTime_Widget() {     $a = SortVotes();     //Before          ?>

Most Voted
     <?php     $rows = 0;          //Now does not include deleted posts     $i = 0;     while ($rows < get_option('voteiu_widgetcount')) {     if ($a[0][$i][0] != '') {             $postdat = get_post($a[0][$i][0]);         if (!empty($postdat)) {             $rows++;                  if (round($rows / 2) == ($rows / 2)) {                 echo '
';             } else {                 echo '
';             }             echo '
'.$a[1][$i][0].' '.Pluralize($a[1][$i][0], 'votes', 'vote').'

guid.'" title="'.$postdat->post_title.'">'.$postdat->post_title.'
';             echo '
';         }     }     if ($i < count($a[0])) {     $i++;     } else {     break; //exit the loop     }     }     //End     ?>


wp_list_comments renders incorrectly nested <ul>

I'm trying to figure out how `wp_list_comments` works. So I made the simplest possible `callback` just to see the structure of the result:               function custom_comments_callback( $comment, $args, $depth ) {         $GLOBALS['comment'] = $comment;              ?>         <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">             Hello!         </li>         <?php         }      I thought this function would be structurally correct but the result seems to contain incorrectly nested `<ul>` elements: ![enter image description here](http://i.stack.imgur.com/pdCYk.png) I thought an `<ul>` in an `<ul>` always **had to** be enclosed in a `<li>` as explained here for instance. Should I modify my `callback` function or am I missing something else here?


Categories or Custom Post Type to Organize Content

Let's say I'm starting a martial arts website and I want to categorize content into themes:   1. philosophy   2. fitness   3. training   4. techniques   5. diet Etc. I keep going back and forth between using custom loops to display the content or making each a custom post type. Is there advantages to either? And is it worth the trouble of creating the custom post types? I know this is sort of a philosophical question, but was wondering if there are any solid reasons I can't think of to go either way. Thanks so much.


Display content from custom meta boxes in revisions

When I see a "revision" for a given post type, I only see the title, the content and the excerpt. How can I see the content of a custom meta box (or any other field, for that matter)?


Get latest 3 posts from multiple CPT in one query

I'm looking to create a site wide feed on my site and have multiple custom post types. I'd like to display say 3 posts from at least 3 different post types. I can get the latest 10 posts across each post type, and I can get the latest 10 overall, but I'd like to specify so that I only get 3 from each so things are even. Is the best way to do it do 3 different queries and then merge them? I get how to do this separately, but I want them all integrated and sorted by timestamp. Any suggestions?


Exclude newest post from category X but show rest

I would like to show all posts but only exclude the NEWEST post from the 'Featured' category, other posts from this cat should display. Any idea what I should add to the loop to achieve this? I want all other posts from other cats to be displayed aswell!


Add column to plugins table screen

I'm trying to add a column to plugin table screen using "manage_plugins_custom_column", but without success. This extra column will show a custom value that was placed inside the plugin file. I hope someone could help! Thanks! Daniel \---------------- edit ---------------- This is the working code that creates the column "Version":               function add_plugins_column( $columns ) {     $columns = array(     "name" => __( 'Plugin', '' ),     "version" => __( 'Version', '' ),     "description" => __( 'Description', '' ),     );     return $columns;     } add_filter( 'manage_plugins_columns', 'add_plugins_column' );          function render_plugins_column( $column, $plugin_file, $plugin_data ) {     switch ($column) {     case "version": echo $plugin_data['Version']; break;     }     } add_action( 'manage_plugins_custom_column' , 'render_plugins_column', 10, 3 );


Does Anyone Know How To Shard A MYSQL Database With HypderDB?

I have a woocommerce site with 80,000 products. It's on pretty speedy VPS (8GB RAM, 4CPUs, SD hard drives) and it's configured pretty well (nginx, php-opcode caching, w3 total cache, etc.) but when navigating individual products, it takes several seconds to load. I noticed this starting around the 40,000 product mark and it only worsened from there. I'm trouble shot just about every, and the only option left is the mysql database. I'm planning on sharding it with hyperdb to see if that improves performance. There's virtually no information out there on how to do this. These two articles do a good job of getting a master and slave scenario set up with hyperdb, but don't mention anything about sharding. (https://www.digitalocean.com/community/tutorials/how-to-set-up-a-remote- database-to-optimize-site-performance-with-mysql & https://www.digitalocean.com/community/tutorials/how-to-optimize-wordpress- performance-with-mysql-replication-on-ubuntu-14-04). At the moment I have the original wordpress install on one server, and another blank mysql server where I want to shard the product table onto. So ideally I would like the original install to keep everything except the product tables. Anyone know how I would go about sharding out one or two tables? Thanks in advance, I've been pounding my head against the wall with this for far too long!


Media Manager selectection state does not have thumbnail size

I have written a plugin that uses the new media manager UI to insert images into a custom gallery custom post type. Everything works 100% but on a specific user's site something strange is happending that I cannot reproduce locally. Here is the code:                   var attachments = FOOGALLERY.media_uploader.state().get('selection').toJSON();              $.each(attachments, function(i, item) {           if (item && item.id && item.sizes && item.sizes.thumbnail) {             var attachment = {                 id: item.id,                 src: item.sizes.thumbnail.url             };                  FOOGALLERY.addAttachmentToGalleryList(attachment);         } else {             //there was a problem adding the item! Move on to the next         }      As you can see on line 3, it does a check if the item is valid before it adds the thumb to the gallery. `item.sizes` has data, but it only contains `full` but I rely on it having `thumbnail` to insert the thumb. Basically, `item.sizes.thumbnail` is return false so it never adds the image to the gallery. So my question is "Why no thumbnail, dude?" I checked his media settings and he does have thumbnails set at 200x200. The media library itself is showing his thumbnail images in the modal too. As I said, I cannot reproduce this locally no matter what I try, and my `items.sizes` always contains `thumbnail`


Bootstrap drop down menu with wp_nav_menu

I am trying to build a Wordpress theme with boostrap, but the nav menu is giving me some trouble. I would like the dropdown to work like boostraps dropdown, but I do not know how to do this. This is my menu:
        <?php wp_nav_menu( array( 'items_wrap' => '%3$s' ) ); ?>
      This is what I have in my functions.php for the menu:               add_action('after_setup_theme', 'blankslate_setup');     function blankslate_setup(){     register_nav_menus(     array( 'main-menu' => __( 'Main Menu', 'blankslate' ) )     );     }          function my_wp_nav_menu_args( $args = '' )     {         $args['container'] = false;         return $args;     } // function          add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );      When I add a submenu item (via Appearance - Menus) this is what is currently generated:

Parent

Child

      For my menu to work with bootstrap I need the menu to be generated like:

Parent

Child

      **So I need:**   * To add the class "dropdown", if a menu-item has child-items.    * To add class="dropdown-toggle" data-toggle="dropdown" to the .dropdown a element    * To add `<b class="caret"></b>` after the Dropdown-menu name (inside the .dropdown a element)   * To add `class="dropdown-menu"` to `<ul class="sub-menu">` Hope someone can help!


How can I link a CSS file only on single posts?

If I understand `is_single()` correctly, it's only supposed to return `true` when the current "post" (in a generic sense) is a literal post (i.e., it has a `post_type` of `post`), and that it will return `false` when the current "post" is a page, attachment, etc. This is what the Codex says:               is_single() returns true if any single post is being displayed     is_singular() returns true when any page, attachment, or single post is being displayed.      But when I try to link a CSS file only into a _post_ , it's still included in attachment pages like `http://example.com/?attachment=123456789`. Here's the code I'm using:               <?php if ( is_single() ) { ?>         <link rel="stylesheet" href="style.css" />     <?php } ?>


Cache issues with redis and nginx

I have a problem with the rewrite rules in my nginx config file. I am running wordpress with nginx and redis to cache the site. I can get the redis to cache all pages not a problem, but as I am using jigoshop which when you add a product to the basket submits a form and then adds some javascript into the page to say 'Product has been added to basket' kind of thing. My problem is I want redis to cache all the pages event the product except for when a user adds a product to the basket we want to remove the product from the cache, so that it returns the 'Product has been added to basket' in the page. In the nginx config file I can add the following:               location /product {         index index.php;         try_files $uri $uri/ /index.php?$args;     }      This will stop all of the products from using redis it hits the index.php file, but what i want is something like:               location (\?[add\-to\-cart]+) {         index wp-index-redis.php;         try_files $uri $uri/ /wp-index-redis.php?$args;     }      The problem is the location does't seem to see the regex. Any ideas or help would be gratefully appreciated.


Wp_query...a type of term a different div

![enter image description here](http://i.stack.imgur.com/x2y9n.png) I need to create a table like this image and I want a specific term in particular DIV but with my code appear all together. **Example** : One div brown with the 5 products. The effect I want is like an accordion "Hide and Show".   So if I do not have all the same hide and show the query does not work. The end result has to be like this image on a div for each term. At this point I have a div with all terms. how I can create a div and each has your term? Thanks for helping.               <?php             $args = array (                     'post_type'=> 'coleccoes',                     'tax_query' => array(                                                     array(                                                         'taxonomy' => 'tag-series',                                                         'field' => 'slug',                                                          'terms' => array('casegoods','rugs','lighting','seating')))); ?>
          <?php      $list_query = new WP_Query($args);             while ($list_query->have_posts()) : $list_query->the_post();                      if( has_term( 'rugs', 'tag-series' ) ) {                 echo '
';                 the_post_thumbnail();                 echo '
';                 echo '
';                 the_content();                 echo '
';     } elseif ( has_term( 'seating', 'tag-series' ) ) {                 echo '
';                 the_post_thumbnail();                 echo '
';                 echo '
';                 the_content();                 echo '
';     } elseif ( has_term( 'lighting', 'tag-series' ) ) {                 echo '
';                 the_post_thumbnail();                 echo '
';                 echo '
';                 the_content();                 echo '
';     } elseif ( has_term( 'casegoods', 'tag-series' ) ) {                 echo '
';                 the_post_thumbnail();                 echo '
';                 echo '
';                 the_content();                 echo '
';     }               endwhile;              wp_reset_query();             ?>
                 **It is thus** ![enter image description here](http://i.stack.imgur.com/KrjhV.png)


How do I control the fallback query after the original query returned cero posts?

I just figured out why WP developers expect you to create a separate 404.php page to control the output of that page. (and the silence about any attempt to do it otherwise) It's basically because they provided no good fallback (or I haven't found it?) to control the second query: the fallback query run if nothing is returned by the initial query. By directing us to create another document, WITHOUT A LOOP in it, you'd never notice the loop is still returning all the blog posts. That is the only reason (or worse) for which creating a whole new template could be seen easier than a (apparently simpler) filter to the_post, to show a specific text and title if nothing found. No new template needed. Yes, I can modify the main query but it makes no sense since all the posts will be retrieved anyway once nothing is found in the initial loop. Yes, I can modify the data before the loop, but ANY post retrieved by the traditional means would revert the 404 to a 301 (with a redirect) Does anyone know how to prevent/change the fallback query? I specifically need the loop to return null or 1 page, not many. (Changing posts_per_page is useless because it only affects the initial loop, but not the one WP runs once the first returns nothing) Thanks.


How to add terms to my tax_query based off of the current post

I need the terms in my tax_query to be the ones from the current post. I am trying to this by using a variable. The value of the variable is given by using the get_terms() function. The problem is that it is not returning anything. It does however return the correct posts when I manually put the terms in the array. How do I grab the posts terms automatically and place them in the terms parameter? Here is the code that I am using.               <?php     //for use in the loop, list 5 post titles related to first tag on current post     $tags1 = get_terms($post->ID, 'b');     if ($tags1) {     echo '

PRODUCTS

';     $args = array(     'tax_query' => array(     array(     'taxonomy' => 'b',     'terms' => array('$tags1'),     'field' => 'slug',          )     )     );     $query = new WP_Query( $args );     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {     while ($my_query->have_posts()) : $my_query->the_post(); ?>
     <?php if ( has_post_thumbnail()) : ?>     title="<?php the_title_attribute(); ?>" >     <?php the_post_thumbnail( array(40,40) ); ?>     " rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title('' ); ?>
     <?php endif; ?>          <?php     endwhile;list     }     }     ?>


Disallow categories from this MySQL query

I'm trying to modify a plugin that generates an archive listing so it shows only one category, making it a single category archive. The old version of the plugin used a get_posts query, and so it was easy to disallow categories of posts:               $rawposts = get_posts( 'numberposts=-1&category=-4,-6,-7,-9' );      The new version of the plugin uses that database query:               SELECT ID, post_date, post_date_gmt, comment_status, comment_count FROM      $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' AND post_password =      How do I disallow several categories from a database query?


change headline of page

I have a web page which includes menu. In its menu I have some items when I click on each item it's gonna show some subitems in it. for example item name : A. It has A.1 and A.2 subitems. which has A.1.1 and A.1.2 subitems. Now the question is when I go to for example A.1.1 page it's gonna show the A.1.1 headline name. how can I change this headline? I don't wanna change the page name like A.1.1. I just wanna change the headline of this page Any help will be appreciated Thanks in advance


How to add a button that enables the user to insert a link in a textarea located in the front-end?

I'm using the following plugin: http://wordpress.org/extend/plugins/question-and-answer-forum/ It as a textarea which enables the user to post a question. The author told me how to allow html on it. But I was wondering how to add a buttons which enables the user to use html, say, attaching a link to a word (like you do here at StackExchange sites). I think the same should apply to commenting forms. Any suggestions?


County Finder form/plugin?

I'm developing a WP site for a client and need to build in a "county finder" for our state (VT). Users would type the name of a town into a field (or select the town from a drop-down menu), press the submit button, and the system would spit out the name of the county that the town is located in. Ideally the results are delivered within the page, no new page load required, but that's not essential. I'm not expecting to find a pre-made solution...I'll have to enter the towns and counties manually of course...but I wasn't even sure what to look for in this case. Any suggestions appreciated. Thanks!


Install WordPress MU outside htdocs

I would like to use WP's MU function to host multiple blogs on the same hosting. I intend to use the Domain Mapping plugin to make it work with different vhosts. My hosting structure is as follows :               web         includes         vhosts             domain                 htdocs      I would like it so that my Wordpress install is in the includes directory with my other CMS libraries. Is this possible knowing that I have access to httpd.conf and php.ini. Thank you


$comment = get_comment( $comment_id );     $post    = get_post( $comment->comment_post_ID );     $author  = get_userdata( $post->post_author );     $test = "***" . $comment_id . "***" . $post->ID . "***" . $author . "***";      How can I obtain the string `$test` without getting into the error `Object of class WP_Post could not be converted to string`?


Permalink remain the same on each page

I have displayed the post title within the anchor tag after which I've set the permalink. The permalink, however, is not working with the same title that came from the post. It's like getting the previous link that just clicked. It's going to the same address over and over again and not to exact post link.                   <a class="heading-link" href="<?php  the_permalink(); ?>">                     <?php                      query_posts('cat=4&showposts=1');                   if (have_posts()) :                 while (have_posts()) : the_post();                   the_title();                   endwhile;             endif;                  wp_reset_query();                       ?>            </a>


What does (10, 2) mean when used with add_filter

Please tell my what is 10, 2 in below mention code:               add_filter('nav_menu_css_class', 'add_active_class', 10, 2 );          function add_active_class($classes, $item) {          if($item->menu_item_parent == 0 && in_array('current-menu-item', $classes)) {              $classes[] = "active";          }          return $classes;          }


Add "Category" to Mysql Query

i need your help :) I've made this custom Mysql query on WordPress:                   $querystr = "        SELECT  DISTINCT meta_value  FROM $wpdb->postmeta WHERE post_id IN(             SELECT DISTINCT wpostmeta.post_id        FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta        WHERE wposts.ID = wpostmeta.post_id         AND wpostmeta.meta_key  = 'color'         AND wpostmeta.meta_value  = 'red'         AND wposts.post_type = 'post' ) AND meta_key ='size'         ORDER BY RAND()        LIMIT 4        ";      How can i ADD in the query search for "Category name" or "Category ID" ? Cheers ;)


Annoying notification when trying to create a new page

Whenever I try tomake a new page, I get an annoying block asking me so upgrade some plugin of some sort. Is there a way to get rid of this extremely annoying notification? ![enter image description here](http://i.stack.imgur.com/sbYLq.png)


301 Redirect Code

I am currently trying to redirect a subdomain.blogger.com blog to a domain located on my hosted WordPress install. The code below is supposed to send a 301 redirect and then make that specific post appear on my blog but it appears to be directing the user only to the home page and not to the corresponding blog post.               /************** 301 REDIRECTION ***********************/     function labnol_blogger_query_vars_filter( $vars ) {       $vars[] = "blogger";       return $vars;     }          add_filter('query_vars', 'labnol_blogger_query_vars_filter');           function labnol_blogger_template_redirect() {       global $wp_query;       $blogger = $wp_query->query_vars['blogger'];       if ( isset ( $blogger ) ) {        wp_redirect( labnol_get_wordpress_url ( $blogger ) , 301 );        exit;       }      }           add_action( 'template_redirect', 'labnol_blogger_template_redirect' );           function labnol_get_wordpress_url($blogger_slug) {       global $wpdb;       if ( preg_match('@^(?:https?://)?([^/]+)(.*)@i', $blogger_slug, $matches) ) {        $q = "SELECT guid FROM $wpdb->posts LEFT JOIN $wpdb->postmeta             ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)             WHERE $wpdb->postmeta.meta_key='blogger_permalink'             AND $wpdb->postmeta.meta_value='$matches[2]'";        $wp_url = $wpdb->get_var($q);       }       return $wp_url ? $wp_url : home_url();      }      /************** 301 REDIRECTION ***********************/      My Wordpress permalink structure is set to custom with the value:               /%year%/%monthnum%/%postname%.html      Any help would be greatly appreciated.


"The package could not be installed" when updating plugins, themes, and core files on WampServer

Whenever I update anything on my local WordPress development site, whether it be plugins, themes, or the WP 3.7.1 update, I get this error message: > Unpacking the update… > > The package could not be installed.: PCLZIP_ERR_BAD_FORMAT (-10) : Unable to > find End of Central Dir Record signature > > Installation Failed I'm using WampServer 2.4, with Apache 2.0.63, PHP 5.2.11, and MySQL 5.0.88.


Tabbed navigation for plugin options using same row in database for all?

I'm trying to use WordPress' native tabbed navigation on my plugin's options page, but I'm having trouble. I've managed to get the options to display, though it displays every plugin option on every tab. I also get the error message `ERROR: options page not found` whenever I try to save settings. I think I've traced this to the fact that I'm trying to use the same row in the database for all plugin options. The reason for this is that most of the options fields are dynamically generated from a remote API call, so the tabs may not be the same across all installations of the plugin. Therefore, I don't want to predefine database rows for each tab, in case certain tabs are not in use, or tabs are added or removed based on the API response after plugin installation. Is it possible to use a single row in the database for all plugin options in conjunction with WordPress' tabbed navigation? Here's the relevant block of code in the commit containing it. I've linked to it because it contains references to methods and properties elsewhere in plugin code that may be relevant for context.


wordpress redirect after password reset

I would like to able to redirect to `get_bloginfo('url');` after reseting password. But I cannot for life of me find any simple answer or function to do this. Does anyone know if this is possible? Thank Josh


How to Display pages with a Custom Fields in one page

I am trying to display all the pages that have custom fields of a certain value. What I would like to do is use the current page title as the value for the custom field and get all pages that have that value defined. For example:   * Current Page is "`Surgery`".    * Custom Field Name is "`Section`".    * Custom Field Value is "`Surgery`". I have been able to do it with post using the following code but I cant seem to work out how to do it with pages.               <?php woo_loop_before(); ?>          <?php         if ( get_query_var( 'paged') ) {              $paged = get_query_var( 'paged' );          } elseif ( get_query_var( 'page') ) {              $paged = get_query_var( 'page' );          } else {              $paged = 1;          }              $query_args = array(                             'post_type' => 'post',                              'paged' => $paged                         );              // Do not remove. Used to exclude categories from displaying here.         $query_args = apply_filters( '', $query_args );               remove_filter( 'pre_get_posts', 'woo_exclude_categories_homepage' );              query_posts( $query_args );     query_posts('category_name='.get_the_title().'&post_status=publish,future');             if ( have_posts() ) {             $count = 0;             while ( have_posts() ) { the_post(); $count++;                      /* Include the Post-Format-specific template for the content.                  * If you want to overload this in a child theme then include a file                  * called content-___.php (where ___ is the Post Format name)                   * and that will be used instead.                  */                 get_template_part( 'content', get_post_format() );                  } // End WHILE Loop              } else {     ?>         <article <?php post_class(); ?>>
<?php _e( 'Sorry, no posts matched your criteria.', 'woothemes' ); ?>

     <?php } // End IF Statement ?>           <?php woo_loop_after(); ?>


Require tags for bbPress topics

I want to require my forum members to enter **at least one word into the "tags"-line** , when they are creating a new topic. As regards plugins and solutions, what I found so far is the **WyPiekacz- plugin** which works well for posts: You can define rules for the data entered. It did not work for the creation of forum posts. What I also found is the answer to " **require one tag for each post** " here in WordPress Answers which contains the code for a small plugin. While exploring the php-files of bbPress, I added the last two lines to the following snippet within **`bb_post.php`** :               $topic = trim( $_POST['topic'] );     $tags  = trim( $_POST['tags']  );          if ('' == $topic)         bb_die(__('Please enter a topic title'));          if ('' == $tags)         bb_die(__('Please enter tags'));      In my understanding, that should do the trick - but still it doesn't. Or am I using the wrong file? My installation uses bbPress within BuddyPress.


How to display articles based on composed tag

I'm encountering an issue when I want to display some articles based on a "composed" tag like "amnesty-international". The query doesn't return any results. The fact is I have two article tagged with this slug. This is the code I use in the template archive.php:               $current_tag =  single_term_title("", false);     $args= array(         'post_type' => 'adverts',         'tag' => $current_tag     );          $adsQuery = new WP_Query($args);      So this url doesnt return anything : http://www.mydomain.net/tag/amnesty- international/ Should I use another function ?


WP_Query () using taxonomy, custom post types

I want to implement this query using `WP_Query()`.               SELECT *          FROM wp_posts as posts              LEFT OUTER JOIN wp_postmeta as postmeta              ON (postmeta.post_ID = posts.ID)              LEFT OUTER JOIN wp_term_relationships as taxonomy_rel              ON (taxonomy_rel.object_id = posts.ID)          WHERE posts.post_type='care-agency'              AND posts.post_status = 'publish'              AND postmeta.meta_key = 'wpcf-listtype'              AND postmeta.meta_value = 'Enhanced Listing'          GROUP by posts.post_title          ORDER BY posts.post_title          ASC


Is it possible to put next and previous category links?

I'm not trying to navigate to the next post within a category, but to put previous category and next category under the category description on its archive page and navigate between archive pages. I've searched, but I'm not sure this is even possible without hardcoding categories, and I don't want to do that. I'd like to dynamically link. Not asking anyone to write any code for me, just asking does this sound like a good starting direction for what I need to look at doing: Build a get_next_category function by using the wp_list_categories, then pulling the adjacent from that list and turning it into a link? In short, I want a category archive page to show a category title, description (know how to do both of those), then next and previous category links before it shows the posts. I am not creating a list of categories, just navigation links. Hope that clarifies what I'm trying to do. Still searching codex and exchange.


Database migration issues - Error #1046 No database selected

i need to get my clients website online and have been able to figure everything out except of course the most crucial part which is the database upload. i can't figure out what i'm doing wrong since every tutorial and forum i've been on has basically told me to do the same things and still i get errors. i'm missing a crucial point that must be assumed. the test i've made was to locally move my database by simply copying my local site and renaming the database and adjusting my config.php file accordingly. after that i figured my database was set for upload but after uploading i get the error: #1046 = No database selected. how can there be no database selected?


Changing wp_insert_post() location

I know that `wp_insert_post()` insert posts into `wp_posts` table. I want to change that to insert posts into lets say `wp_posts2`. Can I do that? I need to do this because I don't want to mess data from 2 databases and I barely use them individually.


Help With Contact Form 7 Dynamic Extension Plugin

I have some posts in a specific category that has a custom field called email. I am getting the custom field values with the following code.               $email_values = get_post_custom_values("email",$post->ID);     if( is_array( $email_values ) )     {         foreach($email_values as $key => $email_value );          }      I want to put this into the contact form 7 "To:" field . I tried the following but I am only getting 1 email address for all posts.               [dynamichidden recipient-email "CF7_get_custom_field key='email'"]      This code displays only the email custom field of the last post. How can I get the custom field of all posts? Thanks


Fixed width and height for the thickbox

How can I set a fixed width and height for the WordPress thickbox? I am trying following code, it opens the thickbox but it does not respect the height and width. I am using this code in a plugin.               jQuery('#test').load(         function() {     tb_show("testing", "#TB_inline?height=300&width=100&inlineId=simple_div");      Edit: I forgot to mention that I'm trying to set the width and height for the `#TB_window`.


Remove default Wordpress styling from metaboxes on edit post pages?

Is there a way to prevent Wordpress from automatically wrapping every metabox in the postbox class? Or at least add my own outer div so I can make custom changes via css? Thanks!


"show option all" on list categories doesn't display taxonomy

I have a `wp_list_categories` list set to display my custom taxonomy. Everything works fine, and now I want to add a `show_option_all` link. However, when the link is clicked it displays all _default_ post type posts and _none_ of the custom taxonomy. Obviously, the intent is to display all of the posts in this taxonomy, and only those.               $args = array('post_type' => 'design_asset', 'show_count' => 1, 'taxonomy' => 'asset_type', 'show_option_all' => 'Show All');     wp_list_categories($args);      Can this work? How?