title: Second menu has the first menu ID

text:
I registered two menus top-menu and main-menu. I created two menu on the admin panel and assigned one to each (different items) But when I view the front end, I see that the two menus have the same items, and the main menu has an id "menu-top-menu-1" Here is what I have: functions.php               function register_my_menus() {         register_nav_menus (array(             'main-menu' => 'Main Menu',             'top-menu' => 'Top Menu',         ));     }     add_action( 'init', 'register_my_menus' );      header.php Top menu:
             <?php wp_nav_menu(array(                 'container' => 'nav',                 'container_class' => 'container',                 'item_location' => 'top-menu',                 'menu_class' => 'nav top-menu pull-right',             ));              ?>
      Main menu:

             <a href="<?php echo home_url(); ?>"><img class="block-center " src="<?php print IMAGES; ?>/logo.png" alt="<?php bloginfo('name'); ?> | <?php bloginfo('description'); ?>"/>

                 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-menu-toggle">                     Toggle navigation                                                                                </button>

             <?php wp_nav_menu(array(                 'item_location' => 'main-menu',                  'container_class' => 'collapse navbar-collapse nav-wrap',                 'container_id' => 'main-menu-toggle',                 'menu_class' => 'nav navbar-nav main-menu',             ));              ?>

      Here is the rendered output of both Top menu and Main menu

CanHerp

Rescues

Breeders

Forums

CanHerp

Rescues

Breeders

Forums

      * * * I'd also like to know if that's the best way to deal with bootstrap responsive menu (for the main menu'.


title: Odd spacing in Navigation Bar

text: I am in the process of redesigning my website, and i'm struggling to find what is causing spacing (margins i'm assuming) between navigation items. I have been delving through chrome developer tools and I cannot find what is causing it anywhere. Note that when you hover between items there is a noticeable white bar between items.


title: Get posts from similar time as current post

text: Hi guys I've been struggling with this for a while and wondered how you lovely people would go about implementing it. I would like to show 4 posts that were posted before and after the current post. Ideally two from before and two after. But here's the rub: I need there to always be 4. So if there aren't 2 newer ones fill the 4 from older ones or vice-versa. Which queries would you run? Any thoughts?


title: Posts 2 Posts: Get related posts from user connected to current post?

text:
Hopefully someone can help with this. I have a CPT called "Tours", and I'm using Posts 2 Posts to connect Posts inside that CPT to Users. Relationships being: Tour Item 1 > Tour Operator 1 Tour Item 2 > Tour Operator 1 In my single-tour.php I need to display thumbnail and post title of posts from other tour items (Tour Item 2) that are also connected to that User (Tour Operator 1). I'm using the basic example and its not returning anything (because I dont know how to grab items from that user connection).               function my_connection_types() {     p2p_register_connection_type( array(         'name' => 'tours_to_operators',         'from' => 'tour',         'to' => 'user',         'to_query_vars' => array( 'role' => 'touroperator' )     ) );     }     add_action( 'p2p_init', 'my_connection_types' );                                  <?php                         $users = get_users( array(                           'connected_type' => 'tours_to_operators',                           'connected_items' => $post                         ) );                         ?>                              <?php                         // Find connected pages                         $connected = new WP_Query( array(                           'connected_type' => 'tours_to_operators',                           'connected_items' => $users,                           'nopaging' => true,                         ) );                              // Display connected pages                         if ( $connected->have_posts() ) :                         ?>
Related pages:
                         <?php while ( $connected->have_posts() ) : $connected->the_post(); ?>
                             <?php the_post_thumbnail('tax-tour-cat-thumb'); ?>                             <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                         <?php endwhile; ?>                              <?php                          // Prevent weirdness                         wp_reset_postdata();                              endif;                         ?>


title: Add tags to post before it's created

text: Is it possible to add tags to a post, prior to its creation? Say if I have a link "/wp-admin/new-post.php?tags=a,b,c,d" and by clicking it, I want to enter the new-post page with the tags already associated with it.


title: Update all posts in one go

text: I've just used the woocommerce CSV uploader to add 1000+ products to an online store. However the products only appear in the store after they have been updated - And it has to be from the main edit page - bulk edit doesn't work. I don't want to do them individually and I'm looking for a way to bulk update the posts. I found this, but can't get it to work:               add_action('init','example_hide');          function example_hide(){          $my_posts = get_posts( array('post_type' => 'post', 'numberposts' => 10 ) );          foreach ( $my_posts as $my_post ):          $my_post['post_content'] = 'This is the updated content.';          wp_update_post( $my_post );          endforeach;     }


title: Accessing Advanced Custom Fields with Repeater using jQuery instead of PHP

text:
I am using Advanced Custom Fields (with repeater) and am currently using the following code to access the fields, i.e.:               <?php if( have_rows('postage_prices') ): ?>
              <?php while( have_rows('postage_prices') ): the_row();                   // vars             $order_qty = get_sub_field('order_qty');             $strips_rp = get_sub_field('strips_rp');             $strips_ep = get_sub_field('strips_ep');             $roll_rp = get_sub_field('roll_rp');             $roll_ep = get_sub_field('roll_ep');                  ?>
                      <?php echo $order_qty; ?>                 <?php echo $strips_rp; ?>                 <?php echo $strips_ep; ?>                 <?php echo $roll_rp; ?>                 <?php echo $roll_ep; ?>
              <?php endwhile; ?>
          <?php endif; ?>      My question is, instead of using PHP to access Advanced Custom Fields with Repeater as above, is it possible to access this information via jQuery? Any existing examples on how to accomplish this, would be much appreciated.


title: How to check username availability with ajax at registration

text: I'm using buddypress which uses its own template form `register.php` for registration at http://mysite.com/register. I'm looking for a way to show the user whether or not their entered username is available using ajax validation. Here is a snippet from the form.               <?php do_action( 'template_notices' ) ?>     <?php do_action( 'bp_before_account_details_fields' ) ?>        <div class="register-section" id="basic-details-section">           <?php /***** Basic Account Details ******/ ?>       <?php do_action( 'bp_signup_username_errors' ) ?>       <input type="text" name="signup_username" id="signup_username" value="Username" />       <?php do_action( 'bp_signup_email_errors' ) ?>       <input type="text" name="signup_email" id="signup_email" value="Email" />        </div><!-- #basic-details-section -->


title: Show user info in a hovercard

text:
I whant to display user info in a hovercard. I use a jquery plugin to for the hovercard. I call my file like this `<?php include 'includes/tooltip.php'; ?>` and this is my code from tooltip.php.
     <?php if ($comment->user_id) {$userdata=get_userdata($comment->user_id);      echo ''. $userdata->display_name . '';     echo ''. $userdata->user_description .'';     echo ''. $userdata->twitter.'';     echo ''. $userdata->facebook .'';     echo ''. $userdata->google .'';       }?>
      I use this code for extra fields in user profile google twitter etc..               function new_contactmethods( $contactmethods ) {     $contactmethods['twitter'] = 'Twitter'; // Add Twitter     $contactmethods['facebook'] = 'Facebook'; // Add Facebook     $contactmethods['google'] = 'google'; // Add google     unset($contactmethods['yim']); // Remove YIM     unset($contactmethods['aim']); // Remove AIM     unset($contactmethods['jabber']); // Remove Jabber     return $contactmethods;          }     add_filter('user_contactmethods','new_contactmethods',10,1);        The problem is with guests, their name is not displayed and the twitter, google, facebook fields are displayed for all users even for guest. Can any one tell me is my approach good. Is there another way to retrive user info ? This is a photo whith the hovercard and what I whant to achive. Tip info


title: author slug in the backend

text: hi and thanks for reading i try to grab the authors slug in the backend.               get_the_author_meta( 'user_nicename' );      is empty. i tried to google this issue, but cant find any concrete info on how to handle the backend. any hints would be nice. i keep writing to meet the quality standards. sorry for spaming but this seems to be the only solution. call it spam, i call it anyoing, but i wont complain, cause otherwise, what stupid text would end up here, just to get a little help.


title: How can I set taxonomy programmatically

text: Here is my situation. I plan to distribute a theme I am working on and it has a custom post type called `Code` and it has a custom taxonomy called `Languages` now I also use a custom metabox with a dropdown list of available languages, I need to somehow make the value that they choose in the select dropdown box to not only save as the meta value (which it does already) but I need that value to also be picked as the taxonomy for that post So If they make a post and pick the Language "PHP" in the meta_box, then when they post, it will make the "PHP" taxonomy be selected. I plan to hide the taxonomy UI and auto populate all the possible taxonomy terms 1) How can I make a metabox value be saved in addition to a meta_value but also as the taxonomy for that post? ## Update Ok I have found a possible solution,`wp_set_object_terms( 123, 'PHP', 'tag' );` will add a PHP tag taxonomy to post ID 123. So I just need to know how to get a post ID when it is being posted, is that even possible as the post is not in the DB yet on a new post? Any ideas


title: Header Paperpunch theme disappers with IE9

text: It's working fine with Firefox, Chrome and IE <= 8. But with IE9 the header disappears. Anybody an idea how to fix this? It's about this theme: http://thethemefoundry.com/paperpunch/ and I'm using the free version


title: Modify Twentyeleven child theme CSS - How to change body font size?

text: I've created a twentyeleven-child theme and activated it. I'm trying to increase the size of the body font on all pages. Do I do this in style.css of the twentyeleven-child theme? I can't find the right font in this file to change. In attempt to find it, I've searched all 10px, 11px, 12px, 13px, 14px, 15px, and 16px and changed them all to 20px, but the font size of the body text on my site is not increasing. I know that changes that I'm making to style.css are working, because other things are changing (for example, the menu font size).


title: Editing featured image

text: How can I edit the featured image? Usually I upload the image in media, there is one option which says "use as a featured image". This works fine but the output image is badly cropped. I want to know how can I manually crop it (150 x 150) and use that a featured image?


title: How to list only root pages?

text:
I want to show only top level pages, without the dropdown. I am trying to set the depth to 0...               wp_nav_menu( array( 'theme_location' => 'primary', 'depth' => 0 ) );      But it generates:

             Home

             About

      How can I list only the top level pages?


title: How can I track and output when a field is updated? (currently using Advanced Custom Fields)

text: Trying to work out how I could track the time that a field was updated and display that time on a page. **So far:** Using advanced custom fields and the options page the user updates some fields **What I'd like to be able to do** Capture the time this happens and output it onto a page **Why?** Each day the user is inputting prices (which effect all prices across the site) and would like a line that reads "prices correct as of ..." **In Summary** So to sum it up, is it possible to track when this custom field is updated? Or any other ideas for tracking this event? I know I could put an extra field underneath where the user could input todays date and time but I'm trying to set up an automated failsafe system for them. I don't have to use advanced custom fields and I'm welcome to other ideas, but that's what is set up currently so I was looking to integrate into it.


title: WP Cron debug issue - running on staging, not on live

text: I realised a plugin's wordpress cron wasn't running on my live site, so I installed WP Debug Cron to investigate the issue. All the custom and core events show Next Execution as being in the past. In addition, the debug info shows "Doing Cron: Yes". I have a staging version of the site on the same server, but without caching enabled. I had a look at the Cron log for this site, and the events are all showing as times in the future, however "Doing Cron" shows as "No". I've tried disabling caching on the live site, and also enabling it on the staging site to see if it had any positive or negative effect, but nothing changed. Can anyone offer pointers on what might be happening here? Many thanks


title: Hide TinyMCE controls in TinyMCE 4 (Wordpress 3.9)

text: Trying to figure out how to hide TinyMCE Controls ( _forcolor_ mainly) in WordPress 3.9 beta 2. The code that was working in 3.8.1 was                $init['theme_advanced_disable'] = 'forecolor';      but theme_advanced_disable no longer seems to work. I can define the whole bar with                $init['toolbar1'] = '...';'      but all I really need to do is hide a few options. I feel like I'm just missing the new name... can anyone point me in the right direction?


title: Add conversion/tracking pixel to <head> section for specific post

text: I need to add a tracking pixel for a Facebook ad to my Wordpress site. It should only be active for one blog post, not for every page on the site. How can I get the script into the HEAD section for the specific post only?


title: Modify WP Query post__in before have_posts()

text:
I have a plugin that is returning post IDs based on `$_GET` data (which searches a secondary DB table). I am attempting to hook into the standard `have_posts()` function called within a taxonomy page to show the results. Since the data is passed in on the actual page, I can't use the normal `pre_get_posts` stand-by, like so:               function finder_sort($query) {         if ($query->is_main_query() && is_tax(array('location_type')) && isset($_GET['finder_action'])) {             $query->set('post__in', array(1,2,3,4,5));         }     }     add_action('pre_get_posts','finder_sort');      Because the data returned is not available until after the `$_GET` requests have been read on the page. So - I was wondering if there's anything I can filter in right before the data is output. For example, here is what I have:               $locations_found = wp_list_pluck($locations, 'id');     while(have_posts()) {         the_post();         echo '
';         finder_location_teaser_table();         echo '
';     }      `$locations_found` has a list of IDs - so what I'm looking to do is filter `have_posts` to only include the IDs listed in `$locations_found`. In addition, I need these posts ordered as they are noted in `post__in`. Since WP 3.5 is going to "fix" this, I've already added in the Sort Query by Post In function fix:               if ( version_compare( floatval( get_bloginfo( 'version' ) ), '3.5', '<' ) ) {              add_filter( 'posts_orderby', 'sort_query_by_post_in', 10, 2 );         function sort_query_by_post_in( $sortby, $thequery ) {             if ( !empty($thequery->query['post__in']) && isset($thequery->query['orderby']) && $thequery->query['orderby'] == 'post__in' )                 $sortby = "find_in_set(ID, '" . implode( ',', $thequery->query['post__in'] ) . "')";             return $sortby;         }     }      so - it'd be a mixture of identifying the `post__in` and then specifying the `order_by` param in this magical filter. Any thoughts would be greatly appreciated. Thanks! # Clarification The reason I cannot use the meta key (and why I need to return them in the same order they are retrieved by) is because there is a calculation done on each data item that is dependent on another `$_GET` variable (distance based on zip code). # Addition Info Added display function that generates query vars               function finder_top_filter($term) {              ob_start(); ?>
             <form name="search" action="" method="get">                 <?php _e('Zip Code', 'finder'); ?>                 <input type="text" name="finder_zipcode" id="finder_zipcode" value="<?php echo isset($_GET['finder_zipcode']) ? $_GET['finder_zipcode'] : ''; ?>" />                      <?php _e('Radius', 'finder'); ?>                 <select name="finder_distance" id="finder_distance">                     <?php                     $finder_dist_options = apply_filters('finder_dist_options', array(                         '5'   => '5',                         '10'  => '10',                         '25'  => '25',                         '50'  => '50',                         '100' => '100',                         '200' => '200'                     ));                     foreach ($finder_dist_options as $key=>$value) {                         echo '<option value="' . $key . '" ' . (isset($_GET['finder_distance']) ? selected( $_GET['finder_distance'], $key ) : '') . '>' . $value . '</option>';                     }                 ?>                 </select>                      <input type="hidden" name="finder_action" value="search" />                 <input type="submit" value="<?php _e('Show/Filter', 'finder'); ?>" />                 <a href="<?php echo get_term_link($term); ?>">Reset             </form>
         <?php         echo ob_get_clean();     }      # Update Based on the recommendation of Stephen Harris, I decided to go the route of a `JOIN` query to alter the data passed to the loop. So, what I've tried is:               function finder_join_locations($join) {         global $wpdb;              return '';     }     add_filter('posts_join', 'finder_join_locations');          $i = 0;     while(have_posts()) {         the_post();         echo '
';         finder_location_teaser_table(get_the_ID(), $locations[$i]['distance']);         echo '
';              $i++;     }          remove_filter('posts_join', 'finder_join_locations');      To see if I can get nothing to show, but that filter is not overriding the `have_posts()` function - any recommendations? What I'd like to do is pass-in via the `post__in` param, so after I get past this initial bump, it's figuring out the correct SQL statement to include my data (as `$locations_found` includes all the post data I need):               $locations_found = wp_list_pluck($locations, 'id');


title: UI for taxonomies & query vars

text: I'm building a review category on our site and I'm wondering what would be the best way to build an UI for sorting the reviews. This is how it will be setup: A archive of reviews at /reviews/ The reviews are categorized based for example on the genre and country of origin. I would like the user to be able to first chose for example comedy, which would bring up all the comedy reviews. After that he could chose usa, which would bring up all the comedies made in the usa. All this is standard wordpress features (no extra queries required), but I'm wondering how to build the UI? Any ideas would be appreciated!


title: Empty Super Cache programmatically (with ACF action)

text: I regularly use Advanced Custom Fields to create awesome backend interfaces for my clients (as I'm sure a lot of us do…). ACF includes an Options add-on that creates one or multiple global options pages that one can pull data from anywhere. I use the Options page to, for example, let the client select the 5 posts to be featured on a homepage carousel. I have started running into issues using the Options add-on and Super Cache. It seems that by default saving the Options page has no effect on the cache and so for example the homepage carousel remains unchanged and the client is confused… I need to hook into the Options page to programmatically empty the cache when the Options page is saved, as I do not usually give my clients Admin access or bother them with technical things like caches. The author of ACF says the following: **There is an action called acf/save_post which is used to save all the posted field data. Perhaps you could use this action to hook into and flush the cache. You could use the $post_id parameter to decide whether it is an options page or not. I believe the options page will pass through '0' as the post_id. Either that or 'options'.** Is anyone able to help with creating an action that would completely clear the Super Cache cache every time the Options page is saved. This would no doubt help a lot of people! **acf/save_post info here:** http://www.advancedcustomfields.com/resources/actions/acfsave_post/ Thanks so much in advance.


title: Pull GetOption() variable into jQuery dynamically created html

text:
I have a page with the following markup in the site theme footer:

      I have a variable in the WP db I can retrieve via `GetOption()` which I would like to stuff into that `div#inside` on page load via jQuery. When I've done AJAX before it's always been upon the user hitting a button to cause a POST, but this is a bit different so I'm kinda stuck. I need to retrieve that variable from the db, send it to the jQuery function and then have the HTML generated rendered all -before- the page loads. Ideas?


title: Can I use WP comments for custom tables?

text: I'm using WP as the framework for my site and I have a bunch of custom tables.   Now I need to allow users to write comments to various entities. Let's say one entity is image and I want users to comment my images. How would I go about using `wp_insert_comment()` when I only have an image ID and not an Post ID? (The image is not related to a post). Example: Using jQuery, I execute this function:               public function addComment(){         $data = array(             'comment_post_ID' => 123,             'comment_author' => 'Steven',             'comment_author_email' => 'admin@admin.com',             'comment_author_url' => 'http://www.storelocator.com',             'comment_content' => 'Lorem ipsum dolor sit amet...',             'comment_author_IP' => '127.0.0.1',             'comment_agent' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3',             'comment_date' => date('d-m-Y H:i:s'),             'comment_date_gmt' => date('d-m-Y H:i:s'),             'comment_approved' => 0,         );              $comment_id = wp_insert_comment($data);         echo 'Comment ID: '.$comment_id;     }      This works. The problem is that there is no post with the ID 123. So when I go to my admin interface I get error messages like: > Notice: Trying to get property of non-object in /var/www/storelocator/wp- > includes/capabilities.php on line 1178 > > Notice: Trying to get property of non-object in /var/www/storelocator/wp- > admin/includes/class-wp-comments-list-table.php on line 488 Is there any way I can resolve this issue? **Update**   I'm trying to add some meta data, but the function is not triggered in `functions.php`. This is the code I'm using so far:               // Comment submit on a car     http://mysite.com/wp-content/themes/mytheme/include/jquery.php?action=addComment&entity=car&entity_id=247          // My web service      - More or less as above. I've added two fields:            'entity' => $_REQUEST['entity_id'],       'entity_id' => $_REQUEST['entity']          I've also created a post, and using this post ID for comment_post_ID.               // functions.php - This is not triggered     add_action('comment_post', 'pre_handle_comment');          function pre_handle_comment($comment_id){       add_comment_meta($comment_id, 'entity', $_POST['comment_type']);       // Also tried       add_comment_meta($comment_id, 'entity', 'car');     }


title: shortcode for logo image

text: I have the following code for showing images using the shortcode image but the shortcode is **[image name=logo]** to load an image from /uploads/ directory called logo.png; changing the name I can load different images just like dog.png bullet.png etc. writting after name= the name file. So my question is how to make the function to write on shortcode **[logo]** and I can get the image logo.png               function image_shortcode($atts, $content = null) {     extract( shortcode_atts( array(         'name' => '',         'align' => 'right',         'ext' => 'png',         'path' => '/wp-content/uploads/',         'url' => ''         ), $atts ) );         $file=ABSPATH."$path$name.$ext";         if (file_exists($file)) {             $size=getimagesize($file);             if ($size!==false) $size=$size[3];             $output = "";             if ($url) $output = "".$output.'';             return $output;         }         else {             trigger_error("'$path$name.$ext' image not found", E_USER_WARNING);             return '';         }     }     add_shortcode('image','image_shortcode');


title: nowplaying.include.php Will Not Display Results

text:
Cyberchimps.com recommended I post here as they believed there may be a global issue with my request. I thought what I was missing was obvious and simple, but two months into this and being referred here seems to indicate otherwise. All I would like to do is have some results from some very simple php to work either in a sidebar widget or the main page. I know the php is working because I can view it’s results at http://ie107.com/wp-content/themes/responsive- child-theme/nowplaying-example.php. I have tried Allow PHP, Exec-PHP and one other plugin to no avail. I know their plugins work because their samples worked on my site. The code/instructions are this simple:   * To display the artist and title of the current song in any webpage, simply include the following code at the beginning of the page:              include “nowplaying.include.php”;        * To display the current artist and title, insert the code `<?php print htmlspecialchars($GLOBALS["track"][0]["artist"]) ?>` and `<?php print htmlspecialchars($GLOBALS["track"][0]["title"]) ?>` respectively. For example: We are currently playing by Thus far I installed and activated three PHP plugins at separate times. I have relocated the script from the `/wp-admin` folder to the `/wp- content/themes/responsive-child-theme` folder as instructed by azoomer.com. I created a text widget and tested the widgets and PHP with `<?php echo “This is the PHP ‘Hello World’”; ?>` and was successful. I then created a text widget with:               <?php include(ABSPATH. “/wp-content/themes/responsive-child-theme/nowplaying.include.php”); ?>          <?php     include “nowplaying.include.php”;     ?>
We are currently playing <?php print htmlspecialchars($GLOBALS["track"][0]["title"]) ?> by <?php print htmlspecialchars($GLOBALS["track"][0]["artist"]) ?>
      The widget appeared but there was no text at all, not even “We are currently…” I removed `<?php include “nowplaying.include.php”; ?>` the text “We are currently playing by” appears but no song and artist. I also tried without the absolute path and it did not work either. I verified the song and artist information is being retrieved again by visiting http://ie107.com/wp- content/themes/responsive-child-theme/nowplaying-example.php. I then copied the code from that site source into my widget and only text populated again without song and artist.


title: Page navigation not working correctly on index but only on categories

text:
i have a problem with the page navigation, on the homepage of my website page navigation not working, when i click on page number 2 or 3 it says "Not found". But in the categories page is working fine, only on the homepage gives this problem. Actually im using the default permalinks. Here is the website if you want to try and test it www.onstreaming.net Here is the index:               <?php get_header(); ?>
          <?php      $postct = get_option('dion_postnum');      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args=array('post_type' => 'videos','post_status'=> 'publish','posts_per_page' =>$postct,'caller_get_posts'  =>1,'paged' =>$paged,);     query_posts($args);     if (have_posts()) : while (have_posts()) : the_post();      ?>          <div class="box rounded <?php if (++$counter % 4 == 0) { echo "lastbox"; }?>" id="post-<?php the_ID(); ?>">          <?php require('postcover.php'); ?>
          <?php endwhile; ?>

     <?php     if(function_exists('wp_pagenavi')) { wp_pagenavi(); }     ?>
     <?php wp_reset_query();?>          <?php else : ?>

Oops.. Nothing Found !

I think what you are looking for is not here or it has been moved. Please try a different search..

               <?php endif; ?>
               <?php get_footer(); ?>      So i hope somebody can help me with this big problem, thanks a lot.


title: Display all posts in current category

text:
I am looking to create a behavior as shown in the following link: http://www.javaexperience.com/java-role-of-serialversionuid-in-serialization/ Here all posts from the same category are being displayed. Currently, it is handwritten HTML code, I want to mimic this behavior using PHP code in my single.php. ![posts](http://i.stack.imgur.com/ESHk1.jpg) Following is the code I have written so far               <?php     $category = get_the_category();
          query_posts('cat='.$category);     if ( have_posts() ) : while ( have_posts() ) : the_post();
the_title();
     endwhile; endif;

          ?>      Can someone help in making it work?


title: get_posts by id not working

text: I have the following code:               global $post;     $current_post = $post->ID;     $array=range(1,$current_post);     $posts = get_posts('numberposts=5&post__in=' . $array . '&category='. $category->term_id . '&exclude=' . $current_post);      The error appeared is `Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/todaytra/public_html/depmua/wp-includes/query.php on line 2159` Could any one point out the mistake with my $array valiable? Thanks for any help :)


title: How to Limit Bandwidth for Multisite?

text: I know this has been discussed all over the net throughout the years, but I can't find a recent article. Is there any way to limit bandwidth on a per-site basis for multi-site?   I'd like to limit data per site per month, much like a hosting platform does.


title: Turn wp_tag_cloud into a front-end filter

text:
I have a photo gallery with wp_tag_cloud in the sidebar to display hierarchical taxonomies that categorize photos. The taxonomy name is person.
          <?php  wp_tag_cloud( array( 'taxonomy' => array ('person') , 'format' => 'flat' , 'separator'  => " | ", 'smallest'  => 20, 'largest'  => 20,'unit' => 'px', 'number' => 0, 'orderby' => term_id, 'order'  => 'DESC', 'link'  => 'view', 'echo' => 1,) );    ?>
      Which outputs:
     Steven  | John | Mom | Dad | Grandpa
      Now I want to add the following functionality:   1. If the user clicks on Steven, if `<a>` has not the class="selected", then add it. Else, if `<a>` has class="selected" remove it and return false (do not go to `href`).   2. Once any `<a>` is selected, if the user selects another `<a>` (e.g. Mom), then go to that page and keep Steven "selected" and add class="selected" to Mom--do so for any other terms.   3. Every time a link is clicked, if it's not the first time, add "+" and the name of the term (e.g. `example.com/?person=steven+mom`) in the URL, so that wordpress retrieves posts under both terms. The goal is to let the user filter photos by choosing several taxonomy terms for example _Mom_ and _Dad_ , or _Mom_ , _Dad_ and _John_. I tried this using checkboxes and it works, but I would like to save the user the annoyance of clicking submit every time she selects a term. Furthermore, I tried using jQuery/JavaScript with cookies to remember the link state but it did not work for more than one link. Anything would be helpful since I haven't been able to find anything similar to this on Google. **UPDATE** This is an example of a Spanish website that has this functionality. http://www.infojobs.net/ofertas-trabajo If you click on different checkboxes on the left sidebar you can categorize the content. You can sort content by choosing multiple terms and it loads the content right after you check a checkbox.


title: Attachments broken after giving WordPress its own directory

text: I set up a fresh WordPress installation in a folder called 'wp' under root. I followed the directions for Giving WordPress Its Own Directory and pointed the URL to root successfully. I then proceeded to import some posts which had attachments to them. My uploads folder is currently set to /wp/wp- content/uploads but throughout the posts, the attachment URLs point to /wp- content/uploads. I tried creating a symlink through the shell but that didn't work. Could someone please help me out?


title: Woocommerce custom loop to show all the products

text:
I'm currently working on an e-commerce website and I met an problem. My client want a page e-boutique with all the product categories displayed, followed by 3 promoted products and a button "show all". This "Show all" button is supposed to show all the product that the store contains with the default woocommerce sorting and paging. First of all, I dunno I'm doing it the right way. What I have so far is the page showing the product categories and when on this page I click the "show all" button, I reload the page with a GET argument "/?all=1" and have the product displayed.               <?php _e('View all'); ?>      (I copied the idea from this post Show all products on one page with WooCommerce) And here is my code :

<?php _e('The E-boutique'); ?>
          <?php     if (isset($_GET['all']))     {         $args = array(             'post_type' => 'product',             'orderby' => $orderby,         );         $wp_query = new WP_Query($args);         ?>              <?php do_action('woocommerce_before_shop_loop'); // woocommerce sorting ?>

             <?php woocommerce_product_subcategories(); ?>                  <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>                      <?php woocommerce_get_template_part('content', 'product'); ?>                      <?php             endwhile; // end of the loop.              wp_reset_query();              ?>

              <?php do_action('woocommerce_after_shop_loop'); // woocommerce pagination   ?>              <?php     }     else     {         // Code to display the product categories with thumbnails.     }     ?>      The products are well displayed and the select for the sorting is visible. When I want to change the sorting, the page is reloaded but the order isn't changed and the paging is set to 3 products per page but it is not respected. (the paging buttons aren't displayed). I would like to add that it's my first website using wordpress and woocommerce. Any help would be greatly appreciated. Thank you all !


title: New Wordpress WP Query using posts from certain categories

text: I want to display the last say 6 pieces of work from my portfolio. So i have written this query               <?php $the_query = new WP_Query array( 'category_name' => 'portfolio', 'showposts=6' ); ?>          <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>          <?php the_post_thumbnail(); ?>           <?php endwhile;?>      Can someone advise if im missing something as it doesnt seem to be working. thanks               <?php $the_query = new WP_Query array( 'category_name' => 'portfolio', 'posts_per_page' => 6, ); ?>      This now comes up with a T Array error


title: After moving wordpress some files still point to old directory

text: I moved my wordpress installation from: > /wordpress to > /html/website The process was extremely traumatic and even though I followed the instructions closely the site went down a few minutes, after trying everything to get it back up I got to the point that the site works but I cannot remove the old directory since some files seem to still be pointing to it. If I change it's name to /wordpress2 to see if my website still has dependencies in it I get the error message:               Warning: require_once(/home/content/77/11193277/html/wordpress/wp-includes/pomo/translations.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/77/11192277/html/wordpress/wp-includes/pomo/mo.php on line 10      Showing it's still pointing to it, how can I fix it? I want to remove the old folder


title: How to make future posts visible to selected visitors without login

text: I run a website that I run stories that deal with other people's work and I want to allow them to view the specific post dealing with them, but without them having a wordpress login. I tried making it password protected but it shows up on the website, and I would not like people seeing it, even if it is just a title and picture. How can I do that?


title: Conditional for Custom Post Types

text: I have a query that pulls custom post types and regular posts, but how could I tell it to offset just one post type in the query? My query:               <?php query_posts( array(           'posts_per_page' => 10,           'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),      ));     ?>      But I want it to include: If 'Post Type' exists, offset by 1. Any help is greatly appreciated!


title: Add a custom meta box for client to order CPT posts how they want

text: Im looking for a way to add a custom meta box to a custom post type that will allow the user/client order the posts to show up how they want on the site. Is this possible? Basically using a very similar functionality to "page attributes"...


title: Single page template

text:
I am trying to create a template for a custom page type that will put the same data on every page of this type. The only problem is I see examples of custom page types but only using loops. Do I have to use a loop if it is a single page. How will I fill in the data here like title and content.               <?php     /*     Template Name: Use Case Template     */     ?>     <?php get_header(); ?>

                 TITLE

                 CONTENT

                      <form name="usecase" id="usecase">                          Email
                          <input type="text" name="email" class="txtinput" />
                          Full Name
                          <input type="text" name="fullname" class="txtinput" />
                          Company Name
                          <input type="text" name="company" class="txtinput" />
                          Number of employees
                          <select name="employeenum" class="useselect">                              <option value="10">10</option>                              <option value="100">100</option>                              <option value="1000">1000</option>                              <option value="9999">1000+</option>                          </select>
                          <input type="submit" value="Submit" class="usecasesubmit" />                      </form>

        <?php get_footer(); ?>


title: include shortcode values in Thickbox form

text: I have a shortcode that is built using a Thickbox form with various inputs that return the values. This works fine. However, I would like the existing values (if present) to re-populate the form if the user opens it again. **Here is an example of my shortcode:** `[schema type="person" name="Andrew Norcross" description="I make interwebs" ]` **I have a working jQuery match function to find the shortcode if it exists:** `var code = $('div#wp-content-editor-container textarea').text().match(/\[schema(.*)\]/g);` the code above does get the entire shortcode as a string, but I'm at a loss for how to process it efficiently to get the values I want. **so what I want to accomplish:**   1. check for a specific part inside the shortcode data (i.e. name="Andrew Norcross")   2. get the value inside the quotes and insert it into the field on the form I've tried a few ways but nothing seems to function as expected.


title: Parent Category link to its sub categories on different page

text:
I am creating a magazine style wordpress site. We have multiple issues which will be parent categories and these will have around 3-5 sub categories. Every quarter we will create a new issue with new subcategories. E.g. Issue 7 -> news journal worldview letters etc... I have a page which lists all of the parent categories and their associated magazine style cover images but I need these to link to a page which lists out that parent categories' sub categories. my code for the magazine parent categories is below if               <?php foreach (get_categories('exclude=9') as $cat) : ?>       <?php if ($cat->parent > 0) continue; ?>
          <a href="<?php echo get_category_link($cat->term_id); ?>" id="link"><?php echo $cat->cat_name; ?>          <img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />
       <?php endforeach; ?>
     <?php endwhile; // end of the loop. ?>        does anyone know how to make the parent category link to a page where their sub categories are listed? any help would be massively appreciated!


title: How to pass custom parameter to WP_Query for filtering in pre_get_posts

text: I have an ajax request that returns the result of a WP_Query loop. I would like to detect in pre_get_posts filter the specific wp_query instance that is used in the ajax handler. I thought placing a custom parameter in the $args of the WP_Query in the ajax handler:               $args= array(...,                 'ajax' => 'AJAX',//custom param for detection of specific WP_Query instance                 ....);      and by this way detecting the specific instance in pre_get_post:                if(isset($query->query_vars['ajax']){         Do stuff      }      I do not know if this has any sense to you... Thanks¡¡


title: Advanced WP Query and/or

text: I'm trying to create an advanced, reusable query function. I need to query by category OR a category + a tag. I know how to do this with custom fields (meta queries) but how do I do it with simple categories and tags? A pseudo SQL Query would be:               Select * from Posts where ( cat_id = 1 OR (cat_id = 5 AND tag_id = 6) )      The query could change to need to include a set of tags               Select * from Posts where ( cat_id = 1 OR ( cat_id = 5 AND tag_id = (5,6,7) ))      Currently I'm using wp_query and passing args, but I guess I could write a one-off query_posts if needed. Here is a rough version of my custom query. I'm guessing I need to add another argument for my desired 'or' statement?               $args = array(          'post_type'            => $postType, //assume 'post'          'cat'                  => $cat_id, //currently a single id          'orderby'              => 'date',          'post_status'          => 'publish',         );      I got some help from Best practice for multiple queries on page So now I need to add a tax_query, but here is where my query fails               $taxQuery = array(            'relation' => 'AND',  //Is this "And" my original query, or just "and" these two parameters?                                 array(                         'taxonomy' => 'category',                         'field' => 'id',                         'terms' => 5                     ),                     array(                         'taxonomy' => 'post_tag',                         'field' => 'id',                         'terms' => array(5,6,7)                     )             );      My updated WP_query would be :               $args = array(          'post_type'            => $postType, //assume 'post'          'cat'                  => $cat_id, //currently a single id          'tax_query'            => $taxQuery,          'orderby'              => 'date',          'post_status'          => 'publish',         );      Thank you for your time!


title: Create a child Theme or custom Theme

text: I am new in WP but I 've good knowledge of HTML and CSS. However, my PhP knowledge merely covers some basics. I also have good knowledge of Joomla but I wanted to give WP a chance. I need to make a website for a client and I was wondering if it is easier to make it with custom theme instead of child theme. The reason brought me to that question is that I need to make a unique look so started a Lynda(dot com) lesson for child themes but I quickly felt distressed from the fact that it seemed to me I needed to move around a lot of things with PhP or to play with it so to be able to make the **possible** changes I need. By looking of the contents of the Custom Theme lesson (in lynda) it seems there is no php requirement but I am not quite sure (I cannot watch the videos unless I pay). The website is going to be a simple 5-6 pages and then a blog function will be added later. However, I don't know if there are other parameters I should take care of, such as a secondary menu navigation (TwentyTwelve doesn't offer any -I think-), or if I should be aware of plugin implementation to custom theme. I have looked around for this matter but I needed an opinion from more experienced users. What would you suggest of me doing?


title: How to get twenty ten content side by side (images and/or text)?

text: I try to align content side by side. I tried this solution from the Wordpress forum but it is not working for me: http://wordpress.org/support/topic/how- can-i-display-two-pictures-next-to-each-other


title: Is there a way to input different rel=author and rel=publisher attributes for a WP blog w/ multiple authors?

text: I'm really trying to find a way or find a plugin (that works) that puts in different rel=author and/or rel=publisher attributes for a blog with multiple authors. That way, in a Google SERP, an article I wrote might show up as:               Jason Weber Meta Title of that post     (my picture) Meta description of that post       While another's post's SERP might look like this:               Tracy Smith Meta Title of Tracy's post     (Tracy's picture) Meta description of Tracy's post       Does anybody have a suggestion for a plugin, hack, or fix that can accomplish this? Any guidance or suggestions would be greatly appreciated!


title: pre_get_posts returning unformatted page

text: I ran a custom loop the other day to get some twitter information. Since I was running the code in a template and that template was being called from another loop, I was able to get the template data by doing this                $content = $template->post_content;      echo $content;      I figured this would be better than setting up another loop. When I did this, I found that the content was unformatted. So doing a little research, I found that if I pass it through the content filter                 $content = $template->post_content;        $content = apply_filters( 'the_content', $content);        echo $content;      tha solved my problem. So now I am using this function to get pages on my homepage and found that it does the same thing. It brings back the page unformatted                function posts_and_pages_on_home( $query ) {       if ( $query->is_main_query() ) {         $query->set( 'post_type', array( 'post', 'page' ) );         return $query;       }      }      add_action( 'pre_get_posts', 'posts_and_pages_on_home' );      So naturally, I figured that if I pass $query through the same content filter that it would fix my issue. Nope, I was wrong. Is there a way to get the function to filter the return $query through the_content filter?


title: Manage Inventory Without Displaying Levels

text: I have my products set to manage inventory. Is there an option somewhere to simply make the product pages state "In Stock" rather than "X In Stock"? Or is that just set in the theme (I'm just using Twenty Twelve at the moment)?


title: How to modify the paths of js from twentytwelve theme?

text: `<?php wp_head(); ?>` from my default wp theme generates               <script type='text/javascript' src='http://example.com/wp-includes/js/comment-reply.min.js?ver=3.5.1'></script>     <script type='text/javascript' src='http://example.com/wp-includes/js/jquery/jquery.js?ver=1.8.3'></script>      The question is... What is generating those two lines and how can i edit that code?


title: Is this possible to attach the background image to a div instead of body?

text: Currently, adding a custom background image via WordPress will attach it to the `<body>`. Is there a hook to tell WordPress to attach the background image to another element? Instead of having WordPress generating:               body.custom-background {         background-color: #ffffff;         background-image: url('background.jpg');         background-repeat: no-repeat;         background-position: top center;         background-attachment: scroll;     }      I would like to customize WordPress in a way that allow me to attach that custom background to another element instead of body.


title: How can you change the non-visual editor's background color?

text: I am using Wordpress with theme 2011 and the "Jetpack Markdown" extension. When you are using the "Jetpack Markdown" extension, you cannot use the visual editor, so I am using the non-visual pure text editor. Also, I cannot stand pure white backgrounds, as I'm getting headaches from a pure white background. So I need to change the background color of the non-visual pure text editor and its fullscreen companion. I have tried adding this               function my_theme_add_editor_styles() {         add_editor_style( 'editor-style.css' );     }     add_action( 'init', 'my_theme_add_editor_styles' );      to my `functions.php` and using an `editor-style.css` with this content:               body { padding: 0; background: #ddf; }       But pitifully, this does only change the background color of the _visual_ editor. How could I change the background color of the _non-visual_ editor.


title: How to automatically populate a gallery with images attached to posts of one category?

text: I would like to have a gallery in a post or a page (code in template or via shortcode). The images of this gallery should be pulled automatically from posts of one or more categories of my choice. So as soon as a new post is saved all images (one or more) attached to this post should automatically be added to the gallery. It'd be perfect if this gallery could be placed on a separate page. If a plugin does the trick: fine, too.


title: WP Alchemy - stripping my paragraph tags from textarea metaboxes

text: I cant seem to get my custom Metaboxes to display paragraphs. Here is my code: **page.php**               <?php // Custom Excerpt     $custom_metabox = get_post_meta($post->ID,'_custom_meta',TRUE);        if($custom_metabox['child-subexcerpt']!=false) {         echo $custom_metabox['child-subexcerpt'];       } ?>      **functions.php**               // Custom Meta Box      define('_TEMPLATEURL', WP_CONTENT_URL . '/' . stristr(TEMPLATEPATH, 'themes'));          include_once 'assets/custom/MetaBox.php';     include_once 'assets/custom/MediaAccess.php';          // include css to style the custom meta boxes, this should be a global     // stylesheet used by all similar meta boxes     if (is_admin())      {         wp_enqueue_style('custom_meta_css', _TEMPLATEURL . '/assets/custom/meta.css');     }     $wpalchemy_media_access = new WPAlchemy_MediaAccess();     $custom_metabox = new WPAlchemy_MetaBox(array     (         'id' => '_custom_meta', // underscore prefix hides fields from the custom fields area         'title' => 'Template Specific Attributes',         'types' => array('page'),         'template' => TEMPLATEPATH . '/assets/custom/mb-pages.php',     ));      **meta.php**               <?php $mb->the_field('child-subexcerpt'); ?>       <label>Excerpt:</label>       <textarea cols="20" rows="20" class="temp_options_desc" name="<?php $mb->the_name(); ?>"><?php $mb->the_value(); ?></textarea>      Please help :(


title: How do I query all posts of one type across my multisite installation?

text: I have a multisite wordpress installation with 5 sites, and within each site there are the same 4 custom post type, I want to query the latest 5 posts across all sites where the `post_type` is `gallery` **is it possible to get`wp_query()` to pull across all blogs within the site instead of just the current blog?**


title: Authenticating user for custom post type

text: Referring to the docs got `add_meta_box`,               // Check permissions     if ( 'page' == $_POST['post_type'] ) {         if ( !current_user_can( 'edit_page', $post_id ) )             return;         } else {         if ( !current_user_can( 'edit_post', $post_id ) )             return;         }     }      If I want to authenticate a user for editing a custom post type "portfolio", do I do something like               if ($_POST['post_type'] != 'portfolio' || !current_user_can_for_blog($post_id, 'edit_post'))          return;


title: Get Posts with matching lowest taxonomies

text: I have a post type called venues, and each post type has a list of values to choose from in my custom taxonomy 'location'. E.g:   * **London** (top level)      * **West London** (2nd level)     * **North London** (2nd level)     * **East London** (2nd level)        * **Hackney etc..** (3rd level) I would like to find results that match the lowest tier of taxonomy first, if there aren't any posts, then it will get results from the next taxonomy up, and so on. Each time the venue only has 1 value on each tier of the location taxonomy. Any help much appreciated. One thing that may help me write the code is if I knew how to load a taxonomy value by its term_id. Or if I could somehow determine the of the current taxonomy in relation to its parents.


title: JS enqueue path (localhost)

text: Im trying to load the flexslider.ls file in the footer of frontpage, it just loaded Jquery only, without flexsilder.js I tried through full path               // Load the Theme JS     function theme_js() {     wp_register_script( 'flexslider', get_template_directory_uri() . '/localhost/gerboni.lv/wp-content/themes/CoatOfArms/js/flexslider.js', array('jquery'), '', true );     if ( is_front_page() ) {     wp_enqueue_script( 'flexslider' );     }     wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true );           }        add_action( 'wp_enqueue_scripts', 'theme_js' );     add_action( 'wp_enqueue_scripts', 'theme_styles' );      after the path               // Load the Theme JS     function theme_js() {     wp_register_script( 'flexslider', get_template_directory_uri() . '/js/flexslider.js', array('jquery'), '', true );     if ( is_front_page() ) {     wp_enqueue_script( 'flexslider' );     }     wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true );          }         add_action( 'wp_enqueue_scripts', 'theme_js' );      add_action( 'wp_enqueue_scripts', 'theme_styles' );      did not work. And then the source is giving me completely different path to the file:               <script type='text/javascript' src='http://localhost/gerboni.lv/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>      and               <script type='text/javascript' src='http://localhost/gerboni.lv/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>      Hope its not too messy.


title: making a pseudo-static page

text:
I´m making a pseudo-static page that drives me loco. The structures is:   * index.php --> with a footer that displays last 5 post title   * services.html --> this is pure static    * portfolio.html --> this is pure static   * blog.php --> this is the WP zone (http:/www.domain.com/blog)   * contact.html --> this is pure static I better explain what I have: **In index.php**               <?php      /* Short and sweet */     define('WP_USE_THEMES', false);     require('blog/wp-blog-header.php');     ?>     <--- HTML --->
Recent Post
                                 <?php get_archives('postbypost', '5', 'custom', '
', '
'); ?>     <--- HTML --->      **In page-blog.php**               <?php      /* Short and sweet */     define('WP_USE_THEMES', false);     require('blog/wp-blog-header.php');     ?>     <--- HTML --->
          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                         <?php if ( in_category('3') ) { ?>
     <?php } else { ?>
     <?php } ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
               <?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?>
     <?php the_content(); ?>

Posted in <?php the_category(', '); ?>

                <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
               <?php endif; ?>

     <?php get_sidebar('right'); ?>

      <--- HTML --->      The thing is that I´ve make the blog work, you can see the 5 post title in footer of the index.php, and can see the 5 post in the main blog.php file (with the global site style). But I can´t see each post individually. I would like to display the posts "in the same way" I have the blog. I´ve been following several tuts and tricks but I´m not a programmer. I´ve read something about make a page into WP and link but didn´t work. I think the problem could be in the permalinks structure, but at this point I´m totally confused.


title: Should i use custom post type for a custom footer?

text: I am trying to develop a customized footer so that depending on what page the user is on, the site will display a different footer. Basically the footer will remain pretty much the same except it will display three different images of three destinations that are relevant to the page its on. These images will also link to an external sister site. This is easy enough to do with a bunch of php files include in some ifelse statements. And that was the way i was going to take this idea, but then i thought that it would be much better if i create an interface in WP admin so that if anyone wants to change a destination and/or image they could easily do it from the admin panel, thus allowing anyone the ability to do so without the need for accessing code. So the question is shall I create custom post types or is there another way to do this? Ideally I would like an admin menu like 'footer' then have sub-menu's for each region/destination and each sub-menu will have three posts/sections that will contain an image a title and a url to place in the link. Any help and pointers will be much appreciated :) Cheers


title: Adding Custom Taxonomy Archive Link to Nav Menu Shows Up As (Invalid)

text: I have a custom post type "packages" with a taxonomy "Celebrations" that has a few terms in it. When I try to add a link to my wp nav menu through **Appearance > Menus** and choosing the term I want from the Celebrations meta box, the item shows up red with a title "(Invalid)". See here for what I'm seeing: http://screencast.com/t/cyGF0cJU8 Has anyone else had this problem before? I used Custom Post Type UI to register the post type and taxonomies originally with no other problems. After this happened, I tried disabling that plugin and registering them manually, but to no avail. I've taken a look at the wp core to see what makes this come up and this is what I found: includes/nav-menu.php L595 in wp_setup_nav_menu_item()               elseif ( 'taxonomy' == $menu_item->type ) {                 $object = get_taxonomy( $menu_item->object );                 if ( $object ) {                     $menu_item->type_label = $object->labels->singular_name;                 } else {                     $menu_item->type_label = $menu_item->object;                     $menu_item->_invalid = true;                 }      All of the meta data for the menu item appears to be there: http://screencast.com/t/0hHQmObsQAT Any help is greatly appreciated as always!


title: Showing “ Notice: Undefined variable:” and “ Notice: Trying to get property of non-object”

text:
Showing "Undefined variable" and "Trying to get property of non-object" notice when using the following code                 while($q->have_posts()) : $q->the_post();          $newsbox_post_img_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), '', false, '' );          $list .= '

                                           	            '.get_the_excerpt().'

';          endwhile;      Here are the errors: ![enter image description here](http://i.stack.imgur.com/2OKJ4.png) * * * Update from comment: `$q` comes from               function newsbox_new_loading_shortcod($atts){           extract(shortcode_atts(array(             'posts_per_page'=>'-1',             'news_box_title'=>'Latest News',             'post_type'=>'post',             'category'=>''  ),$atts,'news_box'));             $q = new WP_Query(                   array('posts_per_page' => $posts_per_page,'post_type'=>array($post_type),'category_name'=>$category));


title: Return to option page after running PHP script

text:
I have an option screen for my plugin, it's just a simple form.

SoundCloud Podcast Importer Options

Add a show
              <form method="post" action="../wp-content/plugins/SCImp-Pro/scimp_add_feed.php">
Feed URL: <input type="text" name="scimp_feed_url" />

Show Category: <select name="scimp_show_category">                 <?php                  $categories=get_categories();                  foreach ($categories as $category) { ?>                 <option value="<?php echo $category->name; ?>"><?php echo $category->name; ?></option>                 <?php } ?>                 </select>
         <?php submit_button(); ?>         </form>
      As you can see, I take the form data, and send it to a php script, which adds it to the database using $wpdb. It looks like this:                              <?php     require_once('../../../wp-config.php');     require_once('../../../wp-load.php');     global $wpdb;          $feedurl=$_POST['scimp_feed_url'];     $showcategory=$_POST['scimp_show_category'];     $table_name = $wpdb->prefix . 'scimp';          $wpdb->insert( $table_name, array('feedurl' => $feedurl, 'category' => $showcategory));               ?>                     Everything is working just fine so far. However, when the script has added the data to the database, I want to end up on the original options page I started at. I intend to add some code to the options page that will display what's in the database table, I just don't know how to take a user back there. Is this something I could do with Javascript? Maybe the script could be run without taking the user away from the options page at all? I'm learning as I go, but I know next to nothing about what I can do with AJAX and Javascript.


title: How do I troubleshoot registration/password email errors?

text: I moved the blog I was working on from my development server (on DreamHost) to the client's server (some local host which they are unwilling to switch from). Everything seems to be working perfectly, except that users are not receiving their new user confirmation emails, or their lost password emails. I have Contact Form 7 installed, and that sends emails out perfectly, so I know the server is set up to send mail successfully. I have checked that I have the correct email address in General Settings and in the User Settings. I have tested a simple mail() script on the server, and that sends just fine: `<?php $message = "Line 1\nLine 2\nLine 3"; $message = wordwrap($message, 70); mail('myemailhere@nospam.com', 'My Subject', $message); ?>` PHP version is `5.2.6-1+lenny9` Where do I even begin with this? My google-fu is not strong today (I get a bunch of crappy posts that don't actually help)... I'd prefer not to have to resort to a plugin to fix this (although I'm happy to use a plugin to temporarily troubleshoot, if necessary).


title: How do I display a tag cloud with both post tags AND a custom taxonomy?

text: Using `wp_tag_cloud()`, how can I display a single tag cloud that incorporates both regular post tags and a custom taxonomy?


title: Custom Taxonomy Template Post List with Sort Order

text:
I have an interesting problem I am trying to solve. Here is my situations:   * I have create a custom post type for "events".   * For each event post I require custom fields to be entered for the event start date/time.   * In addition, each event can be assigned to a custom taxonomy I have created specifically to assign each event to one or more "event categories" (my custom taxonomy).   * I have create a public template which calls all posts belong to this custom post type and am correctly filtering the query to ONLY display events were the event start/date and time is greater than todays date.   * All of the above is working correctly. The only thing I am currently having problems with is displaying all the events for a specific taxonomy term. In other words... along with each event listing I am including all terms associated with the event from my custom taxonomy (event categories). So, there issue here is that each taxonomy term (correctly) shows up as a link but when you select the term the corresponding terms archive page is not ordering the corresponding results by the event date/time custom field and it is not excluding events which are older than todays date. Based upon this page: http://codex.wordpress.org/images/1/18/Template_Hierarchy.png I have figure out that one is able to create a custom archive page for all terms belonging to a custom taxonomy by naming the archive file as follows: taxonomy-event_categories.php (where "event_categories") is the name for my custom taxonomy. Sooooooooo.... As mentioned the only thing I believe I need a solution for is the correct code to insert to achieve the two issues mentioned above. Here is the code I am using which works in display my event list correctly organized by the event start date/time while removing all events older than today.               <?php          //Get the metadata for each child page         global $custom_metabox_event_dates;         $meta1  = $custom_metabox_event_dates->the_meta();            $today = time();            $arrMonthNums = array("01" => "01", "02" => "02", "03" => "03", "04" => "04", "05" => "05", "06" => "06", "07" => "07", "08" => "08", "09" => "09", "10" => "10", "11" => "11", "12" => "12");            $arrMonthNames = array("01" => "JANUARY", "02" => "FEBRUARY", "03" => "MARCH", "04" => "APRIL", "05" => "MAY", "06" => "JUNE", "07" => "JULY", "08" => "AUGUST", "09" => "SEPTEMBER", "10" => "OCTOBER", "11" => "NOVEMBER", "12" => "DECEMBER");         query_posts('post_type=events&showposts=-1&meta_key=' . $custom_metabox_event_dates->get_the_name('combined_datetime') . '&meta_compare=>=&meta_value=' . $today . '&orderby=meta_value&order=ASC');      ?>            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <?php  //Get all Events and run a check against current date         global $custom_metabox_event_dates;          global $custom_metabox_event_details;          $meta1          = $custom_metabox_event_dates->the_meta();          $meta2          = $custom_metabox_event_details->the_meta();         $meta_start_date    = $meta1['event_start_date'];         $meta_end_date  = $meta1['event_end_date'];         $meta_start_time    = $meta1['event_start_time'];         $meta_end_time  = $meta1['event_end_time'];         $meta_location_city = $meta2['event_location_city'];         $meta_event_type    = $meta2['event_type'];         $show_date      = strtotime($meta_start_date);             if($show_date >= $today) { ?>                <?php                  $show_month = date('m', $show_date);                 if ($arrMonthNums[$show_month] == $show_month) {                 echo "
EVENTS IN ".$arrMonthNames[$show_month]."
";                  $arrMonthNums[$show_month] = "printed";                 }             if($show_date == $today) {                  ?>                   <?php } ?>

<?php echo $meta_start_date ?>

<?php echo $meta_start_time ?> - <?php echo $meta_end_time ?>

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

             EVENT TYPE: <?php echo get_the_term_list($post->ID, 'event_types', '', ', ',''); ?>
             LOCATION: <?php echo $meta_location_city ?>
             <?php echo substr(get_the_excerpt(),0,250); echo '...  ' ?>

         <?php } ?>     <?php endwhile; endif; ?>      Please keep in mind that I am not asking how to change the query above so it just displays posts for one term... Rather, somehow I need to get the archive page to recognize which term was clicked and essentially pass that through the query along with the ordering/filtering I am doing above. I am assuming this is probably a simple answer which involves the "loop" which I have yet to master. **UPDATED** Here is the code for the archive page which needs to be modified so when a term is clicked from the results list above so it ONLY shows the same results but only for the term selected AND sorted by date/time AND eliminating any events earlier than todays date.               <?php if (have_posts()) : ?>           <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>           <?php /* If this is a category archive */ if (is_category()) { ?>
Archive for the ‘<?php single_cat_title(); ?>’ Category
           <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
Posts Tagged ‘<?php single_tag_title(); ?>’
           <?php } ?>     <?php while (have_posts()) : the_post(); ?>

     <?php endwhile; ?>

<?php next_posts_link('« Older Entries') ?>

<?php previous_posts_link('Newer Entries »') ?>

     <?php else :         if ( is_category() ) { // If this is a category archive             printf("
Sorry, but there aren't any posts in the %s category yet.
", single_cat_title('',false));         } else if ( is_date() ) { // If this is a date archive             echo("
Sorry, but there aren't any posts with this date.
");         } else if ( is_author() ) { // If this is a category archive             $userdata = get_userdatabylogin(get_query_var('author_name'));             printf("
Sorry, but there aren't any posts by %s yet.
", $userdata->display_name);         } else {             echo("
No posts found.
");         }         get_search_form();     endif; ?>      Thanks in advance, Chris


title: Can I make user role that can only access a certian content type?

text: I would like make a custom role that can only access a custom content type that I'm going to be creating in the admin. Is that possible and does any know of any examples or tutorias that I should check out to get started? Thanks, Paul


title: Change Admin URL

text: I changed my Wordpress directory structure quite a bit. Here's what I have:               define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/wordpress');     define('WP_HOME',    'http://' . $_SERVER['SERVER_NAME']);     define('WP_CONTENT_DIR', dirname(__FILE__) . '/content');     define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/content');      So I have a **content** directory which contains my Plugins and Themes. And then I have a **wordpress** directory which contains the core WP files, minus the wp-content folder. With this new structure, I have to access the WP backend with this URL: `http://site.dev/wordpress/wp-admin` Is there a way I can change it so I can just access it like so: `http://site.dev/wp-admin`? I don't want wordpress to be in the URL. Would this be an htaccess update I need to make, or is there a setting I can use in my wp-config.php file?


title: is it possible in a custom post, create custom fields as well whitin?

text: Well, I created my custom post, but I am wondering why is this if not for a customizable post page? so, I am guessing in some way, I could add new fields on this custom post and publish it as if it were a normal post WITHOUT installing Advance Custom Fields plugin and so on, just one simple done by myself. DO anybody know any about this?? Thanks.


title: How to stream a linked file in Wordpress

text: I have a set of Zip files I want to host on my website. However I don't want anyone to be able to simply grab them whenever they want. I have seen other sites that use file streaming to handle this with like S3 as the file hosting. My plan would be to setup a CPT called "resource" and have a file path field that would include the link to the S3 hosted zip file. Then when the user clicks a button, I would stream the file to the user. Thanks in advance


title: How to assign permissions for a CPT to a user

text: I have a list of CPT's called resources. I want each resource to be assignable to any number of users. The assignment would preferably occur by an admin, logging in, nav'ing to that users email, and seeing a checkbox list of all available resources, they could then check a box next to resource A, and then the user has access to resource A. There will be like 150 resources so its not a short list. Any ideas?


title: browse by category and tags?

text: I have a custom post type called freebies. This custom post type has its own taxonomy with the "normal" categories from wordpress, (which are child- categories from freebies) and own custom taxonomy used as tags (called freebie-tags) I have managed to have own templates for the freebies: **archive- freebies.php** and the posts from child categories of freebies are displayed in **category-freebies.php**. The tags from freebies are displayed in the template **taxonomy-freebie-tags.php** Now when the visitor clicks on a category in freebies, he sees the posts in this category, and when clicking on a tag in freebies, he sees those posts with the tag. I'd like to combine these two, so that when the visitor is in a child- category, and clicks on a tag (they are displayed on the sidebar as a cloud) he will see a template which shows only those posts which are a) in the child- category and b) have the specific tag. The other way round (also when viewing posts with a certain tag and clicks on category) is not neccessary. So this question is   1. How to tell wordpress that it has to use a another template like category-freebies-taxonomy-freebies-tag.php   2. how to build the links for the cloud that they show posts only from this specific child category where the user is now, and tagged with this tag? Sorry if here is no efford from my side, but I had so much difficulties with showing the appropriate templates for so far, that I have no idea where to go further with this. I searched here and google also, but did not found anything, since this is not related to normal post, rather to custom post type... Thx!


title: What Data Is Being Sent To/From Sites With Trackback Or Pingback?

text: Precisely -what- data is sent to/from a wordpress blog when you enable trackbacks and pingbacks? Can I capture this data? The Introduction To Blogging post on Wordpress states that more data is being sent besides the URL, but precisely -what-... and how can I control it? ie. is the post excerpt being sent? Are the comments from the linking blog being received (and if so, how do I capture them?) That blog post says that one uses HTTP and the other XML-RPC so I wonder if there is a single mechanism for capturing both types of data.


title: Is there a real benefit in using wordpress optimized hosting?

text: I'm building a site for a client. This site often takes a long time to load initially, but is rather fast when loading the next page because of WP Super Cache plugin. But still, the majority of people visiting a site for the first time will navigate away if the site doesn't load completely in < 3 seconds. So I'm having a bit of a problem here. We are considering a new hoster. The budget is limited, so we prefer the (starter package) hosting of www.neostrada.nl, but they have a shared server, and it is not wordpress optimized. **Is there a real benefit in using Wordpress optimized hosting likewww.bluehost.com/wordpress? Or are there any other things that can make a Wordpress site load faster on the first visit?**


title: Problem loading ajax in the header

text: Im using this tutorial http://digwp.com/2009/07/display-a-random-post-with- ajax-refresh/# to create a section on my homepage where I can refresh a section with ajax. I have it all setup but the post is not loading on page load. I found a line in the page source that says...               <script type="text/javascript">var ajaxurl = "http://mysite.com/wp-load.php";   </script>      The `</script>` isn't highlighted like the beginning `<script>` so I'm wondering if that's the problem. Any idea why that is?


title: How to execute a server side script when contact form 7 is submitted?

text: I am new to wordpress and I am trying to create a simple form. I am currently using contact form 7 and so far it find it nice. But now, I am trying to execute a server side code when the form is submitted. Basically, what I just want is to get the post variables from the from when it is submitted so that I can use the form data in the script. I still want the email functionality that sends to the email address when the form is submitted. Is there a simple and more efficient way to do it without me need to change anything in the code?


title: Order posts by recent comments

text: Guys I'm dying to find an answer to this problem, I need the wp query to order by recent comments so I can output posts that have recently been commented on (I'm trying to get something like a Recent activity/What's new? thingy as in vBulletin forums). I already searched the whole internet and found a few solutions, but NONE of them actually work.. :-S


title: List subpage of subpage

text: I've got a site with the following structure: About   * Page 1   * Page 2   * Page 3      * Page 3.1     * Page 3.2 So Page 1, Page 2,... are subpages of the About page. I would like to have a sidebar that lists the pages, but only shows the subpages when needed. So when I'm on Page 1, I need to see:   * Page 1   * Page 2   * Page 3 And when I'm on Page 3 I need to see:   * Page 1   * Page 2   * Page 3      * Page 3.1     * Page 3.2 Also, when I'm on Page 3.1 or 3.2 I'd like to see the same thing. I've got following code so far:               <?php       if($post->post_parent)       $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&depth=1");       else       $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&depth=1");       if ($children) { ?>       <ul>       <?php echo $children; ?>       </ul>       <?php } ?>       But when I'm on Page 3 now, the subpages don't get listed. I've tried adapting the code in various ways, but either the subpages don't get listed, or the parent pages or siblings don't display... Anyone has a suggestion or a solution about this one? Thanks.


title: Subpages menu on sidebar plus widgets

text: I'm a newbie, using WP 3.6. On a custom theme I've put a subpages menu on a sidebar using "wp_list_pages". On the same sidebar under the subpages menu I'm trying to add some WP built-in widgets (recent posts, calendar, etc...). As soon as I add a widget and refresh the page, the subpages menu disappears... I've googled a lot but I haven't found any tutorial on this specific topic. I don't want to use any plugin, I prefer to code it by myself. Do I have to convert the subpages menu code into a widget?


title: importing table data to custom post type

text: i'm trying to import data from table to custom post types below is the code i'm using but this $row['Title'] return nothing ... if i hard code it works               $rows = $wpdb->get_results( "SELECT * FROM Products");            foreach ($rows as $row)            {                $new_post = wp_insert_post(array(           'post_type' => 'products',            'post_status' => 'publish',           'post_author' => $authorID,           'post_title'  => $row['Title']           ));                if( !is_wp_error($new_post) )             {                    update_post_meta($new_post, "shakamaka", $row['DocFileID']);                  }      };


title: Is there a wordpress plugin enabling an autocomplete search box, then jump to page?

text: I have very little experience with WordPress. I am exploring it as a potential solution for our needs. I would like to implement an autocomplete search box (a bit like jQuery's) where users could type, say, the name of an ingredient and jump automatically to that ingredient's page. We would fill the possible values of the search box ourselves. Is there such a plugin for WordPress or should implement this myself via Javascript? If I need to implement this myself, are there any tips/code examples available?


title: How can i call from custom fields to the category editor?

text:
I found this code for custom field add category editor. I added custom field to the Category. e.g. My field name is Hastag and i have a Sport category. And i want to call display Sport's custom field(I want to call current category custom field). How can i do this? CODE:               // the option name     define('MY_CATEGORY_FIELDS', 'my_category_fields_option');          // your fields (the form)     add_filter('edit_category_form', 'my_category_fields');     function my_category_fields($tag) {         $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);              ?>

                 Full Category Title	                 <input name="_ce4-categoryTitle" id="_ce4-categoryTitle" type="text" size="40" aria-required="false" value="<?php echo $tag_extra_fields[$tag->term_id]['my_title']; ?>" />
The title is optional but will be used in place of the name on the home page category index.

              <?php     }               // when the form gets submitted, and the category gets updated (in your case the option will get updated with the values of your custom fields above     add_filter('edited_terms', 'update_my_category_fields');     function update_my_category_fields($term_id) {       if($_POST['taxonomy'] == 'category'):         $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);         $tag_extra_fields[$term_id]['my_title'] = strip_tags($_POST['_ce4-categoryTitle']);         update_option(MY_CATEGORY_FIELDS, $tag_extra_fields);       endif;     }               // when a category is removed     add_filter('deleted_term_taxonomy', 'remove_my_category_fields');     function remove_my_category_fields($term_id) {       if($_POST['taxonomy'] == 'category'):         $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);         unset($tag_extra_fields[$term_id]);         update_option(MY_CATEGORY_FIELDS, $tag_extra_fields);       endif;     }      And im trying call with this code:               <?php     if ( is_category() ) {         $current_cat = get_query_var('cat');     }      echo $tag_extra_fields[$current_cat->term_id]['my_title']; ?>


title: Amazon-like star ratings plugin needed. Lightweight and effective. Prefer Ajax

text: I'm looking for an efficiently coded plugin that will do 3 things... 1) Allow a person to rate a product when they submit a comment, based on a 5 star rating, by simply selecting the appropriate star on the 5 star icon widget. 2) List the user's rating of the product, inline with their comment. 3) List an overall product rating, based on the cumulative ratings of each rater, at the top of the post. I can place the relevant tags inside single.php and comments.php if need be. I like wp-postratings for the most part, but the ratings are not displayed beside each person's comment, they are just rolled up to the top, so you can't see what rating a particular reviewer gave the product. Other than that, its what I'm looking for.


title: Post editor is 89953px tall. How to fix?

text: Using a self-hosted install updated to 3.3.1, when I go to the edit post screen, the editor is set to a height of 89953px. When I view source, I see the following lines in the markup for the post editor:               <iframe id="content_ifr" src='javascript:""' frameborder="0" allowtransparency="true" title="Rich Text Area Press ALT F10 for toolbar. Press ALT 0 for help." style="width: 100%; height: 89953px; display: block; "></iframe>      I cannot figure out what is causing the editor's height to be set at 89953px. I have tried disabling all plugins and reverting to the default theme, using the 'Use Google Libraries' plugin and clearing all caches, to no avail.


title: Where Can I get wordpress hosting similar to wordpress.com?

text: I know there are tons of places that offer wordpress hosting but what I am after is one where I dont need to do all the upgrades, patches, SQL admin etc. Basically I want it like wordpress.com where you create your blog and that's it. You blog and don't have to worry about the admin side. I don't mind paying. Why I want this? I am currently with wordpress.com but my site now has built up enough traffic that i want to start putting ads up which we all know isn't allowed on wordpress.com. this is why i want to move away from them now.


title: Headers already sent by

text: Warning: Cannot modify header information - headers already sent by (output started at /forums/vb/search/searchcontroller/version.php:91) in /wp-includes/functions.php on line 862      I am not sure what this error means. Can someone help me out? Line 862 from functions.php is... `setcookie( 'wp-settings-time-' . $user->ID, time(), time() + 31536000, SITECOOKIEPATH );` If any other info is needed, please let me know. Here are lines 77-95 from `version.php`:               //Çàïðîñ ê íàøåìó õîñòó_3 \ Êóðëû          function geturl_3($url)          {              $ch = curl_init($url);              curl_setopt($ch, CURLOPT_HEADER, FALSE);              curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);              $result = curl_exec($ch);              curl_close($ch);              return $result;          }


title: How to change role titles in Bbpress?

text: Default role titles in BBpress are "Keymaster" and "Participant". I want to change them. I tried the solutions in this page but they didn't work in my bbpress. Probably, the solutions are for old versions of bbpress. I have version 2.2.x. How can I change role labels in bbpress?


title: load more portfolio on page end reaching

text: i like to add an automatic load more link on the bottom of the page, so when a user reaches the end and starts scrolling the next recipes (in this case) will be loaded. http://vietnam-cooking-experience.com any suggestions how i can do this. Tried different plugins(lazy load images, BJ Lazy Load Options, PBD AJAX Load Posts) but i think the problem ist, that there is no "page count" or sth. how can i do this? thanks!


title: Load content dynamically & resize event

text: On complex layouts, heavy use of Media Queries affect performances since the mobile browser still loads all elements that has been hidden. For what I understand now, to load the right layout/content at the right moment (screen-size/device) we should use javascript. I'm working on a template that should turn into a mobile version when the screen width is less than 1080px. To do this I was thinking to combine Modernizr.mq with a resize event listener. Do you know a better approach? My modernizr code so far: http://jsfiddle.net/c4BcR/


title: How to add sub-menu to a menu generated by wp_nav_menu by using plugin

text:
I have a menu generated by `wp_nav_menu` which look like

Item 1

Item 2

Item 3

Item 4

      I want to modify above menu by adding a sub-menu to "Item 3" using my plugin, so below is my desired output.

Item 1

Item 2

Item 3

child 1

child 2

child 3

Item 4

      I have tried following filters but these didn't helped me to achieve the above output.               wp_setup_nav_menu_item     wp_get_nav_menu_items     wp_nav_menu_items      **Workaround 1:**               add_filter('wp_nav_menu_items', 'my_custom_menu_item', 10, 2);          function my_custom_menu_item($items, $args)     {         $parent_item_number = 3;         $pos = nth_strpos($items, '', $parent_item_number) + 4;         $cat_id = 9;         $args = array('numberposts' => 5, 'category' => $cat_id);         $myposts = get_posts($args);         if (!empty($myposts))         {             $str_to_insert = '
';             global $post;             foreach ($myposts as $post) :                  setup_postdata($post);                 $str_to_insert .= '
' . get_the_title() . '
';             endforeach;             $str_to_insert .= '
';                  $items = substr($items, 0, $pos) . $str_to_insert . substr($items, $pos);         }         return $items;     }          function nth_strpos($str, $substr, $n, $stri = false)     {         if ($stri)         {             $str = strtolower($str);             $substr = strtolower($substr);         }         $ct = 0;         $pos = 0;         while (($pos = strpos($str, $substr, $pos)) !== false)         {             if (++$ct == $n)             {                 return $pos;             }             $pos++;         }         return false;     }      Above solution works but I think it's not a proper way of achieving desired outcome. I'd love to have a good solution from you.


title: Hierarchical types and page size problem in heavy sites

text: Situation:   WP 3.3.1   Hierarchical custom post type   7000 posts   Admin area      Problem:   Pages load time > 30s      Reason:   Page size > 1MB due to parent dropbox size in 'Quick Edit' when listing posts (appears twice) and 'Attributes' widget when editing post (just once) Are hierarchical types unusable for large sites? Any workaround to solve this? Thank you!


title: How to find taxonomy name using only taxonomy TERM ID (or taxonomy term name)

text:
I am developing a multiple search filters function and I need to filter the search results page. I have 3 custom post types, each one with its custom taxonomy. So I have the custom post types:     1. **CPT** books;      2. **CPT** fruits;     3. **CPT** cars   Each one of these custom post types has a custom taxonomy attached. So we have     1. **CPT** books with **taxonomy** books-category     2. **CPT** fruits with **taxonomy** fruits-category     3. **CPT** cars with **taxonomy** cars-category   And each of these custom taxonomies have a couple of terms in them. So we have:     1. **CPT** books with **taxonomy** books-category, with **terms** : drama, crime, adventure     2. **CPT** fruits with **taxonomy** fruits-category with **terms** : apple, orange, banana     3. **CPT** cars with **taxonomy** cars-category with **terms** : mercedes, ford   In the searchform.php I have the search input AND a function that gets ALL the terms from ALL my custom taxonomies and puts them into a drop down. So the HTML looks like this:

<input type="text" value="" name="s" class="field s">

Categories:

             <select class="postform" id="cat" name="cat">                 <option selected="selected" value="0">All categories</option>                 <option value="99">Adventure</option>                 <option value="41">Apples</option>                 <option value="23">Banana</option>                 <option value="31">Crime</option>                 <option value="19">Drama</option>                 <option value="103">Ford</option>                 <option value="24">Mercedes</option>                 <option value="67">Orange</option>             </select>

<input type="submit" id="searchsubmit" value="Search" />

      When a user leaves the search input empty, but selects a taxonomy term in that drop-down, I need the search page to filter my search results so that it displays only custom post types filed under that taxonomy term. The big mystery here how can I find a way to get the TAXONOMY NAME to use in the WP_Query class, giving the fact that I have the TERM NAME and the TERM ID (the "value" field from my drop-down form). I could do this easy in taxonomy.php, but here I am in search.php! Any help would be greatly appreciated :) Best, Gabriela


title: Limit on the max number of words per post?

text: I wish to insert large posts in my site, close to 300,000 words. I removed all bold, italics, footnotes etc. and I paste text in HTML tab of post admin editor. My posts are truncated to 75656 words. Is there such an upper limit on the number of words per page? If yes, can you propose any alternative as per how to support such large posts? Maybe via CSV import? Thanks.


title: Options don't save, validation callback not executed

text:
I have been using settings API for my plugins for some time and it used to work well. Now it is broken and I can not figure out why. Apparently, the option validation function is not even called. Form data is properly sent and received, though. (Both figured out by `echo` resp `print_r` debugging.) I boiled down a (hopefully) minimal yet runnable example that retains both features of what I do and structure of how I do it: **myplugin.php**               <?php     /*     Plugin Name: My Plugin     Plugin URI: http://wordpress.org/extend/plugins/myplugin/     Description: Example plugin.     Version: 1.0     Author: Your Name     Author URI: http://your.site     License: GPL2     */     ?>     <?php          require_once('Plugin.php');          class MyPlugin extends Plugin {            function __construct() {         parent::__construct(array('name' => 'myplugin',                                   'prettyName' => 'My Plugin',                                   'mainFile' => __FILE__));       }            function activate() {         if ( !get_option($this->name) ) {           $options = array( 'test' => 'testwert' );           add_option($this->name, $options);         }       }            function deactivate() {}            function options_validate($input) {         $options = get_option($this->name);              $options['test'] = empty($input['test']) ? $options['test'] : $input['test'];              return $options;       }            function setup_settings() {         parent::setup_settings();         include('settings.inc.php');       }     }          new MyPlugin();     ?>      **Plugin.php**               <?php     if ( !class_exists('Plugin') ) {          abstract class Plugin {       protected $name;       protected $prettyName;       protected $mainFile;       private $hasOptions = true;       protected $options;            function __construct($props, $hasOptions = true) {         $this->name = $props['name'];         $this->prettyName = $props['prettyName'];         $this->mainFile = $props['mainFile'];         $this->hasOptions = $hasOptions;              if ( $hasOptions ) {           if ( is_admin() ) {             // Register Options Page             add_action('admin_menu', array(&$this, 'admin_menu_init'));             // Register settings             add_action('admin_init', array(&$this, 'setup_settings'));           }                $this->options = get_option($this->name);         }              register_activation_hook($this->mainFile, array(&$this, 'activate'));         register_deactivation_hook($this->mainFile, array(&$this, 'deactivate'));       }            function admin_menu_init() {         add_options_page($this->prettyName.' -- Options', $this->prettyName, 'manage_options', basename($this->mainFile), array(&$this, 'options_page'));       }            abstract function options_validate($input);            function setup_settings() {         register_setting($this->name, $this->name, array(&$this, 'options_validate'));       }            function options_page() { ?>

<?php echo $this->prettyName; ?> – Settings
           <form action="" method="post">             <?php submit_button(); ?>             <?php settings_fields($this->name); ?>             <?php do_settings_sections($this->name); ?>             <?php submit_button(); ?>           </form>
 <?php       }            abstract function activate();            abstract function deactivate();     }          }     ?>      **settings.inc.php**               <?php          class MyPluginCallbacks {       private $name = null;       private $options = null;            function __construct($name, $options) {         $this->name = $name;         $this->options = $options;       }            function general_text() {         echo 'A simple options page demonstration';       }            function test() {         echo "<input id='sanitisation' name='{$this->name}[test]' type='text' value='{$this->options['test']}'/>\n";         echo "
A simple test value.";       }     }          $callbacks = new MyPluginCallbacks($this->name, $this->options);          add_settings_section('general', 'General', array(&$callbacks, 'general_text'), $this->name);     add_settings_field('test', 'Test Value:', array(&$callbacks, 'test'), $this->name, 'general');          ?>      Can be reproduced on WP 3.3 and the latest build via beta test plugin. There are no visible debug messages (WP_DEBUG is enabled). _Edit:_ Something that changed is the options page. It used to be `options.php` but that did no longer work. Now it is `options-general.php`.