title: List of categories instead of dropdown menu selector in admin options

text:
I am using the following code for in admin area for theme options               $categories = get_categories('hide_empty=0&orderby=name');       $tz_wp_cats = array();       foreach ($categories as $category_list ) {           $tz_wp_cats[$category_list->cat_ID] = $category_list->cat_name;           }       array_unshift($tz_wp_cats, "Choose a category");          // ==========================//     //             Start the theme options!                  //     // ==========================//              $themename = "Hype";         $shortname = "tz";              $options = array (              array(  "name" => __("selected", 'framework'),         "id" => $shortname."_selectedtab",         "std" => "",         "type" => "hidden"),              array(  "type" => "opentab"),              array(  "type" => "open"),                   array(  "name" => __('Logo and Favicon Settings', 'framework'),         "id" => $shortname."_logo_settings",         "type" => "title"),              array(  "name" => __("Upload Logo", 'framework'),         "desc" => __("Enter the full URL of an image you would like to use as a logo e.g http://www.example.com/logo.png", 'framework'),         "id" => $shortname."_logo_url",         "std" => "",         "type" => "file"),              array(  "name" => __("Enable plain text logo",'framework'),         "desc" => __("Check this box to use a plain text logo rather than an image. Info will be taken from your WordPress settings.", 'framework'),         "id" => $shortname."_plain_logo",         "std" => "false",         "type" => "checkbox"),              array(  "name" => __("Favicon URL", 'framework'),         "desc" => __("Enter the full URL of your favicon e.g. http://www.example.com/favicon.ico", 'framework'),         "id" => $shortname."_favicon_url",         "std" => get_bloginfo('template_directory')."/favicon.ico",         "type" => "file"),              array(  "type" => "close"),              array(  "type" => "closetab")              );              /*Add The Theme Options Page*/         function mytheme_add_admin() {              global $themename, $shortname, $options;              if ( $_GET['page'] == basename(__FILE__) ) {                  if ( 'save' == $_REQUEST['action'] ) {                          $url = $_REQUEST['tz_selectedtab'];                     if ($url == ''){                         $url = 'themes.php?page=theme-options.php&saved=true&tab=1';                     } else {                         $t = substr($url, -1);                         $url = 'themes.php?page=theme-options.php&saved=true&tab='.$t;                     }                          foreach ($options as $value) {                         if ( ($value['id'] != 'tz_logo_url') && ($value['id'] != 'tz_favicon_url') ){                             update_option( $value['id'], $_REQUEST[ $value['id'] ] );                          }                        }                          foreach ($options as $value) {                         if ( ($value['id'] != 'tz_logo_url') && ($value['id'] != 'tz_favicon_url') ){                             if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); }                          }                     }                           // If files has been uploaded, move them to the /uploads dir and update the option value                 if (  (isset($_FILES['tz_logo_url'])) && ($_FILES['tz_logo_url']['error'] == UPLOAD_ERR_OK)  ) {                     $overrides = array('test_form' => false);                      $file = wp_handle_upload($_FILES['tz_logo_url'], $overrides);                     $urlimage = $file['url'];                     update_option('tz_logo_url', $urlimage);                 }                      if (  (isset($_FILES['tz_favicon_url'])) && ($_FILES['tz_favicon_url']['error'] == UPLOAD_ERR_OK)  ) {                     $overrides = array('test_form' => false);                      $file = wp_handle_upload($_FILES['tz_favicon_url'], $overrides);                     $urlimage = $file['url'];                     update_option('tz_favicon_url', $urlimage);                 }                          header("Location: ".$url);                     die;                  } else if( 'reset' == $_REQUEST['action'] ) {                      foreach ($options as $value) {                     delete_option( $value['id'] ); }                      header("Location: themes.php?page=theme-options.php&reset=true");                 die;                  }         }              add_theme_page($themename." Options", "Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');         }              function mytheme_admin() {              global $themename, $shortname, $options;              if ( $_REQUEST['saved'] ) echo '

'.$themename.' settings saved.

';         if ( $_REQUEST['reset'] ) echo '

'.$themename.' settings reset.

';          ?>             <?php // now style the actual theme options page ?>

<?php _e('Theme Options', 'framework') ?>
                      <form method="post" action="" enctype="multipart/form-data" style="overflow:hidden;">                 <input type="hidden" name="selectedtab" id="selectedtab" value="0"/>

<?php _e('General', 'framework') ?>

<?php _e('Navigation', 'framework') ?>

<?php _e('Homepage', 'framework') ?>

<?php _e('Post Settings', 'framework') ?>

                          <?php                      $tab = 1;                     foreach ($options as $value) {                      switch ( $value['type'] ) {                          case "opentab": ?>                     <div id="tabs-<?php echo $tab;?>">                     <?php                      $tab++;                     break;                          case "closetab": ?>
                     <?php                     break;                          case "open": // style the opening                     ?>
                          <?php                      break;                          case "note": // style the notes                     ?>

<?php echo $value['desc']; ?>

                          <?php                      break;                          case "title": // style the titles                     ?>
<?php echo $value['name']; ?>

                                  <?php break;                          case "hidden": ?>                          <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="hidden" value="<?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(htmlspecialchars(get_settings( $value['id'] ), ENT_QUOTES)); } else { echo $value['std']; } ?>" />                               <?php break;                          case "text": // style the text boxes                     ?>

                             <?php echo $value['name']; ?>:

                             <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(htmlspecialchars(get_settings( $value['id'] ), ENT_QUOTES)); } else { echo $value['std']; } ?>" />
<?php echo stripslashes(htmlspecialchars($value['desc'])); ?>

                          <?php break;                          case "colour": // style the text boxes                     ?>

                             <?php echo $value['name']; ?>:
                         <div id="colourpicker-<?php echo $value['id']; ?>">

                             <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(htmlspecialchars(get_settings( $value['id'] ), ENT_QUOTES)); } else { echo $value['std']; } ?>" />
<?php echo stripslashes(htmlspecialchars($value['desc'])); ?>

                               <?php break;                          case "file": // style the upload boxes                     ?>

                             <?php echo $value['name']; ?>:

                                     File:	                                     <input type="file" name="<?php echo $value['id']; ?>" class="tz-upload" size="40" border="0" />

<?php _e('Current file:', 'framework') ?> <?php echo get_option($value['id']); ?>

                               <?php break;                          case "textarea": // style the textareas                     ?>

<?php echo $value['name']; ?>:

                     <textarea name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>"><?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(htmlspecialchars(get_settings( $value['id'] ), ENT_QUOTES)); } else { echo $value['std']; } ?></textarea>
<?php echo stripslashes(htmlspecialchars($value['desc'])); ?>

                               <?php break;                          case "checkbox": // style the checkboxes                     ?>

<?php echo $value['name']; ?>:

                     <?php if(get_option($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = "";} ?>
<input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />                     <?php echo stripslashes(htmlspecialchars($value['desc'])); ?>

                               <?php break;                          case "select": // style the select                     ?>

<?php echo $value['name']; ?>:

                     <select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>"><?php foreach ($value['options'] as $option) { ?><option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?></select>
<?php echo stripslashes(htmlspecialchars($value['desc'])); ?>

                               <?php break;                          case "close": // style the closing                     ?>

                             <input name="save" type="submit" class="button" value="Save Settings" />                                 <input type="hidden" name="action" value="save" />
                          <?php break;                     }                  }                 ?>

                           </form>                 <form method="post" action="">
                         <input name="reset" type="submit" class="button" value="Reset" />                         <input type="hidden" name="action" value="reset" />                         <?php _e('Caution: will restore theme defaults', 'framework') ?>
                 </form>
              <?php         }                    add_action('admin_menu', 'mytheme_add_admin');               // ==========================//     //             END the theme options!                   //     // ==========================//          ?>      So it looks like this example I would like to list all categories and generates unique ID automatically. I am only able to make dropdown selector but I need to list all categories; i.e. Something like               array(  "name" => __("Categories", 'framework'),     "desc" => __("Category color #1", 'framework'),     "id" => $shortname."_cat_color#1",     "std" => "#",     "type" => "text"     "desc" => __("Category color #2", 'framework'),     "id" => $shortname."_cat_color#2",     "std" => "#",     "type" => "text"     "desc" => __("Category color #3", 'framework'),     "id" => $shortname."_cat_color#3",     "std" => "#",     "type" => "text"),      Any suggestions, please?


title: Wordpress menu performance is slow when lot of items

text: I have a menu with more than 100 items in total and it is very slow to manage all those, slow respond and slow saving. Is there any plugin to somehow improve performance and make my life easier in a big number of items?


title: How to disable lightbox popup for "add a review" only?

text: By default in woocommerce when a user wants to add a review of a product, they click 'add a review' and this opens up a pop-up lightbox. I want to disable this part and just display the review form. Anybody has any ideas?


title: how can redirect sign in and sign out link front-end page rather then wp-login .php in comment form in wordpress

text: I want to redirect the signin and signout link from comment form in Wordpress. I am using a plugin to register users from the front-end; there I have two pages: sign-in and register. When someone registers from this page and logs in from this page, then its working fine. But when someone is going to give a comment to a post and is not logged in, then a link shows directing the user to login. Upon clicking this link it goes to `wp-login.php`, but I want to redirect this link to my sign-in page and after sign in the sign out link should go to this page as well. How can I do this?


title: How to display both home.php and index.php

text: Hey guys i recently created a theme. I want to show home.php when a visitor visit home page but all my blog posts are listed in index.php file. Can someone suggest me how to display index.php i tried http://www.mysiteurl.com/index.php but it redirecting me to http://www.mysiteurl.com/home.php Please advise me. Thanks


title: Associate custom post types with normal posts

text: I have a custom post type, called App. This has details like the name, description, thumbnail image, and some custom fields. Then I have posts about this app, that I'd like to associate with it. In the end, I'd like to be able to view the custom post type and all the posts that are associated with it. But I don't see any way to associate a post with anything besides a category or tag. But categories and tags don't allow for custom fields, images, etc. Is the only way to create a category with the same name as the custom post type, and then do something like have a custom field in that custom post type that has the ID of that category? Thanks!


title: Using GD Star Rating outside of the loop?

text: I need to insert a rating straight away after having programmatically created a post in WordPress and added a comment. What is the (GDSR) function to call to fire the rating once I've got the post id/comment id?


title: What's a good RSS Importer?

text: I'm looking for a good RSS importer to use on my WordPress installation. The current one isn't importing images properly, and I don't want to fix it. It needs to be an automated importer. Where I give it the link to the feed and it auto imports automatically every set interval. It also needs to import into a category, not a page. I'm currently using FeedWordPress, just so no one suggests that as an option.


title: show all in query_posts on category.php?

text: I want to be able to switch back and forth by clicking an anchor tag preferably, between showing a subset of posts and showing all posts, the code I am using is:               query_posts($query_string . '&posts_per_page=-1');      or               query_posts( array(     'posts_per_page' => 45,     //'paged' => ( get_query_var('page') ? get_query_var('page') : 1 ),     ));      (paged isn't working) Any way to do this? The problem is I need the 45 limit to show by default, and then a show all anchor tag or button that the user can click. Any help would be much appreciated! Thanks! Donna


title: Enqueue scripts inside a class

text: I have written a small class that will handle enqueues in my theme :               <?php          class Header {              public function init_hooks()         {             add_action('wp_print_scripts', array(__CLASS__,'include_all_files'));         }              public function include_css_files()         {             wp_register_script('style.css', get_bloginfo('stylesheet_url'));             wp_enqueue_script('style.css');         }              public function include_js_files()         {             wp_register_script('jquery-min', "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");             wp_enqueue_script('jquery-min');                 }              public function include_all_files()         {             $this->include_css_files();             $this->include_js_files();         }          }          ?>      I call it right before closing the head tag, like :               $header = new Header();     $header->init_hooks();       But it does not work. There is no error, but no script is added. Any ideas ?


title: Name of JQuery technique used on this site

text: What is the effect or jquery plugin used to create the on hover video effect used on this site? http://www.iwc.com/it/collezione/


title: Cleared wp-cache and file is still not updated

text: I did all the following:   * Deleted the cache in the WP Super Cache settings   * Added `define('DISABLE_CACHE', true);` in my wp-config.php   * Deleted my 'cache' folder under 'wp-content' However a theme php file is still not updating. Can anyone help me?


title: Creating custom menu with custom themes

text: I have created my own custom WordPress theme and am now trying to implement the custom menu. I noticed with the default theme that when I went to _Appearance > Menus_ , I was able to create my menu based on the pages I had, but after installing my own custom theme, I could not locate _Appearance > Menus_. And by that I mean there was no _Menus_ option under _Appearance_ in WordPress. So now I do not know how to go about it, because this is my first WordPress site.


title: How can I upload SVG images using the media uploader?

text: I really love using SVG images as I can scale them as big or as small as I want. However, WordPress won't allow me to upload them using the media uploader. How can I change this? ![media uploader error](http://i.stack.imgur.com/3FaNI.png)


title: How do you publish a draft on Wordpress

text: I can't work out how to publish a draft. I go to preview, to check everything's ok, and then there doesn't seem to be any option to do anything more.


title: echo or print_r in an admin function

text:
I'm currently working my first plugin (to deal with my CPT) and am at the process of saving the values of a meta box. I wish to add an underscore (`_`) to the meta key so that it is hidden on the custom field part. I have some trouble to get the data saved when this `_` is added (no problem when there's no `_`). So I try to investigate what goes in the meta array, but I can't manage to have an `echo` or `print_r` within a function in my plugin that would print on my admin page. I have wrote the following               function ccp_portfolio_item_info_meta_box_save( $post_id, $post ) {              if ( !isset( $_POST['ccp-portfolio-item-info-nonce'] ) || !wp_verify_nonce( $_POST['ccp-portfolio-item-info-nonce'], basename( __FILE__ ) ) )             return;              $meta = array(             '_portfolio_item_url' => esc_url( $_POST['ccp-portfolio-item-url'] )         );              print_r($meta);         // ccp_split_meta_save ($meta, $post_id, $post); // calling my function to split the metas     }      but that would not print my `$meta` on top of my admin page, what am I doing wrong? @brasofilo thank you for your answer first my form is as follow               function ccp_portfolio_item_info_meta_box_display( $post, $metabox ) {              wp_nonce_field( basename( __FILE__ ), 'ccp-portfolio-item-info-nonce' ); ?>
             <?php _e( 'Project URL', 'custom-content-portfolio' ); ?>
             <input type="text" name="ccp-portfolio-item-url" id="ccp-portfolio-item-url" value="<?php echo esc_url( get_post_meta( $post->ID, '_portfolio_item_url', true ) ); ?>" size="30" tabindex="30" style="width: 99%;" />
         <?php              /* Allow devs to hook in their own stuff here. */         do_action( 'ccp_item_info_meta_box', $post, $metabox );     }      then my save function is :               function ccp_portfolio_item_info_meta_box_save( $post_id, $post ) {              if ( !isset( $_POST['ccp-portfolio-item-info-nonce'] ) || !wp_verify_nonce( $_POST['ccp-portfolio-item-info-nonce'], basename( __FILE__ ) ) )             return;              $meta = array(             '_portfolio_item_url' => esc_url( $_POST['ccp-portfolio-item-url'] )         );                   ccp_split_meta_save ($meta, $post_id, $post); // calling my function to split the metas     }      up to there all is fine, when I print_r the $metal, it show the right thing then within the previous function I call this one               function ccp_split_meta_save ($meta, $post_id, $post) {          echo 'je suis dans ccp_split_meta_save
';     print_r($meta);         //exit();              foreach ( $meta as $meta_key => $new_meta_value ) {                      /* Get the meta value of the custom field key. */                 $meta_value = get_post_meta( $post_id, $meta_key, true );                      echo '
la meta key est '.$meta_key.'
';                 echo '
la meta value  est '.$meta_value.'
';                 // exit();                      /* If there is no new meta value but an old value exists, delete it. */                 if ( current_user_can( 'delete_post_meta', $post_id, $meta_key ) && '' == $new_meta_value && $meta_value )                     {//delete_post_meta( $post_id, $meta_key, $meta_value );                     echo '
je suis dans delete
';                     }                      /* If a new meta value was added and there was no previous value, add it. */                 elseif ( current_user_can( 'add_post_meta', $post_id, $meta_key ) && $new_meta_value && '' == $meta_value )                 {                     //{add_post_meta( $post_id, $meta_key, $new_meta_value, true );                     //echo '
 c est une nouvelle meta value
'; exit();                     echo '
je suis dans add
';                 }                        //}                      /* If the new meta value does not match the old value, update it. */                 elseif ( current_user_can( 'edit_post_meta', $post_id, $meta_key ) && $new_meta_value && $new_meta_value != $meta_value )                 {   //update_post_meta( $post_id, $meta_key, $new_meta_value );                     echo '
je suis dans update
';                 }                 else                  {                 echo '
je suis nul part
';                 echo 'add_post_meta : ' .current_user_can( 'add_post_meta', $post_id, $meta_key ).'
';                 }              exit();         }          }      as you see it is a working/denug function since I have put some pointer to see where my datas are the strange thing is that if I have $meta = array( 'portfolio_item_url' => esc_url( $_POST['ccp-portfolio-item- url'] ) then it goes well to elseif ( current_user_can( 'add_post_meta', $post_id, $meta_key ) && $new_meta_value && '' == $meta_value ) so a new entry is add to the db if I have $meta = array( '_portfolio_item_url' => esc_url( $_POST['ccp-portfolio-item- url'] ) then it goes to my last else, which means nowhere if I print $meta_value = get_post_meta( $post_id, $meta_key, true ); then it well return an empty value so that would direct me to                       /* If a new meta value was added and there was no previous value, add it. */             elseif ( current_user_can( 'add_post_meta', $post_id, $meta_key ) && $new_meta_value && '' == $meta_value )             {                 //{add_post_meta( $post_id, $meta_key, $new_meta_value, true );                 //echo '
 c est une nouvelle meta value
'; exit();                 echo '
je suis dans add
';             }         but no it is not I just don't understant that why adding only the underscore makes trouble thank you in advance for your help @ toscho, sorry I did not really understand how to update my question, but it looks like I found out.. thank you and sorry for my rookiness


title: How to publish new posts/pages in root instead of subfolder, but keep old structure in place?

text: I have a blog that was setup in `example.org/blog/` many years ago, so all its files are in `/blog/`. Back then it seemed like a good idea, but now we want to _slowly_ get rid of the subfolder. Of course I could move the installation to the root folder `/`, change the wordpress url in option and just move everything, add a htaccess redirect from `/blog/*` to `/*` so old links still work. **But** we want to do it slowly because moving all the content at once would be a major risk and possible desaster for the Google rankings and traffic. 301/302 redirects are fine, but Google is not very happy if you move thousands of articles at once while the links stay the same. So new content first, then old stuff. **Is there any way to only publish _new_ posts and pages in `example.org/` instead of `example.org/blog/`?** I'm capable of all kinds of hacks. I already have several blogs running with the Wordpress installation in subfolders, have redirected and moved blogs all over the place and written scripts to change the values of all rows in a database table. Bring it on :)


title: Custom walker to generate menu with integrated breadcrumb dropdowns

text: Have been trying to write a custom walker class which returns a wp_custom_menu as follows. http://i.stack.imgur.com/lC5cP.png Planning to enhance the different states with some scripting. The page at http://www.htmldrive.net/items/demo/169/jQuery-Plugin-xBreadcrumbs-Extended- Breadcrumbs-navigation is a good example of the planned end result. Could not find any leads nor howtos, some ideas would be fabulous! Many thanks, F.


title: Adding a custom field into the_content()

text: Anyway to add a custom field into the_content() somehow? I have the AddThis plugin on my site and it shows up at the bottom of my site right before my custom field, I would like my custom field to show up at the very end of the_content() and then have the AddThis stuff show up. Anyway to do this?


title: Add suffix to filename of uploaded images

text: I registered 3 custom image sizes (Double sized, for retina displays) with add_image_size: thumbnail@2x, medium@2x and large@2x.               function retina_image_sizes() {         $retina_sizes = array(             'thumbnail@2x' => array(             'width' => get_option( 'thumbnail_size_w' ) * 2,             'height' => get_option( 'thumbnail_size_h' ) * 2,             'crop' => get_option('thumbnail_crop'),             ),             'medium@2x' => array(             'width' => get_option( 'medium_size_w' ) * 2,             'height' => get_option( 'medium_size_h' ) * 2,             'crop' => false,             ),             'large@2x' => array(                 'width' => get_option( 'large_size_w' ) * 2,                 'height' => get_option( 'large_size_h' ) * 2,                 'crop' => false,             )         );              foreach ( $retina_sizes as $name => $data ) {             add_image_size( $name, $data['width'], $data['height'], $data['crop'] );         }     }     add_action( 'init', 'retina_image_sizes');      Wordpress's naming convention is filename-width x height.jpg. But I need them to be named in another fashion ( filename-originalwidth x originalheight@2x.jpg) If I upload a picture, and the thumbnail has a size of 100x100, for example, I want the images to be named:               example-100x100.jpg     and     example-100x100@2x.jpg      I found ways to process pictures and save them under another name, but that is too much. This question explains, how to change the filename, but, not how to include with and height information. I tried to get it to work, but I only get a single file instead of seven and it throws some errors (probably because it tries to overwrite the file). How can I change the filename in the above described fashion? Is the add_attachment hook the right one?


title: Multiple gallery thumnbnails on one page

text: I want to post multiple galleries on a single static page. So far, I've only been able to create a gallery that puts every single picture on that one page. What I want to achieve is several images on one page (thumbnails maybe) that represent different galleries, not the same one. How can I do that?


title: What is content.php file that is needed for Jetpack infinite scroll plugin?

text: I'm currently learning how to use Jetpack infinite scroll plugin, while going through the documentation I came across 'render' section: http://jetpack.me/support/infinite-scroll/ It uses default loop, which I actually need to customise, it also says that if I have content.php file in my template than I'm good to go and can omit render argument. However I don't know what content.php file is for. As for the loop and the markup of each post, those are defined in my index.php, single.php and page.php files. Could you please explain and give example of what content.php page is, where it should be located and how can it be used. I'm speculating that its a file where I can paste just my loop and post markup bit, so perhaps I can than somehow include content.php file in my index.php, single.php and page.php files maybe? Not sure. I did look for this in the codex, but surprisingly couldn't find explanation of content.php file.


title: How to remove a filter that is an anonymous object?

text: In my `functions.php` file I would like to remove the below filter, but I'm not sure how to do it since it's in a class. What should `remove_filter()` look like?               add_filter('comments_array',array( &$this, 'FbComments' ));      It's on line 88 here.


title: How to add posts to custom menus?

text: I'm just beginning to work the "Custom Menu" functionality that was introduced in 3.0 into my theme. I like everything about this new capability and API, with one exception: Why no posts? I can create menus containing pages, categories, even tags, but where is the posts selector? I know I could use the "Custom Links" tool as a workaround, by pasting in the URL to a given post, but I'd rather not expect my users to do that without creating a ton of support issues. I'd rather just add a menu box called "Posts" that has the same functionality as "Pages". Has anyone done this and if so can you share the code? Alternately, and I know I'm dreaming on this one, what about a single box with tabs for selecting between pages and posts?


title: I want to use ONLY Disqus and turn off default Comments

text: If I set "Comments: OFF" ( _Discussion_ > _Allow comments_ > _OFF_ ) on post - Disqus (and default WP Comments) does not show on single post. I founded in settings ( _Comments_ > _Disqus_ > _Plugin Settings_ ) " **Appearance** " and I selected " **Use Disqus Comments: Only on blog posts with closed comments.** " but it nothing changed - comments and Disqus do not exist on single post, and if I set "Comments: ON" for some post - exist only default form to add comment (Disqus does not show).


title: Change the "page" slug in pagination

text: Simple question. When pagination is activated, the URL changes to `"site.com/page/2"`. For my site, this should be `"site.com/paggetto/2"`. How can I change that rewrite rule? I also want to change `"author"` and other variables.


title: Advanced Integration - WordPress + YOURLS

text: I've been using a custom YOURLS system to create my own URL shortener for my blog network for a while now. Everything works just great with only a few exceptions (bugs already reported to the developer). But I'm aiming for something a bit more complicated that's not included in the existing WordPress YOURLS plug-in. ## Currently Right now, when a post is published, WordPress automatically logs in to YOURLS, creates a short URL, and pushes a notification to Twitter. It works well and keeps track of everything for me (the short URL is memorized by WordPress and inserted into appropriate `<meta>` tags as well). ## What I want to do I schedule my blog posts for 8am Pacific Time. This works well _if_ you're on Twitter at 8am. But some people are browsing at lunch. Some in the evening. I want to schedule automated re-tweets of my short URL from within WordPress. Some posts I want pushed out once ... others I want pushed out at 2 or 3 strategic times during the day. How would I go about doing this?


title: use wp_get_theme() to get theme author name

text: As of wordpress 3.4 we're supposed to use wp_get_theme to return theme data.               $theme = wp_get_theme();          //var_dump($theme);          echo $theme->Author;      despite the var_dump indicating the correct string, $theme->Author always returns a hyperlink with the author's name, but linked to the author's site. how can i get just the theme's author name?


title: Wikipedia - CMS

text: I am working on Wordpress - Blogging Application. Like Wikipedia or Livejournal .. How to allow a registered users in my Web- Blog site to write their blogs or contents ? If i need to write any blogs on my site, its simple normal process. But making the blogging site .. little bit of commercial by allowing the users to register and to blog on my site .. is our goal ..!


title: Exclude category from related post

text:
I made a related post sidebar widget and im trying to exclude a category from it i tried 'exclude'=>7932 but that doesnt seem to work, is there another way to do this?                           <?php $category = get_the_category();                 $parent = get_cat_id($category[0]->category_parent);                 $parent = $category[0]->cat_id; ?>
                 <?php                 $categories = get_the_category($post->ID);                 if ($categories) {                 $category_ids = array();                 foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;                 $args=array(                 'category__in' => $category_ids,                 'post__not_in' => array($post->ID),                 'showposts'=>5, // Number of related posts that will be shown.                 'caller_get_posts'=>1,                 'exclude'=>7932,                 );                      $my_query = new wp_query($args);                 if( $my_query->have_posts() ) {                 while ($my_query->have_posts()) {                 $my_query->the_post();                 ?>                 <?php $id = get_the_ID(); ?>                      <?php $image_meta = get_post_meta($id,'image',true); ?>

                 <?php if ( (isset($image_meta)) && ($image_meta != '') ) {                  woo_image('key=image&width=140&height=80');                 }else{  echo $small_placeholder;}   ?>
                 <a href="<?php the_permalink() ?>"><?php the_title(); ?>
<?php get_the_excerpt_limit( 75, '...' ); ?>

                             <?php                 }                 }                 }                 $post = $orig_post;                 wp_reset_query();                 ?>


title: How do I hide a term from non-admin users in get_the_term_list?

text: I have a term that I'd like logged in admin users to see while they're browsing the site while keeping it hidden from the public. I'd prefer to have it done at the lowest level possible, even so far as to prevent the term from showing up publicly with _any_ of the functions (e.g wp_list_categories). What's the best way to pull this off?


title: Contact Management Plugin suggestions, or tutorials/resources recommendations

text: I will soon be building a site for a local Non-Profit Art Community, and they would like a to have a powerful **contact/member management system** that can do these key things:   1. Store User Contact info (Address, Phone, Email, Website, regdate, etc.)   2. Synchronize with a newsletter mailing service, their preference is Emma. (Alternatively, the desired plugin could handle the newsletters internally)   3. Tag users with multiple tags, example would be Artist, Volunteer, Member.   4. Track membership and expiry, as well as payment history for Members.   5. Hopefully use the built-in Wordpress User area of the admin. My question is, can anyone recommend a plugin that can get me all the way, or part of the way there?


title: wp_insert_comment error. puzzled by date value

text: I am trying to programmatically insert comments in a bulk operation as part of migration routine. Comments are in a SQL server table. I receive the date info from the SQL server table field and store it in a PHP variable like the following way;                   while( $row = sqlsrv_fetch_array( $RS, SQLSRV_FETCH_ASSOC))         {                        ...             $the_date = $row['the_date'];             ...         }         var_dump view of the $the_date is as follows;               object(DateTime)#97 (3) {       ["date"]=>       string(19) "2012-07-30 00:00:00"       ["timezone_type"]=>       int(3)       ["timezone"]=>       string(3) "UTC"     }      then I prep my wp_insert_comment's data array.   var_dump view of that data array as follows;               array(7) {       ["comment_post_ID"]=>       string(5) "73615"       ["comment_author"]=>       string(14) "Joe  (USA)"       ["comment_author_email"]=>       string(20) "user@domain.com"       ["comment_content"]=>       string(2001) "commment text here"       ["comment_parent"]=>       int(0)       ["comment_date"]=>       object(DateTime)#97 (3) {         ["date"]=>         string(19) "2012-07-30 00:00:00"         ["timezone_type"]=>         int(3)         ["timezone"]=>         string(3) "UTC"       }       ["comment_approved"]=>       int(1)     }      After the wp_insert_comment operation, I get a 0 in return - indicating an error. And the following message stops the whole process.               Warning: preg_match() expects parameter 2 to be string, object given in F:\inetpub\....\wp-includes\formatting.php on line 1868          Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects parameter 1 to be string, object given' in F:\inetpub\....\wp-includes\formatting.php:1872 Stack trace: #0 F:\inetpub\....\wp-includes\formatting.php(1872): DateTime->__construct(Object(DateTime)) #1 F:\inetpub\....\wp-includes\comment.php(1238): get_gmt_from_date(Object(DateTime)) #2 F:\inetpub\...\comments.php(259): wp_insert_comment(Array) #3 F:\inetpub\...\comments.php(100): HandleComments(Resource id #25, '73615', 'services.articl...', 'XYZ1207-5206') #4 {main} thrown in F:\inetpub\....\wp-includes\formatting.php on line 1872      How can I go around this problem and store the date properly? 2012-07-30 00:00:00


title: Calling a div and content in php?

text:
Is there a code that i can place in the header that will call a certain div and the content i place inside it for every custom post type i have, Somthething like this.                <?php if (is_post_type('pretty-little-liars') ) {echo '

'; } ?>      I know that the code above doesn't work, but is there a way that i can call something like that for each post type i have, i will be placing this code in the header. Also if anyone does have the solution could you please tell me where do i add a second line to the code that repeats the first line but with a different post type name?


title: How to display a category list in a mediawiki like way?

text: I would like to reproduce on Wordpress the same behaviour of mediawiki when it comes to display the posts of a certain category (with an alphabetical order, in columns and using first letters in bold as section titles). Do you think it's possible ?if yes, how would I do that ? Currently I'm using a wordpress blog as a Laboratory Notebook and would like to add to it the good sides of a wiki. I already have the post revisions but this kind of category view is a plus I would like to add. It's one of the feature that makes me have difficulties to choose between both applications. Thanks in advance for your help.


title: Featured Image Link to next post?

text: Hello i wonder if anyone knows this is possible? A post featured image click to view next post...? For example..               <a href="next-post">      <?php the_post_thumbnail('post-thumbnails'); ?>     </a>      I assume its something from the WordPress pagination, as when it gets to the final post/image it needs to go back to the first one. Any idea if it can be done?


title: Override dynamic_sidebar() in plugin?

text: I'm writing a custom plugin that allows a particular page to have it's own sidebar with widgets. It works great so far, but what I'd like to do is generalize it more and allow the plugin to "override" the dynamic sidebar of any page (if it has a custom sidebar) without having to edit any template files. I've tried several hooks and have delved into the code a bit, but nothing stands our or works so far. To save some time I thought I'd see if anybody has any working solutions to this issue? I might be able to solve this issue, but it is straining my "after working hours" brain. If it isn't possible I'd be more than willing to have a short-code or function call that does this for me, but I'd really like to make it idiot proof and just have it work without any template changes.


title: Most viewed posts in Wordpress

text: I am owner of a blog/website and I am using this code for tracking post views in site :                 function getPostViews($postID){         $count_key = 'post_views_count';         $count = get_post_meta($postID, $count_key, true);         if($count==''){             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');             return "0 View";         }         return $count.' Views';     }     function setPostViews($postID) {         $count_key = 'post_views_count';         $count = get_post_meta($postID, $count_key, true);         if($count==''){             $count = 0;             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');         }else{             $count++;             update_post_meta($postID, $count_key, $count);         }     }      I want to fetch most viewed posts today, last week, last month to show in sidebar. Is there any way to sort posts based on post views. The post views is stored in a custom field post_views please guide me. Rias


title: Wordpress Url setting

text: AOA, I want to set my urls in wordpress something like this. http://www.digitalspinners.no/wp_mahasib/21-05-2012/abbotabad/page1 http://www.digitalspinners.no/wp_mahasib/21-05-2012/lahore/page1 but wordpress adds a dash and number to the end of url like this wp_mahasib/21-05-2012/lahore/page1-2 url explanation is : date/category/postname Any suggestion or improvement will be appriciated. Thanks


title: Custom rss feed template - Get featured image and custom fields

text: I use wp as a cms. I needed a custom-made template for my rss feeds, so that I could display custom fields of my posts in the feeds. I took the basic custom rss template suggested by Yoast and made some modification as I needed. It is working fine except that I am unable to retrieve the featured-post-thumbnail and other custom-field-values. Here is what my custom rss feed url looks like now - `http://website.com/custom-feed/` _Here is the complete code :_               <?php     /*     Template Name: Custom Feed      */          $numposts = 5;     function yoast_rss_date( $timestamp = null ) {       $timestamp = ($timestamp==null) ? time() : $timestamp;       echo date(DATE_RSS, $timestamp);     }          $posts = query_posts('showposts='.$numposts);     $lastpost = $numposts - 1;          header("Content-Type: application/rss+xml; charset=UTF-8");     echo '<?xml version="1.0"?>';     ?><rss version="2.0">     <channel>     <title>website content feeds</title>     <link>http://website.com/</link>     <description>The latest content from website.</description>     <language>en-us</language>     <pubDate><?php yoast_rss_date( strtotime($ps[$lastpost]->post_date_gmt) ); ?></pubDate>     <lastBuildDate><?php yoast_rss_date( strtotime($ps[$lastpost]->post_date_gmt) ); ?></lastBuildDate>     <managingEditor>director@website.com</managingEditor>     <?php foreach ($posts as $post) { ?>          <item>     <title><?php echo get_the_title($post->ID); ?></title>     <link><?php echo get_permalink($post->ID); ?></link>          <?php echo add_my_custom_field_node();?>          <description><?php $object = new WPSEO_Frontend(); echo $object->metadesc( false ); ?> </description>     <pubDate><?php yoast_rss_date( strtotime($post->post_date_gmt) ); ?></pubDate>     <guid><?php echo get_permalink($post->ID); ?></guid>     </item>          <?php } ?>     </channel>     </rss>      The code that I am trying to pull the thumbnail is suggested in a solution by @bainternet to a similar question and I have it between the `<link>` and `<description>` tags. But it is not doing anything. I tried using `<?php echo get_post_meta($post->ID, 'location', true);?>` for custom-feld-values to appear but it does not work either. Is there specific tags I should be using for the featured-image or custom-fields to appear, if so what tags and how do I use them? I also tried solution suggested here. What am I missing. Please guide, thanks. > FYI - My post descriptions are auto generated by the yoast-wordpress-seo > plugin so for descriptions I am using a custom code, which is working fine. * * * **UPDATE** : Reading the solution by @BenMiller to this question I understood that I have to use `rss2_item` action hook in order to add tags to my custom- rss-feed. Here is a the code in my functions.php now :                add_action('rss2_item', 'add_my_custom_field_node');          function add_my_custom_field_node() {         global $post;         $metaValue = get_post_meta($post->ID, 'location', true);         if(!empty($metaValue)):             echo("<my-custom-field>{$metaValue}</my-custom-field>");         endif;     }      * * * **SECOND UPDATE** : The other strange thing that I noticed is that when I checked my custom-rss-feed-url at validator.org. It shows my custom-field- values and the featured-image url with a .jpg extension but for some reason throws an error. `Undefined item element: my-custom-field`. I use livebookmarks to check feed-url and using firefox browser. I am totally confused.


title: Form post to Wordpress page = wrong template

text: I'm using permalinks and I have a page with a slug like this:               http://www.mysite.com/jobs/      The page uses a specific template for itself. On another page I have a form that I submit as POST to `http://www.mysite.com/jobs/`. However, when the form is submitted, it takes me to the proper `/jobs/` page, but the template is not correct. Even though the url is correct. I appears to use maybe the index or default template for some reason. If I click in the address bar of the browser and press enter to re-visit the same page, then the proper template appears. It's like submitting a POST form to this page makes it use the wrong template even though the permalink slug is exactly the same as when I visit it normally. Any clues?


title: Modify links in user comments

text: When a link is posted in a comment, the format is : rel="nofollow" Using a function, how can I change that to : rel="external nofollow _blank" So the links open in a new window?


title: stop all video players when starting an other to play?

text: I have a wordpress-page where many videos are posted. Some are embedded Vimeo or YouTube Videos, some are hosted on the server and played with wordpress-JW- Player Plugin. The thing is, on some pages there are up to 10 videos and in "worst" case, three different players. When the user watches a video, and then starts a second one, the first video should stop automatically. My question is: is there a Wordpress-compatible-JavaScript/WP-Plugin/etc. which provides such a behavior, when the user starts a second video the first one shell stop (and if he starts a third, then the second one shell also stop, and so on). Or do I have to configure the WP-Plugin of JQ Player in an other way? **UPDATE** I found this script, but it seems no to do anything in my case ... (I don't get any errors - it seems just to do nothing)


title: Network Unreachable error on Google Webmaster Tools at Child-Sitemap

text: My URL is: http://www.chemicalsubjects.com Hi, I have an issue with my wordpress site sitemap.xml 's some child sitemaps. It sometimes gives an HTTP 503 crawl error: Unreachable network. I think that is issue with godaddy server-side. I get this error mostly from this sitemap link: http://www.chemicalsubjects.com/sitemap-pt-post-2011-07.xml . When i click test sitemap, then it works. But after 4-5 hours later and when i look at my sitemap then it doesnt work and status is pending. I did fetch as google bot , so everythings fine on those pages. But why sometimes my sitemap goes down? Why godaddy server is often down for my main website sitemap.xml? This is godaddy reply: When using 3rd party applications or sites to monitor a site those particular robots that are trying to request information may be requesting so much that our hosting accounts will actually block the requests. in your case with the 503 message that is what happens when a request of information happens often. There is nothing wrong with the hosting account its just how our system protects the hosting account and your site. And I asked: I also use jetpack but I have disabled its statistics monitor but auto twitter,facebook posting enabled, and I have limit login attempts, wp-united, ithemes security, akismet, google analytics plugins installed. Which plugin may cause this system with so much traffic? So, which plugin may cause to too much requests? Then I have found something onto my mind; when i create an article on wordpress , a lot of jetpack crawlers comes to my website, also i have auto twitter,facebook and g plus posting option when an article is posting and when an article posted after i looked to my google webmaster tools i saw my wordpress sitemap is on hold (status is pending) So what is that meaning? Which option can cause this issue? I also have some security precautions with ithemes security plugin.


title: Set a cookie only in single posts

text: I'm trying to set a cookie when a user is on a single post. I'm keeping track of how many single posts he has read this month. I have two problems: I have a custom template and added the following code to my functions.php               function articlesVisited() {       if (is_single()){         $postNumber = $wp_query->post->ID;         setcookie($postNumber,'visited',time()+60*60*24*31);       }     }     add_action('init', 'articlesVisited');      First. The code inside is_single() is never reached when I visit a single post on my site. If I put an -else- block after it, it executes that. Second, the $wp_query->post->ID does not give me the ID of the post. I think that has something to do with global variables... Does anyone has experience with this?


title: How do I unserialize this?

text: I don't know the most about WordPress, but I see some serialized data in the DB that a plugin creates. The plugin works just fine, so I guess it unserializes it just fine too. When _I_ try to unserialize() it, it fails and var_dump shows bool(false) for the result. This is the string I see in the database:               a:1:{i:0;a:3:{s:4:"name";s:56:"Song → Black Meen : “So Clean (feat. Dullaah Jin)”";s:4:"file";s:98:"http://localhost/peace.worldwide/wp-content/uploads/2013/05/03-So-Clean-feat.-Dullaah-Jin.mp3";s:9:"condition";s:3:"all";}}      You might notice that the length fields don't match with the lengths of the values in the quotes. What's going on here? How do I unserialize this data?


title: How to change widget's form color in admin?

text: I have a simple question. How to change widget's form color in admin panel of wordpress (on widgets page) to make them more unique? Here is a simple example: ![example](http://i.stack.imgur.com/wFnjZ.jpg)


title: Create user from external file

text: I have this little script for create user from page of template i use in wordpress template page :               $user_name = "usertest";     $user_pass="123456";     $user_email="myemail@domain.com";     wp_create_user( $user_name,$user_pass,$user_email);      I have little from inside template for create user using this way but no works , it´s bad writte or what , thank´s for the help


title: Wordpress Update Links

text: I just need a little help in WordPress query or a plugin which can update all internal links used as hyper link or directly with pages to WordPress normal url i.e `?page_id=69` I have created a website with .htaccess mod_rewrite but unlucky the host which I am going to use not allowing to rewrite urls I have about 140+ Pages so I can't just update links 1 by 1 I have also changed the links to default but that only works for main menu not internal pages. IN SHORT I JUST NEED TO UPDATE ALL URLS FROM:                http://localhost/wordpress-website/about      to                http://localhost/wordpress-website/?page_id=40


title: Custom post metadata not appearing in public API

text: I'm using wordpress.com's public REST API to retrieve custom posts from a Wordpress installation. The JSON that's being returned is missing all the custom fields, however. The fields are definitely there and working, because I can filter on them. For example this URL: https://public- api.wordpress.com/rest/v1/sites/swnfest.com/posts/?type=artist&meta_key=facebook&meta_value=outfitoutfitoutfit is successfully limiting based on the `facebook` custom field, but that field isn't present in the response. Judging by the criteria for including custom fields in this article: > If the user performing the request is unauthenicated, he or she will not be > able to add, edit or delete any metadata; will be able to read any metadata > for which the key doesn’t begin with _ but will not be able to read any > metadata which begins with _ unless it is whitelisted. the field should be appearing. Is there something I'm missing, or is this a bug?


title: Pass PHP variable between functions in functions.php

text: I have a WordPress Admin page where you can add a "listing". Within this Admin Page I have added many fields which transfer variables over to the listing page which is created/updated. Within this admin page I am trying to take the string after the last "&" in the URL which is manually entered in the URL before loading the page:                $url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";      $id = substr( $url, strrpos( $url, '&' )+1 );      NOW the code below here is called when the ABOVE admin page is submitted to update the "listing". what I need to do is somehow get the variable `$id` to pass through to this function and be used again within the submit code.               $dirname = "../wp-content/themes/Explorable/".$id."/";      $images = glob($dirname."*.jpg");     // Open a known directory, and proceed to read its contents       foreach($images as $image) {         $imageNameLong = substr($image, -14);         $imageName = substr($imageNameLong,0 , -4);              if ( isset( $_POST[$imageName.'links'] ) )             update_post_meta( $post_id, '_'.$imageName.'links', sanitize_text_field( $_POST[$imageName.'links'] ) );         else             delete_post_meta( $post_id, '_'.$imageName.'links' );               if ( isset( $_POST[$imageName.'heading'] ) )             update_post_meta( $post_id, '_'.$imageName.'heading', sanitize_text_field( $_POST[$imageName.'heading'] ) );         else             delete_post_meta( $post_id, '_'.$imageName.'heading' );      };


title: Time sort with meta_key using UNIX timestamp failing due to date differences

text: I'm dealing with the following issue trying to sort a custom post type by a meta key created using the Advanced Custom Fields plugin Date and Time Picker add-on. The add-on creates a jQuery datepicker for users to set times in the dashboard. By default, an option _save_as_timestamp_ is set to true, so the data in the back-end is set as a Unix timestamp/epoch time. I'm trying to sort a series of events (all occurring on one day) by time. The problem I'm having is, if all the events were added on one day, then they sort correctly (e.g. a 9:00 am event would come first, 5:00 pm would come last). However, if a day or two later, my boss adds a new event to the list, it will show up as the final event, event if it were a 9:00 am event, because it's date is different. My post type query is as follows:               <?php $args = array(         'post_type' => 'event',         'posts_per_page' => -1,         'nopaging' => true,         'post_status' => 'publish',         'meta_key' => 'start_time',         'orderby' => 'meta_value_num',         'order' => 'ASC'     );     $my_query = new WP_Query( $args );     while( $my_query->have_posts() ) : $my_query->the_post(); ?>      In my estimation, I have two options, change the _save_as_timestamp_ option to false, so that no date is associated with the time. Problem is I'd have to go in and set the times again on all the events and, still, I'd have to manage a meta_query that can sort PM times after AM times, because, when I do this, it still sorts a 9:00 AM time after a 5:00 PM time. I've played with using _meta_query_ and setting type to 'TIME' but still no luck. Second option, I imagine I could format the timestamp in a manner where the date is stripped out using some combination of the date, time or DateTime functions in PHP, but I'm at a loss as to how to do this correctly. I tried added the following to the query, but I'm not experienced with meta_query at all:               'meta_query' => array(         array(             'key' => 'start_time',             'value' => date('Hi', time()),             'compare' => '>='         )     )      Is there any way to do this or would I have to use some function or pre_get_posts filter that will format the meta_key so that I can access it as a formatted variable before the loop begins? Any help is greatly appreciated!


title: Tags results not displaying for post types

text: **UPDATE** Here is the thing... I have a structure where I created a post type which has taxonomies and also tags. Let's call it **Works.** However, when I need to filter by tags, using the tag template, it displays only the blog post posts taged with the blog tags, and do not display the tags used on the post type. **Works has Taxonomies** like: In-house, OutSourced. (there is no problem with taxonomies, just displaying this just in case...) **Works has tags** like: Iron, Wood, etc. So... According to my main guess, if I want to display a filter by tags, or just clicking a tag link generated. I have to create the `tag.php` template, and into the loop, I will have all works tagged with a particular tag. However... the result is empty, or worst... I have a similar tag but into the BLOG section, it will display the blog post, which actually, is normal behavior. I tried going a level deep and used the `archive.php` template instead, however it does not show it either, same thing as `tag.php`. So... the point is, if I want to create a filter that display my custom post type, `Works`, tagged with a particular tag, which is the template I need to create? If I get I click the tag generated, it actually takes me to `example.com/tag/my-tag`, which is in fact, the problem (I think), cause that is the root for blog posts. Any guessing?


title: Wordpress putting "rn" in every line break?

text: I am using a Wordpress plugin called "WP Checkout" and there is a custom post field that allows you to enter additional product information which is tabulated on the product page. I am able to enter HTML into these tabs, but for some reason, the HTML becomes malformed when I save the changes and "rn" is added in every line break. This issue didn't used to exist, it seems like it only started happening since I updated to the latest Wordpress version. The issue can be seen here: http://xactsensing.com/transmisor-del-flujo-de- lodo/#tabs13-2 Any ideas? Thanks in advance!


title: Help with JSON decode and foreach

text:
I have this XML:   http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=science[journal]+AND+breast+cancer+AND+2008[pdat]. And I would like to get some information with JSON and put them in a array using foreach. This is my code:               function pubmedQuery() {               $json = wp_remote_get( 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=science[journal]+AND+breast+cancer+AND+2008[pdat]' );             if ( is_wp_error( $json ) ) {               echo '

Ups! There is an error!

';             } else {                 $decode = json_decode( $json['body'] );                 $results = array();                 foreach ( $decode->IdList as $items ) {                     $results[] = $item->Id;                 }             }     }      But it get me an error: > invalid argument supplied for foreach in **line 17**... (foreach ( > $decode->IdList as $items ) {). Can somebody help me? Excuse my english please!


title: How to migrate, does WordPress hardcode or shortcode image URLs?

text: I am getting very confused. I used to take my website on my dev. server, and copy the files over to my live server, export the database in phpMyAdmin, import it via phpMyAdmin into the new database server, change the `site_url` and `home url` and voila, the site migrated fine. All the image URLs worked fine, it seems they just used the `SITE_URL` for the domain part. Then I migrated my website with WP Migrate. Suddenly, exporting via phpMyAdmin leaves all the image URLs wrong. I have to do a find and replace with WP Migrate to change them all. I don't understand, how come they are suddenly hard coded? In short, are image URLs hardcoded or do they take the domain part from the SITE URL?


title: How to remove the excerpt in the Dzonia Lite theme

text:
I am using Dzonia Lite theme in my website. My front page shows all the latest posts. I am getting an excerpt at the end of each post. Could anyone suggest me how to remove that excerpt at the end of the post. # Below is the code that I have in my template file
              <?php if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { ?>              <a href="<?php the_permalink(); ?>">              <?php the_post_thumbnail('post_thumbnail', array('class' => 'postimg')); ?>                            <?php } else {              ?>              <a href="<?php the_permalink() ?>"><?php echo inkthemes_main_image(); ?>              <?php              }              ?>              <?php the_excerpt(); ?>

              <?php wp_link_pages(array('before' => '
' . 'Pages:' . '', 'after' => '
')); ?>              <?php edit_post_link('Edit', '', ''); ?>
          <a href="<?php the_permalink() ?>" class="continue"><?php _e('Continue reading →', 'dzonia'); ?>
          <?php the_tags('Post Tagged with ', ', ', ''); ?>


title: How to get the path to the current theme?

text: This code is used to get the directory of the current plugin: `plugin_dir_url( __FILE__ )`. What should I use to get the directory of the current theme?


title: Why are admin scripts not printed

text: I am trying to enqueue/print scripts in the admin area. But they dont seem to appear.               add_action('admin_init', function() {         add_meta_box('portfolio-meta', 'Details', 'portfolio_metabox_details', 'portfolio');              wp_register_script('jqeury-validate', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js');         wp_enqueue_script('jquery-validate');         wp_register_script('ae-admin', get_bloginfo('template_directory') . '/js/admin.js', array('jquery', 'jquery-validate'));         wp_enqueue_script('ae-admin');         wp_localize_script('ae-admin', 'WpAjax', array(                 'AjaxUrl' => admin_url('admin-ajax.php')         ));         wp_register_style('ae-validate', get_bloginfo('template_directory') . '/css/validate.css');         wp_enqueue_style('ae-validate');     });      But my script (`admin.js`) does not seem to get printed. I even tried to put those in 'init' instead of 'admin_init' still I dont see my scripts ... why is that? How can I debug?


title: need help adding a new sidebar to a page that can't use page-templates -> multisite

text: This problem is quite complex and hard to describe so bare with me. I'm trying to add a new sidebar to my test-page before I put it live. Basically I've got a website with wordpress installed and inside this are 3 sub-directories for other websites. All the pages are linked using http://pastebin.com/gr594PxQ All the sites use the same wordpress admin panel however they seem to use the default index.php template, some pages are different so they must use other templates but these arn't shown in the admin panel. I've yet to find out how to give my test-page a new template as you can't do it in the WP-ADMIN. If I could find out how to achieve this my problem would be simple to solve. at the moment I've tried playing around with an if conditional so different sidebars will appear for different pages. My results return no sidebar at all which is whats confusing me. Here is what I have. http://pastebin.com/anUgJmkh Many Thanks


title: Dynamic image grid gallery

text:
I want to create a project with the following image grid gallery. I try to do with the using of masonry JQuery ![enter image description here](http://i.stack.imgur.com/O4qvm.jpg) My code : `functions.php`               wp_register_script( 'pkgd', get_template_directory_uri() .'/lib/js/vendor/masonry.pkgd.min.js');     wp_enqueue_script( 'pkgd');      `header.php`                     `category-36.php`

              <?php wp_nav_menu(array('menu' => 'Print-menu'));?>

      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                      <div class="post" id="post-<?php the_ID();?>">

                     <?php the_post_thumbnail(); ?>                       <?php the_content (); ?>

       I upload some images to category but the massory didn't load. How can fix that? Is there any jQuery script that can generate a completely dynamic grid in respect to image size? Thanks in advanced and for any help.


title: Sharing Dynamic Sidebars across Multisite Blogs

text: I'm trying to find away to retrive a dynamic sidebar from one blog and print it on another blog in the same install of Wordpress Multisite. I have tried               switch_to_blog($blog_id);     dynamic_sidebar($sidebar_name);     restore_current_blog();      But nothing is returned. I also tired to retrive the sidebar through `get_blog_option($blog_id, 'sidebar_widgets')` but I was only able to retrive an array identify what widgets were used by the sidebar, but I couldn't find away to process the array into a sidebar.


title: Pagination For Table Rows on a page?

text:
Please See Attached Image Below In Comment I am using a table to display content on my page. I am using the twenty eleven theme. I would like to limit the number of rows on the page. i created a custom sidebar template for the page. anyone have any idea how i can limit the number of rows to 20 rows per page and anything beyond that goes to page two. Thus when i add a new row the last row (20) on page 1 becomes the first on page 2. thank you. i create the tables using html in wordpress. am not using a plugin. as you can see in the image i have the page-navi plugin activated in my template (please refer to code for custom template below) Example of table.

      My Content
     My Content

      If anyone can help i will really appreciate. I have basic code knowledge. if you will, please also advise where i put the code. This is the code for my custom template.                 <?php     /**      * Template Name: SL Sidebar Template      * Description: A Page Template that adds a sidebar to pages      *      * @package WordPress      * @subpackage Twenty_Eleven      * @since Twenty Eleven 1.0      */          get_header(); ?>

                      <?php while ( have_posts() ) : the_post(); ?>                          <?php get_template_part( 'content', 'page' ); ?>                          <?php comments_template( '', true ); ?>                      <?php endwhile; // end of the loop. ?>
     <?php wp_pagenavi(); ?>
          <?php get_sidebar(); ?>     <?php get_footer(); ?>


title: why does bones theme call the_excerpt function with parameters?

text: I have been triying to localize a wordpress site which uses Bones as the theme. In the theme's search.php, there is a line that goes:               <?php the_excerpt('' . __('Read more »', 'bonestheme') . ''); ?>      In the function reference it is said that this function does not take any parameters. So why does this theme send parameters?


title: How can i use this meta box function in my template ? (Wordpress)

text:
this is my function :               $prefix = 'dbt_';          $meta_box = array(         'id' => 'my-meta-box',         'title' => 'Custom meta box',         'page' => 'post',         'context' => 'normal',         'priority' => 'high',         'fields' => array(             array(                 'name' => 'Checkbox',                 'id' => $prefix . 'checkbox',                 'type' => 'checkbox'             )         )     );          add_action('admin_menu', 'mytheme_add_box');          // Add meta box     function mytheme_add_box() {         global $meta_box;              add_meta_box($meta_box['id'], $meta_box['title'], 'mytheme_show_box', $meta_box['page'], $meta_box['context'], $meta_box['priority']);     }          // Callback function to show fields in meta box     function mytheme_show_box() {         global $meta_box, $post;              // Use nonce for verification         echo '<input type="hidden" name="mytheme_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';              echo '
';              foreach ($meta_box['fields'] as $field) {             // get current post meta data             $meta = get_post_meta($post->ID, $field['id'], true);                  echo '
',                     '', $field['name'], '	',                     '';             switch ($field['type']) {                 case 'checkbox':                     echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';                     break;             }             echo    '',                 '
';         }              echo '
';     }          add_action('save_post', 'mytheme_save_data');          // Save data from meta box     function mytheme_save_data($post_id) {         global $meta_box;              // verify nonce         if (!wp_verify_nonce($_POST['mytheme_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;         }              foreach ($meta_box['fields'] as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];                  if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         }     }      i try to use this code in my template if check box checked :               <?php if ($meta_box = get_post_meta($post->ID, "checkbox", true) ) : ?>     Show this when checkbox checked     <?php endif; ?>      And it doesnt work


title: Notification mail about high memory usage?

text: Today morning on valentines I received a shocking mail from my WordPress site,   Don't know what to do, Can anyone help me out in this > Subject: [Online MBA] High memory usage notification Sent: Feb 13, 2011 > 11:33 PM > > WordPress memory usage exceeded 64 MB   >  WordPress peak memory usage: 114.87 MB   >  Number of database queries: 173


title: Front end post form won't post categories to custom post type

text:
Trying to get a front end post form to work with my custom post type. It posting to the post type but the 2 custom taxonomies and the tag field aren't posting/saving. Here is my CPT.               add_action('init', 'portfolio_register');       function portfolio_register() {          $labels = array(         'name' => _x('User Lists', 'post type general name'),         'singular_name' => _x('User List', 'post type singular name'),         'add_new' => _x('Add New', 'list item'),         'add_new_item' => __('Add New List'),         'edit_item' => __('Edit List Item'),         'new_item' => __('New List Item'),         'view_item' => __('View List Item'),         'search_items' => __('Search Lists'),         'not_found' =>  __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''     );          $args = array(     'labels' => $labels,     'public' => true,      'publicly_queryable' => true,     'show_ui' => true,     'query_var' => true,     'menu_icon' => get_stylesheet_directory_uri() . '/img/cutleries.png',     'rewrite' => true,     'capability_type' => 'post',     'hierarchical' => false,     'show_admin_column' => true,     'menu_position' => null,     'taxonomies' => array('post_tag', 'list_type', 'list_state'),     'supports' => array('title',         'editor',         'author',         'custom-fields',         'comments')           );          register_post_type( 'user_lists' , $args ); }          register_taxonomy("list_type", array("user_lists"), array("hierarchical" => true, "label" => "List Types", "singular_label" => "List Type", "rewrite" => true, 'show_admin_column' => true,));           register_taxonomy("list_state", array("user_lists"), array("hierarchical" => true, "label" => "List State", "singular_label" => "List State", "rewrite" => true, 'show_admin_column' => true,));      And here is my form               <?php          //EricHamby.Com          add_shortcode('feEditor', 'feEDoShortcode');         add_action('init', 'catch_save_form');          function catch_save_form()     {      $errors = array();             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       $errors[] = 'Please enter the wine name';          if(isset ($_POST['description']))       $description = $_POST['description'];     else       $errors[] = 'Please enter some notes';          $tags = $_POST['post_tags'];              // ADD THE FORM INPUT TO $new_post ARRAY            $new_post = array('post_title'      => stripslashes($title),                       'post_content'    => stripslashes($description),                       'tags_input'      => stripslashes($tags),                       'post_status'     => 'publish', // Choose: publish, preview, future, draft, etc.                         'post_type'       => 'user_lists', //'post',page' or use a custom post type if you want to                       'tax_input'    => array(                         'list_type'  => $_POST['list_type'],                         'list_state' => $_POST['list_state'],            )        );            //SAVE THE POST         $pid = wp_insert_post($new_post);            //REDIRECT TO THE NEW POST ON SAVE       $link = get_permalink( $pid );      $_POST['form_errors'] = $errors;      wp_redirect( $link );      die();          } // END THE IF STATEMENT           }             //WHERE ALL THE MAGIC HAPPENS          function feEDoShortcode()        {         if(isset($_POST['form_errors']) && !empty($_POST['form_errors']))          foreach($_POST['form_errors'] as $e)           echo '
ERROR: '.$e.'
';          ?>             <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
Submit Your List!

              <form id="new_post" name="new_post" method="post" action="" class="wpcf7-form" enctype="multipart/form-data">                       <fieldset name="name">            <input type="hidden" id="title" value="<?php echo date('F jS Y h:i:s A'); ?>" tabindex="5" name="title" />           </fieldset>

              <fieldset class="category">         <?php erichamby_custom_taxonomy_dropdown( 'list_type', 'date', 'DESC', '10', 'list_type', '', '', 'Select List Type' ); ?>       </fieldset>

              <fieldset class="category">         <?php erichamby_custom_taxonomy_dropdown( 'list_state', 'date', 'DESC', '10', 'list_state', '', '', 'Select List State' ); ?>       </fieldset>

                   <fieldset class="content space">         Description and Notes:         <?php wp_editor("", 'description', array('media_buttons' => false, )); //change media_buttons to true to allow images/videos/music ?>       </fieldset>                   <fieldset class="tags space">         Additional Keywords (comma separated):         <input type="text" value="" tabindex="35" name="post_tags" id="post_tags" />       </fieldset>                   <fieldset class="submit space">         <input type="submit" value="Post Review" tabindex="40" id="submit" name="submit" />       </fieldset>            <input type="hidden" name="action" value="new_post" />       <?php wp_nonce_field( 'new-post' ); ?>     </form>

     <?php            }             function erichamby_custom_taxonomy_dropdown( $taxonomy, $orderby = 'date', $order = 'DESC', $limit = '-1', $name, $show_option_all = null, $show_option_none = null,    $show_option_select = null ) {        $args = array(         'orderby' => $orderby,         'order' => $order,         'number' => $limit,         'hide_empty' => 0,           );        $terms = get_terms( $taxonomy, $args );       $name = ( $name ) ? $name : $taxonomy;        if ( $terms ) {         printf( '<select name="%s" class="postform">', $name );         if ( $show_option_select ) {             printf( '<option>%s</option>', $show_option_select );         }         if ( $show_option_all ) {             printf( '<option value="0">%s</option>', $show_option_all );         }         if ( $show_option_none ) {             printf( '<option value="-1">%s</option>', $show_option_none );         }         foreach ( $terms as $term ) {             printf( '<option value="%s">%s</option>', $term->slug, $term->name       );                            }                                     print( '</select>' );                                       }                     }                    //EricHamby.Com                        ?>


title: How to implement pagination eg. newer - 3 - 4 - 5 - 6 - 7 - older

text: How can I implement pagination like shown in the title perhaps something similar to most sites ![](http://imgur.com/Y2D08.jpg)


title: Create Table Failed Column Date DateType

text: I have a plugin that creates tables and one of them is failing and I feel like it's due to either my syntax or the fact that I'm trying to create a column with datatype DATE and not TIMESTAMP (only one that I can make work). Can someone look at my syntax below and tell me what is wrong?               $table = $wpdb->prefix.SSM_ACADEMIC_YEAR_TABLE;                  $sql =  "CREATE TABLE IF NOT EXISTS " . $table . " (                       id mediumint(12) NOT NULL AUTO_INCREMENT,                       description VARCHAR(200) NOT NULL,                       begin_date DATE NOT NULL,                        end_date DATE NOT NULL                     PRIMARY KEY (id));";              $wpdb->query($sql);      and now just looking at the other field in question, is it possible that it doesn't like VARCHAR(200)? Having issues here and running out of steam and time. Any help would be greatly appreciated!


title: Create an auto-populated menu that is automatically assigned to the primary menu in twentythirteen?

text: A similar question was asked about buddypress here , but I tried applying it to a twentythirteen, and I am getting this error. > Cannot use object of type stdClass as array in > /hsphere/local/home/c349026/expressbraiding.com/blog/wp-admin/menu.php on > line 25 How I can I properly apply the code bellow to a twenty thirteen child theme?                //give your menu a name      $name = 'theme default menu';      //create the menu      $menu_id = wp_create_nav_menu($name);      //then get the menu object by its name      $menu = get_term_by( 'name', $name, 'nav_menu' );      //then add the actuall link/ menu item and you do this for each item you want to add     wp_update_nav_menu_item($menu->term_id, 0, array(     'menu-item-title' =>  __('Home'),     'menu-item-classes' => 'home',     'menu-item-url' => home_url( '/' ),      'menu-item-status' => 'publish'));      // you add as many items ass you need with wp_update_nav_menu_item()          //then you set the wanted theme  location     $locations = get_theme_mod('nav_menu_locations');     $locations['LOCATION_NAME'] = $menu->term_id;     set_theme_mod( 'nav_menu_locations', $locations );      Thanks to @bainternet


title: Does is_child() exist in wp 3.5.1?

text: I'm trying to figure out how to get to a is_child() equivalent; I'd like to be able to target the parent page and it's children. How can this be achieved? My pseudo-code is...               if (is_page('pagename') || is_child('pagename')) {...}      ...however, the is_child() doesn't seem to work. I would like it to return true.


title: Make only the image an anchor link using the advanced excerpt plugin?

text: I am using the advanced excerpt plugin for Wordpress http://wordpress.org/plugins/advanced-excerpt/ so I can display images and video's in my excerpts, as opposed to just text. So my code is simply...               <?php the_excerpt(); ?>      Now if the excerpt is an image and text, I would like to make only the image tag an anchor link, not the text. If I do this...               <a href="<?php the_permalink(); ?>">         <?php the_excerpt(); ?>     </a>      ...it makes the whole excerpt an anchor link as you would expect. The trouble with this is the paragraph text then inherits the link colour which I do not want, and if I disable this colour just for this excerpt, it also disables intended anchor links. Is there any way I can do this in jQuery or PHP to select only the image in the excerpt and make it link to the corresponding blog post? Thanks in advance


title: How can I attach hotlinked images in posts/pages within the same server?

text: Not sure if this makes sense but I'm trying to attach hotlinked images to their posts/pages with no lucky, most plugins such Cache images works ok but only to external domains, I need to auto-attach hotlinked images in the same domain/server. _Addendum_ : This happened duo copying-pasting content from static html files into WP pages and posts. Thanks for any clue!


title: Override pluggable functions in a plugin?

text: WordPress has a file called `pluggable.php` which contains a list of functions you can override in your plugin. The problem I am facing (I am overriding `wp_authenticate`) is for each blog in my network I try to activate this plugin, I get: > failure, can't re-declare wp_authenticate which was previously declared in > pluggable.php This somewhat defeats the ease of use, I have to comment the function in the plugin file, activate the plugin, un-comment the function for it to work properly. What is the correct way to do it?   Can't expect users who download plugin to do all that. I am using 3.5 + multi-site configuration


title: How to echo the_title from an array of posts?

text: I'm trying to query wordpress post by using `query_posts` and trying to save them in an array so that I get retrieve the post from array. This is what I'm doing,                   $posts =array();         $args = array('posts_per_page' =>3,'cat' => 3 );         $posts[] = query_posts( $args );              global $post;         if ( ! empty($posts) ) :         foreach ($posts as $post) {         setup_postdata($post);               echo get_the_title();         }         wp_reset_postdata();         endif;         wp_reset_query();      When I run this script it shows a post which is not in `cat` 3\. but if I do `print_r($post)` it shows the correct three posts. Any idea of where I'm getting wrong?


title: facebook Page Publish 2

text: I am using acebook Page Publish 2 plugin . which is working fine. but i want to POST feature image on fb page. but it doesnot showing anything on facebook page. Does anybody tel me how to POST feature image on fb page Thanks


title: Extend page routing with custom parameters

text: In WordPress there is defined a simple routing               /%postname%/      So when I access `/projects/` it loads me `Projects` page which has specified custom `template_projects.php` template. Is it possible to extend routing but only for this template ? Let's say I want to extend routing to handle project id, so it should be:               /%postname%/%project-id%/      But other pages will work with base route.


title: How to prevent meta data from being edited in a post?

text: I need to add a 'poll' to every single post automatically, and wish to do this without having to manually create a poll each time using a plugin, so I had an idea to store the poll results as meta data in the post. So each time someone votes, it saves their vote as a custom field meta value in the post. This should work in theory, however one problem I've discovered early on is that when editing the post which contains a poll, if someone votes while I am editing and then I press Update, the results are reset back to whatever they were before I started editing, because the custom field is being saved along with the post. Is there any way to stop a certain custom field from being saved when I update a post? Or to make it retrieve the latest value before saving it?


title: Tags and Taxonomy links not working for Custom Post Types

text: In my theme, I registered a taxonomy by the name of `tax_groups` for a custom post type named `custom_items`. So the following URL was returning the lastest `custom_items` http://website.com/custom_items/ The Search widget was also working perfectly fine but not Tag and Taxonomy links like these:               http://website.com/tag/a_random_tag/     http://website.com/tax_groups/a_random_group/


title: Contents of HTML editor mangled after multiple UPDATES

text: In a perfect world, WordPress would take what I enter into the HTML editor and write it verbatim into the post/page document received by the browser. Disabling `wpautop` has already helped me slightly to this end. Alas.. **Setup:** I write some HTML into the editor and click UPDATE. My post/page is formatted correctly, but the contents of my editor have changed: `p` and `br` tags are gone, replaced respectively with actual empty lines and line breaks. When I view source, the contents of the editor `textarea` are what I originally typed, but its as if `p` and `br` tags are actually being rendered in the `textarea`. **The problem is that when I click UPDATE again (without changing anything), the post/page is formatted incorrectly, because said tags are lost.** How can I get my HTML editor contents not to be automatically mangled? I do not ever switch over to the visual editor. Just scanning through `wp- includes/formatting.php`, the function `format_to_edit` seems promising, but unsure how to proceed. **Example**   1. Enter `<p>Hello</p>` in HTML editor for new post   2. Click PUBLISH, published post is formatted correctly   3. Contents of editor changed after the PUBLISH refresh to `Hello` (p tags gone)   4. Click UPDATE, post is formatted incorrectly due to lack of p tags * * * **UDPATE** _After looking at some of the comments/answers and doing some testing, this does look like a hackery side-effect. I can't repro in a fresh install of Roots. Here are the details of my install:_   1. Customized Roots theme, no hackery.   2. Plugins: Akismet, Advanced Custom Fields, Custom Post Type UI, Google Analytics for WP


title: Find out if a page has no parent

text: Hay, have a basic menu looking like this               Item 1         Item 1.1             Item 1.1.1             Item 1.1.2         Item 1.2     Item 2         Item 2.1      I'm outputting this as a list using WordPresses "wp_list_pages()" function. This is working fine. However on the pages, i am list the subpages. So, when I'm on page "Item 1.1" it says "Other pages" and lists "Item 1.1.1" and "Item 1.1.2". I'm using               <?php wp_list_pages( array('child_of'=>get_the_ID(),'title_li'=>'') ); ?>       to do this. However, i only want this to output "other pages" on the subpage. I don't want to display the "other pages" on the top level pages (like "Item 1, Item 2"). Is there a way to see if the current page is a top level page?


title: post_class() breaks out of formatting. . . extra markup also generated

text:
Hoping Im just running into something easy Here's the scenario, I've created a function called `tr_get_post_image_tplt` that spits out the post thumbnail (or custom size) for the post being called. Im calling it as follows from my front-page loop:               <a href="<?php the_permalink(); ?>"<?php post_class('thumbnail span1'); ?> ><?php tr_get_post_image_tplt('thumbnail', 'thumbnail');?>         I would expect the function to output something like:                     But instead Im getting:               class="post-864 post type-post status-publish format-quote hentry category-general thumbnail"

               Note that that the class has slipped out of the `<a>` tag and extra markup has been added. I've poured over this for hours now - so Im praying its not some silly typo. But assuming it isn't a typo can someone explain what's going on and how to avoid it in future? Here's the function, stored in a functionality plugin(though I've tried it in functions.php with the same results):               function tr_get_post_image_tplt($size='thumbnail', $class='thumbnail', $default='post-thumb-default.gif') {     global $post;          if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.         $image_src = wp_get_attachment_image_src( get_post_thumbnail_id(), $size );              $alt_text =  get_the_title(get_post_thumbnail_id());         $tr_post_thumb = '';         //$tr_post_thumb = the_post_thumbnail($size); isn't flexable enough     }     else{         $photos = get_children( array(         'post_parent' => $post->ID,          'post_status' => 'inherit',          'post_type' => 'attachment',          'post_mime_type' => 'image',          'order' => 'ASC',          'orderby' => 'menu_order ID'         ) );         if (!empty($photos)) {             $photo = array_shift($photos);             $image_src = wp_get_attachment_image_src($photo->ID, $size);             $alt_text =  get_the_title($photo->ID);             $tr_post_thumb = '';         }         else {             // if above fails, spit out a default image             $alt_text =  get_the_title($post->ID);             $tr_post_thumb = '';               }     }     echo apply_filters('the_content', $tr_post_thumb );     }      Many thanks for sharing your experience!


title: Generate multiple goo.gl shortlinks for qtranslate bilingual blog

text: I'm working on revamping my personal blog with a custom built theme and making it bilingual with the help of qtranslate. I've gotten to a grinding halt when it comes to automatically generating the shortlinks (offered for analytics reasons). Up till now, I got the following code, based on Kovshenin's goo.gl plugin, that queries the google shorten API:               function googl_shortlink($url, $post_id) {         global $post;         if (is_404())             return;         if (!$post_id && $post) $post_id = $post->ID;              if ($post->post_status != 'publish')             return "";              $shortlink = get_post_meta($post_id, '_googl_shortlink', true);         if ($shortlink)             return $shortlink;              $permalink = get_permalink($post_id);              $http = new WP_Http();         $headers = array('Content-Type' => 'application/json');         $result = $http->request('https://www.googleapis.com/urlshortener/v1/url', array( 'method' => 'POST', 'body' => '{"longUrl": "' . $permalink . '"}', 'headers' => $headers));         $result = json_decode($result['body']);         $shortlink = $result->id;              if ($shortlink) {             add_post_meta($post_id, '_googl_shortlink', $shortlink, true);             return $shortlink;         } else {             return $url;         }     }     add_filter('get_shortlink', 'googl_shortlink', 9, 2);      and adds a nice column to my posts dashboard with a link to the analytics page:               function googl_post_columns($columns) {         $columns['shortlink'] = 'Shortlink';         return $columns;     }          function googl_custom_columns($column) {         global $post;         if ('shortlink' == $column) {             $shorturl = wp_get_shortlink();             $shorturl_caption = str_replace('http://', '', $shorturl);             $shorturl_info = str_replace('goo.gl/', 'goo.gl/info/', $shorturl);             echo "{$shorturl_caption} (info)";         }     }     add_action('manage_posts_custom_column', 'googl_custom_columns');     add_filter('manage_edit-post_columns', 'googl_post_columns');      Here's the problem: The snippet above works perfectly for a single language environment, but when it comes to going bilingual, it only generates the shortlinks for the default language. The question is: How can I make it generate the links for the second language as well? I think it's obvious that I'll need to save them in separate meta keys, but I can't find a way to make it look further than the default language.


title: Where is it better to start learning how to develop for Wordpress?

text: I have already read this question and answer to it ( Where do I start from ). So I have slightly different question. If I basicaly have no knowledge of how the WordPress code is structured and I have some ideas for plugin I would like to write should I start at the same place where author of the answer sugested in the post linked above or there is some other path? Thanks to all who will contribute to this question. P.S. I have more than 3.5 years of experience with PHP and other web technologies.


title: Editing custom fields for comments

text: I need help with why the save function is not working in the edit_comment hook. Here is the code for the 'comment_post' hook:               add_action( 'comment_post', 'save_comment_meta_data' );     function save_comment_meta_data( $comment_id ) {         if ( ( isset( $_POST['private'] ) ) && ( $_POST['private'] != '') )         $private = wp_filter_nohtml_kses($_POST['private']);         add_comment_meta( $comment_id, 'private', $private );     }      And here is the 'edit_comment' hook:               add_action( 'edit_comment', 'extend_comment_edit_metafields' );     function extend_comment_edit_metafields( $comment_id ) {         if( ! isset( $_POST['extend_comment_update'] ) || ! wp_verify_nonce( $_POST['extend_comment_update'], 'extend_comment_update' ) ) return;             if ( ( isset( $_POST['private'] ) ) && ( $_POST['private'] != '') ) :             $private = wp_filter_nohtml_kses($_POST['private']);             update_comment_meta( $comment_id, 'private', $private );             else :             delete_comment_meta( $comment_id, 'private', $private );             endif;     }      This adds a checkmark box in the edit window to make the comment private. The checkmark box appears but it does not save when I update the comment in the edit window. Any idea why?


title: Post edit screen: How to check if meta_box is registered?

text: I got some custom post types where i deregistered the "title" meta box. Now i always get "Auto Draft" as title. To avoid this i'd like to add the name of a taxonomy as the title. But how would i check if the meta box "title" exists or not?