title: Wordpress custom posts and permalinks

text: I have a custom post type called "menu" with the following categories   * hotboxes   * salads   * soups   * wraps Code:               register_taxonomy(         'menutype',         array("menu"),         array(             "hierarchical" => true,              "label" => "Menu Categories",              "singular_label" => "Menu Category",              "rewrite" => array( 'slug' => 'menu/type', 'hierarchical'=>'true'),              "show_ui"=>"radio", // used a plugin             "query_var" => true         )     );      Right now if I want to say, show all my "hotboxes" it goes to               http://www.mysite.com/menu/type/hotboxes      But if it shows an _individual_ hotbox it just goes to               http://www.mysite.com/menu/hotbox-single-item      Is there a way to rewrite the url so it says               http://www.mysite.com/menu/type/hotbox/hotbox-single-item      The ideal format I am looking for is:               http://www.mysite.com/custom_post_type/custom_taxonomy/post_name      EDIT: I managed to get the link **looking** like the way I wanted by doing:               function menu_post_link( $post_link, $id = 0 ) {                  $post = get_post($id);                  if ( $post->post_type != 'menu')             {                 return $post_link;               }                  if( $terms = wp_get_object_terms( $post->ID, 'menutype' ) ) {                 $custom_taxonomy = $terms[0]->slug;                 $post_link = str_replace('menu', 'menu/'.$custom_taxonomy, $post_link);             }                       return $post_link;              }         add_filter( 'post_type_link', 'menu_post_link', 10, 2 );      Note: My custom post type is called "menu" and my custom taxonomy is called "menutype". This now creates the permalink I want: http://www.mysite.com/custom_post_type/custom_taxonomy/post_name However it generates a 404 error even after flushing my rewrite rules (Settings > Permalinks > save)


title: Filter/Sort Post Form On Taxonomy page

text: I am trying to create a form on the taxonomy template that will be able to filter the posts the current user is viewing. I want to use a few drop downs and submit button to do so. My code looks like this - `               <form method="get" id="searchform" name="searchform" action="<?php echo home_url(); ?>/blog/videoscategory/">               <?php      $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );      if ($term->parent == 0) {       wp_dropdown_categories('taxonomy=videoscategory&hide_if_empty=true&depth=2&show_count=0     &title_li=&child_of=' . $term->term_id);     } else {     wp_dropdown_categories('taxonomy=videoscategory&hide_if_empty=true&show_count=0     &title_li=&child_of=' . $term->parent);      }     ?>               <?php wp_dropdown_categories('show_option_all=All U.S. States&taxonomy=states&depth=2&orderby=name&show_count=1'); ?>     <button tabindex="2" type="submit" class="search_btn">                     </button>     </form>      ` The category pages URL looks like this - http://domain.com/blog/videoscategory/bankruptcy-law/ When I submit the form (using 2 dropdowns - sub category and custom tags taxonomy) the url returns like this - http://domain.com/blog/videoscategory/?cat=273&cat=87 How can I correct this? Or is there a better way about going about using a form to sort posts?


title: Wordpress Popular posts by view with time range

text: I am using this code provided here to display popular posts by views count. Code found here http://www.wpbeginner.com/wp-tutorials/how-to-track-popular-posts-by-views-in- wordpress-without-a-plugin/ But now I want to add a time range. I would like to display the popular posts for the day. So count will only be for a day and not overall Thanks


title: Only first category!

text: I have a category organized like this:   * sport     * football     * basketball     * volleyball   * news     * economy     * world     * country And I want to display only the _sport_ and _news_ root categories, but I don’t know how.


title: Enqueue Script After TinyMCE initialized

text: I am making a small live preview area inside a meta box using jquery where i need to get content from tinymce editor. But it seem my script loads before tinymce, this returns null when i try to get content from editor field. **Enqueue:**               add_action('admin_enqueue_scripts', 'wpk_popup_admin_script', 100);          function wpk_popup_admin_script($hook) {         global $post;         if( 'edit.php' != $hook && $post->post_type != 'wpk_popup'  )             return;              if(is_admin()){             wp_enqueue_script( 'jquery' );                  wp_register_script( 'wpk-popup-admin', plugins_url('/js/admin.js', __FILE__), array('jquery'), false, true);             wp_enqueue_script( 'wpk-popup-admin' );         }          }      Tried adding `editor` on dependency but its no use. The script prints just before the tinymce configuration. ![enter image description here](http://i.stack.imgur.com/1uy1L.jpg) **jQ Code for getting editor content:**               html += jQuery('#content_ifr').contents().find('#tinymce').html();      Which returns `NULL`. **Resolved:** Thanks to @birgire, I was able to solve the problem. Here is the final code.               add_action( 'after_wp_tiny_mce', 'custom_after_wp_tiny_mce' );     function custom_after_wp_tiny_mce() {         printf( '<script type="text/javascript" src="%s"></script>',  plugins_url('/js/admin.js', __FILE__) );     }      For Getting or Inserting data I prefer to use tinymce api instead of jquery hack. So, **Getting Data**               var content = tinyMCE.activeEditor.getContent();      **Inserting Content**               tinymce.activeEditor.execCommand('mceInsertContent', false, 'Text to insert goes here')


title: How to detect when a file has been uploaded?

text: I'm trying to analyze a file after it has been uploaded using a custom file upload field (ACF). Is there a way to do this using a hook? If not using a hook then maybe theres a Javascript event?


title: wordpress custom fields multiple data

text: i need help with wordpress custom fields currently i store date in one custom field called audio using the "," and "$" example: name, link $ name, link $ etc i have managed to use the data and split the data using php in my theme i.e the playlist. i just need help in creating a custom metabox with 2 text fields that can be duplicated by clicking on adding more and two more fields would show. i only want to use only one custom field to store the data. thanks


title: Dismiss Admin Pointer Temporarily

text:
I have a custom meta field for a page that contains a future date. I'm wanting to make sure this is always a future date and have decided the best way to do so is by creating an admin pointer if the date is in the past. The only problem is the default way to close the pointer sets `user_meta_data` I want to use a cookie instead and nag the user daily until the date is changed. Okay here is some code examples:               add_action( 'admin_enqueue_scripts', 'nifty_admin_enqueue_scripts' );     function nifty_admin_enqueue_scripts() {         // Using Pointers         wp_enqueue_style( 'wp-pointer' );         wp_enqueue_script( 'wp-pointer' );              // Register our action         add_action( 'admin_print_footer_scripts', 'nifty_admin_print_footer_scripts' );     }          function nifty_admin_print_footer_scripts() {         $pointer_content = '
Meetings are are of date
';         $pointer_content .= '
It seems that next meeting date is in the past. Please update this setting.
';     ?>          <?php     }      If you look at the admin-ajax.php you can see the `dismiss-wp-pointer` defined and follow the white rabbit back to where it sets the meta data. I'm thinking there has to be a way to use a cookie instead. Any thoughts would be appreciated. **EDIT:** Originally I was thinking I would need to do this using a cookie, but now that I think about it more I see that this is only ONE option. I've outlined some others below in hopes that someone will have an idea how to do them.   1. Use 2 user meta values one that has the date they last closed it and one has the reset value   2. Use `wp_cron` and delete the key value each day   3. Have the date be part of the key value (ie nifty_$epochtime) then loop through user meta data and split the nifty key on `_` and check the date with current date.    4. Orignal way use a cookie instead.  The only problem is I don't know how to do any of these or which one would work best.


title: Display Only Certain Category In a Custom Page Template

text: I have a **Page** in Wordpress that is a **Blog Page Template**. Now my issue is that it displays ALL the posts. I only want it to display posts assigned to a certain **category** How do I do that? Here is my blog.php page: I guess you have to edit it here right?               /*     Template Name: Blog page     */          $gogo_blog_text_no_posts = get_post_meta($post->ID, 'gogo_blog_text_no_posts', true);          $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();     $wp_query->query('posts_per_page='.$gogo_blog_text_no_posts.'&paged='.$paged);      $postcount = 0;     while ($wp_query->have_posts()) : $wp_query->the_post(); $postcount++;          //the loop goes here          $wp_query= null;     $temp = $wp_query;     ?>


title: Add image size array to a portfolio thumbnail in combination with Masonry Jquery Plugin

text: add_image_size( 'category-thumb', 250, 9999 ); //300 pixels wide (and unlimited height)      I am using the above code within my functions.php file, to generate various thumbnail sizes for my masonry portfolio theme.               <?php the_post_thumbnail(); ?>      Can the above take an array of images within this to randomise the images that is displayed within the grid? Thanks Kirsty


title: Wordpress in "Couch Mode"?

text: I am trying to setup a "Couch Mode" (distraction free reading) on my WordPress blog as laid out in this article. The guide in the article follows these steps:   1. Create a new page in WordPress with slug `read`   2. Add the following rewrite rule at the top of the _.htaccess_ file: `RewriteRule ^read/([0-9]+)/?$ /read/?u=$1 [QSA,L]`   3. Save this file as _page-read.php_   4. Add this link to to single.php of my theme using `<?php the_ID(); ?>` I did everything as per the article but when I click the "Read story without the clutter" link on my posts it throws an error: > Not Found > > The requested URL /read/761/ was not found on this server. My local development wordpress installation is: `localhost/techylab/` While the post where I am trying this Couch Mode is: `localhost/techylab/761/something`


title: Duplicating/Cloning Multiple Form Fields

text: Not sure what to call this one, but I am working on a form that asks for product information (name, description, color, features, etc.) but what I'd like to do is give users the option to add additional products by clicking on a link. They could add as many products as they need. After they finish entering information they could click a link that states `"Add another product"` or something similar and the form would give them a whole set of new fields that they could fill out. Through the same form, the page would grow as the items are added and it would be part of the same form (instead of having to submit the form over and over again on a per-product basis). I hope I'm making sense, does anyone know what the term is for this or have any recommendations on a plugin that could do something like this? Magic fields can do this but on the back-end not the front-end. ![enter image description here](http://i.stack.imgur.com/wCVXZ.png)


title: A attachment file with a php form in wordpress?

text:
I am making a PHP form in **WordPress**. I would like to receive a **notepad or PDF** file along this form when user submit form. I am getting all this in email using mail function in a body variable for example:               $body =" Attachment: $CV ";      Instead of file I am receiving **file name that user uploading** instead of **file**. I am trying to receive file in email. Actually I am learning too that how to do it. My PHP code for assigning to HTML file tag is:               if(trim($_POST['CV']) === '') {     $CVError = 'Please enter your CV.';     $CVError = true;     } else {     $CV = trim($_POST['CV']);     }      and my HTML code for getting file:
     Attachments :*
     <input class="txt" type="file" name="CV" id="CV" value="<?php if(isset($_POST['CV']))   echo $_POST['CV'];?>">
      and this is my mail function code:               $headers = 'From: '.$name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;     $headers .= "\r\n" . 'Content-type: text/html';     wp_mail($emailTo, $subject, $body, $headers);     $emailSent = true;      Can you help and modify my code in order to get file in email.


title: Taxonomy Overview Page?

text: I'm looking for a way to create an overview page for taxonomies. So say you're on a page for a certain page (domain.com/my_tax/myterm) it would show different content types in the 'myterm' category. Posts, Pages, and a Custom Content types. All of which are pulled through taxonomy.php. I can get this working fine, but when a taxonomy archive for the content type 'Posts' is viewed it ends up going to this overview page rather than a working archive of posts. So currently there's no way to view all posts of a content type and get a working archive. I tried adding `<?php if ( is_post_type_archive() ) { ?>..normal loop..<? } ?>` but the pagination breaks and it's rather buggy at detecting the current post type.


title: How to automatically change a posts status to draft based on custom field

text: I would like to set a post to Draft automatically based on a custom field date. Note: **I am using the plugin Magic Fields.** Based on the following code I want to use a custom field 'expiration' to give the date.               function sfn_show_expire() {          global $wpdb;          $server_time = date('mdy');          $result = $wpdb->get_results("SELECT * FROM wp_posts WHERE post_type = 'show' AND post_status = 'publish'");          if( !empty($result)) {             foreach ($result as $a) {                  $show_time = get_the_time('mdy', $a->ID );                  if ( $server_time > $show_time) {                      $my_post = array();                      $my_post['ID'] = $a->ID;                          $my_post['post_status'] = 'draft';                      wp_update_post( $my_post );                  }              } // end foreach          }     }      add_action( 'init', 'sfn_show_expire' );       Ultimately I would like to make this in a cron job, but for now any suggestions to the code would be great.


title: My permalinks are broken! Can I use mod_rewrite to ignore a physical file?

text: A website I work on recently posted a file at the root of their website named "2011.html." Now, any 2011 blog posts with the permalink structure of year/month/day/post-name do not work, and instead load the 2011.html file. Trying to bring up the archive at domain.com/2011/ also incorrectly brings up the file. 2010 and other years work as expected. Is there any way I can use mod_rewrite to only acknowledge this file when 2011.html is explicitly in the URL, and use the standard permalink structure with every other URL so that the blog functionality is restored? The link to this file was sent out in a marketing e-mail, and is receiving a lot of activity so it can't be moved or renamed.


title: multicheck box for post metabox

text:
Hi guys I have a headache on this I make a multicheck with this tutorial wpshout.com/create-an-in-post-theme-options-meta-box-in-wordpress/ the problem is it doesn't save all checked value and it doesn't checked the checked value when editing post. Here are my code I add here an array for muticheckbox                   <?php    function hybrid_post_meta_boxes() {          /* Array of the meta box options. */     $meta_boxes = array(         'title' => array( 'name' => 'Title', 'title' => __('Title', 'hybrid'), 'type' => 'text' ),         'description' => array( 'name' => 'Description', 'title' => __('Description', 'hybrid'), 'type' => 'textarea' ),         'location' => array( 'name' => 'location', 'title' => __('Location:', 'hybrid'), 'type' => 'check', 'options' => array(         'AL' => 'Alabama',         'CA' => 'California',         'DE' => 'Delaware',     ),     );          return apply_filters( 'hybrid_post_meta_boxes', $meta_boxes ); } ?>      I add else statement for multi checkbox                   <?php         function post_meta_boxes() {         global $post;         $meta_boxes = hybrid_post_meta_boxes(); ?>
     <?php foreach ( $meta_boxes as $meta ) :              $value = get_post_meta( $post->ID, $meta['name'], true );              if ( $meta['type'] == 'text' )             get_meta_text_input( $meta, $value );         elseif ( $meta['type'] == 'textarea' )             get_meta_textarea( $meta, $value );         elseif ( $meta['type'] == 'select' )             get_meta_select( $meta, $value );         elseif ( $meta['type'] == 'check' )             get_meta_check( $meta, $value );          endforeach; ?>
      I made a function for multicheck                   <?php function get_meta_check( $args = array(), $value = false ) {          extract( $args ); ?>
                      <label for="<?php echo $name; ?>"><?php echo $title; ?>         	                           <?php foreach ( $options as $option ) : ?>               <input type="checkbox" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value=", <?php echo $option; ?>, " <?php if ( htmlentities( $value, ENT_QUOTES ) == $option ) echo ' checked="checked"'; ?> /> <?php echo $option; ?>,             <?php endforeach; ?>             <input type="hidden" name="<?php echo $name; ?>_noncename" id="<?php echo $name; ?>_noncename" value="<?php echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" />
     <?php } ?>      How can I do code with saving all value of checked box? thanks! > > UPDATE                   function save_meta_data( $post_id ) {         global $post;              if ( 'page' == $_POST['post_type'] )             $meta_boxes = array_merge( page_meta_boxes() );         else             $meta_boxes = array_merge( post_meta_boxes() );              foreach ( $meta_boxes as $meta_box ) :                  if ( !wp_verify_nonce( $_POST[$meta_box['name'] . '_noncename'], plugin_basename( __FILE__ ) ) )                 return $post_id;                  if ( 'page' == $_POST['post_type'] && !current_user_can( 'edit_page', $post_id ) )                 return $post_id;                  elseif ( 'post' == $_POST['post_type'] && !current_user_can( 'edit_post', $post_id ) )                 return $post_id;                  $data = stripslashes( $_POST[$meta_box['name']] );             if ( get_post_meta( $post_id, $meta_box['name'] ) == '' )                 add_post_meta( $post_id, $meta_box['name'], $data, true );                  elseif ( $data != get_post_meta( $post_id, $meta_box['name'], true ) )                 update_post_meta( $post_id, $meta_box['name'], $data );                  elseif ( $data == '' )                 delete_post_meta( $post_id, $meta_box['name'], get_post_meta( $post_id, $meta_box['name'], true ) );              endforeach;     }    ?>


title: Recommendations for requesting quotes?

text: I have a tab in the header having named `Request Quote`. In my experience I have not yet used a quote functionality. Please provide me any help or any link that will be helpful for me. Is there is any plugin or something else? I need your ideas and suggestions. I shall be very thankful to you all.


title: Widget Area: Modify $param['xy'] from widget-$n

text: I have different widget areas. One is a horizontal area that may contain eg. 4 widgets next to each other. My Question is how would i add a different eg. `$param['widget_title']` to widget number `$n` (via a filter)? I already tried using `wp_registered_widgets();` function and te different globals, but with no result.


title: Creating a press page for our project

text: Over time our project got some good press: press releases, interviews, media appearances Now I want to create a "press page" (something like this). Requirements:   * is easy to update - everyone can write html at some degree, the procedure for adding a new article on the press page should be straightforward   * aggregates content from the original articles - a picture, title, maybe an abstract(excerpts )   * bind in my current theme (cannot be changed atm) How can I achieve this? Is there any plugin I can use?


title: How to add filter with 2 args?

text: I want to modify $path in the following filter. It has 1 input and 2 args.               function documents_template( $template = '' ) {                 $path = DOCUMENTS_INCLUDES_DIR . '/document/' . $template;            return apply_filters( 'document_template', $path, $template );     }      This is my function to add filter, it gets error message, how to get it right?               function my_template( $template = '' ){                $path = MY_INCLUDES_DIR . '/document/'. $template;               return $path;     }     add_filter( 'document_template','my_template', 10, 2 );      I tried to change my return value as following, it doesn't work either:               return apply_filters( 'my_template', $path, $template);      With the belowing answers, my new filter still not working, so, maybe it's because my filter is in a class? here's the completely new code:               Class My_Class{       function __construct() {          add_filter( 'document_template', array( $this, 'my_template',10, 2 ) );       }      function my_template( $path, $template ){                $path = MY_INCLUDES_DIR . '/document/'. $template;               return $path;      }     }


title: Jquery plugin not working on single pages

text: I use a news ticker jQuery plugin to show the last posts. The codes are in the `header.php` file and work fine on the home page, but not on single pages. The links are loaded but they don't move. Here is the home page and here the single page.


title: W3 Total Cache benefits without using plugin?

text: W3 Total Cache isn't compatible with WPTouch. Is there a way to get the benefits of W3 Total Cache without using the plugin?


title: Broken pagination

text: Well I'm here again with almost the same problem as I had in this post three weeks ago, but let me explain what has happened since then: I was originally using one loop to display the most recent sticky post at the top of the front page, then a second loop to display every other post (except for all other stickies). Here's my code as it stands now:               // first loop to display only my single, MOST RECENT sticky post     $sticky = get_option('sticky_posts');     $wp_query = new WP_Query(array('post__in' => $sticky, 'caller_get_posts' => 1, 'orderby' => ID, 'showposts' => 1)); ?>     <?php while (have_posts()) : the_post(); ?>         <!-- loop code -->     <?php endwhile; wp_reset_query(); ?>          // second loop to display every other post, excluding sticky posts     <?php query_posts(array('post__not_in' => get_option('sticky_posts'))); // exclude all sticky posts ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <!-- loop code -->     <?php endif; wp_reset_query(); ?>      What is happening here is perfect...for the front page only. I get my nice single/most-recent sticky post at the very top, followed by another 5 posts. Unfortunately, if I page over to the 2nd, 3rd, 4th, etc pages - all I see are the same 5 posts that were under the sticky post on the front page! I'm quite new with the concept of multiple loops, so I could really use a hand here! Thank you in advance :)


title: Daily notices of failed login attempts for non-existent admin user

text: I run a multi-user site and for the past week or two I have been getting daily notices that someone is getting locked out due to failed login attempts for user "admin" via the Limit Login Attempts plugin. There is no user account for "admin" and I assume this is an attack in an attempt to gain access to the wp-admin section of the site. I'm assuming if there is no "admin" user, then these attempts will never be successful. Am I safe to disregard these notices since there is no user named "admin" or are there other measures I can take to safeguard my site from being accessed maliciously? The attempts have been from a few different IP addresses so blocking the IP would only temporarily deter the behavior. Limiting the wp-admin to only specific IP addresses is not realistic due to the number of users that log in from different places.


title: bloginfo('template_directory') img src

text: I am lazy loading some images with URLs which are added via custom fields. The lazy load plugin I'm using requires a place-holder image in the `src` attribute and the actual image in data-original. http://www.appelsiini.net/projects/lazyload I need the image height and width as well, so I've been using `wp_get_attachment_image_src()`. My problem is using `bloginfo('template_directory')` to get the place-holding image. The first image here doesn't show the place-holder images but does output the url to the page.                   <?php                     $attch_id_1 = pn_get_attachment_id_from_url(get_post_meta($post->ID, 'img1', true));             $image_attributes_1 = wp_get_attachment_image_src( $attch_id_1, 'full');                   $attch_id_2 = pn_get_attachment_id_from_url(get_post_meta($post->ID, 'img2', true));             $image_attributes_2 = wp_get_attachment_image_src( $attch_id_2, 'full');                  $attch_id_3 = pn_get_attachment_id_from_url(get_post_meta($post->ID, 'img3', true));             $image_attributes_3 = wp_get_attachment_image_src( $attch_id_3, 'full');                  echo '';                  echo '';                  echo '';              ?>      The source for the page looks like this. `http://localhost/wordpress-cd/wp-content/themes/cd<img src="/images/img- BG.png"` Why can't I use `bloginfo('template_directory')` here? How can I output the images correctly?


title: When using TinyMCE which function should i use to sanitize the data?

text: I am developing a theme with several `custom post types` and each custom post type has its own settings page added with `[add_submenu_page(...)][1]`. One of these submenu pages includes a tinyMCE rich text editor, added with the following code:               <?php                      $content   = esc_html( get_option( 'standard_artist_contract_text' ) );                     $editor_id = 'artistcontract';                     $settings  = array(                         'textarea_name' => 'standard_artist_contract_text',                         'textarea_rows' => $textarea_rows,                         'media_buttons' => $media_buttons                         );                     wp_editor( $content, $editor_id, $settings );                     ?>      Each of the settings is registered with `[register_setting(...)][2]` now my question is which of wordpresses built in sanitation functions is best to handle this data, which one should i use as the third parameter in register_setting for data coming from wp_editor? Previously, with a textarea i had been using `esc_textarea` and `sanitize_text_field` with text inputs (to the contrary of what seems to be suggested in this post, where they use esc_attr only` !?)


title: Regarding Posts

text: I have several questions   1. How to limit characters in the post?   2. How to ensure every posting require images upload? That's all, appreciate if anyone can help..


title: Save WYSIWYG editor plugin settings, only works after second save

text:
I have set up a WYSIWYG editor on one of my plugin settings pages. The content saves, but only after you hit save twice. If you hit it once, you get he message for settings saved, but the content doesn't actually save. You refresh the page and it reverts back to its previous state. I'm initializing the editor using wp_editor, like so:               $single_optin_message_parameters = array(             'teeny' => true,             'textarea_rows' => 15,             'tabindex' => 1,             'textarea_name' => 'single-optin-message'         );          <?php wp_editor( $this->optionVal['single-optin-message'] , 'single_optin_message', $single_optin_message_parameters); ?>      and I'm saving the content via AJAX.               $('#form').submit(function (e) {                     // Make sure the api key exists        if (blankFieldCheck()) {                   $.ajax({                     type: 'POST',                     url: ajaxurl,                     data: {                         action: 'yks_form',                         form_action: 'update_options',                         form_data: $('#yks-form').serialize()                     },                     dataType: 'json',                     success: function (RESPONSE) {                         if (RESPONSE == '1') {                               $('#yks-status').html('

<?php _e('The options were saved successfully!', 'yikesplugin'); ?>

');                             $('#yks-status').slideDown('fast');                         } else {                             $('#yks-status').html('

<?php _e('The options could not be saved (or you did not change them).', 'yikes-inc-easy-mailchimp-extender'); ?>

');                             $('#yks-status').slideDown('fast');                             console.log(RESPONSE);                         }                     },                     error : function(RESPONSE2) {                         console.log(RESPONSE2.responseText);                     }                 });        }         e.preventDefault();     });      This works when the field is a standard `<textarea></textarea>` but the second I convert it to a WYSIWYG, I need to hit save twice for the data to actually save. I'm not seeing why. I've tested the data that is serialized when saving the form, and I can see my new data has been passed along, and I get the confirmation that it saved. Then I refresh the page and it reverts. No sense made.


title: Advanced Custom Fields Plugin - Unable to get URL from post_object

text:
I'm not sure what I'm doing wrong here. I have a field called "grid_thumbnail" and a "related_projects" post_object. I am able to display the title of the related post. I just don't know how to get the Image URL of that related post. Suggestions?               <?php foreach(get_field('related_projects') as $post_object): ?>
     <img src="<?php echo get_field('grid_thumbnail'); ?>">
     <a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID) ?>
      # Edit print_r returns:               stdClass Object ( [ID] => 100      [post_author] => 1      [post_date] => 2012-01-12 05:11:25      [post_date_gmt] => 2012-01-12 05:11:25      [post_content] => Nulla facilisi. Pellentesque non tincidunt est. Nulla porta bibendum auctor. Proin feugiat eros bibendum lacus viverra fringilla ac id felis. Praesent a commodo leo. Phasellus et odio eget justo venenatis interdum at ut nulla. Praesent lacinia nulla eu libero tempus pulvinar. Sed elementum, nulla vitae imperdiet ornare, elit lorem vestibulum erat, ac aliquet purus lacus pharetra risus. Mauris facilisis volutpat odio a ultrices. Etiam nisl urna, mattis sed ultricies sit amet, euismod sit amet eros. Nam tempus erat ut ligula elementum cursus faucibus elit accumsan. Fusce rhoncus, nunc nec vestibulum facilisis, nibh leo vestibulum metus, vitae malesuada leo dui eu erat. Proin scelerisque, mi viverra dignissim porta, lectus justo pellentesque metus, at consequat ligula nulla eu ante. Fusce fringilla pretium venenatis. Quisque quis arcu porta dolor condimentum viverra at id augue. Donec pharetra venenatis felis.      [post_title] => Rada      [post_excerpt] =>      [post_status] => publish      [comment_status] => open      [ping_status] => open      [post_password] =>      [post_name] => rada-2      [to_ping] =>      [pinged] =>      [post_modified] => 2012-01-16 23:01:37      [post_modified_gmt] => 2012-01-16 23:01:37      [post_content_filtered] =>      [post_parent] => 0      [guid] => http://estevancarlos.kodingen.com/ecv7/?post_type=projects&p=100      [menu_order] => 0      [post_type] => projects      [post_mime_type] =>      [comment_count] => 0      [ancestors] => Array ( ) [filter] => raw )


title: Meta Box Only in CPT Edit Page, Not in Add New

text: I have a CTP named `leads` and have 2 metaboxes added to the CPT new/edit screen. I need to have one of them only in edit screen, not in add new. Played with the codes provided in couple of answers, but they weren't of much help. (97845 and 89395) Can anyone help? I don't necessarily want anyone to do it for me, but a few playable starts would be great. Thanks


title: Set role for manage users only under a role

text: I have to implement membership functionality where a user (company owner) can manage multiple users(employees) under him. I have created two roles in members plugin -               Company user - Can add /edit/delete/manage users     Employee - read permission      In my custom registration process I have linked employee type users to company type users. But problem here is after company user's login it shows all users in wp admin users list and he is able to edit users not under him. Is there any custom role or functionality using that I can show only users under that company user ? I have database structure, already setup with my custom tables -               wp_users - main wordpress users table     wp_company- custom table to add companies      wp_company_users - to link users, for company usertype I have a column for making him admin, using this column I can find employees under this user.      Any help please. How it is possible.


title: Not sure why wp_ajax isn't working?

text:
I'm trying to get into grips in using AJAX in wordpress, the following code creates a form with an input box using the wordpress feature shortcode [ajaxf].               <?php     add_action( "wp_ajax_ajaxcf", "my_action_callback" );     add_action( "wp_ajax_nopriv_ajaxcf", "my_action_callback" );          function my_action_callback() {         $whatever = intval( $_POST['fname'] );         echo $whatever;         die();      }     function ajax_contact_form() {     ?>               <form id="ajaxForms">            First Name:         <input id="fname" name="fname" value="First Name" type="text" />

         <input name="action" type="hidden" value="ajaxcf" />         <input id="submit_button" class="submit" value="Send" type="button" />
     </form>     <?php         }     add_shortcode("ajaxcf", "ajax_contact_form");      I simply want to alert the response with jQuery but it doesn't seem to work and i have no idea why. Help appreciated. Thanks


title: Automatic creation of mutisite blog outside of the admin

text: i working on a system that in which i want user to be able to create their own page on login using the multisite feature in wordpress how do i get these done outside the admin. It seems like all the files in wordpress are all interwoven. i dont understand how all those function and class can be included into my project


title: How to create multiple loop in archive page?

text:
This is my archive page codes i want to avoid duplicate posts in 4th loop & i want to count post in 3rd loop there are 4 loops 1 first loop count : 1 post                 <?php        $count = 1;       if (have_posts()) : while (have_posts()) : the_post();                   if($count == 1) : ?>           <a href="<?php the_permalink() ?>" rel="bookmark" title="" ><?php the_title(); ?>       2 second loop - - count = 1 post               <?php if (have_posts()) : ?>     <?php $count = 1; ?>     <?php while (have_posts()) : the_post(); ?>     <?php $count++; ?>     <?php if ($count == 2) : ?>      <a href="<?php the_permalink(); ?>" title=""><?php the_title(); ?>         3 third loop-- count = 5 post               <?php else : ?>      <a href="<?php the_permalink(); ?>" title=""><?php the_title(); ?>      <?php endif; ?>     <?php endwhile; ?>          <?php else : ?>
Most Viewed News
     <?php endif; ?>      4 loop -- count = rest of all post               <?php else : ?>      <a href="<?php the_permalink(); ?>" title=""><?php the_title(); ?>       -- ad count --               <?php if ( $count == 3 || $count == 5 ) : ?>     <?php dt_show_ads();?>      <?php endif; ?>          <?php endif; ?>      <?php $count++; ?>      <?php endwhile; ?>                <?php else : ?>

<?php _e('Sorry','linepress');?>

     <?php endif; ?>


title: Wordpress: embedding last posted video

text: I need to embed the last posted video (from a specific category) to the frontpage of my Wordpress site. Is there any shortcode (or widget, even) I can use to simply filter my posts by category, and have the content (in this case, an embedded .wmv or .m4v) displayed based on a "last posted" basis. I am currently able to get a simple static embed working, but I need the embed to be dynamic based on the last video posted. The video cannot be hosted on sites like youtube or vimeo; I need to have them hosted as video files on a server and embed them that way. Thanks in advance.


title: I want to add post meta for picture thum during submit for revision

text: I am using this function to get imnages urls from google                  function getGoogleImg($k)     {         $url = "http://images.google.com/images?as_q=##query##&hl=it&imgtbs=z&btnG=Cerca+con+Google&as_epq=&as_oq=&as_eq=&imgtype=&imgsz=m&imgw=&imgh=&imgar=&as_filetype=&imgc=&as_sitesearch=&as_rights=&safe=images&as_st=y";         $web_page = file_get_contents( str_replace("##query##",urlencode($k), $url ));         $tieni = stristr($web_page,"dyn.setResults(");         $tieni = str_replace( "dyn.setResults(","", str_replace(stristr($tieni,");"),"",$tieni) );         $tieni = str_replace("[]","",$tieni);         $m = preg_split("/[\[\]]/",$tieni);         $x = array();         for($i=0;$i<count($m);$i++)         {             $m[$i] = str_replace("/imgres?imgurl\\x3d","",$m[$i]);             $m[$i] = str_replace(stristr($m[$i],"\\x26imgrefurl"),"",$m[$i]);             $m[$i] = preg_replace("/^\"/i","",$m[$i]);             $m[$i] = preg_replace("/^,/i","",$m[$i]);             if ($m[$i]!="")             array_push($x,$m[$i]);        }        return $x;     }      After that i want add image url to post meta i am using this function to add post meta                 function add_image_to_save_post($post_ID)         {                 if ( !wp_is_post_revision($post_id) )             {             $title = $_POST['post_title'];             $image = getGoogleImg ($title);             add_post_meta($post_ID, 'thumb', $image[3], true);                  }         }         add_action('wp_insert_post', 'add_image_to_save_post');      But when i click on on link add new post its add autmatically blank thumb key in database I just want this for users so just add articles they no need to add image to article image will fetch automatically, Can anyone give me suggestion how this possible Thanks MOhammad Umer


title: WordPress Comment functions

text: As we know we can usually make changes to "the content" by calling the_content(). is there any equivalent function available for comments? or any such way do you know?


title: How to make search include data from wp_postmeta?

text: I have a site using Advanced Custom Fields to create and store various bits of relevant info. These need to be included in the main general search, which by default only searches the title and main content. I've found plenty of info about getting search results based on specific bits of postmeta, but I have an issue with that. There are a potentially unlimited amount of potential fields in postmeta to search. The solution could either search anything in postmeta or anything with a meta_key that matches this regex: `content_section_[0-9]{1,4}_content_.{2,8}` Example meta_keys to match are:               content_section_0_content_title     content_section_0_content_title     content_section_4_content_subtitle     content_section_8_content_text      Any way that I can alter the fields searched to include the postmeta would be very much appreciated.


title: Shortcodes not working

text: I have `WordPress 3.2.1` and I have created a personal shortcode, everything works fine until I change the `Permalink Settings` from `Default` to `Custom Structure`. The shortcodes stop to work permanently, instead I turn back to `Default` setting. > Hello, I'm [birthday year="1975-03-25"] years old. I've added `add_shortcode` function in my theme's `functions.php`.   If I add the new `shortcode` to the original WordPress theme `Twenty Eleven` in the `functions.php` file, it works fine! my functions.php file:               function short_birthday ($date) {         list($Y,$m,$d) = explode("-", $date['year']);         return( date("md") < $m.$d ? date("Y")-$Y-1 : date("Y")-$Y );     }     add_shortcode('birthday', 'short_birthday');      this is the only thing I've added to `functions.php`. How my theme can block the shortcodes? It's the only thing I've did.   Can I do something to fix it?


title: Multiple textdomains

text: I have a bunch of plugins. Obviously, they all have their own unique textdomains for internationalization (i18n). I also have a bunch of files that I include in all my plugins - I throw them all in a directory called common. This adds a dashboard widget that I want all my plugins to have, as well as a script for updating (since they don't live on the wordpress.org plugin repo). I want to be able to just drop my common folder into each of my plugins without having to edit the files. But I'm concerned about the text strings contained inside. Can I call load_plugin_textdomain twice, for two different domains, within the same plugin? What's the best way of handling this situation with i18n in mind? Or will I have to go through each instance of my common files and manually change the textdomain to match the plugin?


title: Meta_query and numeric comparison

text: I have a WP_Query with meta_query filter on meta_value.               if( ($capacity != '') && ($capacity > 0) ) $filters[] = array('key' => 'mb_capacity','compare' => '>','value' => $capacity, 'type' => 'NUMERIC');     and then later i set the  'meta_query' => $filters of the query      The custom field mb_capacity represents an number but WP store it as a String. I was thinking the "type=>'numeric'" option will handle that, but unfortunatly it doesn't work, the comparison still be done on String instead of Integer. Is there any solution to that problem ? Note that i'm using WP 3.2.1. Many thanks for any suggestions


title: Modifying the main editor priority

text: I want the main WordPress post editor to appear below some of my meta boxes (generated by Advanced Custom Fields). I know there are the `add_meta_box()` and `remove_meta_box()` functions, however it'd be really awesome if I could just modify the editor meta box priority without having to remove and add it again. Any ideas?


title: Get menu item slug

text:
I use custom menus and I’d like to get the menu item slugs. Is that possible?               // Get the nav menu based on $menu_name (same as 'theme_location' or 'menu' arg to wp_nav_menu)     // This code based on wp_nav_menu's code to get Menu ID from menu slug          $menu_name = 'main-menu';          if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {              $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );         $menu_items = wp_get_nav_menu_items($menu->term_id);         $menu_list = '
';                  foreach ( (array) $menu_items as $key => $menu_item ) {                 $title = $menu_item->title;                 $url = $menu_item->url;                 $menu_list .= '
' . $title . '
';             }              $menu_list .= '
';          }          echo $menu_list;      http://codex.wordpress.org/Function_Reference/wp_get_nav_menu_items


title: Filter my args by the post 1st letter

text: I filter my `WP_Query` by this script:               $args = array (             'posts_per_page' => $posts_per_page,             'post_type' => $post_type,             'meta_key' => 'post_views_count',             'orderby' => 'meta_value_num',             'showposts' => 160,             'order' => 'DESC',             'paged' => $paged,                 'tax_query' => array(                    array(                        'taxonomy' => $term->taxonomy,                        'field' => 'slug',                        'terms' => $term->name)));      And I would like to add the filter `SUBSTRING(post_title, 1,1) ='z'`.   Is that possible to implement it?   what's the best practice to loop only post which start with letter X?


title: Users are being redirected to main site when trying to register on subsite of my Multisite network

text: I want to allow my clients on my network to have visitors register on their site. Currently, there is no link or button to allow visitors to access the signup page. This looks like default functionality for some bizarre reason. Anyone trying to reach "subdomain.mydomain.com/wp-signup" is redirected to "mydomain.com." Instead, visitors should be able to register on the subdomain, and remain there, without ever seeing my domain. So far in my research, others have recommended Multisite User Management, however this did not do what I needed. I don't want any manual involvement in the user registration process of my clients. Any help would be greatly appreciated. Thanks. WP: 3.4.2


title: Show ID's in main section of my own page

text: I've included wordpress in my own website and I use the main section of the blogs aswell as the sidebar. In the sidebar there are shortcuts that lead to Id's Cat=01 p=01 etc. Everytime I click them it opens a new wordpress site instead of opening in the main section off my own side. What code do I use to make sure that the link will link me to my main section? (I use header, sidebar left, main section, sidebar right, footer). ps. I've been searching for about a week now to find the code and I know it is out there but I probely don't know how to ask the question right. If someone can help me I'd be very thankfull! My website is http://www.volunteeringnews.com


title: Breadcrumbs stop working on a specific template file

text:
I'm working on a theme and i use dimox's breadcrumbs to display breadcrumbs in the footer, so far so good, works almost flawlessly BUT there's one template file where i use 2 loops and i'm guessing this is what screws with the breadcrumbs... but i couldn't put my finger on it exactly... here's the code:
                    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>          <?php $parent_title = $post->post_title; ?>     <?php $parent_content = $post->post_content; ?>     <?php $parent = $post->ID; ?>          <?php endwhile; else : ?>     <?php endif; ?>
         <img id="previewImg" src="<?php bloginfo("template_url"); ?>/images/spacer.png" alt="" />

<?php echo $parent_title; ?>

         <?php query_posts('posts_per_page=15&post_type=page&post_parent='.$parent); while (have_posts()) : the_post(); ?>            <?php $image_thumb = get_post_meta($post->ID, 'image-thumb', true); ?>
<a href="<?php the_permalink(); ?>" rel="<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), medium, false, '' ); echo $src[0]; ?>"><?php the_title(); ?>
         <?php endwhile; ?>

           <?php print($parent_content);?>

          <?php get_footer(); ?>      Take a look at previewUL ...


title: WordPress built-in method to extract array of term IDs?

text: I'm querying a custom taxonomy for a post, hoping to get a list of all terms for that post and taxonomy. `get_the_terms($post_id, $taxonomy)` works, but gives this ungodly array of term objects that will require an extra layer of parsing before I can run the following code: `if (in_array($list_of_term_ids, $my_term_id)){ do good stuff... }` I'm looking to see whether anyone has come across a native WP function or method that extracts term ids into a flat list before rolling my own utility function, just so I can be using built-in best practices.


title: Multiple Blogs on one site. Best Practise

text: I've been tasked with adding a blog to an already up and running client site. The site uses wordpress as it's CMS already. So a blog install should be a relatively simply task and simply a matter of blending in the stylings of the blog to match the clients taste. However I get the sinking feeling that the client has already set up a "blog" with there testimonials page. I've not yet got the access passwords from the client to look under the hood but I thought I'd get an early start on my workload and do some research into my options. Theoretically I'm going to have to find a way to create another blog section within the site. I've come up with four options and I wanted the opinion of the wordpress community as to which one would be best. One of the key factors to bare in mind is that I would prefer to leave installing a second wordpress cms as that will end up causing confusion for the client, however I'm open to arguments if it turns out to be what the community think is best practice. So far my options as I see them are:   1. A second install of wordpress in a sub folder and then link through from the clients original site. This has all sorts of draw backs though as I'll be duplicating login credentials, having to replicate the theme, two sets of plugins to upgrade and maintain and may well be detrimental to the sites SEO if I have to start setting up redirects or fixing broken links ect. Like I say though if there is a strong argument for a second install that I'm missing then I'm open to suggestions.    2. Wordpress network site. This came up in a quick google search, I've never set up one before and I was wondering if anyone could list some pro's or cons. I'm not entirely convinced this is the right way to go, but again, I'm not an expert so this could be what I'm after. From what I've read (which at this point is limited to the codex) this would allow me to set up a second site but from the same install. Would this allow me to maintain one set of plug=ins/login details/theme but run two Blogs? Any idea what the affect on SEO mite be?    3. Using a plug in. This seems like the sound option and I've already earmarked a plug in that could do the job. However I'm worried about the long term support and don't want to be getting a frantic email from a client because the plug in is no longer supported in a future wordpress update. However the pro's (from what I've read) are that I can generate a template page and seperate the posts via the categories. Once the site is live I'll be managing the blog entries anyway so this would be beneficial. Also as the new blog will be built by inserting a series of codes into a template I shouldn't have to do too much in the way of styling as the css and layout from the theme should still apply (in theory :) . Any hoo, So far it looks like option three is the main contender, but I thought I'd throw it open to the forums to see if there are any reasons that options 1 or 2 would be better, or a possible option 4 that I'd not considered. Thanks in advance for any help guys.


title: get_option() filtering and getting out of recursion

text: `get_option()` provides couple of filters `'pre_option_'.$option` and `'option_'.$option`. However most times I tried to make use of these it usually explodes and not worth the trouble - either I need to check another option inside my filter, which triggers my filter, which triggers my filter... Another common case is that I need to get current option that I am filtering and I cannot do that because I am filtering it. Just curious - is there some practical logic to follow here? I know I could juggle my filter, but that is overhead that I don't like and filter removal is considered not too reliable by some. ;) For recent practical example - I want to filter `posts_per_rss` to my option, but provide WordPress value if my option is not set (for the record I know that recommended way to mess with it is via `post_limits`).


title: combine multiple feeds with fetch_feed and display blog titles for each item?

text:
I'm trying to display multiple feeds using the fetch_feed function. Its working well thus far except I can't figure out why the title for each individual rss feed will not show up. Here is my code:               <?php // Get RSS Feed(s)     include_once(ABSPATH . WPINC . '/feed.php');     $rsslist = array(   'http://www.lt11.com/rss',                         'http://feeds.feedburner.com/climbingnarc'                     );     $rss = fetch_feed($rsslist);     if (!is_wp_error( $rss ) ) :      $maxitems = $rss->get_item_quantity(25);      $rss_items = $rss->get_items(0, $maxitems);      endif;     ?>         <?php if ($maxitems == 0) echo '
No items.
';         else         foreach ( $rss_items as $item ) : ?>
              <a href='<?php echo esc_url( $item->get_permalink() ); ?>'             title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>             <?php echo esc_html( $item->get_date('j/n/Y - g:i A') ); ?> -
<?php echo esc_html( $item->get_title() ); ?>
 - <?php echo esc_html($rss->get_title() ); ?>
         <?php endforeach; ?>              Its that list bit that calls for the title of the rss feed. If I only fetch one feed then the title shows up. When I fetch more than one feed as in the example above, the title does not show up. Any ideas on how to fix this? Thanks!


title: get facebook status

text: I'm looking for a good, simple PHP or JS function to get my latest Facebook status updates. Anyone have a good solution? I had a JS script but simply stop working. heres the code: view code Thanks in advance!


title: Loading scripts & styles from a meta box callback function

text: ### Case: I got a set of classes that build form fields based on data from an input array. The class can build the following types of form fields:   * input (basic, hidden, password)   * textarea   * radio   * checkbox   * select   * colorpicker   * datepicker   * file upload _EDIT:_ The class uses `wp_register_script/_style` & `wp_enqueue_script/_style` to load the scripts & styles. The functions containing the actions are hooked inside the class like this: `add_action( 'admin_enqueue_scripts', array( &$this, 'enqueue' ) );`. ### Example: _(Inside`functions.php`)_               // meta box callback function     function test_meta_box_cb()     {            $input_args = array(              'type'         => 'color'             ,'id'           => 'color-id'             ,'label'        => 'Input Colorpicker Label'             ,'opt_name'     => 'abc_xyz'             ,'value'        => '009ee0'          );         new FormClass( $input_args, true );     }     // add the meta box     function add_test_meta_box()     {         add_meta_box( 'test_box', __('TestBox'), 'test_meta_box_cb', 'post', 'advanced', 'high' );     }     add_action( 'add_meta_boxes', 'add_test_meta_box' );      ### Problem: This way, my call for `wp_enqueue_script` & `wp_enqueue_style` doesn't work. I get the form fields rendered, but no scripts or styles. ### Situation & Backtracing of the problem: So far I could track down the problem to the wordpress core architecture:   * WP doesn't question what happens inside the callback function until `do_action('add_meta_boxes', $post_type, $post)` get's called (inside _edit-form-advanced.php_ ).    * That call happens long after _admin-header.php_ was called (which contains `do_action('admin_enqueue_scripts', $hook_suffix);`).   * Therefore the script & style can't get loaded (if I'm not wrong). ### Question:   1. How could i load styles before the meta box form fields get called?    2. How could i avoid repeating the same stylesheet over and over again - i want to use `wp_enqueue_style` & `wp_register_style`? I'm open to any answers including those who force me to rewrite my class architecture. _Note:_ I need to use this class in a lot of different szenarios, so bundling it to close together with the `add_meta_box` function is not good. I'm close to making an abstraction layer that divides the call for the meta box and the style/script part, but why would I want to add another layer above a core function?


title: Retrieving old forms in Contact Form 7

text: I recently was having trouble with some of my Contact Form 7 forms so I decided to install the latest version. I backed up (or thought I did) the old version by copying the old Contact Form 7 folder to my computer. Long story short, I had issues with the new version and have chosen to go back to the old. Unfortunately, now that I've copied my backup directory to the WP folder, the plugin works but only one of my old forms is still in the settings menu. Does anyone know where I can find the rest of the forms I had created? I'm really hoping they're stored somewhere in the directory I copied. Thanks.


title: Dropdown list of available posts for post editing

text: I have posts of two different categories that I can't easily relate. categories are: instructors and class categories (like aerobic, weights etc.) I would like to tie instructors to class posts NOT class types. Ideally from the **post edit screen** , I would like a dropdown of all instructors available from the class postings and then be able to select an instructor. Here is the class listing page http://howlingwolfmedia.com/site3/classes/classlist/ You can also see the instructor's listed under > classes > instructors I'd like the selected name to then show in the 'instructor' column. code for the classlist table: http://pastebin.com/tNScDVxW class postings fall under child cat 5-10 of parent cat id: 4 instructors cat id: 4 these are standard (not custom) post types This must in some way alter the admin part of the site and I'm not familiar with coding for that... nor am I well versed in mysql coding etc.


title: HTML inside __() or _e() language translation string

text:
What is the proper approach to building translation strings? For example,               echo __( 'Hello ' . $first . ' you owe me money.' );     echo __( '

Top: ' . $t_margin . '
' . '
Bottom: ' . $b_margin . '

' )      Is it OK to add the strings and/or HTML or should it be done first and then run through translation like:               $html = '

Top: ' . $t_margin . '
' . '
Bottom: ' . $b_margin . '

';     echo __( $html );


title: Why won't the Jquery validation plugin work?

text:
I am trying to use a Jquery validation plugin called bassistance. I have wp_enqueue_script the script. I have loaded Jquery as I understand it's built into wordpress. I have included the `<script>` tag so that I can `.validate()` it . I have added the rules by adding `class` to each field. This is all in one .php script, as I'm just learning. It doesn't seem to work. Please can someone advise? Has the `<style>` tag been used wrongly?               add_action( 'wp_enqueue_script', 'load_jquery2' );         function load_jquery2() {             wp_enqueue_script( 'jquery' );       }                    function add_my_css_and_my_js_files(){                 wp_enqueue_script('jquery-validate-min', plugins_url('activate/jquery_validate_min.js', __FILE__ ) );          }           add_action('wp_enqueue_scripts', "add_my_css_and_my_js_files");                          function mp_calcs_display() {     return '     <form name="calsinput" action="" method="post" id="calsinput" >
 Process

 operation type always robot

     Number of welds: <input type="number" name="numberofwelds" class="required digits" title="This field is required and must be a no."  >

     Number of construction welds: <input type="number" name="numberofconwelds" class="required digits"  title="This field is required and must be a no.">     <input type="submit" value="Calculate cycle time ">     </form>  ';     }


title: Want to add different text after each menu item

text: I want my main nav bar to display menu items with very short description of said menu under each item's title. To do this, I was hoping to just inject the menu item's 'title' attribute into the 'after' function below. Not quite sure how to do this:               // the main menu     function bones_main_nav() {         // display the wp3 menu if available         wp_nav_menu(array(             'container' => false,                           // remove nav container             'container_class' => 'menu clearfix',           // class of container (should you choose to use it)             'menu' => __( 'The Main Menu', 'bonestheme' ),  // nav name             'menu_class' => 'nav top-nav clearfix',         // adding custom nav class             'theme_location' => 'main-nav',                 // where it's located in the theme             'before' => '',                                 // before the menu             'after' => '',                                  // after the menu             'link_before' => '',                            // before each link             'link_after' => '',                             // after each link             'depth' => 0,                                   // limit the depth of the nav             'fallback_cb' => 'bones_main_nav_fallback'      // fallback function         ));     } /* end bones main nav */      I'm also worried about this interfering with drop-down functionality. Any help would be greatly appreciated.


title: How to hide "Comments are disabled"

text: is it possible to hide the string: "Comments are disabled" from everywhere? I mean also from posts list, and post page :) Thanks :) EDIT: sorry, the theme is Journal Cruch by Site5.com However I resolved using               if (comments_open())         comments_popup_link();      where the comments are displayed, but I don't like too much this solution :)


title: Instant install of wordpress

text: I just think about that... maybe it exist...you will tell me... Wordpressis a beautifull software, and the thing i like the most, is the instant install of the theme and plugin... So i though, why not have a onefile.html upload, and install wordpress ITSELF utomaticly fron the svn instead of having to upload a whole buch of file that take a looong time, and sometime failed... Maybe that file, will just select the language and the name of the folder... Or maybe, it exist ?... I know that the database must be done before... i do it, it's just the folder with 1000 files that weight 10 mg that bug me... autoinstall as plugin !


title: How to make multiple page out of one post

text: Suppose I write a long article and display products in one post but it is too long so I want to cut it and continue the next page in the same post? Can I do that in wordpress? I want to display many products so I want to build pages with in a post. One post but there is a navigation numbers like 1 2 3 -- like 3 page in one Post? How do I do that?


title: Hook into 'when user logs in' [persistent login]

text: I'm trying to create a persistent login mechanism in Wordpress (I can't find a plugin, but if there is one, let me know!). But I'm struggling to find a hook (add_action or add_filter) that runs when the user is initially authenticated by wordpress when logging in. Does anyone know of an appropriate way to execute code only once when a user logs into wordpress?


title: Deprecated function get_user_by_email($email)

text: I tried to find replacement function for get_user_by_email($email) but no luck. This function I am using to allow user to log in by email address or user id. Is there any replacement function or alternate way to do that?


title: Must I download entire WP directory for each separate instance/website that uses WP?

text: I'm no noob when it comes to website design or development. And am quite savvy with JQuery, XHTML and PHP. However, I admit I am quite noob-ish when it comes to WP... I already have the WP directory (folders for includes,admin,content and all the other php files it requires) uploaded to my root. Well, obviously in a subdirectory of the root (ex. root/wordpress). My question is, if I'm creating multiple (different clients) websites with WP yet stored on the same host, do I need to fully install the entire WP directory again? This time under a different pathname (ex. root/wordpress02)? I'm pretty damn sure the answer is yes, as each instance of WP has its own Dashboard and makes calls to its own PHP files. Unless I changed the target path of the plugins and other files I plan on sharing amongst my different WP sites, the answer is **yes**. I'm pretty sure I just answered my own question -- it's 1 am here. I've had a long day...   but I'm still kinda curious how you guys go about installing multiple instances of WP on your root. Just append a number to the different directories? (ex. root/wordpress01 , root/wordpress02 , root/wordpress03) **Thank you!**


title: Find relative post number in single post page

text: **My problem:** I need to find the relative post number (e.g 3rd of 10 posts) within a category. I can get the total amount of posts (10), like so:               $category = get_the_category();      $category[0]->category_count;       However, I am using a loop that only fetches 1 post (I only need to show the 1 post. It's the post number I need, in descending order). This is the loop that only retrieves 1 post:                   if ( have_posts() ):             while ( have_posts() ):                 the_post();     //content             endwhile;         endif; ?>      And the `$wp_query` request shows this:               [request] => SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'another-hero-candy-etc' AND wp_posts.post_type = 'post'  ORDER BY wp_posts.post_date DESC       This means that `[current_post] => 0` and `[in_the_loop] => 1` are always the staying same (regardless if I go to **Next post ->** or not). My question: **How can I find the relative post number, if the loop is only fetching one post?**


title: Can't update an option when the publish_post action is fired.

text: I'm using Tom McFarlin's Plugin Boilerplate, and I'm facing this huge problem where I can't update an option when the `publish_post` action is fired. I have a function that hooks into the publish post action and all it does is update an option. This wasn't even my original task. What I wanted to do was call a private function from within the function mentioned above, that would update the option. That didn't work out so I got down to updating the option from within the public function itself. Here's the code, and if someone can help me out with not just this, but also how to use the private function it would really bail me out. P.S.: `the_content` filter works, but the `publish_post` action does not work. I've left the line which calls the private function commented out, so that you can test my two issues separately.               <?php     /*     Plugin Name: winkadoka on caffeine     Plugin URI: zilch     Description: blah blah blah     Version: 1.1.1     Author: richard madson               License:GPL v.2          /*--------------------------------------------*      * Constructor      *--------------------------------------------*/          /**      * Initializes the plugin by setting localization, filters, and administration functions.      */     function __construct()      {              // Load plugin text domain         add_action( 'init', array( $this, 'plugin_textdomain' ) );              // Register admin styles and scripts         add_action( 'admin_print_styles', array( $this, 'register_admin_styles' ) );         add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) );              // Register site styles and scripts         add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_styles' ) );         add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_scripts' ) );              // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.         register_activation_hook( __FILE__, array( $this, 'activate' ) );         register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );         register_uninstall_hook( __FILE__, array( $this, 'uninstall' ) );              /*          * TODO:          * Define the custom functionality for your plugin. The first parameter of the          * add_action/add_filter calls are the hooks into which your code should fire.          *          * The second parameter is the function name located within this class. See the stubs          * later in the file.          *          * For more information:          * http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters          */         add_action( 'publish_post', array( $this, 'on_publish_post' ) );         add_filter( 'the_content', array( $this, 'on_content_load' ) );          } // end constructor          /**      * Fired when the plugin is activated.      *      * @param   boolean $network_wide   True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog      */     public function activate( $network_wide ) {         // TODO:    Define activation functionality here         //on activation --->see what akismet does.          } // end activate          /**      * Fired when the plugin is deactivated.      *      * @param   boolean $network_wide   True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog      */     public function deactivate( $network_wide ) {         // TODO:    Define deactivation functionality here     } // end deactivate          /**      * Fired when the plugin is uninstalled.      *      * @param   boolean $network_wide   True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog      */     public function uninstall( $network_wide ) {         // TODO:    Define uninstall functionality here     } // end uninstall          /**      * Loads the plugin text domain for translation      */     public function plugin_textdomain() {              // TODO: replace "plugin-name-locale" with a unique value for your plugin         $domain = 'plugin-name-locale';         $locale = apply_filters( 'plugin_locale', get_locale(), $domain );         load_textdomain( $domain, WP_LANG_DIR.'/'.$domain.'/'.$domain.'-'.$locale.'.mo' );         load_plugin_textdomain( $domain, FALSE, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );          } // end plugin_textdomain          /**      * Registers and enqueues admin-specific styles.      */     public function register_admin_styles() {              // TODO:    Change 'plugin-name' to the name of your plugin         wp_enqueue_style( 'plugin-name-admin-styles', plugins_url( 'plugin-name/css/admin.css' ) );          } // end register_admin_styles          /**      * Registers and enqueues admin-specific JavaScript.      */     public function register_admin_scripts() {              // TODO:    Change 'plugin-name' to the name of your plugin         wp_enqueue_script( 'plugin-name-admin-script', plugins_url( 'plugin-name/js/admin.js' ), array('jquery') );          } // end register_admin_scripts          /**      * Registers and enqueues plugin-specific styles.      */     public function register_plugin_styles() {              // TODO:    Change 'plugin-name' to the name of your plugin         wp_enqueue_style( 'plugin-name-plugin-styles', plugins_url( 'plugin-name/css/display.css' ) );          } // end register_plugin_styles          /**      * Registers and enqueues plugin-specific scripts.      */     public function register_plugin_scripts() {              // TODO:    Change 'plugin-name' to the name of your plugin         wp_enqueue_script( 'plugin-name-plugin-script', plugins_url( 'plugin-name/js/display.js' ), array('jquery') );          } // end register_plugin_scripts          /*--------------------------------------------*      * Core Functions      *---------------------------------------------*/          /**      * NOTE:  Actions are points in the execution of a page or process      *        lifecycle that WordPress fires.      *      *        WordPress Actions: http://codex.wordpress.org/Plugin_API#Actions      *        Action Reference:  http://codex.wordpress.org/Plugin_API/Action_Reference      *      */     private function wj_check_entry_count($post_id)     {         $wj_check_option = get_option($post_id.'_wj_bentry_count',false);         if($wj_check_option===false)         {             $wj_entry_count = 1;             settype($wj_entry_count, "integer");              }         else         {             $wj_entry_count = $wj_check_option + 1;         }         $wj_update_option = update_option($post_id.'_wj_bentry_count',$wj_entry_count);         return $wj_entry_count;     }     public function on_publish_post($post_id)      {         //$this->wj_check_entry_count($post_id);         update_option('long_live_marlboro','heLLO');              // TODO:    Define your action method here     }   // end action_method_name          /**      * NOTE:  Filters are points of execution in which WordPress modifies data      *        before saving it or sending it to the browser.      *      *        WordPress Filters: http://codex.wordpress.org/Plugin_API#Filters      *        Filter Reference:  http://codex.wordpress.org/Plugin_API/Filter_Reference      *      */     public function on_content_load($content) {         return $content."hello world";         // TODO:    Define your filter method here     } // end filter_method_name          } // end class          // TODO:    Update the instantiation call of your plugin to the name given at      the class definition     $plugin_name = new winkadoka_111();


title: How to display custom post types AND regular posts separately on a shared taxonomy archive?

text: I've looked over numerous questions and answers on problems somewhat related to this but can't seem to find the same situation or solution. I have a custom taxonomy that needs to have an archive page that can display both custom post types and regular posts, but not in the same section. Basically there needs to be a clear difference between the CPT-posts and regular posts. For example, if "movie guides" is the custom taxonomy, "ben affleck" is a movie guide, and "Movies" are custom post types on: website.com/movie- guides/ben-affleck I would like that page to **also** have regular posts that are in the "ben affleck" movie guide taxonomy, but at the bottom of the page, in a different section for regular posts/post thumbnails. So part of the page would have Movies (posts from the CPT "Movies") with Ben Affleck, and after that would be post snippets from posts about Ben Affleck. I've found information to just pull both types of posts on the same page together, but wasn't sure how to separate them in the template which is what I'm really looking for. UPDATE: So far I've taken part of the theme's default category template and created taxonomy-{taxonomy_slugname}.php, which has pulled the CPTs onto the page, but now I can't figure out how to add posts since it's pulling the CPT's via "get post." My theme is Braxton, if that helps.


title: Hide content-box on specific pages (in admin)?

text: Is this possible to do somehow? In some pages i use a custom box plugin and i don't need to show the content box on some of those pages. Is it possible to hide it by page template? Or ID if template is not possible?


title: Checkbox in post not saving value

text: I have a checkbox above my metabox in a custom post. When I check it and publish/update the post, it become unchecked again meaning it's not saving it's value. Here is my code for the checkbox:               add_action('add_meta_boxes', 'my_meta_box');      add_action('save_post', 'save_postdata');        function my_meta_box() {         add_meta_box(             'movie_meta_box',             'Movie Meta Options',             'movie_options_meta_box_func',             'movie'         );     }     function movie_options_meta_box_func( $post ) {       wp_nonce_field( plugin_basename( __FILE__ ), 'movie_noncename' );       $mydata = get_post_meta($post->ID, 'movie', TRUE);       echo '<input type="checkbox" id="movie_abc" name="movie_abc" value="true" />';       echo '<input type="text" id="movie_xyz" name="movie_xyz" value="'.$mydata['movie_xyz'].'" size="60" />';     }     function save_postdata( $post_id ) {       if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )           return;       if ( !wp_verify_nonce( $_POST['movie_noncename'], plugin_basename( __FILE__ ) ) )           return;       if ( !current_user_can( 'edit_post', $post_id ) )           return;       $mydata = array();       foreach($_POST as $key => $data) {         if($key == 'movie_noncename')           continue;         if(preg_match('/^/i', $key))          {           $mydata[$key] = $data;         }       }       update_post_meta($post_id, 'movie', $mydata);       return $mydata;     }      Your help will be highly appreciated.


title: Best Practice For Querying Grandchildren?

text:
**Objective:** Query and loop through a page's third-level "grandchildren" in a way that allows pagination. Here's the code that I'm using (pagination excluded):                       // Get the ID of the first generation             $gen1_ids = $post->ID;                  // Query for second generation IDs             $gen2 = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_parent IN ($gen1_ids) AND $wpdb->posts.post_type = 'page' AND $wpdb->posts.post_status = 'publish' ORDER BY $wpdb->posts.ID ASC" ); // Test ordering by title                  // Implode the results for further use             $gen2_ids = implode( $gen2,', ' );                  // Now, query for third generation IDs using second generation IDs             $gen3 = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_parent IN ($gen2_ids) AND $wpdb->posts.post_type = 'page' AND $wpdb->posts.post_status = 'publish' ORDER BY $wpdb->posts.ID ASC" );                  $args = array(               'post__in' => $gen3,               'post_type' => 'page',               'post_status' => 'publish',               'posts_per_page' => 5,               'paged' => get_query_var('paged')             );                  $results = null;             $results = new WP_Query( $args );                  if( $results->have_posts() ) {                  while ( $results->have_posts() ) : $results->the_post(); ?>
                         <a href="<?php the_permalink(); ?>" class="img">

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

...

             <?php endwhile;             } /* end if */ ?>               <?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>      I've adapted the code from an answer to a support question two years back on the WordPress.org forums. The code is working. Is there a way that this can be done better?


title: Removing \\\ from Saved Data

text:
I am saving some text to a setting field for use in an email template. So the text that is being put into the textarea to save looks like this...
some text [HERE]
      and after saving it looks like this....
some text [HERE]
      So what do I need to do to make it remove the `\\\\\` when I need to work with this data? * * * **UPDATE** I am saving the option/setting with this...               update_option('contact_record_client_template', $post_client_template);      So when I retrieve it with               $client_template = get_option('contact_record_client_template');      I just need to remove the `///`'s If I run `stripslashes()` on it, it removes 2 of the 3 `/`'s so it still leaves 1. I also tried using `str_replace( '///', '', $value );` but it just seems to add more or do nothing


title: Rearranging posts based on categories

text:
Hey everyone on Stackexchange! I'm trying to find a way to prioritize posts based on a category in a loop, which is sorted by dates. All posts are grouped under their respective dates. The date labels appear once on top of posts of the same date like this: Date   * Post1   * Post2   * Post3 Date before that   * Post 4   * Post 5 etc I'm trying to achieve a result, where if a post belongs to a certain predetermined category (I would only be using 1 category), it would be moved above others under a date as such: Date   * Post3 (special category)    * Post1    * Post2 Date before that   * etc I've done research for a while on this topic and I can't figure out whether this would even be possible or not. Some query functions seem to serve a similar purpose, but I'm not certain and the date sorting makes it harder to figure out. Would I need multiple loops or something of that nature? My loop: http://pastebin.com/Pp0rA5j7 The loop and the sorting mechanism look like this in general (pastebin for a full code):               <?php $w_h = $w_d = $last = 0; ?>          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>              <?php         if ( date('Yz') == get_the_time('Yz') ) {             if (!$w_d++) echo '
Today
';         } elseif ( date('Yz')-1 == get_the_time('Yz') ) {             if (!$w_h++) echo '
Yesterday
';         } else {             echo the_date('', '
', '
');         }; ?>          // post content              <?php endwhile; ?>         <?php endif; ?>                          <?php else : ?>      Sample site: http://goldenred.web44.net (I would like to move the post test 6 with the category "test" above others under February 3, 2013) I would be extremely thankful if anyone more experienced could help or at least point me towards a general direction. All comments are welcome.


title: Custom single-product page for product from category x

text: Is it possible to show a different single-product.php page for a product in a specific category?


title: Post Auto Draft Issue

text: I've made custom post type without title and editor and I use custom taxonomies, custom fields and attachments to form a post. My title is generated from custom taxonomies and custom fields (or "ID #" if nothing else is set). Here's title code (could use some polishing probably):               function custom_post_type_title ( $post_id ) {         global $wpdb;         if ( get_post_type( $post_id ) == 'cars' ) {             $autos = wp_get_object_terms($post_id, 'brand');                 $brand= '';                 $model= '';                     foreach ( $autos as $auto ) {                         if ( $auto->parent == 0) {                             $brand = ' '.$auto->name;                         } else {                             $model .= ' '.$auto->name;                         }                     }             $engine = get_post_meta($post_id, 'Engine', true);             if ($engine != '') { $engine = ', '.$engine.'l'; }             $title = $brand.$model.$engine;             if ($title == '') { $title = 'ID '.$post_id; }             $slug = sanitize_title('id-'.$post_id.$brand.$model.$engine);             $where = array( 'ID' => $post_id );             $wpdb->update( $wpdb->posts, array( 'post_title' => $title, 'post_name' => $slug), $where );         }     }          add_action('init', 'cars_save_post');     function cars_save_post($post_id) {             if ( ! defined( 'DOING_AUTOSAVE' ) && ! DOING_AUTOSAVE ) return;             add_action('save_post', 'custom_post_type_title', 100);             add_action('publish_post', 'custom_post_type_title', 100);     }      Problem is, if I attach an image and navigate away from the post, post will be saved, but won't apear as draft in my post list. The only way (that I know of) I can reach it - thru media's "attached to" link. Not sure if it's a bug or what, but I would like to see those posts in my Manage Posts list. Any solutions? **EDIT:** Maybe I wasn't clear enough. Just try this scenario:   * Add New Post (regular post will do);   * Upload an Image to it;   * Keep everything else empty;   * Do not save the post;   * Leave the page; Now if you'll check your Posts page, you won't find an "Auto Draft" in it. But if you'll check your Media page, image you uploaded just now, will be attached to "Auto Draft", which you can access from there. Even if you delete that image, that post will stay. I just want to keep my server clean, so if Author made a mistake and forgot to save his post, he should have an easy access to that post via Posts Page. So my question was, is this a bug and how can I fix it (display "Auto Drafts" in authors Posts page)?


title: Repository reporting incorrect plugin 'active version' stat

text: I released a new plugin to the .org repository about a month ago, and have committed several new versions since then, but the pie chart on the stats page has always stayed at 100% for an arbitrary version. For example, a week or so after 1.1 was released, it said that 100% of users had 1.0 installed, and recently it's been saying that 1.1.2 has 100%. I released 1.1.3 yesterday and it's gotten about 75 downloads so far, but the chart still says 1.1.2 has 100%. I realize there's probably some caching going on, but there's obviously a problem. It has around 1000 total downloads spread out over 5 releases, and we know that users don't update very frequently, so the chart should show the numbers spread out more. I'm guessing the next time it updates it'll say that 1.1.3 has 100%, like it's done for previous versions. Am I doing something wrong in my readme.txt or main PHP files? I've always had `Version: [current version number]` in the main PHP file and `Stable tag: [current version number]` in the readme.txt, and the readme.txt passes the validator.. You can browse through the different versions at http://plugins.svn.wordpress.org/basic-google-maps-placemarks/tags/. * * * **Update:** The File Header page in the codex has a specification, which can be helpful in debugging issues. * * * **Update 2:** Now it's stopped working again. ~~It might just take a couple releases with the fixed headers to work, though.~~. I finally fixed it; see my answer below.


title: Wordpress Theme Modification Help

text: I'm currently working with the 2010 theme and want to modify the nav bar so that when you click on a page that is listed on the navbar, it takes you to one of my categories pages (example, clicking on 'swag', will take you to the swag category page). How would I go about doing this? I've included my website: http://www.bro-campus.com Here is the code that deals w/ the navbar:               <?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu.  The menu assiged to the primary position is the one used.  If none is assigned, the menu with the lowest ID is used.  */ ?>                 <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>             </div><!-- #access -->      Thanks for the help.


title: Multi-site vs seperate installs for just 3 blogs?

text: I'm new to Wordpress and in a few months will be attempting to set up three blogs. They most likely will be hosted on a Windows Server with IIS. (because the server is already there, and nobody else would know how to maintain Apache) The blogs will be unrelated and not share any common users. My question is, are there any benefits in this case to doing a multi-site setup, or would it be much simpler to have three separate Wordpress installs? If we'd go with separate installs now, would it be a hassle to combine them into one multi-site install in the future? I've read that multi-site on IIS doesn't work very well.


title: Create an Array of Specific Custom Post Meta

text: I'm having an issue thinking today and ran into a brick wall. What I'm trying to do it take 3 different custom field data for posts and combine them into an array that I can then json encode for use in some jquery. The three fields I want to use are the 'project title' and a custom field of 'latitude' and 'longitude'. And this is what I'm looking to get: Array ([0] => array ([0] => "project title", [1] => "latitude", [2] => "longitude"),[1] => array ([0] => "post title", [1] => "latitude", [2] => "longitude") I'm thinking i need a foreach loop, but just can't get it to work in my head. Any help would be greatly appreciated!


title: set_post_thumbnail_size in percent, not pixels?

text: I've created a new custom post type and I need the post thumbnails or featured images generated by the `get_the_post_thumbnail()` function to be set in percent, rather than pixels, as I'm using a fluid grid. Ideally I would only set the width (to 100%). Is there a way to do this? Potentially using `add_image_size()`?


title: Output data like WP's plugin installer/updater

text: I want to update my plugin and have proper feedback, like the WordPress update/upgrade mechanism. How is this effect done? Essentially I have a script I want to run that has lots of processing, and with each run through the loop, output another line to the screen. Is this done with the output buffer?


title: register_nav_menus() won't register menus

text: Please help with menu registeration: I have followed this guide (http://codex.wordpress.org/Navigation_Menus) step by step. Added the following code to functions.php:               function register_my_menus() {       register_nav_menus(         array('header-menu' => __( 'Header Menu' ) )       );     }          add_action( 'init', 'register_my_menus' );      But the guide says that this will make the menu appear in the Appearance -> Menus admin screen in the "Theme Locations" box as "Header Menu". When I go to Appearance -> Menus everything is greyed out and there is no option of "Theme Locations"


title: Proper syntax or method for keeping url in modified isotope / category links

text:
I'm setting up a project gallery using isotope jquery plugin for layout and filterability. I've seen examples of how to add a list of category links and modify them to filter on click, but... I want to keep the url in the href attr, so that searchbots (or the theoretical non-js user) can click thru to project category pages. My code works until I set up the $link variable and try to insert it into the html. Yeah.... my php is weak. How do I add the link to the href attr?               /**      * Set up list of category links for gallery filter      */     function galleryFilterLinks() {         $categories = get_categories('exclude=1');         $link = the_permalink();         $html = '
';         $html .= '
All
';         foreach ($categories as $category) {             $html .= "
category_nicename}'>{$category->cat_name}
";            }         $html .= '
';         echo $html;     }


title: get_search_form() doesn't appear to take parameter into account

text:
I am creating a menu manually and trying to include the search form. this is taken from the Wordpress Docs "Building a simple menu list" at http://codex.wordpress.org/Function_Reference/wp_get_nav_menu_items. I have added an additional
 element before completing the menu and added the search form.                           // Get the nav menu based on $menu_name (same as 'theme_location' or 'menu' arg to wp_nav_menu)                 // This code based on wp_nav_menu's code to get Menu ID from menu slug                      $menu_name = 'main-menu';                      if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {                          $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );                          $menu_items = wp_get_nav_menu_items($menu->term_id);                          $menu_list = '
';                          foreach ( (array) $menu_items as $key => $menu_item ) {                         $title = $menu_item->title;                         $url = $menu_item->url;                         $menu_list .= '
' . $title . '
';                     }                     $menu_list .= '
' . get_search_form(false) . '
';                     $menu_list .= '
';                 } else {                     $menu_list = '

No Menu

';                 }                 echo $menu_list;      The problem is in the output.
               <form role="search" method="get" id="searchform" action="/">       <input type="text" value="" name="s" id="s" size="40" placeholder="Search" alt="Site Search">       <input type="submit" id="searchsubmit" value="Search">     </form>

Home

Sample Page

 Could someone tell me why the search is printing before the menu even though I specify echo = false?


title: add custom field in user register form

text: In my WordPress based site, I want to add a custom field (e.g. type of user - employee, investor) in the user registration form in the **admin side** , **without editing the core file**. Can anyone please suggest how can I do it, may be a plug-in or some script? I have already tried Cimi, Register Plus, CYC plug-ins but they all give facility to add custom field from front side registration form OR in the user edit form after the user is registered for first time from admin side. Is there any way we can do it in the user register form from admin side?


title: How to Filter Buddypress member by some of their profile fields

text: I am developing job site using Buddypress where people can search people, send friend request to them and become a friend. I am using user profile fields like name, email, phone, work location, Experience, Industry, Expected annual salary, Preferred Work days, etc. But my question is that, in members directory I want to let user can filters member(profile) by some of their profile fields like work location, Experiance,Indusstry, Expected annual salary, Preferred Work days ?


title: Add custom Facebook share link with share count and variable text

text: I'm trying to do this in a news site homepage. ![news site homepage](http://i.stack.imgur.com/eInPA.png) The part I'm struggling with is the Facebook share link text. It should:   * count the share/link of the specific post   * hide the number is it's 0   * write "share!" if it has 0 share   * write "shared 1 time" if it has 1 share   * write "n shares" if it has more than 1 shares. The text is arbitrary, I would like to be able to control it. I found this code to get the likes count:               function get_likes($url) {      $json_string = file_get_contents('http://graph.facebook.com/?ids=' . $url);      $json = json_decode($json_string, true);      return intval( $json[$url]['shares'] );     }       And I managed to use it to get the actual share count:               <a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>">      <?php $url = get_permalink( $post_id ); echo get_likes("$url"); ?> shares      Now the difficult part would be how to control the text the same way it's controlled in "comments_number":               comments_number( 'no responses', 'one response', '% responses' );      Any hint?


title: Remove width and height attributes from [gallery] output

text: WordPress automatically adds the width and height attributes to [gallery] shortcode images. How to delete these attributes? Something like this but for [gallery] output.


title: Get posts from multiple tax terms

text:
I'm trying to get related posts by taxonomy term. So a post tagged to 'London' would have related posts tagged to London. The code I have works if the post is tagged to a single taxonomy term only - in this case a single Location (entry_location is the taxonomy). But if I tag it to more than one (eg London and Paris), it returns no results. How do I make it accept multiple tax terms and display results from both? This is what I have so far. It works for posts tagged with one tax term only.               <?php     $this_post = $post->ID;     $query = new WP_Query(array(         'post_type' => 'dir_entry',          'posts_per_page' => 10,          'orderby' => 'date',          'order' => 'DESC',          'post__not_in' => array($this_post),          'entry_location' => get_the_term_list( $post->ID, 'entry_location' ))     );     while ($query->have_posts()) : $query->the_post();     ?>
         <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>
          <?php endwhile; wp_reset_query(); ?>      Thanks for any advice.


title: Looking For a Plugin to Limit User to Editing only one post or page and only on certain dates

text: I am creating a site for a sports tournament. There will be many teams involved. Each team needs to be able to amend a post updating their player roster, but they will not be allowed to do this 2 weeks before the game. Each team will be able to login to the site but should only have access to their team page. Is their a plugin or setting which would allow me to restrict a user to modifying only one page or post, and would restict them from editing on certain dates?


title: append stylesheet via shortcode

text: Wondering how I can add a stylesheet to wp_head section via shortcode, since shortcodes are parsed after wp_head, I've hearing about output buffering but I Am not sure. Any idea?


title: Featured image with the same height thumbs returns wrong thumb

text: I have 2 sizes thumbs for featured images with the same height:   * 300 x 200   * 540 x 200 I've checked the uploads folder and both thumbs with different sizes appear correctly:   * file_name-300x200.jpg   * file_name-540x200.jpg I'm trying to get the bigger thumb size (540x200) as following:               $width = 540;     $height = 200;     echo get_the_post_thumbnail( $post->ID, array($width,$height) );      However, the image markup that is returned is for the smaller thumb zise (300x200). Interestingly, the class is displayed with the correct domantions as 'attachment-540x200':               <img width="300" height="200" src="http://mysite.com/wp-content/uploads/file_name-300x200.jpg" class="attachment-540x200 wp-post-image" alt="file_name" title="file_name" />      Would really appreciate if anyone could explain what's happening and why the correct size thumb isn't returned. Many thanks, Dasha