Display list of custom taxonomies from a custom post type ordered by their parent

I'm not quite sure the question explains my point. And it's interesting to have a look at this previous answer, since the code to display the custom taxonomies is explained in there. What I need is to display the child item category under his father, but I can't figure it out. What I'm creating is a list of books under every category I've created. I have my custom category and it's related to a custom post type which have additional custom meta boxes, in my this case, for books. When making the query, it's working well, but I have two issues: The first is, because I really don't know how to display the child under his father, actually the child is displayed as another category as the others and its totally separated from his father. And the same query is displaying post both, under the father category as the child category. So it seems to be kind of duplicated in my list: being the "astrological" the father category it has a child named "stars". So in my list, the category "astrological" has 2 post related to it, but that's because its displaying the post related to it and the post related to his child, which is "stars". Explained best is: > ASTROLOGICAL (father) (has one post related, "Aquarium") > > -STARS (child) (has one post related, "Andormeda") What I see being displayed is a list in this way: > ASTROLOGICAL > > -Aquiarium > > -Andormeda > > ANOTHER CATEGORY > > -his post related > > STARS > > -Andormeda Don't know if I was clear, so I post my code for the query... As you can see above categories is for giving an example, actually my query is for books but its in spanish, that's why I'm using the "astrological" example.               <?php                  $custom = get_post_custom($post->ID);                  $autor = $custom["autor"][0];                  $editorial = $custom["editorial"][0];                ?>             <?php     //for a given post type, return all     $post_type = 'Libro';     $tax = 'categoria_libro';     $tax_terms = get_terms($tax);          if ($tax_terms) {       foreach ($tax_terms  as $tax_term) {         $args=array(           'post_type' => $post_type,           "$tax" => $tax_term->slug,           'post_status' => 'publish',           'posts_per_page' => -1,           'caller_get_posts'=> 1       );                   $my_query = null;         $my_query = new WP_Query($args);              if( $my_query->have_posts() ) {             echo '

 '. $tax_term->name. '
';                while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?> <?=$autor?> <?=$editorial?>
                            <?php endwhile;?>
         <?php }         wp_reset_query();       }     }     ?>      .....EDITED...... With my code this is what is displaying Link actual displaying Notice that in my backend the category "energia" is actually a child of "herramientas terapueticas" And what I want is to display this The category "herramientas terapeuticas displaying its posts, and displaying too another list of its child, in this case "energia". I really dont know how to write the code for this. I hope this help to clear my point Thanks in advanced!!!


Where to place PHP for shortcodes

My custom plugin is broken into two parts: a frontend.php and admin.php for loading code conditionally. Here is a rough outline of the code:               <?php     /*     My plugin info here     */          if (is_admin()) {       include_once('admin.php');     } else {       include_once('frontend.php');     }          ?>      I have written several shortcodes for use in pages and posts. In which file (admin.php or frontend.php) should code related to shortcodes be placed?


Custom Post Types - Taxonomy and Customization

I'm trying to learn Custom Post Types and I have some questions. I'm trying to add a categories menu but that doesn't seem to be working for some reason - I don't get an error or anything. Here's my code, let me know if I should add in / improve on something:               // Create The Custom Post Type     function products_post_type(){         register_post_type( 'generic_prodcts',             array(                 'labels'    =>  array(                     'name'          =>  __( 'Products' ),                     'singular_name' =>  __( 'Product' ),                     'add_new_item'  =>  __('Add New Product'),                     'edit_item'     =>  __('Edit Product'),                     'search_items'  =>  __('Search Products')                 ),                 'public'        =>  true,                 'has_archive'   =>  true,                 'rewrite'       =>  array('slug' => 'products')             )         );     }     add_action( 'init', 'products_post_type' );          // Create The Columns     function generic_products_columns($columns){         $columns = array(             'check'     =>  '<input type="checkbox" />',             'title'     =>  __('Title',      'trans'),             'desc'      =>  __('Description','trans'),             'price'     =>  __('Price',      'trans'),         );         return $columns;     }     add_filter("manage_generic_prodcts_posts_columns", "generic_products_columns");          // Create The Column Data     function generic_products_column_data( $column, $post_id ) {         switch ( $column ) {             case "title":                 $title = get_post_meta( $post_id, 'title', true);                 echo '' . $title. '';                     break;             case "desc":                 echo get_post_meta( $post_id, 'desc', true);                     break;             case "price":                 $price = get_post_meta( $post_id, 'price', true);                 echo '' . $price. '';                     break;         }     }     add_action( "manage_posts_custom_column", "generic_products_column_data");          // Make Post Type Columns Sortable     function generic_prodcts_sortable() {       return array(         'title' => 'Title',         'desc'  => 'Description',         'price' => 'Price'       );     }     add_filter( "manage_edit-generic_prodcts_sortable_columns", "generic_prodcts_sortable" );          register_taxonomy(         'Categories',          array('generic_products'),          array(             'hierarchical'      => true,              'label'             => 'Categories',             'singular_label'    => 'Category',             'rewrite'           => true         )     );      Also how do I go about customizing the custom post type page? Like I'd like to remove the text box and add in my own fields. I've tried googling it but I don't exactly know how to explain it to find decent results. For reference, I've just been following: Yoast and Wordpress Codex


What file is the </body> tag located in Genesis default theme?

I need to add some tracking code for Aweber and they said to add it before the `</body>` tag. I've looked through all the Genesis files and cannot find it!


Remove navigation from header in custom page template

I'm building a landing page and want to remove the navigation menu from the page. The navigation menu is in header.php which is of course in the page template. Is there a WordPress function I can use to remove the navigation menu from this specific page? I know I could do it with jQuery and do display:none for the nav menu but i'd like to do it server side before the page loads. Thanks


How to hide a piece of code from a wordpress web page?

I installed a plugin called Sociable on my Wordpress website. It displays social media share icons below each blog post, but on my website it's also showing up in the footer. Like here http://amsa.mn/%D0%B1%D0%BB%D0%BE%D0%B3 I've been trying to figure out how to remove it from the footer for quite a while, but can't figure it out. Can anyone help? Thanks!


How to use wp_terms_checklist() on front end

Getting a Fatal Error using `wp_terms_checklist()` in one of my advanced search form in Front End. > **Fatal error:** Call to undefined function `wp_terms_checklist()` With search I got that it's creating problem because the function is for _admin panel use only_ , BTW _not_ deprecated.               <?php     $args = array(         'descendants_and_self'  => 0,         'selected_cats'         => false,         'popular_cats'          => false,         'walker'                => null,         'taxonomy'              => 'mytaxonomy',         'checked_ontop'         => true     );     wp_terms_checklist( 0, $args );     ?>      But if I need a similar thing in my front end. How can I achieve that? Is that possible in current flow?


Bestway To Define Theme and Plugin path and url

I am in a mess.I know this is a silly question.You see the theme path is not so good.So is there any other way?How can I use `get_template_directory()` here?                   // theme folder path         if ( ! defined( 'TZSC_THEME_DIR' ) ) {             define( 'TZSC_THEME_DIR', dirname(__FILE__).'/' );         }              // theme folder URL         if ( ! defined( 'TZSC_THEME_URL' ) ) {             define( 'TZSC_THEME_URL', plugin_dir_url( __FILE__ ) );         }


Why does my Posts page only show a single post when using Thematic?

This seems to be a Thematic theme bug becuase if I switch to other themes, everything is working as expected. This is not the first time I created a frontpage using a static page. I made sure I followed this: http://codex.wordpress.org/Creating_a_Static_Front_Page. Any idea pls?


Why am I locked out of the system?

I've installed a wordpress site for a client. The site resides on mttv.co.il For some reson I'm being locked out of the system most of the time with no error message displayed The system takes the login & password and just redirecs me back to the login page. Any help would be much appreciated


WordPress kills an IFRAME's apostrophes

I'm using an IFRAME to let multiple sites embed one interactive element. On the IFRAME's actual page it works fine, and it looks fine on another website I embedded it. But when I embed it in a WordPress blog, all my apostrophes show up as squares. I tried removing all smart quotes and apostrophes with "dumb" quotes, no luck. I tried replacing all the apostrophes with ' and, again, no luck Any clues what my cause this? The IFRAME code:               <iframe src="http://necir-bu.org/wp/interactives/sheriffinteract/interactive.html" name="interactive" scrolling="no" frameborder="0" marginheight="5" align="center" vspace="5" widtha"590px" height="720px"></iframe>      And you can see the interactive code by just viewing the first link


Error activating certain plugins

When I try to activate All-In-One SEO Pack or ANY (I've tried all by now!) caching plugin, the page goes blank - i.e the content of the page empty, except the WordPress bar on the top and the toolbar on the left. No error is displayed. What is wrong? All other plugins are activated and work just fine! Please help!


Show taxonomy and custom post type in the same query

I am not sure how to raise the question, because I find all that goes in another way, I will try... I have three custom post types and these have their own taxonomies. The following is a simplified example:   * Photos      * Photo # 1     * Photo # 2   * Videos      * Vid # 1     * Vid # 2   * Websites      * Site # 1     * Site # 2  What I want to do is showing all post photographs and videos and also the category Website, can I do this? And every time some post to be updated within the category is displayed websites.


wp_update_post() doesn't update post_status?

I'm using this bit to insert/update a custom post type from the front-end. The date is set from a custom jquery datepicker.                   if (strtotime($date) < strtotime('tomorrow')) {                 $newpostdata['post_status'] = 'publish';         } elseif (strtotime($date) > strtotime('today')) {                 $newpostdata['post_status'] = 'future';                 $newpostdata['post_date'] = date('Y-m-d H:i:s', strtotime($date));         }              if ('insert' == $operation) {             $err = wp_insert_post($newpostdata, true);         } elseif ('edit' == $operation) {             $newpostdata['ID'] = $post_id;             $err = wp_update_post($newpostdata);         }      **This works** when first publishing the post, setting it correctly as `publish` or `future`, with the correct date. **This doesn't work** when editing the same post, neither from `publish` to `future` nor the other way around. Everything else is properly updated, except for the post status/ ~~future_date~~. **UPDATE Oct. 9th** I'm starting to think this might be a bug, so i started a conversation at the wp-hackers mailing list, about this. There's some fresh install test results on the link. * * * **OTHER FAILED ATTEMPTS:** i've tried leaving `post_status` decisions to `wp_insert_post()` using:               elseif ('edit' == $operation) {             $newpostdata['post_status'] = '';             $newpostdata['ID'] = $post_id;             $err = wp_update_post($newpostdata);         }      And this sets the post status to `draft` while maintaning the requested dates. I've also tried calling `wp_transition_post_status()` again (it's called once inside wp_insert_post()):               elseif ('edit' == $operation) {             $newpostdata['ID'] = $post_id;             $err = wp_update_post($newpostdata);             wp_transition_post_status($old_status, $status, $post_id);         }      but that also didn't seem to work. I'm running out of ideas here. Any clues?


How to exclude certain portfolios from a loop

I am new to the site and have racking my brain on a Wordpress issue for days. Hope you the intelligent people here can help me figure this out. I have a page on my website that displays all my portfolios at once. My portfolios can be categorized into different 'sets'. There are particular 'sets' that I would like to not display on this page. The page can be viewed here: http://www.industrygallerydc.com/works/ I believe I have pinpointed the loop that causes the portfolio 'sets' to display:               //prepare data for pagintion     $offset_query = '';     if(!isset($_GET['page']) OR empty($_GET['page']) OR $_GET['page'] == 1)     {         $current_page = 1;     }     else     {          $current_page = $_GET['page'];         $offset = (($current_page-1) * $portfolio_items);     }          $args = array(         'numberposts' => $portfolio_items,         'order' => $portfolio_sort,         'orderby' => 'date',         'post_type' => array('portfolios'),         'offset' => $offset,     );     if(!empty($term))     {         $args['portfoliosets'].= $term;     }          $page_photo_arr = get_posts($args);               //Get all portfolio items for paging          $args = array(         'numberposts' => -1,         'order' => $portfolio_sort,         'orderby' => 'date',         'post_type' => array('portfolios'),     );     if(!empty($term))     {         $args['portfoliosets'].= $term;     }          $all_photo_arr = get_posts($args);     $total = count($all_photo_arr);          if(isset($page_photo_arr) && !empty($page_photo_arr))     {        ?>      Is there a way I can exclude a 'set' here?


Watermark featured image as soon as it is set on post edit page

I want to watermark featured image of specific category when featured image is set on post edit page. I made a small script which watermarks but how can I know that featured image has been set so that script function runs automatically before publishing the post?


Authors list Pagination : result set from $wpdb->get_results()

Using this solution : Paginate result set from $wpdb->get_results() I did make my code for Authors list page template as follow:

          <?php      // Get the authors from the database ordered by user's display name      global $wpdb;      $query = "SELECT ID, display_name from $wpdb->users ORDER BY display_name LIMIT 10";      $author_ids = $wpdb->get_results($query);     $authcount = -1;          $total = $wpdb->get_var("         SELECT COUNT(ID)         FROM $wpdb->users     ");     $authors_per_page = 10;     $page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1;          echo paginate_links( array(         'base' => add_query_arg( 'cpage', '%#%' ),         'format' => '',         'prev_text' => __('«'),         'next_text' => __('»'),         'total' => ceil($total / $authors_per_page),         'current' => $page     ));           // Loop through each author      foreach($author_ids as $author) :      // Get user data      $curauth = get_userdata($author->ID);           // If user_ID is 1 or 24, remove them from list      if( ! in_array($curauth->ID, array(1, 24 )) ) :      // Get link to author page      $user_link = get_author_posts_url($curauth->ID);         $post_count = get_usernumposts($curauth->ID);      ?>     <tr<?php echo $authcount % 2 ? ' class="odd"' : ''; ?>>          <?php echo $authcount; ?>     	     <a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>"><?php echo $curauth->display_name; ?>     	     ( <?php echo $post_count; ?> )
          <?php endif; ?>     <?php $authcount = $authcount + 1; ?>     <?php endforeach; ?>

      But every page-number link display only the authors list from 1 to 10, whereas the database have a list of atleast 50-authors. Please help me to find out the error and its rectification. Thanks a lot.


Custom Post Type, Two categories, Two columns with Pagination

I searching a lot to found a way solves that and no luck at least. Sorry for my unpulish english, I do my best explaining my issue. I have a Custom Post Type called `'Events'` this have two categories `'Congresses in Argentina'` and `'International Congresses'`, I need to show the list of posts sorted by columns (2) and with pagination after 5 of each other. Something like this: Format: `Cat 1 / Cat 2 [ 1 = most recent / 5 = oldest post ]`                [1] [1]      [2] [2]      [3] [3]      [4] [4]      [5] [5]     « 1 2 3 »      I wondering if I can show the last posts of each category on a row and later the next two ones and so on, this because the design needs to be in this way to show up nicely. Thanks in advance for your help, any comment would be appreciate it.


Disable Visual editor for all users

Is there a way to Disable the visual editor for all users without logging in and setting each user's setting in the admin panel, preferable some way to do it with code in the functions file?


Use Wordpress Built In Jquery

I see that on every page Wordpress is loading in jquery, how do I go about using that jquery as it keeps telling me that it doesn't recognize `$` or `$noConflict();` - I'm trying to add some jquery under `wp_head()`.


How to run a SQL Query for character in Post Titles

Pretty much self explanatory. I have a development server running the latest WP, and I imported a bunch of posts from a blogger account. After the import, every post was titled as such: **>Example Title** . What i want to do is a run a sql query to delete all the " **>** " characters in the post titles. I've checked other tutorials already, but still do not understand the complete syntax of the query. Any help is appreciated. okay this is the query i 'want' to run. update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’); but what I don't understand is that, I'm trying to update my table name (which is by default wp_, right?), and I'm guessing the next step is updating the field name (which is by default wp_posts, right?), and I want to update ALL the Post Titles to remove a character that shows up in front of all of them. Example: >This Is A Post Title . I want to remove the ">" character. But what I'm lost on is if I'm doing it wrong by naming "wp_" for "TABLE_NAME", and "wp_posts" as the "FIELD_NAME". Or am I missing something in that query just all together? Hope I'm making it clear and not too confusing.


Importing into wp_postmeta

I am converting a custom site to WordPress but I have a problem. I have about 20,000 posts for one Custom Post Type that has custom fields for both "source_name" and "source_url". Both these Custom Field Values need to be entered into the "wp_postmeta.meta_key" column for each article that has the custom field data. Each unit of custom field data also needs to be imported into the "wp_postmeta.meta_value" column. While every "post_id" is unique, both the "meta_key" and "meta_values" share the same "post_id". I am working with SQL and CSV. Does anyone have insight into how I can get all this custom data into the wp_postmeta table correctly? Thank you in advance!


How to create notification on frontend using heartbeat api for multiple custom post types

How can I get correct action hook on publish_posts for multiple custom types ? I have a following problem, I can use this hook for posts or single custom post_type, but I don't know correct hook for multiple custom post types:               // Post publication for posts     add_filter ( 'publish_post', 'notify_published_post' );     function notify_published_post( $post_id ) {      I would like to publish to all even future custom post_types, so I would like to get something like this:               // Post publication hook for all custom posts     add_filter ( 'publish_anypost', 'notify_published_post' );     function notify_published_post( $post_id ) {


get meta value from database by post id

I am just really confused how to do this, becouse I am newbie in wordpress. So what am trying to do: I have a custom form on home page and posting form value by post method. Now I want to fetch meta value by the comparision of post value. I am trying               <?php      $from=$_POST['a'];     $to=$_POST['b'];     $froms = get_post_meta( 139, 'from',true );     print_r($froms);     $tos = get_post_meta( 139, 'to',true );      if($froms=$from && $to=$tos)      {     echo "test match";     }     else     {     echo "Not found";     }      Now for whatever value of $from its showing match found. and if i tried to `print_r($from)` it always show `Array([0]=>"test")` feel free to ask me if my question is unclear, how can i fetch meta value by some comparision of posted value.. **I just want to check if my meta value and posted form value are same then`echo "test match"`, if my posted value did not match with meta value then `echo "not found"`** Thanks


Personalized Gallery what are my options?

In my game website I would like to implement a Screenshot page where my registered users can upload images to it (it might be more then 1 screenshot page, 1 for the users and 1 for the game in question what I mean is users can upload and the staff will be using the game website available images so it would be 2 different categories or w/e). Once an image is uploaded it will be pending for approval before becoming available on the gallery page. I would like that the page that will display the list of images will be displaying it as thumbnail or resized images to a smaller size and the bigger image will show uppon click or something alike. **What i would like to know is:**   * Is there a plugin with such features ?   * What are my options here ? * * * I've got a good programming background, if i were to make such changes what would be my best approch to it ? like creating a custom template page or what ?


Display some arbitrary HTML or content in a sidebar

I need to have a bit of frequently changing content in a sidebar (the time and location of the next meeting of a club). What I'd really like is a nice widget that displays `the_content()` of a selected page or just has a rich text field and displays what's in that. I figured there would be something like this around, but I can't find it. (Maybe because the search terms are too cloudy and overloaded?) I wrote a widget that displays `the_content()` of a hardcoded page, but that's not an ideal solution.


Redeclare function (override)

What is the best method, to change the previously declared function into the new one? for example, there is already declared:               function smth(){     echo 'aaa';     }      and i want that it displayed not **aaa** , but **bbb**               function smth(){     echo 'bbb';     }      but when i insert the new function ( _inside functions.php_ ), i get error message `(Fatal error: Cannot redeclare **smth()** (previously declared in ... )`       # UPDATE - I have found a solution: http://stackoverflow.com/a/8125517/2165415


How to remove comment section from page only , not from posts pages?


How to overwrite youtube embed?

I really like how you can just paste a URL right into the post... such as: `http://youtube.com/watch?v=xyz` or `http://vimeo.com/123456` What I want to do is change the default code for this to support the code from here: http://embedresponsively.com/ How can I go about overwriting the youtube and vimeo code, I'm assuming in functions.php somehow?


Filtering categories in the permalink structure

Using `/%category%/%postname%/` for the permalink I get a URL string of all the categories that the specific post is included in. I would like the categories in the url to be filtered down to only one branch of the categories structure, and starting not from the root parent category. I have a travel blog and I have this category structure:   **places › countryName › regionName › cityName**   ex: _www.mytravelblog.com/places/indonesia/java/jakarta/myPostName/_ I would like to skip the root category in the URL or even just use the smallest child   ex: _www.mytravelblog.com/jakarta/myPostName_ Is it possible? (WP 3.0.1)


Show all posts of all categories but excluding a category on custom blog page with pagination of my theme

Recent Posts
       <?php // Display blog posts on any page @ http://m0n.co/l         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $temp = $wp_query; $wp_query= null;         $category_id = get_cat_ID('Tour');         $wp_query = new WP_Query(); $wp_query->query('showposts=6' . '&paged='.$paged);         while ($wp_query->have_posts()) : $wp_query->the_post();    if(in_category($category_id)){?>
             <time datetime="2013-01-01"><?php echo date("j"); ?>
     <?php echo strtoupper(substr(date("F"),0,3)); ?></time>

        <?php the_title(); ?>

         <?php if(has_post_thumbnail()) { ?> <?php the_post_thumbnail('full', array('class' => 'img_inner fleft')); ?> <?php } ?>
         <?php the_excerpt(); ?>
           <a href="<?php the_permalink(); ?>" class="btn">Details

      please give a suitable guidance for that customization in retrieve posts of all category exclude one category post in Wordpress custom theme. thanks in advance.


Directory structure for plugin changes

When I'm working in Wordpress, I quite often need to make adjustments to plugins. The recommended method, as I understand it, is to take the plugin file I'd like to modify (say, `mypluginfile.php`), and copy it to my theme folder. The file will now override the plugin's version of the file. My problem with this is that in order for it to work, the file HAS to be in the root of the theme directory...which means that the theme root quickly becomes incredibly messy. With adjusted plugin files strewn throughout the theme root, it's also very difficult to, at a glance, keep track of which file belong to which plugin. Is there any way of modifying plugin files but still maintaining a nice directory structure. Maybe something like:               - /mytheme/style.css     - /mytheme/functions.php     - /mytheme/myplugin/mypluginfile.php     - /mytheme/myplugin/mysecondpluginfile.php     - /mytheme/mysecondplugin/anotherpluginfile.php      I have a hard time believing that everyone out there just fills their theme folder with an array of files belonging to different plugins. What's best practice here?


Theme licensing and permission on changing content

When using themes on a WordPress site, can I customize (I mean modify/change files) that makeup the theme? So as to remove a particular section on stock photo provided in the pages? I like certain themes, but most of them include a footer, header, or something somewhere with extra information I would not want displayed, i.e.) theme name/version, developer link, etc. Is it ok to remove those from displaying on the website?


Why would apply_filters return a non-empty string, when the value returned is empty?

Been breaking my keyboard over this. Did a proper install, uploaded the database to a fresh MySQL and been working on using child themes properly. But there is something plaguing me I can not figure out. On my new install (ver2.whowhatwhy.com) I intentionally left some of my widgets blank. I would expect, when reading the `default-widgets.php` file in wp-includes that there would be no title element showing on that widget. Instead, the title widget is showing because, for some reason, the value being passed by `apply_filters` is a space, rather than a blank value when the `$instance['title']` is blank.               $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );      Has anyone seen this before? The problem I have is that the original installation has no problem with this call (returns a blank value). If you go to the site, you can see the vardumps of the different elements of the code:               function widget( $args, $instance ) {             extract($args);             $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );             $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance );             echo $before_widget;             if ( !empty( $title ) ) { echo $before_title . '[' . $title . '] ' . $after_title; } ?>
<?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?>
             <?php             echo $after_widget;         }      I also removed all of the widgets and then replaced the one widget on the page. This is what is in the database: @Otto - I also looked in the database and eliminated all of the other widgets. And here is what I found:               a:2:{i:916707761;a:3:{s:5:"title";s:0:"";s:4:"text";s:1333:"

     <form name="ccoptin" action="http://visitor.r20.constantcontact.com/d.jsp" target="_blank" method="post" style="margin-bottom:3;">
Do you need the truth?
         Sign up for our weekly email updates and stay informed.

             <input type="text" name="ea" size="22" value="" style="font-family:Verdana,Geneva,Arial,Helvetica,sans-serif; font-size:14px; border:1px solid #999999;">             <input type="submit" name="go" value="JOIN" class="submit"  style="font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px;">             <input type="hidden" name="llr" value="">             <input type="hidden" name="m" value="">             <input type="hidden" name="p" value="">
     </form>

     ";s:6:"filter";b:0;}s:12:"_multiwidget";i:1;}      Note where the `a:3` is, you can see that the `title` value is an empty string with no length. So, why would apply_filters return a non-empty value?


wp_nav_menu add some element to container

I've tried to hook `wp_nav_menu_args` to get an ID for the nav menu. I tried to add an element using javascript to container menu. But I never get the ID for the menu. How can I add an element to a nav menu container from:

.....

      to:

.....


Conditional to grab parent page thumbnail URL

I'm currently using this code to grab the featured image URL and insert it as a background image:               <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?>     <div class='guideHeader' style='background-image: url(<?php echo $thumb['0']; ?>);'>      What I'd like to do is make this a conditional:   1. If Parent Page > Insert Thumbnail URL.   2. If child of Parent and has no featured image > insert parent thumbnail URL.   3. If child of Parent and has featured image > Insert Thumbnail URL.


Latest comments from each category?

On the "home"-page I'm trying to display the most recently commented-on post for each category. I managed to display the most recently published post for each category, but if an older post from each category gets a comments, that post should be bumped to the top of the list with that latest comment displayed. Here's the code I tried:               <?php $cat_args=array(       'child_of'=>1,       'exclude'=> 12,       'orderby' => 'name',       'order' => 'ASC'        );     $categories=get_categories($cat_args);       foreach($categories as $category) {         $args=array(           'showposts' => 1,           'category__in' => array($category->term_id),           'caller_get_posts'=>1         );         $posts=get_posts($args);           if ($posts) {             echo '

term_id ) . '">' . $category->name.'
 ';             foreach($posts as $post) {               setup_postdata($post); ?>                           <?php $recent_reviews = get_comments('post_id='.$post->ID.'&status=approve&number=1');?>                       <?php                       foreach($recent_reviews as $recent_review) {                         $comment_url = get_permalink($recent_review->comment_post_ID).'#reviews';                         $comment_info = get_comment_meta($recent_review->comment_ID, 'comment_info', true);                         $comment_rating = get_comment_avg_rating($comment_info);                     ?>

Restaurant: <a href="<?php echo get_permalink($recent_review->comment_post_ID); ?>"><?php echo get_the_title($recent_review->comment_post_ID); ?>

<?php echo get_limit_content(strip_tags($recent_review->comment_content), 150); ?>

<a href="<?php echo $comment_url; ?>" class="more-link">read review

                       <img alt="" src="<?php bloginfo('template_directory'); ?>/images/star-m-<?php echo $comment_rating; ?>.png" />                       <?php echo date('m/d/Y', strtotime($recent_review->comment_date)); ?>
                     <?php } // foreach($recent_reviews as $recent_review) { ?>               <?php             }              echo '
';// foreach($posts           } // if ($posts         } // foreach($categories     ?>


How to echo excerpts with wp_list_pages?

I've tried to echo excerpts in `wp_list_pages` with the code below. It works, but only for one of the child pages. How would I echo the excerpt and title for each child page?               <?php     $children = wp_list_pages('title_li=&depth=1&child_of='.$post->ID.'&echo=0');     if ($children) { ?>         <h2>             <?php echo $children; ?>             <?php the_excerpt(); ?>          </h2>     <?php } ?>


Custom taxonomy/category order

My products are sort by menu_order, but I would like to sort category name too. I tried a few plugins and all doesn't works. Code, which display category name and products list:               <?php $custom_terms = get_terms('product-cat');     foreach($custom_terms as $custom_term) {         wp_reset_query();         $args = array(         'post_type' => 'product',         'posts_per_page' => 9999,          'orderby' => 'menu_order',          'order' => 'ASC',         'tax_query' => array(             array(                 'taxonomy' => 'product-cat',                 'field' => 'slug',                 'terms' => $custom_term->slug             ),         ),         );              $loop = new WP_Query($args);         if($loop->have_posts()) {             echo '

'.$custom_term->name.'
';             echo '
';             while($loop->have_posts()) : $loop->the_post();                 echo '
'.get_the_title().'
';             endwhile;             echo '
';             echo '
';         }      } ?>      Thanks for reply. Regards.


how to change location of the plugins & wordpress themes folder I am waiting for reply and in which file changes required also mention please....


How do I make the selected layout display for all MarketPress pages?

I've set up a WordPress site and installed MarketPress. It works fine overall and the `/store/` page is correctly displaying my selected template/layout. However, all subpages such as `/store/products`, `/store/cart`, `/store/categories` etc. are not using the template/layout that I chose, but rather some default. Maybe this is because they are "virtual" pages that MP itself are handling. Question is: How do I tell MarketPress to use my chosen template/layout for all of MarketPress´ pages? I've tried a solution that I found here, but it doesn't work for me. It could be a solution connected to some other product or plugin that the author has but not me.


Clarification on filters and hooks

I am about to start my first WordPress project and I have the task of moving customized core code that override the core into separate functions/files (this way it'll be easier to maintain when we upgrade in the future. I have been doing research and it looks like `add_filter` and `apply_filter` and `do_action` and `add_action` seem to be the way to go. I'm still unsure about how they work though. Are those methods what I use to overwrite core methods? I am confused because `add_filter` uses the word `add` when I feel like it is more on the lines of `replace` or `overwrite` (unless I am misunderstanding) I just read the first answer to this: http://wordpress.org/support/topic/fliters-vs-actions-from-a-newbe (the one about the tacos) So there were three steps the author used in describing how to use add_filter: Step 1 : a static value for the $taco variable `<?php $taco = 'chicken'; ?>` Step 2:                   <?php         $taco = apply_filters( 'get_taco', 'chicken' );         ?>      Step 3:                   <?php         add_filter( 'get_taco', 'my_special_order' );         function my_special_order( $content ) {             return 'shredded beef';         }         ?>      So in this situation is the apply_filter just creating a dynamic method on the fly and making it return the `chicken` string? Or is the assumption here that there is a core WordPress method called `get_taco` and that using `apply_filter` would help in overriding whatever the original functionality was? Also, can you only `apply_filter` something that you've `add_filter`ed ? In other words, would `apply_filter('get_taco');` not work if I did not define `add_filter('get_taco', 'my_special_order');` AND `function my_special_order ($content) ...` first? Do I put these filters in my functions.php file? Sorry for bombarding you with questions, I am coming from Ruby on Rails so I'm completely clueless in WordPress.


How to use wp cron job to run a function

I have one function: "update_user_like" to sum all facebook likes from all user's posts. How to run that function at 3am every day by wp cron job? Thanks much!


Load script only on selected Pages

The following function within my functions.php loads a JS script..               function my_scripts_method() {         wp_enqueue_script(             'myashdrop',             get_template_directory_uri() . '/js/dropdown.jquery.min.js',             array('jquery')         );     }          add_action('wp_enqueue_scripts', 'my_scripts_method');      How could i modify this function so that the JS script is loaded only on specified pages (perhaps by providing their ID in the function's arguments..)


Permalink clashing with Custom Post Type rewrite rule

I have created a custom post type called **'members'** which works correctly. I have set the rewrite rule to...               'rewrite' => array('slug' => 'our-members'),      I have then added some items to this custom post type which gives me permalinks like so...               http://www.mydomain.com/our-members/john-doe     http://www.mydomain.com/our-members/jane-doe     http://www.mydomain.com/our-members/tom-tompson     http://www.mydomain.com/our-members/joe-blogs      I also have a page called **'About Members'** which has the slug **'about- members'** meaning the permalink for the page is....               http://www.mydomain.com/our-members/about-members      This doesn't work as it is clashing with the rewrite rule, is there a way to have this working with the permalink?


Wordpress for questions and responses website

I am using Wordpress to create a Q&A website. The question is returned by `the_content.` If I store the answers as post meta field array:               {           [1] => 'first answer',           [2] => 'second answer',           [3] => 'third answer',           .....           }      How can I create separte comments for each item (comments for question, then comments for first answer, then comments for second answer....)? Noramlly, I use `<?php comments_template( '', true ); ?>` which creates comments relative to `the_content`. If I reuse it, it will display a new comment for all the items. `comments_template` doesnt have a pramater to identify a list of comments against other lists.


Echo number of all users (subscribers, contributors, authors, etc.) whom have posted at least once

Hopefully quite an easy question for you code-savvy ladies and gents today: how would one go about echoing the precise number of registered users on a WordPress blog whom have successfully published at least one post (discounting pending, drafts, etc.)? Subscribers are able to publish posts on my blog, and there's a terrific number of new members joining and new posts being generated daily, so manually updating the number would be a bit tricky (hehe). I'd love to be able to just plonk a somewhere in the sidebar, but, given my limited knowledge of PHP, I'm at my wit's end as to how to accomplish this. Thanks for any and all help, guys. Cheers!


get all sub categories without specify any category

I have 2 levels of categories ( one sub-category only. No `sub-sub` category ). I need to get all sub categories without parent category. (I don't want to specify any parent category.) Example:               p_cat1        s_cat1        s_cat2     p_cat4     p_cat3        s_cat4        s_cat5        s_cat7      from here, I need               s_cat1     s_cat2     s_cat4     s_cat5     s_cat7      And, I need there to be a URL for each of those sub-categories. I want to give `<a>` for each subcategory. How do I do that?


Multiple post types on a grid (every nth post must be a specific post type)

I have a grid where I display multiple posts types. I need to lay out the grid making sure that I have 2 posts from one post type, followed by 4 posts from another, flowing continously thereafter. In addition, every post type needs to use a different class (for box size) on the grid. Such as:
         1st post (must belong to post type 'movies')

         2nd post (must belong to post type 'movies')

         3rd post (must belong to post type 'artists')

         4th post (must belong to post type 'artists')

         5th post (must belong to post type 'artists')

         6th post (must belong to post type 'artists')
           This is what I have so far; I have managed to lay them out the way I want (visually), but I can't find a way to make sure I have the right post type in the right position:               // http://wordpress.stackexchange.com/questions/53194/wordpress-paginate-wpdb-get-results     $grid_items = "       (SELECT *          FROM wp_sorter_items          WHERE area_id = 1          AND active = '1'          ORDER BY item_order ASC     )";          if ( $grid_items ) {          $total = $wpdb->get_var( "SELECT COUNT(1) FROM (${grid_items}) AS combined_table" );     $items_per_page = 12;     $page = isset( $_GET['page'] ) ? abs( (int) $_GET['page'] ) : 1;     $offset = ( $page * $items_per_page ) - $items_per_page;     $latestposts = $wpdb->get_results( $grid_items . " ORDER BY item_order ASC LIMIT ${offset}, ${items_per_page}" );          $counter  = 0;          foreach( $latestposts AS $grid ) {          $post = get_post( $grid->item_post_id );     setup_postdata( $post );              if ($counter % 6 == 0 || $counter % 6 == 1){             $grid_type = "big";         } else {            $grid_type = "small";         }              // including the template so I can have pagination         include(locate_template('templates/loop-home.php'));              $counter ++;      }         How can I make sure the big ones are `post_type=movie` and the small ones are `post_type=artist`? Any help would be much appreciated. Thanks in advance.


custom url - add attachment's id or name after post

I want to link to attachments but through its parent page. /directors/piranha-bar/ shows all of that post's attachments on single.php and i want /directors/piranha-bar/video/name-or-ID/ to still use single.php but have the variable $video captured. How can i firstly make the links on the attachments into this format? Then get wordpress to recognise this url, get the variable and go to single.php? hope that's clear! best, Dc


How can I create post templates that users can choose from?

I have created a user driven site for the Talmud. I have made a couple posts and would like other users posts to look the same. I'm not talking about the actually page, just the post content. I would like to create templates that the users can choose from that look exactly my post and they can then just insert their own text their. Is this possible? And if its is how would I do it.


Plugin redirects URL structure using 301 redirect. Time to disable the plugin?

I have been using a plugin that goes by the name "Permalink Redirect." This WordPress plugin redirects older permalinks to the newer one set by me. Old URL structure: /%year%/%category%/%postname%.html New URL structure: /%category%/%postname%/%post_id%/ All the posts with the older URL structure are redirected to newer ones using 301 redirects. Now it has been months since I implemented this, and Google doesn't index the older URL structure anymore -- newer ones are visible in Google index. I was wondering if it's the right time to disable the plugin? I am doing this because I have seen constant dip in the traffic -- Google doesn't like 301 with another 301 redirect, or so I read. (I also use another plugin for custom redirecting of broken URLs.) I implemented this plugin back in May, 2011. Is it okay to deactivate the Permalink Redirect plugin? I'm worried if this is the right move. My site: http://blogote.com -- I have deactivated the plugin just now. Edit: Plugin activated; over 1200 inbound URLs are removed and replaced with newer URLs.


How to accomplish a child page navigation?

I'm not finding any info on this, so I'm probably wording it incorrectly in my search. So I'm hoping someone can point me in the right direction. I have 50 pieces of content that'll be going on my wordpress site. Each piece of content will be broken down into 5-6 pages (each). So I made a custom page template for this. My goal is to have a navigation that shows the child pages, so users can click through them easily to reference different sections of the content. But I don't want to do this manually per page. I've tried searching for child-page navigations and the best I've come up with is a plugin that just lists the child-pages. This wont work because even on the child pages I want the navigation to show. Any direction would be extremely helpful.


append PHP function to the_content

I'm using the Jetpack plugin for related items and social sharing. Both of these options filter the_content and append themselves to the end of it. The problem is that I'm using custom navigation in my posts which I output by using this code above and after `the_content` in my `single.php`.
           <?php multipagebar(); ?>
             <?php TA_content_jump(1); ?>

        I know that to append something to the_content I can use a filter:               add_filter('the_content', function($content)     {         return 'text-to-append' . $content;     });      My question and problem is: how to append the navigation PHP functions so that they display before the related and social sharing items of Jetpack?


get_post_meta in WP_Query

I'm doing a plugin to add likes to posts I want to create a table on a page in the plugin to show each post and the number of likes               function my_plugin_options() {              echo '
Table of Likes
';         echo '
';              echo '
';       echo '
';       echo 'Post	';       echo 'Number of likes	';       echo '
';              // -- WP_Query --               $like_args = array(             'post_type' => 'post',             'order' => 'DES',             'post_status' => 'publish'         );              $like_loop = new WP_Query($like_args);              if($like_loop->have_posts()):             while($like_loop->have_posts()):                 $like_loop->the_post();              // -- WP_Query --                    $likes = get_post_meta( $like_loop->post_ID, "_like_amount", true);                   echo '
';         echo '';         the_title();         echo '	';         echo '';         $likes;         echo '	';         echo '
';              endwhile;         endif;              wp_reset_postdata();              echo '
';     }      I have a meta field in each post '_like_amount' that is the number of likes. How do I use get_post_meta to retrieve the meta field in my `WP_Query` loop? I've tried               $likes = get_post_meta( $like_loop->post_ID, "_like_amount", true);      But it fails


Using css class selectors on a specifc page

I'm trying to position images next to several bullet lists in such a way the global default doesn't achieve so in my style.css file for the child theme I have my selector as .activities img{ code here; } then on the page I'm applying it to I find an img tag make it look like               <img class="activities" src"linktoimage.png"/>      When I refresh nothing happens to the image. I've tried using ID instead of class and putting the image within a DIV that uses the selector none of which has any effect. I'm possibly doing it wrong so any help would be appreciated thanks


can i create 2 blog 'feeds' within one blog

Right now by blog has the 'home' section where all my new posts go, and 'pages' sections which are static pages that i can edit. my question is, can i have another section that will behave like the 'home' link? for example, can i have a page called 'cars' and a section called 'cats', where i can add new posts to either section? if this is not possible, what are some workarounds? **edit:** i dont want the blog homepage to contains ALL stories, i want it to contain all stories under the cat category, and the 'car' page contain all the posts under 'car' category. in essence, it will be like i have 2 different blogs under a single blog


How can I find the 'public absolute' path of a file?

**Short Version** I need to give in the absolute path of a Javascript file that is to be hooked into something. It works if I hardcode it into 'http://mywebsite.com/folder/script.js' However I prefer not to hardcode it in. I can do `dirname(___FILE___)`, which gives me this: '/home/public_html/folder/script.js' But that fails, the script isn't loaded. What's the best practice to find the absolute path (starting with 'http://')? - **Long Version** On this page in the Wordpress documentation relating to the tinyMCE plugin creation, I found this:               // Load the TinyMCE plugin : editor_plugin.js (wp2.5)     function add_myplugin_tinymce_plugin($plugin_array) {        $plugin_array['myplugin'] = URLPATH.'tinymce/editor_plugin.js';        return $plugin_array;     }      There's a note at the bottom saying: > Note: when using the mce_external_plugins filter, the url should point to > the actual plugin file, as in the example above. A bit higher in the documentation they say > mce_external_plugins: passes in/out an associative php array 'plugin_name' > => 'plugin_url'. The url should be absolute and on the same domain as your > WordPress installation. I am completely puzzled because I can't find any information about **'URLPATH'** which is used in their example. I don't think it exists in PHP, WP or TinyMCE, but I could be wrong. Incidentally, were this to be an error in the WP documentation, what would I replace URLPATH with to make it work?


Grab Wordpress Salt Data From URL

I'm looking to grab only the values of the Wordpress salt information from this URL with PHP: https://api.wordpress.org/secret-key/1.1/salt I want to target the second set of values within single quotation marks. Is this do-able with regex? I'm having issues               $url = 'https://api.wordpress.org/secret-key/1.1/salt';          $ch = curl_init();          curl_setopt($ch, CURLOPT_POST,1);     curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));     curl_setopt($ch, CURLOPT_URL,$url);     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);          $output= curl_exec($ch);     preg_match_all("/'(.*?)'/", $output, $matches, PREG_PATTERN_ORDER);     var_export($matches);      I'm working on a tool that will automatically grab the content from the url, strip out everything except for the values of the defined keys and return it in an array. It seems to mess up alot and doesn't bring back the proper values, is there any other way to target the defined values only from the second set of quotation marks? Thanks


What level of permissions should the plugins folder be set to?

I am on a (non-hosted) server...what level of permissions should my plugins folder (and everything inside of it) be set to? I seem to be having issues deleting or moving files inside of this folder...


Remove [ and ] from excerpt

I am displaying the wordpress posts on the index page with:               <?php the_excerpt(); ?>      In my functions.php file I have following code:               add_filter('excerpt_length', 'my_excerpt_length');     function my_excerpt_length($length) {     return 30; }      This works fine but it shows `[...]` at the end of excerpt. I want to remove these `[` and `]` and instead I want to show only three dots `...` . How can i do that? Thanks.


Enclosures being deleted "automatically"

I am using PowerPress for my podcast support. I am working on some things on the web site and I swear, I set the enclosure, verify via phpMyAdmin that it is there. I don't touch anything on the site and check minutes later and the enclosure is missing. Huh?!? Does anyone have any ideas where to start looking? I am running my own server on Ubuntu 11.x. I am using Apache for my web server.


How to use is_active_widget?

This is the manual page and this is the code. But I'm still struggling to understand how to use this function. Perhaps I am using it right, but something I can't think of is wrong. But more surely, I need to know what this means:   1. `callback` - I assumed this was the name of the Widget class. Am I right?   2. `widget id`, what is this?   3. `id base`, what is it?   4. _Whether to check in`wp_inactive_widgets`._ What is `wp_inactive_widgets`? I really feel like the manual isn't explaining these things. Here's something that I put together which does not work:               function cbs_register_widgets() {         register_widget( 'cbs_map_widget' );     }          add_action( 'widgets_init', 'cbs_register_widgets' );          function cbs_enqueue_resources() {              if ( is_active_widget( 'cbs_map_widget' ) ) {             wp_enqueue_script( 'fancybox-js', plugins_url( '/fancybox/jquery.fancybox-1.3.4.pack.js', __FILE__), array( 'jquery' ), '1.3.4' );             wp_enqueue_style( 'fancybox-css', plugins_url( '/fancybox/jquery.fancybox-1.3.4.js', __FILE__ ), '', '1.3.4' );         }              wp_enqueue_script( 'cbs-widgets-js', plugins_url( '/js/cbs-widgets.js', __FILE__ ), array( 'jquery' ) );         wp_enqueue_style( 'cbs-widgets-css', plugins_url( '/css/style.css', __FILE__ ) );          }          add_action( 'template_redirect', 'cbs_enqueue_resources' );      The enqueueing in itself works, it is the `is_active_widget` that doesn't work. The widget itself works too, and displays correctly. Just the fancybox js that's missing. Here's my implementation of one of the answers I got below, it does not work either:               class cbs_map_widget extends WP_Widget     {         function cbs_map_widget()         {             $ops = array('classname' => 'cbs-map-widget', 'description' => 'Visar en karta över Chalmers område där lokaler som används av Sällskapet har markerats.');                  $this->WP_Widget('cbs-map-widget', 'CBS kartwidget', $ops);         }              function widget($args, $instance)         {             extract($args);                  echo $before_widget;                  echo '
text
';             echo '';                  echo $after_widget;                  add_action('wp_enqueue_scripts', array(&$this, 'js'));         }              function js()         {             if ( is_active_widget(false, false, $this->id_base, true) ) {                 wp_enqueue_script( 'fancybox-js', plugins_url( '/fancybox/jquery.fancybox-1.3.4.pack.js', __FILE__), array( 'jquery' ), '1.3.4' );                 wp_enqueue_style( 'fancybox-css', plugins_url( '/fancybox/jquery.fancybox-1.3.4.js', __FILE__ ), '', '1.3.4' );             }         }          }


Dash or underscore in theme folder name?

I'm confused and I didn't find any answer by Googling. My theme files such as `single.php` or `header.php` reside in a folder. Should I use dashes or underscores in the folder name? My web server run on Linux / Apache and I'm not sure what the consequences are regarding folder names. So should I prefer something like `my_wordpress_theme_folder` over `my-wordpress-theme-folder` or are both equally valid?


How to change title "Search Results for:...." in search results page of genesis?

I want change title "Search Results for:...." in search results page because i want translate to Vietnamese. I use Genesis. Please help me!!


How to show dynamic side bar on menu item

I want to show dynamic sidebar content on menu item (within `<li></li>` tag) but unfortunately sidebar content show top of `<nav></nav>` tag, i mean top of the menu and where i call dynamic side bar here show result 1. I don't find any suggestion related this problem. So please, any one can help me. Thank you. here is my menu code               1. Menu code:                                                               <?php                              if(has_nav_menu('primary-menu')){                               wp_nav_menu( array('menu' => 'primary-menu' ));                             } else {                                 $pages = wp_list_pages('sort_column=menu_order&title_li=&echo=0');                                 $pages = str_replace(array('
', '
'), '', $pages);                                 echo "
".$pages."

";                             } ?>                                       2. dynamic side bar adding code:              add_filter('wp_nav_menu_items', 'your_custom_menu_item', 10, 2);              function your_custom_menu_item($items, $args) {             if ($args->menu == 'primary-menu') {                 return $items .= '
What is blank         '.dynamic_sidebar('Mega Menu').'

                     <form role="search" method="get" class="search-form" action="'.home_url( '/' ).'">                         <input type="search" class="search-field" placeholder="Search …" value="" name="s"/>                         <input type="submit" class="search-submit postfix" value="Search" />                     </form>

';             }             return $items;         }          3. Result code:
What is blank1


How to show tags in posts with a theme that does not do it

For my wordpress site I bought a theme, but I discovered later that this particular theme does not show posts' tags (in posts' pages). Is it possible to force the theme to show tags in posts ?


pre_get_posts redirecting

Is there any possibility to redirect visitors to home page, for example, if they aren't allowed to view page's/post's content, using pre_get_posts action? I'm trying to develop a simplified membership plugin and I want to test if current_user/ current_visitor is allowed to view the content of page/post. For that, I want to retrieve the queried post id from wp_query and test if user/visitor can view the content he asked for. If he can't, I want to redirect him to an error page. I'm also using classes to encapsulate a little bit data. Here's a piece of code:               class Public {         public function __construct() {             add_action('pre_get_posts', array($this, 'try_redirect'));         }              private function try_redirect() {             wp_redirect( home_url() ); // doesn't work         }     }      If this isn't possible can you bring me another idea? Thanks!


How Does Wordpress Remember Metabox Positions?

I was wondering how Wordpress remembers the position of metaboxes: session basis, user basis, computer basis? Does it set a cookie? Is it saved in the database?


Filter the_content to add something before each <h1> element?

I'm looking for a clean way of filtering the_content to add a piece of code before each H1 tag present in it. In fact, I have a long privacy policy text and I want to add a back to the top link before each paragraph. Of course, I could easily add these in the content editor but I don't want my customer to be able to remove it accidentally. So I have something like :
BLA BLA BLA

A very interesting piece of text here...

BLA BLA BLA

A very interesting piece of text here...

BLA BLA BLA

A very interesting piece of text here...
      and I want to filter it to get :               Back to the top
BLA BLA BLA

A very interesting piece of text here...
     Back to the top
BLA BLA BLA

A very interesting piece of text here...
     Back to the top
BLA BLA BLA

A very interesting piece of text here...
      Thanks in advance for your time. Cheers, J.


Add default WordPress tag meta box to User Profile

I've set up my user profiles to allow custom taxonomies following this tutorial. Ideally, I'd like to use the default Tag meta box from the Post screen, so users can easily add new terms and find commonly used ones. I'm currently using a checkbox list, but this could get very long as we'll have a number of taxonomies. Could I somehow use the `post_tags_meta_box()`? I've looked into `add_meta_box()` but that doesn't work on `'user'`.


the loop - how to control whether wp or plug-in runs it

I have a problem with the loop running on two instances with thecartpress plugin. Im not great with php by any standards but can usually get things done, however with wordpress im fairly new. Is there a way to have my plugin control the loop for just my catalog page and have wordpress ignore it? i hope im not being to vague. THIS IS ALL CODE FROM PAGE.PHP IN MY THEME                       <?php                  global $projectTheme;                      get_header();                  ?>                       <?php get_template_part('theloop'); ?>                  <?php comments_template(); ?>                  <?php get_template_part('navigation'); ?>                              <?php get_footer(); ?>      THIS IS THE ONLY HTML ON THE CATALOG PAGE CREATING THE DUPLICATION                                 [tcp_list id="all_products"]      That is shortcode from the tcp (thecartpress plugin) Now this plugin is great, it gives you options for theme compatibility, asking how to display things in your catalog, and whether to let your theme control the loop, or use their configurable loop, however i have exhausted every bit on settings within their control panel and none of their settings effect this. I believe anymore its something with their shortcode, which is done by using a shortcode generator they supply with the plugin. I feel as though my theme runs this shortcode, and their plugin as well no matter how i set it, causing a double loop?


Error when installing theme - "failed to open stream: No such file or directory in..."

I'm trying to upload and install a custom theme, and have encountered an error I've not seen before. > Warning: copy(/home/content/38/7184638/html/wp- > content/upgrade/SEWS_theme1/SEWS_theme/img/border.png) [function.copy]: > failed to open stream: No such file or directory in > /home/content/38/7184638/html/wp-admin/includes/class-wp-filesystem- > direct.php on line 200 > > Warning: copy(/home/content/38/7184638/html/wp- > content/upgrade/SEWS_theme1/SEWS_theme/img/border.png) [function.copy]: > failed to open stream: No such file or directory in > /home/content/38/7184638/html/wp-admin/includes/class-wp-filesystem- > direct.php on line 200 > > Could not copy file. /home/content/38/7184638/html/wp- > content/themes/SEWS_theme/img/border.png Theme install failed. I'm not at all sure what that means, any ideas what the problem could be?


Dynamically pull the correct email address from a match

Here's my current function,                class emailer {       function notifyHeart($post_ID)  {         $interests = get_user_meta(get_current_user_id(), 'interests');         $post = get_post($post_ID);              foreach($interests as $interest) {           if(has_tag($interest, $post)) {             $to = get_the_author_meta( 'user_email', get_current_user_id() );               $email = $to;             mail($email, "An article about Heart", 'A new post has been published!');             break;           }         }       }     }     add_action('publish_post', array('emailer', 'notifyHeart'));      So far it only works with one user, the other user isn't receiving an email when there's a tag from post that match their interest. Ideally, I would like to retrieve an email only when a user's $interest matches a tag from a post, then the appropriate email address will be selected and sent.


wp_insert_term doesn't work with custom post type's taxonomy

Here is the problem I am having:   1. I have a custom post type called "weddingguests"   2. This custom post type "weddingguests" has a custom taxonomy, "friendsof", hierarchic   3. I want to programmatically insert into this custom taxonomy "friendsof" 2 terms: "Friends of the Bride" and "Friends of the Groom" Here is the function and the action I am using to insert one term:               // programatically add 2 terms to the taxonomy "FRIENDS OF"     function example_insert_category() {         wp_insert_term(             'Example Category',             'friendsof'         );     }     add_action( 'after_setup_theme', 'example_insert_category' );      The problem: wp_insert_term doesn't appear to be working with my custom taxonomy What I have tried:   1. I have tried switching the taxonomy from hierarchic to non-hierarchic - that didn't work   2. I have tried using wp_insert_term (the same code) to add terms to the post "category" - that is working   3. I have tried assigning the custom taxonomy "friendsof" to the posts and then add my term ( I thought there is a problem with the way I am building my custom post types) - that didn't work


Media not found / Convinced it's a install issue

Used auto installer through my host account and WP installed fine. This install is to an add-on domain under my already running account. In short I already have another site up and running fine under this hosting acct. It's NOT a WP site. Again, followed normal install instructions and choose default options to install this new WP site. Fast fwd to adding media (pics) to a new page and I get this error : It looks like nothing was found at this location. Maybe try a search? I’ve chased different solutions regarding permalinks, file permissions and even did a manual WP install resulting in the same issue. Now here’s why I think the issue has something to do with my install. I have another account with the same hosting Co. It’s not running a site at all. When I attempt to install WP to this account everything works fine as expected. Using this acct I can add media crap until I’m blue in the face and it works just fine. At this point I’m suspicious of how WP may be stepping on the .htaccess at the top level of my already running (non-wp) site. Can anyone please help me get past this bump in the road by either offering up a solution or pointing me to an already resolved topic that I may have overlooked? I’ve exhausted my resources at this point.


Permalinks of archive tag wordpress

I try to add link of tag archive in text that contain tag. For example:- if i have tag that name "football" and in single.php i display the content like "the_content();", So now when article have word like " football " it must be add link to get me all article have word " football ". I do this function, but i need the the link of tag archive ???               function tag_content_replace($post_content) {        global $wp_query, $post;             if (!is_single() ) return $post_content;       $content_with_tags_link = $post_content;           $posttags = get_the_tags();      if ($posttags) {        foreach($posttags as $tag) {        $tag_name = ' '.$tag->name.' ';       $link_ = ' name.'">'.$tag->name.' ';       $content_with_tags_link =  str_replace($tag_name , $link_ ,$content_with_tags_link)  ;             }     }               $content_with_tags_link = preg_replace('//', '', $content_with_tags_link);                return  $content_with_tags_link;     }


Categories to be added by users but kept pending till approved

I want Categories to be added by users OR contributors but kept pending till approved by admin. I need this feature in my hindi poems publishing wordpress blog


Importing Data from a Non-WordPress database, into WP

I'm migrating data from a totally different database style into WP. The main issue I'm trying to wrap my head around is how to import any meta data, given that WP uses a `key` `value` pair style for meta tables. Is there a way to import column data as `key` `value` pairs?


Get only last child category link of products

At the moment i have this code:               $collections = get_the_terms( $post->ID, 'product_cat' );          foreach( $collections as $collection ) {         $link = get_bloginfo( 'url' ) . '/' . $collection->slug . '/';         echo $link .'  ';     }      That outputs a product terms, taxanomies url of products. Problem is that code returns all of categories for one product like: http://www.rebella.lv/aizsardzibu-no-saules-iedarbibas/ http://www.rebella.lv/dzilu-kondicionesanu/ I need only to show last child one category of products for example only one from list: product_cat. Here is final working code:               $terms = wp_get_object_terms($post->ID, 'product_cat', array('orderby' => 'term_id', 'order' => 'ASC') );     if ( !empty( $terms ) ) :     $project = array();     $project_url = array();     foreach ( $terms as $term ) {         $project[] = $term->name;         $project_url[] = $term->slug;     }     echo '<category_full>' .$project[0] . ' >>'. $project[1]. ' >>'. $project[2]. '</category_full><category_link>' . get_bloginfo( 'url' ) . '/product-category/' . $project_url[0].'/'.$project_url[1].'/'.$project_url[2] . '/' . '</category_link>';     endif;


Return Attachments from Custom Post Type

I'm a fairly new WP developer. I am trying to get my `portfolio.php` to display all images attached to my custom post type 'portfolio', and then display them in a masonry format. I've managed to get them to show without the `$post->post_type` query, but not much success when trying to limit WP to retrieving images attached to my custom post type. Any help will be much appreciated, and thanks in advance!                   <?php get_header(); ?>
         <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>         <?php if ( $post->post_type == 'portfolio'  ) {         $attachments = get_posts( array (             'post_type' => 'attachment',             'numberposts' => -1,             'post_parent' => $post->ID         ) );               if ( $attachments ) {     foreach ( $attachments as $attachment ) {         $imgurl = wp_get_attachment_url ($attachment->ID);                 echo '
';                 echo '';                 echo '
';             }              }     }         ?>
         <?php endwhile; endif; ?>         <?php get_footer(); ?>      As requested, my solution. Not very elegant, but it works:                   $query = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => -1 ) );         if( $query->have_posts() ){             while($query->have_posts()){                 $query->the_post();                 $image_query = new WP_Query( array( 'post_type' => 'attachment', 'post_status'         => 'inherit', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID(), 'order' => 'DESC' ) );         while( $image_query->have_posts() ) {             $image_query->the_post();             $imgurl = wp_get_attachment_url( get_the_ID() );             echo '
';             echo '';             echo '
';         }     }      }


Extending WP_Widget throws error when Monster Widget used

I wanted to override the output for the core Recent Comments Widget. I extended `WP_Widget_Recent_Comments` made the changes needed and it displays exactly how I want. However, I have now tested the theme with Monster widget, and for where the Recent Comments widget should be output an error is thrown:               Notice: Undefined index: WP_Widget_Recent_Comments in /Users/tfisher/Sites/mysite/dev/wp-includes/widgets.php on line 1319      Can't figure out why it would only throw an error when used by Monster Widget. Here's my extension class:               Class My_Recent_Comments_Widget extends WP_Widget_Recent_Comments {              function widget( $args, $instance ) {             global $comments, $comment;                  $cache = wp_cache_get('widget_recent_comments', 'widget');                  if ( ! is_array( $cache ) )                 $cache = array();                  if ( ! isset( $args['widget_id'] ) )                 $args['widget_id'] = $this->id;                  if ( isset( $cache[ $args['widget_id'] ] ) ) {                 echo $cache[ $args['widget_id'] ];                 return;             }                  extract($args, EXTR_SKIP);             $output = '';                  $title = ( ! empty( $instance['title'] ) && isset($instance['title']) ) ? $instance['title'] : __( 'Recent Comments', 'mysite' );                  /** This filter is documented in wp-includes/default-widgets.php */             $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );                  $number = ( ! empty( $instance['number'] ) && isset($instance['number']) ) ? absint( $instance['number'] ) : 5;             if ( ! $number )                 $number = 5;                  /**              * Filter the arguments for the Recent Comments widget.              *              * @since 3.4.0              *              * @see get_comments()              *              * @param array $comment_args An array of arguments used to retrieve the recent comments.              */             $comments = get_comments( apply_filters( 'widget_comments_args', array(                 'number'      => $number,                 'status'      => 'approve',                 'post_status' => 'publish'             ) ) );                  $output .= $before_widget;             if ( $title )                 $output .= $before_title . $title . $after_title;                  if ( $comments ) {                 // Prime cache for associated posts. (Prime post term cache if we need it for permalinks.)                 $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) );                 _prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false );                      foreach ( (array) $comments as $comment) {                     $output .= '
';                     if(get_avatar($comment)) {                         $output .= '
';                         $output .= '';                         $output .= get_avatar( $comment, 100 );                         $output .= '';                         $output .= '
';                         $output .= '
';                     } else {                         $output .= '
';                     }                     $output .= sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), 'comment_ID) )) . '">';                     $output .= get_the_title($comment->comment_post_ID) . '';                     $output .= '
'; // content                     $output .= '
'; // item                 }             }             $output .= $after_widget;                  echo $output;             $cache[$args['widget_id']] = $output;             wp_cache_set('widget_recent_comments', $cache, 'widget');         }     }


Can't seem to attach uploaded image to post and set it as thumbnail

I'm using this code to submit a post form and upload an image which I want as the post thumbnail. Everything submits perfectly and the image even uploads but I can't seem to figure out how to attach the image to the post and set it as the post thumbnail automatically. Any help would be greatly appreciated.               <?php          $postContentError = '';          if ( isset( $_POST['submitted'] ) && isset( $_POST['post_nonce_field'] ) && wp_verify_nonce( $_POST['post_nonce_field'], 'post_nonce' ) ) {          if ( trim( $_POST['postContent'] ) === '' ) {         $postContentError = 'Please enter a description of this property.';         $hasError = true;     }          $random = rand(1000000, 9999999);          $post_information = array(               'post_name' => sanitize_title( date( 'YmdHis' ). '-' . $random),         'post_title' => 'Property '.date( 'YmdHis' ). '-' . $random,         'post_content' => $_POST['postContent'],         'post_type' => 'properties',         'post_status' => 'publish'     );          $propertyfor = $_POST['propertyfor'];     $propertytype = $_POST['propertytype'];     $bedrooms = $_POST['bedrooms'];          $post_id = wp_insert_post($post_information);          function upload_user_file( $file = array() ) {           require_once( ABSPATH . 'wp-admin/includes/admin.php' );           $file_return = wp_handle_upload( $file, array('test_form' => false ) );           if( isset( $file_return['error'] ) || isset( $file_return['upload_error_handler'] ) ) {               return false;           } else {               $filename = $file_return['file'];               $attachment = array(                   'post_mime_type' => $file_return['type'],                   'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),                   'post_content' => '',                   'post_status' => 'inherit',                   'guid' => $file_return['url']               );               $attachment_id = wp_insert_attachment( $attachment, $file_return['url'], $post_id );               require_once(ABSPATH . 'wp-admin/includes/image.php');               $attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename );               wp_update_attachment_metadata( $attachment_id, $attachment_data );               if( 0 < intval( $attachment_id ) ) {                     return $attachment_id;               }           }           return false;     }          if( ! empty( $_FILES ) ) {       foreach( $_FILES as $file ) {         if( is_array( $file ) ) {           $attachment_id = upload_user_file( $file );         }       }     }          if($post_id) {         // Update Custom Meta         update_post_meta($post_id, 'shru_price', esc_attr(strip_tags($_POST['shru_price'])));         update_post_meta($post_id, 'shru_address', esc_attr(strip_tags($_POST['shru_address'])));              wp_set_object_terms( $post_id, $propertyfor, 'propertyfor' );         wp_set_object_terms( $post_id, $propertytype, 'propertytype' );         wp_set_object_terms( $post_id, $bedrooms, 'bedrooms' );              // Redirect         wp_redirect(home_url('/listings'));         exit;     }          }          ?>


Twenty Eleven black jetpack carousel gallery page. How to debug this?

I'm using the twenty eleven theme and I want to use the jetpack carousel for my gallery. I've activated it but whenever I click an image, the image doesn't show up. I can see that black screen with the 'WRITE A COMMENT' from the jetpack carousel but the image doesn't display. Also, whenever I try to close the carousel pop-up I can't, so the only way to get rid of it is to refresh the page. Here's my console log:               Uncaught TypeError: Cannot call method 'split' of null (index):52      Not sure how I can fix this. Any help is appreciated. Thanks!


Is it possible to change the CSS rules for Disqus comments?

I have tried everything I could come up with, including using the '!important' attribute, but have not been able to change the CSS for the Disqus comments on my site. Their CSS not only originates from a file on their website, but I think the comments are in an iframe or something, which would explain why the '!important' attribute isn't working. Is it possible to change the CSS for Disqus comments on a wordpress blog? All I want to add is the following code:               #disqus_thread {     font-family: arial;     font-weight: bold;     font-size: 13px;     }      That's it! Any help would be greatly appreciated.


Hiding media uploaded by other users in wordpress multisite?

I am using WordPress Multisite and want to hide media which others have uploaded. Like if X User of that site has uploaded any media in the site, Y User should not be able to see or access this from their login.


Is there an existing capability to allow editing of only pre-existing pages? If not, a good way to implement this?

I'm working on a setup for which I need general users to be able to edit a specific list of pages, but not create any new ones. Looking through the Codex, I don't see anything that will come close to this desired functionality, but I thought I might be looking through it. Failing a pre-set, I started looking into Advanced Access Manager, but it was not immediately obvious to me if it would do what I need. Anyone with experience with this plugin have any idea where to begin?


Add an access code form to call a unique page based on page without registration

I've seen some other questions similar but not the totally the same. If I missed in the search, please forgive me. However this what I have so far: I've created a form that has the following: an input field for the access code and a submit button as follows:               <form action="#" method="POST" name="access">
<input id="access_code" type="Text" name="access_code" value="" /> <input type="Submit" name="access1" value="Register" />
     </form>      Then on the backend - I started with something like this:               <?php          if(isset($_POST['Register'])){          if(empty($_POST['access_code'])){     echo "Access Code Must Be Entered";     }          }          $DisplayForm = True;     if(isset($_POST['Register'])){     $DisplayForm = False;     echo $_POST['access_code'];          }          if ($DisplayForm){     ?>     <form action="#" method="POST" name="access">     <input type="Text" name="access_code" value=" " /> <input type="Submit" name="access1" value="Register" />          </form>     <?Php     }          ?>          <?php           echo "<a href="http://www.mysite.com/<?php echo $_POST['access_code'];?>""          ?>      I realize my final echo syntax is also broken. But not quite sure how to write out. I know programmer but this what I had on the simple side. All I want to do is have this form redirect a user to a custom page that's based on the access code they have been given and call it with a short code. For example if the access code is "help" they are then sent to a page of http://www.mysite.com/help or if the password is "contact" they are then sent to a page of http://www.mysite.com/contact I initially wanted to base this on the password protection feature in WordPress where if the page password was also "help" it would just redirect to that url but I may be over complicating things. **So the new code should look like this:**               if(isset($_POST['Register'])){          if(empty($_POST['access_code'])){     echo "Access Code Must Be Entered";     }          }          $DisplayForm = True;     if(isset($_POST['Register'])){     $DisplayForm = False;     echo $_POST['access_code'];          }          if ($DisplayForm){     ?>     <form action="/" method="$_GET" name="access">     <input type="Text" name="name" value="" /> <input type="Submit" name="access1" value="Register" />          </form>     <?Php     }     ?>          <?php           wp_redirect(get_bloginfo('url').'/'.$_POST['access_code']);          ?>      I think I understand it all except the execution of the before `get_header()` part. How would I do that? Sorry - I'm very new to actually programming something. I mostly just make things look pretty.


Using custom post types WordPress network

Working on a project I am setting up a WordPress network containing sites/blogs for small shops. I would like to use 2 custom post types in the following way: A location post type; The blog admin can change/add a location, which is picked by a Google Maps plugin and inserted in the main blog Google Maps (which can searched and so on...) A sale post type; the blog admin can change/add a sale item, which should be randomly shown on main blog and around relevant Google Maps results. I have been searching for an answer weither this is possible for over a week now. But I just can't believe that this is impossible to realize. Can anyone at least point me in the right direction? EDIT to clarify: I would like every site admin to add these post types and then be able to display them on the network main site.


Getshopped (WP-e-commerce): show all protucts on one admin page for drag-and-drop ordering

How I can show all my products on one page? I need drag-and-drop products from page 3 to page 1 but I can't do this over pages. Or I can use another solution for manual product sorting? ![Getshopped \(WP-e-commerce\) products](http://i.stack.imgur.com/kaJuI.png)


Remove action plugin

i have installed the theme-my-login plugin and i want change the password_fields function: this is the code of custom-password.php of the plugin:                    /**      * Loads the module      *      * @since 6.0      * @access protected      */     protected function load() {         add_action( 'register_form',       array( &$this, 'password_fields' ) );         add_filter( 'registration_errors', array( &$this, 'password_errors' ) );         add_filter( 'random_password',     array( &$this, 'set_password'    ) );              add_action( 'signup_extra_fields',       array( &$this, 'ms_password_fields'       ) );         add_action( 'signup_hidden_fields',      array( &$this, 'ms_hidden_password_field' ) );         add_filter( 'wpmu_validate_user_signup', array( &$this, 'ms_password_errors'       ) );         add_filter( 'add_signup_meta',           array( &$this, 'ms_save_password'         ) );              add_action( 'tml_new_user_registered', array( &$this, 'remove_default_password_nag' ) );         add_action( 'approve_user',            array( &$this, 'remove_default_password_nag' ) );              add_filter( 'tml_register_passmail_template_message', array( &$this, 'register_passmail_template_message' ) );         add_action( 'tml_request',                            array( &$this, 'action_messages'                    ) );              add_filter( 'registration_redirect', array( &$this, 'registration_redirect' ) );     }          /**      * Outputs password fields to registration form      *      * Callback for "register_form" hook in file "register-form.php", included by Theme_My_Login_Template::display()      *      * @see Theme_My_Login::display()      * @since 6.0      * @access public      */     public function password_fields() {         $template =& Theme_My_Login::get_object()->get_active_instance();         ?>
<label for="pass1<?php $template->the_instance(); ?>"><?php _e( 'Password' ); ?>         <input autocomplete="off" name="pass1" id="pass1<?php $template->the_instance(); ?>" class="input" size="20" value="" type="password" />

<label for="pass2<?php $template->the_instance(); ?>"><?php _e( 'Confirm Password', 'theme-my-login' ); ?>         <input autocomplete="off" name="pass2" id="pass2<?php $template->the_instance(); ?>" class="input" size="20" value="" type="password" />
         <?php     }      in functions.php i have added this but not working:                    function init_wp() {          // remove parent theme's header content action     remove_action('register_form', 'password_fields');          // add child theme's header content action     add_action('register_form', 'cust_password_fields');               }          add_action('init', 'init_wp');          function cust_password_fields(){          }      any ideas ?


How would I restrict certain user levels from editing categories

I have a situation where I need WooCommerce product categories to be edited by an admin only. So, basically I'm looking for a way to prevent other user roles from adding, editing or deleting categories for posts.


First post article different on Archives template

Hi I'm trying to make the first post article in the list different for the archive template. Basically they'd all be in order descending, but the first post in the list would be styled differently. Other people have said they've done it but the coding is much different and I don't know how to change the first post using the php in my theme. I want the first post to show the thumbnail and the title larger than the rest. Here is the basic code I'm using. Thanks in advance for any help!               get_header(); ?>
<?php                 if (is_day()):                     printf(__('Daily Archives: %s', 'outspoken'), get_the_date());                 elseif (is_month()):                     printf(__('Monthly Archives: %s', 'outspoken'), get_the_date(_x('F Y', 'monthly archives date format', 'outspoken')));                 elseif (is_year()):                     printf(__('Yearly Archives: %s', 'outspoken'), get_the_date(_x('Y', 'yearly archives date format', 'outspoken')));                 else:                     _e('Archives', 'outspoken');                 endif;                 ?>
                             <?php /* The loop */ ?>          <?php while (have_posts()): the_post(); ?>         <?php get_template_part('content', get_post_format()); ?>     <?php endwhile; ?>              <?php outspoken_paging_nav(); ?>                        <?php get_template_part('content', 'none'); ?>


Why is my custom form saving with 'autodraft' as title and slug?

I am currently writing a custom theme from scratch, which utilizes a number of custom post types. I am currently trying to build custom posting forms for them. I have hidden all of the normal form fields, and want the title/slug to populate based on one of the custom fields. So far, the metainformation is saving fin, but the title/slug is always 'autodraft'. Does anybody know how I might fix this? I have posted the relevant code snippets below. from functions.php               include_once( 'init/custom_post_types.php' );      from init/custom_post_types.php               function save_custom_post_form( $post ) {         if( file_exists( dirname( __FILE__  ) . '/../submission_handling/' . $_POST ['post_type'] . '.php' ) )             include_once( dirname( __FILE__  ) . '/../submission_handling/' . $_POST ['post_type'] . '.php' );     }     add_action( 'save_post', 'save_custom_post_form');      submission_handling/fixture.php (called when $_POST['post_type'] == 'fixture')               <?php     if(basename(__FILE__) == basename($_SERVER['PHP_SELF'])){exit();}          // save metainformation from custom form. This code works fine          $fixturedate = strtotime( $_POST['fixture-date'] );     update_post_meta($post, 'fixture-date', $fixturedate);     $fixturekickoff = esc_attr( $_POST['fixture-kickoff-time'] );         update_post_meta($post, 'fixture-kickoff-time', $fixturekickoff);     $fixtureoppteam = esc_attr( $_POST['fixture-opposing-team'] );     update_post_meta($post, 'fixture-opposing-team', $fixtureoppteam);     $fixturepat = esc_attr( $_POST['fixture-player-arrival-time'] );     update_post_meta($post, 'fixture-player-arrival-time', $fixturepat);     $fixtureoppteamurl = esc_attr( $_POST['fixture-opposing-team-website-url'] );            update_post_meta($post, 'fixture-opposing-team-website-url', $fixtureoppteamurl);     $fixtureaddy = esc_attr( $_POST['fixture-address'] );     update_post_meta($post, 'fixture-address', $fixtureaddy);     $fixface = esc_attr( $_POST['fixture-facebook-event'] );     update_post_meta($post, 'fixture-facebook-event', $fixface);          // Save title and slug into new post. This doesn't seem to work          if ( ! wp_is_post_revision( $post ) ){         $posttitle = array (              'ID' => $post,              'post_title' => $fixtureoppteam,              'post_name' => $fixtureoppteam,          );               // unhook this function so it doesn't loop infinitely          remove_action('save_post', 'save_custom_post_form');               // update the post, which calls save_post again          wp_update_post( $posttitle );                    // re-hook this function          add_action('save_post', 'save_custom_post_form');     }      **EDIT** Ok, with a bit of debugging, I have worked out that wp_is_post_revision( $post ) is returning the post ID of $post, which is why the post updating code is not firing. After looking at the raw database I have worked out the following. When I add a new post, TWO entries are made in the database, with statuses of 'inherit' and 'publish' respectively. It seems that $post is taking the id of the 'inherit' post, which is why `wp_is_post_revision ( $post )` is failing. The odd thing is that all those `update_post_meta ( ... )` entries are also using `$post` but the meta entries end up linked to the correct post (the 'publish' post). I still have no idea how to solve this problem without removing the `wp_is_post_revision ( $post )` check, which I don't think is a great idea.


Load testing for WordPress functionality

Does anyone know of (or have) any scripts / processes they use for testing performance under load - especially of WordPress specific behaviours, like posting many comments nearly simultaneously, while under heavy simulated traffic. I typically use apachebench to test general performance (and to make sure caching is working), but I can't see a way of testing comment and posting performance without scripting it myself. Any ideas?


Would switching to InnoDB from MyISAM improve performance of comments table?

A site I've built gets lots of comments in a short space of time - so perhaps 100 comments might be left in 5 or 10 minutes. This seems to cause a pretty heavy load on the database, especially when combined with recent comment widgets - I've seen server load rapidly spiral up to 40+, and using mtop I can see plenty of blocked queries. So, I'm using MyISAM as the storage engine, which locks the entire table for writing. Would switching to InnoDB which (I believe) uses row locking improve things? Looking at the MySQL docs, it seems perfectly possible to use both engines within the same database. So, the question: Does switching to InnoDB seem like it's a reasonable solution for what i described? Any WP specific experiences / benchmarks?


StackExchange clone using WordPress?

If you were to build a StackExchange clone site using WordPress, how would you do it?


Set the active Navigation Menu from a plugin

Is there a way to set the following option from a WordPress plugin, if you know the name of the menu you want to set: ![enter image description here](http://i.stack.imgur.com/FEbSF.jpg) My developer says it's not possible, but I am sure on of you gurus knows a way around this ;)


Possible to hide Page if no posts from a CPT?

I was thinking this would be an easy solution to accomplish, but I'm stuck since Main Pages in the Front-End are arrayed automatically. Basically I created individual pages to display specific Custom Post Type posts with different Template pages. What I want to accomplish is, if no posts were created for this specific CPT, than the page will not show in the Main Navigation links. Is this possible? Each page is using a unique URL (i.e. site.com/specials). So if no 'Special' post has been created, I do not want that page to show. Is there a function I can create to accomplish this? Thanks!


How to make posts appear under pages

I have created pages for my website, however when i create a new post, it is not assigned to any page and i am missing the option to place it under a certain page. For example i have a menu like Home Football Basketball if a user clicks on home, i would like them to see the page that i have published about home, which is static, however, when they click on basketball, they must see all relevant posts that have been made on besketball likewise for football.


current_page_item not being added in menu output

I've created a menu that I call on using following code.               <?php          wp_nav_menu( array(           'menu' => 'Primary Nav',           'container' => '',           'items_wrap' => '<ul>%3$s</ul>',           'depth' => -1           )          );      ?>      For some reason current_page_item is not output even though I'm having parent pages in the menu. I tried adding `depth` as `-1` to the arguments but it doesn't seem to have any effect.


Is there an alternative way to upload html without using TinyMCE?

I am comfortable editing HTML (I usually use Notepad++). Is there a way for me to upload HTML to my WP site without using the TinyMCE editor? I don't like how it strips tags or puts in unwanted ones. I do not know how else to modify the content of my page without using the Edit Page function in the Admin. I know there are some plugin alternatives (like TinyMCE Advanced), but I have not been able to find any information on how to use an external rich-text editor with WordPress. Thanks.


Saving data when javascript state changes

how to save data using ajax in wordpress when there is a change in javascript variable's value ? Vimeo Video State Change - http://jsfiddle.net/bdougherty/HfwWY/light/ I'm trying to save the (video finished) state for individual user to database