force category table refresh when adding new category

i wonder if there's a relatively easy solution to this : i have added a custom field to the categories, which in turn gets displayed in the right hand table under its own column name. (essentailly it's a "this category is the default" field. all works fine, when editing a category. however, when adding a category with this field(checkbox) selected , all other categories update to "we are not the default anymore". the db also stores these new values as required. however, as adding a new category is invoked via ajax, the category table on the right hand side does not refresh to reflect these new settings. (only when actually refreshing the whole page , can i actually see the current values) question is therefore, is there a hook i can plug in to that automatically forces a page refresh after a new category has been added (or better still, just to refresh the table on the right ), or do i actually run a seperate ajax call to get the updated values and update that table ?


How to Create Template File for Parent Page of Custom Post Type

After creating a custom post type I made a custom template file for the post (`single-customposttypename.php`). So the URL structure would be: `example.com/page/postname`, and `postname` would be the post that renders `single-custompostype.php` (this works fine). But what I'm trying to get is `example.com/PAGE` to loop all the posts generated from that custom post type on one page...which it does, but it's unstyled. I tried creating a custom template called `page- customposttypename.php` but that didn't seem to work. Seems like this should be really simple but I can't seem to figure it out. Can anyone point me in the right direction?


Change html structure of all img tags in Wordpress

I have a Wordpress blog and am trying to implement the foresight.js image script. In short, I need to target all post images, swap out the `src, width, & height` attributes with `data-src, data-width, & data-height` attributes. I then need to duplicate the image line and wrap it in `<noscript>` tags. This is the structure I'm trying to have Wordpress generate/create:                                        I have searched the Wordpress codex and the best possible route I can find are to use filters (ie. _'get_image_tag'_ & _'image_tag'_ ) for modifying the html that Wordpress outputs for each image. I'm thinking that one of these options should work, or that I can do some pattern matching with regex _(I know, not ideal)_ , throw in a `preg_replace` and then inject this back into `the_content` filter. I have tried some of these options but cannot get any to work. Could someone please offer some help? Found one suggestion here, but can't even get it to work! ### 'get_image_tag' attempt: _Found this particular one on the web, but it would need modified to fit my logic (see above structure)...can't make sense of what the`preg_replace` array is doing on my own._               <?php function image_tag($html, $id, $alt, $title) {         return preg_replace(array(             '/'.str_replace('//','\/\/',get_bloginfo('url')).'/i',             '/\s+width="\d+"/i',             '/\s+height="\d+"/i',             '/alt=""/i'         ),         array(             '',             '',             '',             alt='"' . $title . '"'         ),         $html);     }     add_filter('get_image_tag', 'image_tag', 0, 4);     ?>      ### Another 'get_image_tag' attempt:               <?php function get_image_tag($id, $alt, $title, $align, $size='full') {         list($width, $height, $type, $attr) = getimagesize($img_src);         $hwstring = image_hwstring($width, $height);              $class = 'align' . esc_attr($align) . ' size-' . esc_attr($size) . ' wp-image-' . $id;         $class = apply_filters('get_image_tag_class', $class, $id, $align, $size);              $html = '';         $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size);              return $html;     }     ?>      ### Pattern-matching attempt: Tried creating my own regex on this one, but not sure if it's correct.               <?php function restructure_imgs($content) {         global $post;         $pattern = "//i";              list($width, $height, $type, $attr) = getimagesize($2$3.$4$5);         $hwstring = image_hwstring($width, $height);              $replacement = 'post_title.'" data-width="'.$width.'" data-height="'.$height.'" class="fs-img"$6>';         $content = preg_replace($pattern, $replacement, $content);         return $content;     }     add_filter('the_content', 'restructure_imgs');     ?>      Unfortunately can't get any of these examples to work. Any help or sharing your pre-written scripts/functions would be much appreciated! Thanks for helping a student learn!!


How can I access a post's feature image outside the loop?

I want to update my `<meta property="og:image" content="http://amemoirproject.com/facebook/og-image.png"/>` tag in the head with the current post's feature image. How can I do that?


Ethics question: what qualifies as a fork?

I recently came across the need for a WP plugin which did not exist and so I started working on a plugin of my own. In my search, I found non-published (in terms of availability on WP.org) code about 100 lines long on someone else's github which was mostly copied and pasted from an online tutorial by another person and WP codex examples. I have since expanded the code to about 1000 lines, rewrote and rebranded most of the functions, and I am looking to publish it on WP.org soon. When I originally found this code, I just forked it on github and credited the middle man in my description. I was confused why github was not recognizing my commits as "activity" until I found this page which explains that github does not count commits in forks until it gets pulled back up the main branch. This got me thinking about whether or not the code I have been working on should be considered a "fork" or not. Since I mainly used it as a function reference, I have been leaning towards thinking of it as not a fork. (I am still crediting the middle man in the description though.) I could really use some input on this situation since this is the first time that I have started with someone else's code and am looking to publish it as open-source. Thoughts? Maybe on where the line between "fork" and "original code" is?


Insert a field with PREG_REPLACE – strange behaviour

I'm trying to insert a custom field (from the Advanced Custom Fields plugin), and I need to place it within a div which I'm wrapping around an img, right before the img-tag. So basically this is the result I want (I use `the_field('description')` here to make it cleaner):

                 [ the content from the_field() ]

      But this is what happens:
         [ the content from the_field() ]

      I.e. content from the field gets inserted at the top instead of in the div I place it. Isn't it rather strange? Here's my code:               function wrapImagesInDiv($content) {         if ( in_category( 'projects' ) ) {             $pattern = '/(]*class=\"([^>]*?)\"[^>]*>)/i';             $replacement = '

                     '.the_field('description').'                     $1

';             $content = preg_replace($pattern, $replacement, $content);         }         return $content;     }     add_filter('the_content', 'wrapImagesInDiv');


Is it possible to put the add-filter()-hook into a function?

for my plugin with a lot of different features, I want to realize a mail- function to send HTML-mails. For this I have to add a filter-Hook like this:               function set_content_type($content_type){         return 'text/html';     }      and two filter-hooks:               add_filter('wp_mail_content_type','set_content_type');     remove_filter( 'wp_mail_content_type', 'set_html_content_type' );      Can I put this two hooks inside my mail function?


Date time doesn't show correctly in qTranslate

I've used qTranslate to enable multiple languages on site. It works fine except for date-time for english language. Here are screenshots: Serbian: ![serbian](http://i.stack.imgur.com/AVmeB.jpg) English: ![english](http://i.stack.imgur.com/KLZRL.jpg) Languages settings looks like: ![serbian edit](http://i.stack.imgur.com/ynHQK.jpg) ![english edit](http://i.stack.imgur.com/BaDa7.jpg) How to fix this?


Bypass nonce value while trashing a post

I want to move a post in trash but the condition is that simultaneously I need to delete some more posts. Sample Code:               jQuery(function($) {         $('#delete-action a').unbind();         $('#delete-action a').click(function(event) {             event.preventDefault();         openbox('Trash Child Posts', 1);             setTimeout(                 function() {                     $('#save-action .spinner').hide();                     $('#publish').removeClass('button-primary-disabled');                 },                 1             );         });     });      It pop ups a new popup to delete the child post.                   var trash_blog = $('div#trash-button');     $("#trash-button").click( function()            {              TrashBlogs.each(function(){             var allVals = [];             $('div#box :checked').each(function() {               allVals.push($(this).val());             });                  window.location.replace("post.php?post="+post_id                 +"&action=trash&_wpnonce=20a76fd1e5&blog_id="+allVals);         });            }         );`      Now the problem: How to bypass the nonce value when `window.location` executes?   After redirection it says 'Are you Sure to do this, Please try again' because nonce value doesn't match.


custom upload directory only for plugin uploads

i'm trying to add an upload_dir filter only for plugin-uploads. does anybody know why the code below doesn't work, and what could work instead? thanks in advance!               $upload_dir = 'publications';     $plugin_dir = WP_CONTENT_DIR ;     $plugin_url = WP_CONTENT_URL ;          add_filter('upload_dir', 'custom_upload_dir');          function custom_upload_dir($path_data){     global $upload_dir;     global $plugin_dir;     global $plugin_url;          if ( $_GET['page'] == 'teachpress/addpublications.php'){         $path_data['path'] = $plugin_dir . "/" . $upload_dir;         $path_data['url'] = $plugin_url . "/" . $upload_dir;         $path_data['subdir'] = "/" . $upload_dir;         $path_data['basedir'] = $plugin_dir;         $path_data['baseurl'] = $plugin_url;         }     return $path_data;     }


Add 20yrs to post date, and then query

I would like to know if anyone knows a way of adding a timeframe (say 20 years) to the datestamp on a set of posts, and then running a query on the loop which uses the new date? Basically what I want to do is have a series of normal news posts. In addition to that, I have a custom post type for '20 years ago today', with the posts in that date stamped appropriately in the early 90s. I'd like for those posts to appear in the same loop as the news posts (rather than in a separate loop). So it might go:   * News Post (21 March 2012)   * News Post (19 March 2012)   * 20 years ago (17 March 1992)   * News Post (12 March 2012)   * 20 years ago (6 March 1992) and so on. And anything that happened less than 20 years ago (say, in 1993), would behave like a pending post, and not show up. Any suggestions would be appreciated


Mail not sent when I set HTML headers

$subject = get_the_title();      $sender_name = get_bloginfo('name');     $blog_url = get_bloginfo('url');          $to      = 'myemail@mydomainname.com';     $subject = 'the subject';     $message = 'hello';     $headers = 'MIME-Version: 1.0' . "\r\n";     $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";     $headers .= 'From: '.$sender_name.' <no-reply@'.$blog_url.'>' . "\r\n";          $headersssssssssssss = 'From: webmaster@example.com' . "\r\n" .         'Reply-To: webmaster@example.com' . "\r\n" .         'Content-type: text/html; charset=iso-8859-1' . "\r\n" .         'X-Mailer: PHP/' . phpversion();      When I use the `$headersssssssssssss` variable as a parameter in the `mail()` function, it works and sends an E-Mail.   But when I use `$headers` as a parameter, it does not. Note: I have already tried using `wp_mail` instead, with the same results.               if( mail($to, $subject, $message, $headersssssssssssss) )     {         echo '<script>alert("mail sent success!");</script>';     } else {         echo '<script>alert("mail where not sent");</script>';     }           exit;


using update_user_meta to rank users

I'm using a plugin that allows users to vote on posts, I'd like to add each vote that's cast to the authors user_meta so I can rank users the same way I rank posts. There's a couple of different functions in the plugin that update and save the post_meta.               add_action( 'wp_ajax_nopriv_epicred_vote', 'epicred_vote' );     add_action( 'wp_ajax_epicred_vote', 'epicred_vote' );         function epicred_vote(){             global $wpdb, $current_user;                  get_currentuserinfo();                  $wpdb->myo_ip   = $wpdb->prefix . 'epicred';                  $option = (int)$_POST['option'];             $current = (int)$_POST['current'];                  //if we are locked via IP set the fid variable to be the IP address, otherwise log the member ID             if(get_option('epicred_ip') == 'yes'){                 $ipAddr = isset($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']) ? $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] : $_SERVER['REMOTE_ADDR'];                 $fid = "'" . $ipAddr . "'";              }else{                 $fid = $current_user->ID;             }                       $postid = (int)$_POST['poll'];                    $query = "SELECT epicred_option FROM $wpdb->myo_ip WHERE epicred_ip = $fid AND epicred_id = $postid";                  $al = $wpdb->get_var($query);                       if($al == NULL){                 $query = "INSERT INTO $wpdb->myo_ip ( epicred_id , epicred_ip, epicred_option) VALUES ( $postid, $fid, $option)";                 $wpdb->query($query);             }else{                 $query = "UPDATE $wpdb->myo_ip SET epicred_option = $option WHERE epicred_ip = $fid AND epicred_id = $postid";                 $wpdb->query($query);             }                  $vote = get_post_meta($postid,'epicredvote',true);                      if($option == 1){                     if($al != 1){                         if($al == -1){                         $vote = $vote+2;                             }else{                         $vote = $vote+1;                         }                     }                 }                           if($option == -1){                          if($al != -1){                         if($al == 1){                             $vote = $vote-2;                         }else{                         $vote = $vote-1;                         }                        }                    }                 update_post_meta($postid,'epicredvote',$vote);                           $response['poll'] = $postid;                 $response['vote'] = $vote;                  echo json_encode($response);                  // IMPORTANT: don't forget to "exit"             exit;         }      And               function wpt_save_wpeddit() {               global $wp, $wpdb, $post;                     // unhook this function so it doesn't loop infinitely         remove_action('save_post', 'wpt_save_wpeddit');                   // Is the user allowed to edit the post or page?         if ( !current_user_can( 'edit_post', $post->ID ))         return $post->ID;         // OK, we're authenticated: we need to find and save the data. Make sure we don't add an image every time the post is         // saved as a draft - so keep track of the external URL in a custom field.                       $vote = get_post_meta($post->ID,'epicredvote',true);             $rank = get_post_meta($post->ID,'epicredrank',true);                  if($vote == ""){                 $vote = 0;             }             if($rank == ""){                 $rank = 0;             }                  update_post_meta($post->ID, 'epicredvote', $vote );             update_post_meta($post->ID,'epicredrank',$rank);                   add_action('save_post', 'wpt_save_wpeddit');          }      Then my goal would be to use something like this in order to rank the users:- EDIT:- loop I'm using to output users/scores.                <?php                                       $args = array(                                 'meta_key' => 'epicredvote',                                 'orderby'  => 'meta_value',                                 'order'    => 'DESC',                                 'number' => 10,                                  );                                  add_action( 'pre_user_query', 'wpse_149342_pre_user_query' );                                  $user_query = new WP_User_Query(  $args );                                  // User Loop                             if ( ! empty( $user_query->results ) ) {                                 foreach ( $user_query->results as $user ) {                                     echo '
' . $user->display_name . '
';                                    echo '' . $user->epicredvote . '';                                  }                             } else {                                 echo 'No users found.';                             }                         ?>      So one vote on a post = one vote for that user essentially. Possible, or am I completely off track here?


How to save media-form on custom tab

On my custom tab, I copied media-form from media_upload_gallery_form, only changed form id and action-url to reflect my tab's name. The form displayed as expected, but after click "Save All Changes", the post data is not saved. Please note unlike custom fields that we add filter to "attachment_field_save", this time it is the entire media-form. It can be saved on either Gallery tab or Library tab, so I guess there has to be a way to be saved on my custom tab?


WordPress in Drupal

I got a Drupal site, and I must install WordPress in it. If I install WordPress to "www.mysdrupalsite/wordpress/", will it work as a standard WordPress installation ? THANKS !


Your ideas on my though "delete or move all of the posts in a specific category when 3 days are passed"

I need to clean up my database and I think that a way to do and keep it that way is by deleting all posts that have 3 days of life. One good thing is that those posts I want to delete are in a specific category. So, how can I clean up my database correctly by deleting or moving thoem and also their posts_meta or terms or anything ? I want to just have/show the posts that are 3 days or earlier.


Custom Meta Boxes: Store two values in one repeatable field

I am trying to create a custom meta box where the user can add fields as needed. I followed this tutorial: http://wp.tutsplus.com/tutorials/reusable- custom-meta-boxes-part-1-intro-and-basic-fields/ I would like to expand on this tutorial and create a repeatable field that allows two inputs. For Example: Name and URL. How could I achieve this? I found this other question here: Create more Meta Boxes as needed I was able to integrate the meta box example into my custom post type but I couldn't figure out how to output the meta values into my theme. Here the code I am working with:                   /*---------------------------*/         /* Define Metabox Fields         /*---------------------------*/              $prefix = 'tz_';              $custom_downloads = array(              'id' => 'custom-downloads',              'title' => __('Custom Downloads Downloads (Beta)'),              'page' => 'categories-supported',              'context' => 'normal',              'priority' => 'high',              'fields' => array(                  array(                 'name' => __('Add Product Downloads', 'framework'),                 'desc' => __('This meta box is under development', 'framework'),                 'id' => $prefix . 'custom-downloads',                 'type' => 'text',                 'std' => ''             ),                                   )         );              /*-------------------------------------*/         /* Add Meta Box to CPT screen          /*-------------------------------------*/              function tz_add_box() {             global $custom_downloads;                  add_meta_box($custom_downloads['id'], $custom_downloads['title'], 'tz_show_box_custom_dwnld', $custom_downloads['page'], $custom_downloads['context'], $custom_downloads['priority']);                   }           }           add_action('admin_menu', 'tz_add_box');              /*------------------------------------------*/         /* Callback function/show fields in meta box         This is taken directly from: http://wordpress.stackexchange.com/questions/19838/create-more-meta-boxes-as-needed         /*------------------------------------------*/                   function tz_show_box_custom_dwnld() {             global $custom_downloads, $post;             // Use nonce for verification             echo '<input type="hidden" name="tz_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';                       ?>
             <?php                  //get the saved meta as an arry             $songs = get_post_meta($post->ID,'songs',true);                  $c = 0;             if ( count( $songs ) > 0 ) {                 foreach( $songs as $track ) {                     if ( isset( $track['title'] ) || isset( $track['track'] ) ) {                         printf( '
Song Title <input type="text" name="songs[%1$s][title]" value="%2$s" /> -- Track number : <input type="text" name="songs[%1$s][track]" value="%3$s" />%4$s
', $c, $track['title'], $track['track'], __( 'Remove Track' ) );                         $c = $c +1;                     }                 }             }                  ?>                          <?php _e('Add Tracks'); ?>
             <?php              }          /*-------------------------------------*/     /* Save data when post is edited     /*-------------------------------------*/               function tz_save_data($post_id) {         global $meta_box, $meta_box_video, $meta_box_video_page, $meta_box_product_tabs, $meta_deployments, $meta_features, $meta_downloads;         // verify nonce         if (!wp_verify_nonce($_POST['tz_meta_box_nonce'], basename(__FILE__))) {             return $post_id;         }         // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $post_id;         }         // check permissions         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id)) {                 return $post_id;             }         } elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;         }                $songs = $_POST['songs'];         update_post_meta($post_id,'songs',$songs);               }          add_action('save_post', 'tz_save_data');      Using The above code I am able to generate the dynamic meta box on my CPT edit screen and am able to save data in the fields successfully. I'm a little embarrassed to admit it, but I don't know how to display the info from these fields in my theme. I have been able to successfully display other custom meta information stored in other fields by using               <?php $post_meta_data = get_post_custom($post->ID); ?>     <?php $custom_features = unserialize($post_meta_data['tz_features-repeat'][0]); ?>          <?php echo '
';         foreach ($custom_deployments as $string) {             echo '
'.$string.'
';         }         echo '
';     ?>      Any help would be greatly appreciated!


Saving frontend form data in wordpress

I have front-end user form like,   * Title   * Image Upload   * Drop Down Category   * Description   * Tag Now when a user fills the form and hits the publish button from the front- end..... at the back-end a post is created with title and all the details, im able to create a post with post title and the description, but im unable to save the category, tag. and how to add category and tags to the columns ![enter image description here](http://i.stack.imgur.com/GTi7f.jpg) For image upload i searched for solutions but nothing helped, the code is               <form id="new_post"<?php do_action('post_edit_form_tag'); ?> name="new_post" method="post" action="">
Title
                         <input type="text" id="title" value="" tabindex="1" size="20" name="title" />

Parent:
                         <?php                              wp_dropdown_categories('type=product&show_count=0&selected=-1&hierarchical=1&depth=1&hide_empty=0&exclude=0&show_option_none=Select Gender&name=main_prod&taxonomy=product_cat');                         ?>

Image Upload
                         <input type="file" name="file" id="file" />

Content
                         <textarea id="description" tabindex="3" name="description" cols="50" rows="6"></textarea>

Tags:
                         <input type="text" value="" tabindex="5" size="16" name="post_tags" id="post_tags" />

<input type="submit" value="Publish" tabindex="6" id="submit" name="submit" />
                              <input type="hidden" name="action" value="new_post" />                         <?php wp_nonce_field( 'new-post' ); ?>                         </form>
                          <?php                         if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {                                  // Do some minor form validation to make sure there is content                             if (isset ($_POST['title'])) {                                 $title =  $_POST['title'];                             } else {                                 echo 'Please enter a  title';                             }                             if (isset ($_POST['description'])) {                                 $description = $_POST['description'];                             } else {                                 echo 'Please enter the content';                             }                             $tags = $_POST['post_tags'];                                  // Add the content of the form to $post as an array                             $new_post = array(                              'post_title'    => $title,                              'post_content'  => $description,                                   'post_category' => array($_POST['cat']),  // Usable for custom taxonomies too                              'tags_input'    => array($tags),                              'post_status'   => 'publish',           // Choose: publish, preview, future, draft, etc.                              'post_type' => 'product'  //'post',page' or use a custom post type if you want to                             );                              //save the new post                             $pid = wp_insert_post($new_post);                             //insert taxonomies                         }      in functions.php /////////////////////////// file upload function ///////////////////////               add_action( 'post_edit_form_tag' , 'post_edit_form_tag' );          function post_edit_form_tag( ) {         echo ' enctype="multipart/form-data"';     }      i dont want to use any plugins, any ideas plz


Extract featured image from link mentioned in blog post

You ever notice Google News has relevant images associated with its headlines? How can I use WordPress to extract a featured image from an external webpage referenced in a blog post (or custom field)? I'm open to any suggestions. I've seen this kind of functionality on a lot of web sites. There must be a way to do this with WP.


How to know what functions are hooked to an action/filter?

Is there a way to know what functions are hooked to a particular hook? For example if I'd like to know what functions are hooked to the `wp_head` hook.


Database question while Migrating from one domain to another on same WebHost [Bluehost]

I am about to migrate WordPress Installation from One Domain to another which are under the same host and have common cpanel. Besides the first step of backing up and moving the WP filesystem, can we just use the same database without exporting/importing it via PHPmyAdmin ?


Sorting Posts Via Custom Taxonomy Values Using Checkboxes?

I am working on a project that has a dropdown of custom taxonomy values called "Disciplines", there are only 4 of them in the dropdown. The way it has been designed is that you can select more than one discipline to filter by. The idea is you check the checkbox and it will filter the posts via the value specified in the checkbox value. My question is: what is the best way to go about this? It doesn't have to be AJAX, in-fact I would be happy for the user to check their desired values and if they don't check anything within the space of 2 seconds or so, then the page reloaded and the values they want to sort by only showed the posts matching that criteria. The problem I am facing here is where do I store these values, and how do I reload the page so it knows about these values? I'm assuming that the solution will most likely use query_var's, but not sure if there are other ways like using custom rewrite rules and rewrite tags. **This is the current code I am using to display the dropdown:**

                     <?php                     $disciplines = get_terms('discipline', array('hide_empty' => 0));                     ?>                     All Disciplines                     <?php if ($disciplines): ?>
                         <?php foreach($disciplines AS $discipline): ?>
<input type="checkbox" name="discipline[]" value="<?php echo $discipline->slug; ?>"><?php echo $discipline->name; ?>
                         <?php endforeach; ?>
                     <?php endif; ?>
      **The generated HTML output looks like this:**

                                                     All Disciplines

<input type="checkbox" name="discipline[]" value="better-living">Better Living

<input type="checkbox" name="discipline[]" value="communication">Communication

<input type="checkbox" name="discipline[]" value="design-thinking">Design Thinking

<input type="checkbox" name="discipline[]" value="fashion">Fashion

<input type="checkbox" name="discipline[]" value="public-places">Public Places


WordPress hosting - Shared/dedicated server? Any recommendations?

I'm testing out a shared hosting package with Dreamhost at the moment which is only $2.95 a month for unlimited domains, storage space, bandwidth, mysql databases etc. But I'm currently only running one test site on it and it seems pretty slow. Am I going to run into problems if I host lots of sites on a shared hosting package. Should I be looking at a dedicated server instead? iPage seem to offer a similar package but with lots of extras for $3.50 per month. Have you had any experience with either company? Any advice greatly appreciated. Thanks


where is the documentation for add_action() parameters?

I am reading the source of a plugin (gallery to slideshow plugin) to make it behave like i want and it is using an action               add_action( 'the_posts', array( &$this, 'have_gallery' ), 10, 1 );      I want to know what those extra parameters (10,1) mean but i cant find the documentation of this action. Please help


Is it possible to convert wordpress language files .mo to .po (and vice versa) in windows?

I know how to convert these files in linux, but I am using Windows 7. Is it possible to use some kind of software and convert these files?


Is it possible to get rid of admin new updates notifications?

I am doing projects for clients and sometimes an update messes a lot. So, can we leave error messages and get rid of new updates notifications in wordpress admin side? Thanks!


What is the best caching option for WordPress multi-site on non-shared hosting?

What caching plugin configuration do you recommend and why under the following assumptions:   * full control of the server configuration   * running WordPress in multi-site/multi-domain mode   * most domains are not using `www.` prefix (cookies)   * (desire) to be able to disable caching for specific IPs or based on a cookie, when you do changes to the site you don't need caching. Details: I'm using Firefox Google Page Speed plugin to try to optimize the speed of the website. Also please do not guide with generic guidelines, like smaller images. Let's be fair, using more than one caching plugin will bring you more problems than it will solve so please try to give a simple approach.


Insert data in database using form

I am writing a simple plugin that create a table with name "newsletter" in database and provide a shortcode to put a registration form in pages. the form contain "name" and "email". i have problem with inserting the form data(name+email) in database. i wrote this:               <?php     $name = $_POST['name'];     $email = $_POST['email'];     function insertuser(){     global $wpdb;     $table_name = $wpdb->prefix . "newsletter";     $wpdb->insert($table_name, array('name' => $name, 'email' => $email) );      }     ?>       but id does not work. what should i do to get data from form and insert into table?


$wp_query->queried_object->ID throws warning: Undefined property

<?php                  $current_term = $wp_query->queried_object->name;                 $current_term_id = $wp_query->queried_object->ID;             ?>                      <hgroup class="section-heading wrapper">
<?php echo $current_term; ?>

<?php echo category_description( $current_term_id ); ?>
                 </hgroup>      This works fine but the `$current_term_id` variable throws a warning …               Notice: Undefined property: stdClass::$ID in /Users/my/htdocs/wr/wp-content/themes/wr/taxonomy-event_type.php on line 12      Any ideas what I'm doing wrong here or what's the real property for the ID of the current term?


In widget, the value of select field doesn't get updated, changes after saving

I'm building a simple widget which will allow the user to select a post among a list of posts.   For some reason, when I select an option, I believe it actually gets selected but the option doesn't remain in the select field. I think my error is at the following line but I don't manage to fix it. Maybe calling the_ID is not the way to do it...:               <option value="<? echo the_ID(); ?>" <?php selected(the_ID(), $instance['post_to_display']); ?>><?php the_title(); ?></option>      Here is my code:               class Simple_Widget extends WP_Widget{            function Simple_Widget() {         $widget_ops = array(           'classname' => 'w_reports',           'description' => __('Use this widget to add a post to the sidebar', 'theme'));         $this->WP_Widget('w_reports', __('Simple_Widget', 'roots'), $widget_ops);       }            function widget($args, $instance) {         extract( $args );         $post_to_display = $instance['post_to_display'];            }            function update($new_instance, $old_instance) {         $instance['post_to_display'] = $new_instance['post_to_display'];         return $instance;       }            function form($instance) {       ?>         <p>           <label for="<?php echo $this->get_field_id('post_to_display'); ?>">Choose a post to display:</label>            <select id="<?php echo $this->get_field_id('post_to_display'); ?>" name="<?php echo $this->get_field_name('post_to_display'); ?>" class="widefat">                <?php // My query             $the_query = new WP_Query( 'post_type=my-post' );             while ( $the_query->have_posts() ) : $the_query->the_post();           ?>           <option value="<? echo the_ID(); ?>" <?php selected(the_ID(), $instance['post_to_display']); ?>><?php the_title(); ?></option>                <?php endwhile;           wp_reset_postdata();           ?>          </select>       </p>            // Just a test           <?php echo $instance['post_to_display']; ?>      What am I doing wrong? Thanks in advance for your help!


What is with the one month time limit for sub directory installs for multisite network?

http://codex.wordpress.org/Before_You_Create_A_Network If you scroll down to the bottom you see: > You cannot choose Sub-directory Install (for a path-based network) if your > existing WordPress installation has been set up for more than a month, due > to issues with existing permalinks. (This problem will be fixed in a future > version. See Switching network types for more information.) I believe that this is causing some of the permalink issues I am facing here. But I would like to understand why there is a one month time limit and what they are doing to fix it. For instance the permalink issues I am having - I definitely notice that the newer WP installs that I have on my server are not having issues while the older ones are. What the $%%**% is happening at the one month time period that is "locking" permalinks?


Google Docs Viewer have problem in MultiSite sub-blogs

An example file: http://twentyeleven.korkmaz.biz/files/2012/09/example.docx and here is same file but direct url without ms-files.php: http://twentyeleven.korkmaz.biz/wp- content/blogs.dir/3/files/2012/09/example.docx Its same file. Just first one is getting call with ms-files.php. Problem is first file is not working in google docs viewer: http://docs.google.com/viewer?url=http://twentyeleven.korkmaz.biz/files/2012/09/example.docx giving this error: > Sorry, we are unable to generate a view of the document at this time. Please > try again later. You can also try to download the original document by > clicking here. But if i call same file with directly without ms-files.php: http://docs.google.com/viewer?url=http://twentyeleven.korkmaz.biz/wp- content/blogs.dir/3/files/2012/09/example.docx Its working! So for some reason wordpress multisite is corrupting files in sub-blogs. There is no problem in main blog because main blog's files getting direct call and not using ms-files.php So how can i fix this? If you think i cant fix it, how can i get real path url from WordPress generated /files/ url?


Explanation of User Roles and Capabilities

I'm developing a Wordpress theme. In this theme, there are a few custom post types. Custom Post Types :   * book   * article   * event We are using Wordpress' default user roles (we can create new roles, if necessary) . Contributors just post new **book** and **article** . But they can't create **event**. Also they can't see, _event_ menu item on **wp-admin** . How can i do this ? While registering new post type :               "map_meta_cap" => TRUE,     "capability_type" => "book",      And (on plugin activation)               $role = get_role( 'contributor' );           $role->add_cap( 'publish_books' );      But I think it's still not working. it's so complicated for me. I couldn't do it. I just want this roles and capabilities : ## Administrator Can see , post , publish everything ## Contributors Just can see, post to review **book** and **article** Can NOT see other post types on wp-admin menu.


Index in root, wordpress in subdirectory

Okay I've googled this for hours...I installed wordpress to a subdirectory as a content management system, but I want my main index.php along with other files to remain in the root. What .htaccess code do I need to so that the main url http://foo.com/index.php doesn't look for the wordpress/index.php (which of course causes the error "Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/..."


Use ajax response in PHP function

Ok, so I'm working on a plugin and just ran into a problem. Here's what I'm doing:   1. Using a metabox with Plupload to upload an image to an upload dir in the plugin folder.   2. Upon upload success a script is called and the image is initialized in jCrop.   3. The cropped image is processed and saved to another dir in the plugin folder using a form with ajax.   4. Upon image processing success the filename of this new, cropped file is passed back. And here's where I'm stuck. What I want to do now is to use the filename that I passed back and use it for further processing within Wordpress. Until now everything has been handled without any WP specific code being involved. What I was thinking about now was to use `$.get` to pass the filename on to a standalone php file within the plugin folder and use `require_once('wp- load.php');` in it to be able to use Wordpress functions. But while reading up on the I came a cross multiple posts that said that you shouldn't go about that way. So basically, my question is, how do I go from here:                 jQuery.ajax({           type: "POST",           url: plugin_path + "process.php",           data: dataString,         success: function (data) {             var obj = jQuery.parseJSON(data);             if (obj.response == 'success') {                 return obj.tempfile; // PASS THIS ON FOR WP INTERACTION             } else {                 alert('sorry there was an error');             }         }     });       To here:                 $video_thumb_url = obj.tempfile; // THIS IS WRONG, BUT JUST TO PROVE POINT           $result = media_sideload_image($video_thumb_url, $post_id, 'video_thumbnail');     $attachments = get_posts(array('numberposts' => '1', 'post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC'));          if(sizeof($attachments) > 0){         // set image as the post thumbnail         set_post_thumbnail($post_id, $attachments[0]->ID);     }        Thanks in advance P.S. Really had a hard time coming up with a title for this, if you know something better suited, just let me know/edit it, thanks.


How long should it take for a plugin to fully load into the WordPress.org plugin repository?

I updated my plugin, Export to Text, to 1.3 and committed it to the WordPress SVN repository yesterday. The 1.3 download button was available pretty quickly, but a day later the read me text is not rendering on the plugin page and the download update reminder is not working in the WP UI for users with earlier versions installed. How long does it typically take for plugins to be fully loaded by the WordPress.org website?


Validating widget's configuration data on Admin page

I have a simple widget that needs its width and height set by the user, so that it is displayed properly on the blog. The thing is: on the **Administrator/Appearance/Widgets** page, if the admin user puts something like "400px" on the width, it works perfectly. But what if the user puts "xxxx"? Is there any way that I can fire some javascript when the user presses the "Save" button, so as **to inform the user that the data is invalid**? I looked all around for hooks on the save button, or ways to intercept the submit, but found nothing. Am I looking at this problem from a wrong perspective? Is there a better way to do this? Thanks in advance.


Correct way to add a block element to sidebar layout

First time experimenting with wordpress and looking for advice on the correct way to add a block of html to a sidebar. This doesn't seem like a custom widget to me as there is no functionality involved, other than displaying an image. I want to position it above a sidebar menu which exists there already - instead of just lobbing the html directly into the template file, should i be doing something else with it? Thanks for any help!


Blubrry PowerPress vs. PodPress?

I'm setting up a simple WP install to host a friend's podcast, and looking into various podcasting plugins. I need something that makes it easy to upload a podcast, attach it to a post, and publish a feed I can provide to iTunes. Most of the buzz seems to indicate that PodPress and Blubrry PowerPress are the two best plugins to use for this, but I haven't found a good list of what one offers over the other. What are the strengths and weaknesses of these plugins? Are there any other great podcasting-related plugins I should be considering?


Changing "Enter title here" based on post format

I'm wondering if is possible to change the text "Enter title here" based on the post format that you selected? For example: If you select the post format **Quote** than your text will be "Enter author's quote". Is that possible?


Why load_textdomain work but not load_plugin_textdomain?

In my plugin's `init` function                   load_textdomain( 'myplugin', ABS_PATH_TO_MO_FILE ); // OK              load_plugin_textdomain( 'myplugin', false,  ABS_PATH_TO_LANGS_DIR); // No effect              echo( __('Test', 'myplugin') );      In the code above, the load_textdomain works, but not load_plugin_textdomain, any idea?


Firebug says jQuery is loaded but $() and jQuery() are not defined

I'm trying to test my wordpress page with some simple jQuery script but it won't work. I've loaded the script with `wp_enqueue_script('jquery');` in `functions.php` as explained in the wordpress guide but something's buggy. I'm testing the page using `FireBug` installed in `Firefox 4` and if I take a look to the loaded scripts list it's all ok, but it also return me the error `jQuery is not defined` too. I've followed the instructions on the `noConflict` mode but it still won't work for me:               // functions.php     <?php         function init_scripts () {             if (!is_admin()) {                 wp_enqueue_script('jquery');             }          }         add_action('init', 'init_scripts');     ?>          // header.php     <script type="text/javascript">         (function($) {             $(document).ready(function() {                 alert('hello?');             });         }(jQuery));     </script>      Where I'm wrong? I've tried this tutorial too and it's says jQuery object is not defined here:               // jquery from ajax.googleapis.com is correctly loaded     $j=jQuery.noConflict(); // firebug says jQuery is not defined by here          $j(document).ready(function(){         alert('test');     });


Making a wordpress page print friendly

I'm trying to use an existing plugin in order to make my posts print friendly. I haven't got any support from the plugin developer. I think I have narrowed down the script to the function that places the 'Print' text in the posts. Problem is that this plugin places the 'Print' button automatically. But I would like to place it in a template and prevent the automatic placement. This is the code that does the job of placing the print button. Can someone suggest a modification so that the following script 1. DOES NOT place the 'Print' button automatically. 2.What would be the function to call/place in my single.php page.               if ( !$_GET['print'] == 1  ) {         add_filter( 'the_content', 'printme_add_link' );     }          function printme_add_link( $content ) {         if ( is_singular() ) {             $printme_options = get_option( 'printme_options' );             $print_stub = $printme_options['print_text'];             }             wp_enqueue_script( 'jquery' );             wp_register_script( 'printme', plugins_url( '/printme.js', __FILE__ ), false, '1', true );             wp_enqueue_script( 'printme' );             $link = add_query_arg( 'print', '1', get_permalink() );             $content = '<a href="' . $link . '" target="_blank">' . $print_stub . ' </a>' . $content;             return $content;              }          add_action( 'template_redirect', 'printme', 5 );     function printme() {         if ( $_GET["print"] == 1 ) {             include( plugin_dir_path(__FILE__) . 'print.php' );             exit();         }     }


Sorting main query by custom taxonomy slug

Is there a way to sort posts by custom taxonomy (shoe_color) ASC|DESC? I would like to do this using `query_posts` and passing the `orderby=shoe_color` into it. Here is the code I'm trying to work out:               function shoe_color_orderby( $wp_query ) {         global $wpdb;         return "(             SELECT GROUP_CONCAT(slug ORDER BY slug ASC)             FROM $wpdb->term_relationships             INNER JOIN $wpdb->term_taxonomy USING (term_taxonomy_id)             INNER JOIN $wpdb->terms USING (term_id)             WHERE $wpdb->posts.ID = object_id             AND taxonomy = 'shoe_color'             GROUP BY object_id         ) ";     }     add_filter( 'posts_orderby', 'shoe_color_orderby');


Switch theme if ie compatibility/quirks mode?

How could you detect a browser is using ie quirks/compatibilty mode and then switch themes if detected? I've developed a nice new "responsive" theme for wordpress. It works great on mobiles & in all the browsers I've tested - firefox, chrome, even ie 6, 7, 8 & 9. The only issue arises when using the compatibility mode in internet explorer - the site becomes "unresponsive" (divs & images not scaling properly). For the moment I have disabled the compatibiltiy view completely with:               <meta http-equiv="X-UA-Compatible" content="IE=Edge" >       So a couple of questions:   * Should I expect responsive themes to work properly in ie compatibility mode?   * How can I change to a different theme if compatibilty mode is selected? Thanks


How can I debug my database connection for unit testing?

I've set up a wordpress environment on my Mac with MAMP and I'm running 3.5.1 locally (i.e. `http://localhost:8888/blog` works). I'm trying to run the unit test suit from wordpress.org and having trouble connecting to the database.               $svn co https://unit-tests.svn.wordpress.org/trunk wordpress-tests     $cd wordpress-tests     $cp wp-tests-config-sample.php wp-tests-config.php      edit `wp-test-config.php` for my setup               $ cat wp-tests-config.php     <?php          /* Path to the WordPress codebase you'd like to test. Add a backslash in the end. */     define( 'ABSPATH', '/Applications/MAMP/htdocs/blog/' );          // Test with multisite enabled: (previously -m)     // define( 'WP_TESTS_MULTISITE', true );          // Force known bugs: (previously -f)     // define( 'WP_TESTS_FORCE_KNOWN_BUGS', true );          // Test with WordPress debug mode on (previously -d)     // define( 'WP_DEBUG', true );          // ** MySQL settings ** //          // This configuration file will be used by the copy of WordPress being tested.     // wordpress/wp-config.php will be ignored.          // WARNING WARNING WARNING!     // These tests will DROP ALL TABLES in the database with the prefix named below.     // DO NOT use a production database or one that is shared with something else.          define( 'DB_NAME', 'wordpress' );     define( 'DB_USER', 'root' );     define( 'DB_PASSWORD', 'root' );     define( 'DB_HOST', 'localhost:8889' );     define( 'DB_CHARSET', 'utf8' );     define( 'DB_COLLATE', '' );          $table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!          define( 'WP_TESTS_DOMAIN', 'example.org' );     define( 'WP_TESTS_EMAIL', 'admin@example.org' );     define( 'WP_TESTS_TITLE', 'Test Blog' );          define( 'WP_PHP_BINARY', 'php' );          define( 'WPLANG', '' );      But, when I try to run the test suite, I `phpunit` can't connect to the database:               $phpunit     ...
Error establishing a database connection

This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at localhost:8889. This could mean your host's database server is down.
     ...      Can anyone help debug this issue? ** EDIT ** After adding `wp-content/db-error.php` as described below. I'm getting the following error:               $ phpunit     PHP Warning:  mysql_error() expects parameter 1 to be resource, boolean given in /Users/spinlock/WordPress/wordpress-3.5.1/wp-includes/wp-db.php on line 1023     WordPress database error  for query  made by require_once('/Users/spinlock/WordPress/wordpress-3.5.1/wp-settings.php'), wp_set_wpdb_vars, dead_db, require_once('/Users/spinlock/WordPress/wordpress-3.5.1/wp-content/db-error.php')     Running as single site... To run multisite, use -c multisite.xml     PHP Warning:  mysql_error() expects parameter 1 to be resource, boolean given in /Users/spinlock/WordPress/wordpress-3.5.1/wp-includes/wp-db.php on line 1023     WordPress database error  for query  made by PHPUnit_TextUI_Command::main, PHPUnit_TextUI_Command->run, PHPUnit_TextUI_Command->handleArguments, PHPUnit_TextUI_Command->handleBootstrap, PHPUnit_Util_Fileloader::checkAndLoad, PHPUnit_Util_Fileloader::load, include_once('/Users/spinlock/WordPress/wordpress-tests/includes/bootstrap.php'), require_once('/Users/spinlock/WordPress/wordpress-3.5.1/wp-settings.php'), wp_set_wpdb_vars, dead_db, require_once('/Users/spinlock/WordPress/wordpress-3.5.1/wp-content/db-error.php')      wp-db.php line 1023 is the implementation of `print_error()` and it's choking here:               1019   function print_error( $str = '' ) {     1020     global $EZSQL_ERROR;     1021     1022     if ( !$str )     1023       $str = mysql_error( $this->dbh );     1024     $EZSQL_ERROR[] = array( 'query' => $this->last_query, 'error_str' => $str );     1025      **Solution** Ok, I finally got this working by changing `DB_HOST` to `localhost:/Applications/MAMP/tmp/mysql/mysql.sock`. And the tests are running:               $ phpunit     Installing...     Running as single site... To run multisite, use -c multisite.xml     Not running ajax tests... To execute these, use --group ajax.     PHPUnit 3.7.19 by Sebastian Bergmann.          Configuration read from /Users/spinlock/WordPress/wordpress-tests/phpunit.xml.dist          .............FFF................PHP Fatal error:  Call to undefined function wp_unslash() in /Users/spinlock/WordPress/wordpress-tests/tests/attachment/slashes.php on line 45          Fatal error: Call to undefined function wp_unslash() in /Users/spinlock/WordPress/wordpress-tests/tests/attachment/slashes.php on line 45


Per Page Permalink Structure for Page Post Type

I am trying to Re-Write Page URL's so that they END with `.htm` I was able to do this using...               /* Add .htm extension to Page URL Links */     add_action('init', 'htm_page_permalink', -1);     function htm_page_permalink() {         global $wp_rewrite;         if ( !strpos($wp_rewrite->get_page_permastruct(), '.htm')){             $wp_rewrite->page_structure = $wp_rewrite->page_structure . '.htm';         }     }          /* Remove the trailing slash/ on Pages */     add_filter('user_trailingslashit', 'no_page_slash',66,2);     function no_page_slash($string, $type){         global $wp_rewrite;         if ($wp_rewrite->using_permalinks() && $wp_rewrite->use_trailing_slashes==true && $type == 'page'){             return untrailingslashit($string);         }else{             return $string;         }     }      But then I ran into a problem where I am using my `Blog` post list on a Page named `Blog`. I need this page to **NOT** end with `.htm` So I then used this code to change the Page Links to filter out the `.htm` on my `blog` page...               /* Filter .htm out of Blog Page Links */     function blog_page_url($content) {         $current_path = '/blog.htm';         $new_path = '/blog/';         $content = str_replace($current_path, $new_path, $content);         return $content;     }     add_filter('_get_page_link', 'blog_page_url');      And I used this Re-write rule to make `/blog/` load the `Blog Page` ...               /* Setup Custom Re-write for the Blog Page */     add_action( 'init', 'blog_page_rewrite' );     function blog_page_rewrite(){         add_rewrite_rule('blog', 'index.php?pagename=blog','top' );         //add_rewrite_rule('blog/(.*?)/', 'index.php?p=$matches[1]','top' );     }      But now I have the problme that any URL with the `/blog/` in it is showing the `Blog page`. This means my actual blog post which are set up in WP Permalink settings like this... `/blog/%postname%/` are not working, instead they always show the `Blog page` which list all the blog posts. In my `blog_page_rewrite()` function above you can see I had tested an extra re-write rule to hopefully work with the Blog posts but it had no affect.


Plugin scans for images in post_content, how about "featured image"?

I use WordPress SEO by Yoast, especially for the Google News sitemap feature. My theme is coded in such a way that the main image of a post is also the featured image of the point (i.e. the same image, but a different size, is shown for post thumbnails). That's the design decision I had to make (for various reasons I can say here). * * * In case it helps, the code looks like this:

<?php the_post_thumbnail( 'full' ); ?>
         <?php the_content( __( 'Continue reading →', 'reddle' ) ); ?>         <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'reddle' ), 'after' => '
' ) ); ?>
      * * * Here's the problem: The plugin scans for images in `post_content` i.e. for it to reference the images of a post in the sitemap, the images should be in `post_content` field for that post in the database. And since that's not how featured images work, the main image of my post is not referenced in the sitemap. Now, the question is -- is there a way around? I don't want to edit the plugin (unless there's no other way). Is there a way for me to get the featured image into `post_content` as it is shown in the code? (i.e. like `<p style="text- align: center;"><img src="FEATURED IMAGE LINK" /></p>`)


Get image URL from media library in input

On `wp-admin/post.php?post=447&action=edit` for example I have a link and an input. The link appears as follows:               gallery      When I click the link the media library opens, and i'd like the URL of the inserted image to populate an input field, eg.               <input type="text" name="tj_image_url" id="tj_image_url" value="VALUEHERE" size="30" />      How can I do this?


Problems with explode

I have a text box in the admin area for entering the names of categories. Right now, this is what is in it events homepage Just like that above. Two categories separated by a space. So now I am trying to get the categories from the database and that is done this way. (I am using SMOF framework)                echo $data['exclude_categories'];      If I do the above, it will echo out                events homepage      So then I am trying to get a - sign and a comma placed between each category like so                //looping through my key to get the values      $string = explode(" ", $data['exclude_categories'] );      foreach($string as $cat) {           //concatenating my values into one string      $string .= '-' .$cat.",";      }      echo $data['exclude_categories']; //for testing purposes      //trimming the trailing comma from the string      $string = substr($string, 0, -1); // Delete the last character      My problem is that I get this "Array-events,-homepage" and I don't know why the Array is there


mysql query from wordpress page using custom table

I want to a mysql query that matches a page title. Not sure of a better way to accomplish this task, but I am stuck. This is my basic test code.               <?php     $page_title = wp_title('');     echo $page_title;     $test = $wpdb->get_results("SELECT * FROM $wpdb->park_data WHERE park_name = '"$page_title"' ") or die(mysql_error());       $row = mysql_fetch_array($test);     echo $row['park_name'];     ?>      I keep getting a error on the query. If I just echo wp_title('');, no problem, prints. Can anyone see what I am doing wrong?


Any plugins that upload, resize, and display images?

Here is an ideal workflow for my situation:   1. Upload a folder full of images   2. Resize images according to a specified size   3. Have the ability to organize these images into folders (collection1, collection2, etc)   4. Display the images within these folders in a non-flash gallery (collection1 on page 1, collection2 on page 2, etc) Is there any plugin that will help this process from start to finish, or set of plugins that play nicely together? It's important that these galleries work on non-flash-supported devices, as mobile and tablet traffic will be significant. Paid is fine for a good quality plugin. Thanks.


Edit page header on a custom plugin

I am writing a custom plugin for Wordpress but how in the world do I edit the page header? I need to add some javascript and related codes there.


get_pages and get_posts returning different data?

this is driving me crazy... I have an admin plugin page that lists pages for a wordpress website. I'm trying to list all the pages using get_pages() but for some reason once pages are published they don't show up anymore - when I use get_posts they show up, but the new draft pages don't :( Here is the code.. please help               //this only displays the new draft pages - once published pages don't show up here     $args = array('post_status' => 'draft, publish');     $pages = get_pages($args);                                                        foreach ( $pages as $page ) { some html code that displays the page title }          //this piece of code will return all pages onces they were published,      //even if 'unpublished' later - but will not return new draft pages     global $post;     $args2 = array( 'numberposts' => 50, 'post_status' => 'publish, draft');     $myposts = get_posts( $args2 );     foreach( $myposts as $post ) {         setup_postdata($post);          ... some HTML code to display the pages     }      what's going on?


302 on Wordpress Multi site installation on subdomain

I have a Multi Site installation on www.example.com, which is working fine. Afterwards I've made an exact copy of this installation and placed it on a subdomain of this site: subdomain.example.com. The top level domain still works fine. But the Multi Site installation on the subdomain keeps redirecting (302) me to my toplevel domain. And I just can't find out where this redirect could be. What should I do?


Using TinyMce with textareas in meta boxes on custom post types

I am trying to use the http://www.tinymce.com/ plugin to add a tinymce to my textareas in my meta boxes I have created. I've googled other ways and either I cant get it to work or didnt grasp the concept. SO this is what Im trying now -- I tried creating plugin to add the script to my admin dashboard --               add_action('admin_init', 'admin_load_scripts');      function admin_load_scripts() {          $js_file = plugins_url( '/tinymce/jquery.tinymce.min.js', __FILE__ );           wp_enqueue_script('jquery.tinymce.min', $js_file, array('jquery'));      }      Then I need to call it like so --               <script>             tinymce.init({selector:'textarea'});     </script>      But im not sure how to do this, being that this is for the backend and not the front end. How can I achieve this? **UPDATED** This is my code for the meta boxes. http://pastebin.com/WcC51uA9 I tried the following methods (placing it in functions.php of course), and for the most part they either just didnt work or would show up on the top of the page or on the bottom of the page. They didnt show up on the textarea at all. --- http://pastebin.com/Ct0mF6q7 http://pastebin.com/R6t0ij6h http://pastebin.com/dcczcVby http://pastebin.com/yt1uRS5U


Flush Rewrite Rules when new site is created on network

I am working with a multisite setup and I have created some custom post types, which seem to work fine except when trying to view any of the post types pages on the front end, I get a white screen. After looking into the issue it seems that flush rewrite rules fixes it. The problem with this is that admins wont have access to the permalinks setting so they cant flush it themselves. I am currently using the following code to flush when activating a theme, but this is not ideal since a user will have to switch to another theme then switch back to the primary theme. So Im trying to find a way to modify the following code to work when a new site is made, thus having the custom post types working from the start. ---               /* Flush rewrite rules for custom post types. */     add_action( 'after_switch_theme', 'bt_flush_rewrite_rules' );          /* Flush your rewrite rules */     function bt_flush_rewrite_rules() {          flush_rewrite_rules();     }      Any help is appreciated, thanks. **UPDATED** I have a main site that users sign up on the front end for a site like such mysite.com/theirsite. The default theme for them is set. Thats where Im trying to place the code so flush rewrite works when they create a site, not switch theme. Admin dashboard is simplified so they dont have access to permalinks or theme -> editor. I would think though that when creating custom post types, it's suppose to flush rewrite, thus not even needing to use the extra code? If it helps this is my register post type code -- http://pastebin.com/XsRjLj3q


How to add active class to separate page link?

I'm using the Wordpress Bootstrap theme as my base theme. It uses the following code to add the class "active" to any links in the header if the user is currently on that page:               add_filter('nav_menu_css_class', 'add_active_class', 10, 2 );          function add_active_class($classes, $item) {              if($item->menu_item_parent == 0 && in_array('current-menu-item', $classes)) {                  $classes[] = "active";              }              return $classes;          }      However, I have multiple pages that I want to display as "active" when the user is not actually on that specific page. For example, users may sometimes be on "tutorials-by-topic" (Tutorials by Topic) but I want the link titled "Tutorials" to be displayed as the active link. I have four pages I want to do this way. I have tried different conditionals, etc. in the add_active_class function but I've had no luck. Any guidance? Thanks!


PODS performance vs custom field

is using pods's own content tpye where custom fields are all stored in one table more scalable than custom fields of wordpress where each field is a row in the meta table... I haven't used PODS yet but storing all fields in one table seems more scalable and easier to maintain? what are the disadvantages of PODS (i don't see many people using it)? are the custom fields of pods indexable for the search engine?


Make posts_per_page value the same on all pages

I'm almost finished with this one, just a small problem left. Hope you can help me. I've got two very simple, custom loops. One for sticky posts, and one for non- sticky. I've manage to get the sticky posts to only show up on page 1, and not on the rest of the pages (when using pagination), which is just what I want. The problem is this: If I use posts_per_page set to 8, and have 1 sticky post in my database, I get 9 posts on the first page, and 8 on the rest of the pages. I've managed to change the posts_per_page value with this script in between the loops:               $postcount = $wp_query->post_count;      $postnumber = 8;      if ( $paged != True ){ $postnumber = $postnumber - $postcount; }      and it almost work. If I have 1 sticky post and post 15-9 on the first page, and then click the next button, WP skips post #8 and only shows 7-1 on the next page. Here is my code:               <!-- Sticky -->     <?php if ( $paged != True ): ?>         <?php $wp_query = new WP_Query(array('post__in' => get_option('sticky_posts'), 'category_name' => Work)); ?>             <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>                 <?php get_template_part( 'loop', 'index' ); ?>             <?php endwhile; ?>         <?php wp_reset_postdata(); // reset the query ?>     <?php endif ?>          <?php      $postcount = $wp_query->post_count;      $postnumber = 8;      if ( $paged != True ){ $postnumber = $postnumber - $postcount; }     ?>          <!-- Non-Sticky -->     <?php $wp_query = new WP_Query(array('post__not_in' => get_option('sticky_posts'), 'category_name' => Work, 'posts_per_page' => $postnumber, 'paged' => $paged)); ?>         <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>             <?php get_template_part( 'loop', 'index' ); ?>         <?php endwhile; ?>     <?php wp_reset_postdata(); // reset the query ?>


Custom Post Type Meta Box Text Input Field Won't Save When Blank

I have some text fields in a custom post type that I fill in at first, but need to delete on a future update of the post. When I delete the text in the field and save the post, the text I deleted comes back! If I enter a space, it saves OK. Does anybody know how I can fix this? Here are the parts of the code for my custom post type that display and save the field data (didn't post the custom post type init code because it's right from the codex):               function book_info()     {         global $post;         $custom = get_post_custom($post->ID);         $book_title = $custom["book_title"][0];         ... (more field variables) ...         ?>
Book Title:
         <input class="medium" name="book_title" value="<?php echo esc_html($book_title); ?>" />
         ... (more field display blocks) ...         <?php     }           add_action('save_post', 'save_book');     function save_book($post_id)     {         // Verify this came from our screen with proper authorization.         if ( !wp_verify_nonce( $_POST['book_info_noncename'], 'book_info'.$post_id )) {             return $post_id;         }              // Determine whether this is an autosave routine. If so, our form has not been submitted and we don't want to do anything.         if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )              return $post_id;              // Check permissions         if ( !current_user_can( 'edit_post', $post_id ) )             return $post_id;              // Now that authentication is complete, find and save the data.         $post = get_post($post_id);             if ($post->post_type == 'book') {                       if (isset($_POST["book_title"]) && $_POST["book_title"] <> '') update_post_meta($post->ID, "book_title", $_POST["book_title"]);                 ... (more field save statements) ...                  return($_POST['book']);         }         return $post_id;     }      If I enter text in the "book_title" field and save, it works. If I then delete that text and save, the text is still there when the edit post screen refreshes after clicking save. If I delete that text and replace it with a space character, it saves. I need to be able to delete the text from the field without having to replace it with a space character. Any thoughts on how to accomplish this?


Remove /author/ from the author profile url

I'm trying to figure out the best way to remove /author/ from the profile URL of my users. I tried using the method in the link below and although it worked, it also prevented me from accessing any of my other pages that used a page template. So not sure if there's a tweak I need to make to the code? I would like to do this through the functions file and not use a plugin so any guidance is much appreciated.               add_action('init', 'cng_author_base');     function cng_author_base() {        global $wp_rewrite;        $author_slug = ''; // change slug name        $wp_rewrite->author_base = $author_slug;     }


Change the URL of an image from wp_get_attachment_image_src

I call a lot of images with `wp_get_attachment_image_src()` and would like to off load those images to a CDN. Is there a filter to grab the URL and change it?


debugging wordpress

I noticed that when I'm working on a php page that loads wp programmatically, some of my errors are not fired. For example, a variables that has not initialized previously creates a warning when I have the E_ALL on top, but not when I load wp after that. Any comments? how do I put wordpress in a mode so that anything wrong anywhere is reported.


Action hook "wp_insert_post" works but not for last imported post

I want to run a custom function whenever posts are imported to my custom post type. I am currently running this code -               function on_post_import($post){       global $wpdb;            $results = $wpdb->get_results(         "SELECT ID FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'"       );            foreach ($results as $result) {           // run custom function       }            $wpdb->flush();     }     add_action( 'wp_insert_post', 'on_post_import' );      The problem I am facing is that it does not work for last imported post. So if there are 3 posts imported then it works fine for 2 of those posts but not for the 3rd one (last imported). UPDATE: If there is only one post imported the custom function does not work. UPDATE2: Seems like the issue is with my custom function which makes use of get_post_meta() which does not seem to output anything. **UPDATE 3: I am now simply using the wpdb query to run custom function. _I want to avoid it as it will keep running in the background._ If anyone have a better solution then do let me know thanks!**               global $wpdb;            $results = $wpdb->get_results(         "SELECT ID FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'"       );            foreach ($results as $result) {           // run custom function       }            $wpdb->flush();      What wrong am I doing? Or is there any other way to get my function to work on all imported posts including the last imported?


get_post_meta() empty in preview WHEN custom post is published

So my client managed to find some (bug?), when custom post is published and he previews post all information what is posted with custom meta boxes is inaccessible. When I started debugging I found that in this case get post meta returns empty. Someone know why system acts this way. And yes, when i look at post not prview all information shows fine. And before posting get_post_meta() works okay. Only in this case where post is pubished and preview is clicked.


Is it possible to add a filter for the output of nav-menu items in admin?

I want to remove certain input fields on the admin screen for nav-menus for specific menu positions. I've used filters to filter front-end output but not for admin output. Is there a filter available for this purpose? For example, I want to remove the option to add a `title` attribute to menu items, only if the menu is used in 'position-x'. Filters such as `nav_menu_link_attributes` and `wp_nav_menu_args` all seem to be to filter the front end output.


Where to put custom PHP files in a child theme?

I am customising a premium WP theme to suit my site better, but I can't quite figure out what to do with PHP files that I customise. Do they just go into the root of the child theme folder? Or do they get put into a similar folder hierarchy as in the original theme? How do I make sure the child theme PHP file is being used instead of the parent theme PHP file (e.g. header.php)?


Is it possible to have a network of BuddyPress sites, a-la WordPress MU, with single-sign-on?

We're looking to create a network of BuddyPress sites that share a common design, a common theme and some common content, but the same userbase across all network sites. Each user will 'belong' to a network site, so whilst people can browse the London, New York and Sydney editions, they will need to 'belong' to one of these sites:   * ldn.mainsite.com   * nyc.mainsite.com   * syd.mainsite.com Each subdomain-based BuddyPress site will feature different content depending on the location to which the site is based. Logging in to the network will mean they are logged in across all of the sites (SSO). Is this possible with WordPress, BuddyPress and/or WordPress MU, or will this require some significant work on top of the existing code? (Or, would it be better doing this from scratch on top of something else?)


Wordpress and simple forums

This might be an annoying question, since there are some pretty good answers to this question, but they are 9 months old, so please but bare with me. I would like to have some input to point me to the right direction. I'm looking to integrate a simple forum for a Wordpress project. The forum must haves:   * Simple threads, similar to the WP threaded comments system.   * Ability to display only the forum login page as forum front page.   * Ability to show only the forum the user is registered to, or the forum the admin assigns the user to. In a way the flow is:   Click on forums page > Login > Browse only one specific forum.   * Ability to show some info about each of the users: phone, email, etc.   * Ability to register without going to wp-admin What I need is way less then what vBulletin or phpBB or even SimplePress provide, i just need a place for users to chat on specific topics and get in touch. I've tried to use bbPress, as it is as close as it gets to what I wanted, but they don't have the ability to close forums for specific groups of users, so maybe one can point me to the right software of combination of plugins. Thanks in advance.


Custom Post Types, or completely custom?

I'm currently in the process of redeveloping my website. I've decided to use WordPress as its CMS, rather than coding everything from scratch. It's a fishkeeping website, consisting of species profiles; plant profiles; fossil species profiles; articles; news posts and blog posts. My original idea was to create plugins for each of those (excluding articles/news posts/blog posts as I can just add post categories), with each plugin creating a new database table and adding the relevant admin menus (create, view/amend). I've stumbled across custom post types today, and I'm now wondering if they'll do the job for me? It would be ideal if they could - save me a lot of time and offer some reasonably useful functionality that I probably won't bother to code if I do it the other way (time constraints). The species profile is the most complex aspect of the site. It will have ~20 fields. A few of the fields will need to be lookup fields, i.e. category which will allow the user to select from a list. A few of the fields will need to be array values, i.e. one textbox called "ph_min" and one called "ph_max" which are stored in the DB as a serialized array. Fields following these array fields will require a custom TinyMCE button to insert BBCode such as [ph_min] (this will allow us to write: "keep these fish at [temp_min] if possible, but don't use water above [temp_max]" whilst having a conversion button at the top of each profile). Are Custom Post Types flexible enough to do all of the above for me, or should I just take it back to basics and write my own admin pages and database tables?


Disabled trackbacks in Wordpress but I am still receiving trackbacks

I have disabled trackbacks in Wordpress back end discussion panel but I am still receiving trackbacks. How can I ensure that I do not receive any trackbacks?


Using media-upload.php to upload mp3 via custom fields

I'm trying to use the Thickbox file upload dialogue with a custom field to allow the user to upload an mp3. What I want to do is to grab the URL of the uploaded mp3 and save it as postmeta (saving the data when I've got it isn't a problem, but getting what I need is!). I've got the code to make this work with an image                jQuery(function($){          var formfield = null;          $('#rps_upload_mp3').click(function() {         $('html').addClass('Image');         formfield = $('#rps_mp3_url').attr('name');         tb_show('', 'media-upload.php?type=image&TB_iframe=true');         return false;     });          window.original_send_to_editor = window.send_to_editor;     window.send_to_editor = function(html) {              var fileurl;              if( formfield = !null ) {                  fileurl = $('img', html).attr('src');             $('#rps_mp3_url').val(fileurl);             tb_remove();                  $('html').removeClass('Image');             formfield = null;              } else {                  window.original_send_to_editor(html);              }          }           });      Obviously the line that reads `fileurl = $('img', html).attr('src');` will only get the `src` of an image, not an mp3, but I can't figure out where the script is grabbing the source of this image from and I don't know how to target the uploaded mp3. Thanks in advance!


Adjust query on single

I am building an event manager. One of the template files I have is events- single.php which displays single events. At the bottom of this I have next and previous events using `next_post_link` and `previous_post_link`. The problem is that those functions proceed through the events in order of **published date** rather than **event date**. (I have a meta key `_fulldate` setup on the CPT for this). When I was building events-archive.php file I overcame a similar problem by doing something like this               $query = new WP_Query( array (      'post_type' => 'events',      'orderby' => 'meta_value',      'meta_key' => '_fulldate',      'order' => 'ASC')     );      However when I try that on events-single.php it makes all the events display on the page. Ultimatly I want events-single.php to behave like a single page but then allow me control over the query as above. Is this possible or will I have to do a second loop for the Previous and Next links


WP_Query Pagination on single-custom.php

## What I am looking to do: Setup `WP_Query` pagination in a single-custom-post-type.php template file ## What I have done 1) Created a post type called "authors". Each post within that post type is an individual author. 2) Standard edit post screen pages contain a dropdown which lists all posts (authors) from the authors custom post type. 3) Created a single-authors.php template which query's all posts with the author metadata from the dropdown, so the result is a list of posts that have the same author assigned to them (kind of like an archive):               <?php          // set the "paged" parameter (use 'page' if the query is on a static front page)     global $paged;          /*We need this here to add and maintain Pagination if Template is assigned to Front Page*/     if ( get_query_var( 'paged' ) ) {         $paged = get_query_var('paged');     } elseif ( get_query_var( 'page' ) ) {         $paged = get_query_var( 'page' );     } else {         $paged = 1;     }          $args = array(         'posts_per_page'    =>  10,         'meta_key'          => 'author_select',         'meta_value'        => $author_id,         'paged'             => $paged,     );          $temp = $wp_query;     $wp_query = NULL;          $wp_query = new WP_Query($args);          ?>          <?php if( $wp_query->have_posts() ) : ?>             <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>         <?php // Successfully outputs the results of the above query, so I've omitted the code from this example. ?>              <?php endwhile; ?>
          <?php if( get_adjacent_post( false, '', true ) ) { ?>             <?php previous_post_link( '< %link' ) ?>         <?php } ?>              <?php if( get_adjacent_post( false, '', false ) ) { ?>             <?php next_post_link( '%link >' ) ?>         <?php } ?>
     <?php endif; ?>          <?php         $wp_query = null;         $wp_query = $temp;         wp_reset_query();     ?>      ## What I am stuck on The pagination links do not appear. I have done some research and have found that they use the `$wp_query` variable, however when I changed my query variable to `$wp_query`, the links appeared, but when clicked did nothing. Any idea where I am going wrong? ## Edit: To answer some of your questions, my query successfully outputs the posts that I am querying, $author_id already has a value that I did not include in this code snippet. Similarly, I left out the actual content output within the while loop because that part is not the issue. The issue is that I need to paginate the content that already exists on this single post. The purpose of this functionality was to allow posts to have custom authors (outside of the built in Users system) and this template's purpose is to output all of the posts for a given author (which is already working).


Placing auto-complete results Where I want them in my HTML

I have some code in my functions.php that creates a list of auto-suggested items based on a form's text:               <?     add_action('wp_enqueue_scripts', 'se_wp_enqueue_scripts');     function se_wp_enqueue_scripts() {         wp_enqueue_script('suggest');     }          add_action('wp_head', 'se_wp_head');     function se_wp_head() {     ?>     <script type="text/javascript">         var se_ajax_url = '<?php echo admin_url('admin-ajax.php'); ?>';          jQuery(document).ready(function() {     jQuery('#love-input').suggest(se_ajax_url + '?action=se_lookup', {         onSelect: function() {             thevalue = this.value;             thevalue = thevalue.split(' (');             jQuery('#love-input').val(thevalue[0]);         }     });     });          </script>     <?php     }          add_action('wp_ajax_se_lookup', 'se_lookup');     add_action('wp_ajax_nopriv_se_lookup', 'se_lookup');          function se_lookup() {         global $wpdb, $wp_query;              $search = like_escape($_REQUEST['q']);              $query = 'SELECT ID,post_title FROM ' . $wpdb->posts . '             WHERE post_title LIKE \'%' . $search . '%\'             AND post_type = \'loves\'             AND post_status = \'publish\'             ORDER BY post_title ASC';         foreach ($wpdb->get_results($query) as $row) {             $post_title = $row->post_title;             $id = $row->ID;          $post_count = $wpdb->get_var("                     SELECT COUNT(*) FROM $wpdb->postmeta                     WHERE post_id = $id                     ");             echo $post_title . ' (' . $post_count . ')' . "\n";         }         die();     }          ?>      I'm trying to place this box under the text field, but the output it always a with a class "ac_results" that appears at the very bottom of the html. Problem is I don't know where this and class are coming from?? It's not in admin- ajax.php, and I'm not calling any other files.. or does wordpress do this automatically? How Can I tell it exactly where to appear in my html?


Create a "Dummy" parent page for a hierarchy in page listing?

**Is it possible to set up a "dummy" page - just a page title that appears in the page listing, and a page that is not editable and doesn't have a slug?** This is more of a hypothetical question, as I don't know where to start with code or determine the best way to go. I'd like to have the option to set up such a parent/child hierarchy in the page listing so that the child pages fall under the parent, but the parent page is just a placeholder and not a real page. The reason: for users without lots of experience in WordPress, it's helpful to organize pages in a parent/child hierarchy - especially if there are lots of pages - so that that related pages are more organized in the page listing. Users can also visualize building a menu, too, if child pages are organized under a parent. The problem is the parent page can be editable and not part of the established page content, and in my experience, this leads to user confusion. I can use a function to remove the editor for a specific page and use entires in robots.txt to not index the dummy parent, but that means changing those for a new parent. And that parent page still has a slug, even if blocked wit _So is there a way to create a function that creates a page title and with the ability to assign child pages, but have the parent page unopenable, uneditable and not have a slug?_ ![enter image description here](http://i.stack.imgur.com/hAlh5.png)


How to check if a categoryID exists in a theme options page

I have tried to make a theme options page (starting with a sample theme options page from themeshaper) and I want to check if a comma separated list of categories is valid. Remove duplicates, remove non-existing categories, but it doesn't work. :( It is deleting the last value if I check with empty():               function theme_options_validate( $input ) {         if ($input['slidercats'] != '') {               $slidercats = $input['slidercats'];             $slidercats_array = explode( ',', $slidercats );             $slidercats_array = array_unique( $slidercats_array );             $slidercats_array = array_map('intval', $slidercats_array );                  foreach($slidercats_array AS $i => $value)               {                   $cat = get_category($i); // cat_ID                 if ( empty( $cat ) )                     unset($slidercats_array[$i]);             }                    $input['slidercats'] = implode(",", $slidercats_array);                   }              return $input;     }      http://pastebin.com/xR1aq6mD And it is deleting all values but one with `term_exists(id, 'category');`               function theme_options_validate( $input ) {         // global $select_options, $radio_options;              // Change to integer         $input['slidercount'] = (int)$input['slidercount'];         if ($input['slidercount'] < 1 || $input['slidercount'] > 50)             $input['slidercount'] = 10;              // Make array from string, remove duplicates, change all values to integer, remove non existing categories, make string from array         if ($input['slidercats'] != '') {               $slidercats = $input['slidercats'];             $slidercats_array = explode( ',', $slidercats );             $slidercats_array = array_unique( $slidercats_array );             $slidercats_array = array_map('intval', $slidercats_array );                  foreach($slidercats_array AS $i => $value)               {                   $cat = term_exists($i, 'category'); // cat_ID                 if ( ! $cat )                     unset($slidercats_array[$i]);             }                   $input['slidercats'] = implode(",", $slidercats_array);                   }              return $input;     }      http://pastebin.com/edx8F1YZ The problem is the `foreach`, but I'm stuck and no php guru. Maybe someone could give me a hint how to solve this ...


username in rewritten URL, howto use it in a template

on my site user profiles can be accessed on /user/xxx. Now i created a rewrite rule and all user links are handled on the template page. But how can i access the xxx(user) in the template file? The page should display the profile of xxx. Rewite rules:               add_filter( 'query_vars', 'wpleet_rewrite_add_var' );     function wpleet_rewrite_add_var( $vars )     {     $vars[] = 'user';     return $vars;     }     add_rewrite_tag( '%user%', '([^&]+)' );     add_rewrite_rule(     '^user/([^/]*)/?',     'index.php?user=$matches[1]',     'top'      );      add_action( 'template_redirect', 'wpleet_rewrite_catch' );      function wpleet_rewrite_catch()      {      global $wp_query;           if ( array_key_exists( 'user', $wp_query->query_vars ) ) {         include (TEMPLATEPATH . '/user-profile.php');         exit;     }     }


Category count inside the link

Is it possible using `wp_list_categories` set count of post in category in the `href`?


How to include a file for admin and 2 pages without being loaded on other parts of the site?

I need to include a file twice. once in admin, another in its component.               if( is_admin() || is_the_component() ) require...       But, there's a big function in the class for registering stuffs is only needed at plugin activation. What's more, I want to make the class a super GLOBAL.               $GLOBALS['user_data'] = new My_Class();      This makes me feel it's a bit too heavy to carry the big registering function all over the site. Should I re-arrange the class to exclude the function?


List the authors that have written posts in a category

How can I list the authors of posts in a category in WordPress? On my blog have three authors and I want to list who written the posts in a category. For example:               CAT NAME: INTERNET     AUTHOR: JOHN, DOE, ALEX     CAT NAME: TECH         AUTHOR: JOHN     CAT NAME: CODE         AUTHOR: ALEX


Display commenter's registration date on comments?

Is there any way to display a user's (registered) registration date on the comment. Lets say i have a written an article, registered users A, B, C and D left a comment on my article. I can display comment date, commenter's name and email by default . I want to display the commenter's registration date also. How can this be done?


How to list posts that appear in two categories

I would like to list all posts that appear in the current category being viewed that are also posted to a second category. Example Pictures : LINK For instance, a listing of the common posts between the Headline category and the Media category if Media is currently being viewed.


Need help "sanitizing" a custom function that pulls category slug into body class

Not sure if "sanitizing" is really the correct phrase to use for this but it was the best one I could think of...anyways, here is the problem: My function works great like so...               // add category id to body & post classes      function category_id_class($classes) {         global $post;         foreach((get_the_category($post->ID)) as $category)             $classes [] = $category->cat_name;             return $classes;     }     add_filter('post_class', 'category_id_class');     add_filter('body_class', 'category_id_class');      That works great until the user inputs a category such as "Category 1" with a _space_. Spaces are obviously not desirable as CSS classes so if we could maybe just have a dash added to replace the space that would be perfect - just not sure how to accomplish that? Thanks!


Using a portfolio_category slug in wordpress URL

I won't lie - I don't know php but I enjoy digging around trying to find ways to customize themes so that they behave how I want them to. Any help would be very much appreciated. What I am trying to do: There is a section in a wordpress theme I am using which allows you to publish portfolios. The URL for any portfolio page would be: **mysite.com/portfolio/example-portfolio** When creating a new portfolio, you are given the option to assign a portfolio category, much in the same way as when you create a new post. I would like to be able to have my portfolio URL's appear like this: **mysite.com/portfolio-category/example-portfolio** I have highlighted an area of code I suspect might be editable to allow for this, but that is where my adventure sadly ends :( Here is the code:               function mysite_post_types() {         register_post_type('portfolio', array(             'labels' => array(                 'name' => _x('Portfolios', 'post type general name', MYSITE_ADMIN_TEXTDOMAIN ),                 'singular_name' => _x('Portfolio', 'post type singular name', MYSITE_ADMIN_TEXTDOMAIN ),                 'add_new' => _x('Add New', 'portfolio', MYSITE_ADMIN_TEXTDOMAIN ),                 'add_new_item' => __('Add New Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),                 'edit_item' => __('Edit Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),                 'new_item' => __('New Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),                 'view_item' => __('View Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),                 'search_items' => __('Search Portfolios', MYSITE_ADMIN_TEXTDOMAIN ),                 'not_found' =>  __('No portfolios found', MYSITE_ADMIN_TEXTDOMAIN ),                 'not_found_in_trash' => __('No portfolios found in Trash', MYSITE_ADMIN_TEXTDOMAIN ),                  'parent_item_colon' => ''             ),             'singular_label' => __('Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),             'public' => true,             'exclude_from_search' => false,             'show_ui' => true,             'capability_type' => 'post',             'hierarchical' => true,             'rewrite' => array( 'with_front' => false, 'slug' => 'products' ),      I have worked out how to change 'mysite.com/ **portfolio** /example-portfolio' to 'mysite.com/ **products** /example-portfolio' (on the last line in the example) but I don't want to stop there! Since you can categorize the portfolios I would like to take advantage of this in the URLs which are generated. This is surely possible with not too much work involved, and I would be very grateful if somebody with more php knowledge than myself (which doesn't take much!) could let me lean on them for a solution thanks


Creating a better multi-site search experience

We have a multi-site wordpress blog with the following characteristics:   1. "home" site [site #1] with dozens of pages, some custom post types, our own blog, etc.   2. custom partner sites [site 2-N] each with their own customized blog and (at least) an "about us" page. Mostly a simple set of pages & posts. I'd like to build a good search experience for users who are trying to find a particular partner's pages:   * search for site 1 content has high quality (default wordpress search doesn't seem to be very good)   * search also returns pages from sites 2-N, only for blogs that are public   * specific custom fields of posts on sites 2-N are indexed   * if content is found on site 2-N's about page, the site's home page is suggested in a separate area. ie. this is "partner results" rather than "content results"   * we don't need to index tags, categories, etc. in fact based on how we are (ab)using them they might get in the way of good search I am technical and can build something using whatever APIs are available, for instance Google custom search, etc. But I'd love it if there is already a network-wide search plugin that will let me configure this (or at least give me a head start and APIs.) Commercial plugins are okay. Are there any good solutions or is custom development the best option?


Slideshow with thumbnails

I have a simple demo here to illustrate my problem. http://www.ttmt.org.uk/wordpress/ It's a slideshow of images that is using the cycle plugin - http://jquery.malsup.com/cycle/ The images are added directly to the content of the page and the div containing the content is passed to the cycle function. My problem is I would like to have thumbnails of the images underneath. I have seen a few WordPress plugins that do this but they ALL need the images to be the same dimensions for it to work. My images have the same height but the width are different. Is there a plugin thats can do this with images that are different widths. If not can anyone recommend how I might do this. I really hope this is at least possible - it seems so simple but i can't find a solution anywhere.


Create a dashboard-style site (not Wordpress dashboard) - is there a theme?

Trying to figure out if there are any themes out there I could use to create a dashboard web site. (basically want to create something to point to all the ancillary services I use - backup, analytics, stock images, web host, etc.) It is practically impossible to Google an answer - because once you use the term dashboard along with Wordpress every result refers to the Wordpress admin dashboard (whereas I'm just looking to create a site/page) Anyone know of a dashboard-style theme?