text: dodawanie linku rodzica do podmenu

body: I am making a template for the page which will contain a slider. Can anyone share some advice with me of how to go about it?

body: How can I use a meta query like this:               >>>>>> KEY_X Conditional IS ABSOLUTELY REQUIRED <<<<<<<<<<                  array(                     'key' => 'Key_X',                     'value' => 'Value_for_X'                      ),     >>>>>> KEY_Y **OR** KEY_Z ARE REQUIRED  / AT LEAST ONE <<<<<<<<<<                 array(                     'key' => 'Key_Y',                     'value' => 'Value_for_X'                 ),                 array(                     'key' => 'Key_Z',                     'value' => 'Value_for_Z'                 )      So the first one is an absolute must, and then one or the other is required (at least one). Thank you so much! Ciprian

body: After some searching I haven't been able to find a answer to what I'm trying to archive. I'm trying to set up an archive page with accordion panels that hide/show posts from a given year with links. So how do I show an entire year of posts, not just a link to a year? Example: ## 2012 ### Post Title ### Next Post Title ### Another Post Title ============== ## 2011 ### Post Title ### Next Post Title ### Another Post Title Etc

body:
I'm working on a project in which I'm creating a custom post type and custom data entered via meta boxes associated with my custom post type. For whatever reason I decided to code the meta boxes in such a way that the inputs in each metabox are part of an array. For instance, I'm storing longitude and latitude:
          Latitude:
          <input type="text" id="latitude" name="coordinates[latitude]" class="full-width" value="" />

              Longitude:
          <input type="text" id="longitude" name="coordinates[longitude]" class="full-width" value="" />
      For whatever reason, I liked the idea of having a singular postmeta entry for each metabox. On the `save_post` hook, I save the data like so:               update_post_meta($post_id, '_coordinates', $_POST['coordinates']);      I did this because I have three metaboxes and I like just having 3 postmeta values for each post; however, I've now realized a potential issue with this. I may want to use WP_Query to only pull out certain posts based these meta values. For instance, I may want to get all posts that have latitude values above 50. If I had this data in the database individually, perhaps using the key `latitude`, I would do something like:               $args = array(         'post_type' => 'my-post-type',         'meta_query' => array(             array(                 'key' => 'latitude',                 'value' => '50',                 'compare' => '>'             )         )      );     $query = new WP_Query( $args );      Since I have the latitude as part of the `_coordinates` postmeta, this would not work. So, my question is, is there a way to utilize `meta_query` to query a serialized array like I have in this scenario?

body: I was wondering whether it is possible to completely disable a function that is called in a parent theme's `functions.php` and if so, how? (Of course without deleting the function. Rather by adding something to `functions.php` of the child theme.)

body: Currently I'm working on a theme, and did some styles and scripts enqueue. When enqueued the scripts, I used `wp_register_script()` first, and then enqueued with `wp_enqueue_script()` \- because I got that's the proper way of enqueuing the scripts. But in enqueuing the styles, I used only the `wp_enqueue_style()` with all its parameters. But just now I got an answer from s_ha_dum saying that using the `wp_register_style()` would make theme child theme-friendly - I wonder, without the `wp_register_style()` I's using only the `wp_enqueue_style()` and my theme's working fine with the enqueued styles. I enqueued them like:               add_action( 'wp_enqueue_scripts', 'wpse20131025_styles' );          function wpse20131025_styles(){              wp_enqueue_style( 'site-styles', get_template_directory_uri() . '/style.css', '', '', 'screen' );         wp_enqueue_style( 'menu-styles', get_template_directory_uri() . '/css/menu.css', '', '', 'screen and (min-device-width: 800px)' );         wp_enqueue_style( 'mobile-menu-styles', get_template_directory_uri() . '/css/mobile-menu.css', '', '', 'screen and (max-device-width: 799px)' );          }      While the `wp_enqueue_style()` has all the parameters that present in `wp_register_style()` ( _$handle, $src, $deps, $ver, $media_ ) then why should I repeat them? Or, what exactly the purpose of `wp_register_style()` other than `wp_enqueue_style()`?

body: I took a look around but didn't found an answer, i would to be able to set some default Screen Options in Wordpress backend when my theme is installed, specifically would be able to flag the description field of Appaearence->Menus. Any idea? Thanks!

body: I am trying to change my attachment page link yo               example.com/photos/attachment_ID/post_name/attachment_name      can you tell me how to call the parent post name                   function wpd_attachment_link( $link, $post_id ){         $post = get_post( $post_id );         $parent_post = get_post($parent_post_id);         $rewrite_link = $post->post_name;         $parent_post_name = $parent_post->parent_post_name;         $home_url ->rules = '/photos/' . $post->ID . "/$rewrite_link" . "/$parent_post_name";         return $home_url->rules;     }     add_filter( 'attachment_link', 'wpd_attachment_link', 20, 2 );

body: I have a hierarchical custom category which is setup similar to this: ![a busy cat](http://i.imgur.com/yh1zEBj.png) It functions as expected. If I check a child cat, it auto checks the parent cat. If I uncheck a child cat, it auto unchecks the parent cat. However, after I publish, it will look like this: ![a busy cat](http://i.imgur.com/hJQiCtM.png) Apparently, it doesn't check the parent category because I disabled it? I need it to retain the setup I have from the first image.. Here is the script I used in the first image:               <script>     jQuery(document).ready(function($){       jQuery("#audiocatchecklist>li>label input").each(function(){         jQuery(this).attr("disabled", "disabled");       });            keep_child_below_parent($);     });          function keep_child_below_parent($) {       $("#audiocatchecklist").find("input").each(function(index, input) {         $(input).bind("change", function() {           var checkbox = $(this);           var is_checked = $(checkbox).is(":checked");           if(is_checked) {             $(checkbox).parents("li").children("label").children("input").attr("checked", "checked");           } else {             $(checkbox).parents("li").children("label").children("input").removeAttr("checked");           }         });       });     }     </script>      Thanks!!

body: Anyone know of a plugin that adds syntax highlighting to the post/page HTML editor? Thanks-

body: I noticed that WP 3.1 supposedly has 'new CMS capabilities like archive pages for custom content types', however, I can't see that implemented yet? I've been using a plugin called 'Simple Custom Post Type Archives' to view custom posts at the url http://www.domainname.com/custom-post-type/, but wanted to use the in-built capability considering it is 'now possible'. Has anyone else had the same issue? Thanks osu PS. I'm using archive-custom_post_type_name.php to try and style my custom post type archive page

body: > **Possible Duplicate:**   >  How to Protect Uploads, if User is not Logged In? Is there any way at all to restrict direct access to files within a specific folder to only specific wordpress users that have that specific capability set?

body: This is really driving me up the wall now. Randomly, all my menu items for all menus are just being deleted on their own. Not the menus themselves but all items within them. This is a custom theme we built upon the Bones boilerplate. We've built plenty of sites on Bones though and we're not experiencing the problem with any others. I know the usual advice will be:-   * Deactivate all plugins and see if the problem persists.   * Revert to the default Wordpress theme and see if the problem persists. But this isn't particularly practical as it means breaking our website for weeks on end waiting to see whether the problem occurs again. Each time this happens, we have to manually rebuild all our menus and it is becoming a real pain now plus potentially catastrophic if Google crawl our website when these menu items have all been deleted. This only started happening since the 3.8 update but occurs within four days of reinstating all the menu items again. There is nothing of note in the error logs. This last happened in the past 48 hours and all we have in the error log from this period is the following (actual domain replaced with `domain.com`):-               [Sun May 25 02:32:23 2014] [warn] RSA server certificate CommonName (CN) `plesk' does NOT match server name!?     [Tue May 27 04:10:55 2014] [error] [client 188.143.234.90] script not found or unable to stat: /var/www/vhosts/domain.com/cgi-bin/php     [Tue May 27 04:10:55 2014] [error] [client 188.143.234.90] script not found or unable to stat: /var/www/vhosts/domain.com/cgi-bin/php5     [Tue May 27 04:10:55 2014] [error] [client 188.143.234.90] script not found or unable to stat: /var/www/vhosts/domain.com/cgi-bin/php-cgi     [Tue May 27 04:10:55 2014] [error] [client 188.143.234.90] script not found or unable to stat: /var/www/vhosts/domain.com/cgi-bin/php.cgi     [Tue May 27 04:10:55 2014] [error] [client 188.143.234.90] script not found or unable to stat: /var/www/vhosts/domain.com/cgi-bin/php4     [Tue May 27 04:10:55 2014] [error] [client 188.143.234.90] script not found or unable to stat: /var/www/cgi-bin/cgi_wrapper/php      If all anyone can suggest is the above bullet points, then all I can really think of is to replicate the website in a dev environment and noindex the site for web crawlers (I've asked in various communities already) - there does seem to be a few other people that have experienced the same problem with little idea of resolution although for some it seemed to be related to plugins (although I don't have those plugins installed on our website). Frustrating! Can anyone shed some better light on how to get to the bottom (debug) of this one? I've just found this same question on here as well... The database has been repaired as well to no avail.

body: This is my ipn.php that is sending a mail to the user when PayPal transaction is completed. The problem is that I also need to change the state of the order in the WP database and not just send the email. I know the unique `$code` variable (integer) of that transaction (I have saved it when the form was sent and the user redirected to finish the process on PayPal page) and PayPal is sending it back to ipn.php file inside custom field `$_POST['custom']`. So, the code in **ipn.php** (accessed by PayPal as notify_url when the transaction is successful) looks like this:               <?php          $req = 'cmd=_notify-validate';          foreach ($_POST as $key => $value) {         $value = urlencode(stripslashes($value));         $req .= "&$key=$value";     }          // post back to PayPal system to validate     $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";     $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";     $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);          // CUSTOM VARIABLE     $code = $_POST['custom'];          if (!$fp) {         // ERROR     } else {              $email = "emailtouser@email.com" ;         $subject = "Test" ;         $message = "Your code is {$code}" ;         mail($email, $subject, $message, "From:" . $email);              fclose ($fp);     }      So, the email is send OK with the code value as it supposed to be. However, I also need to get the user email from the WP database based on the $code that is unique for every user (post type) and then change the state of the order in the db. I know how to do that, but the problem is that WP is not loaded and I cannot access the database to perform these acts. How to do that? I mean, how to access WP db here ?:               } else {                  // BEFORE SENDING I NEED TO ACCESS WP DB HERE...                       // AND THEN SEND THE EMAIL             $email = "emailtouser@email.com" ;             $subject = "Test" ;             $message = "Your code is {$code}" ;             mail($email, $subject, $message, "From:" . $email);                  fclose ($fp);         }

body:
I've finally managed to get my live search in Wordpress working, but it only works when i directly call it in the class. I want to put it in a shortcode, so i can call it on every page i want. But when i call the shortcode, my jquery/ajax is not working. **Constructor**                   add_action( 'wp_ajax_schoenen_zoeken_shortcode_output', array($this, 'schoenen_zoeken_shortcode_output'));         add_action( 'wp_ajax_nopriv_schoenen_zoeken_shortcode_output', array($this, 'schoenen_zoeken_shortcode_output'));         add_action( 'wp_head', array($this, 'add_js' ));         add_action( 'init', array($this, 'register_schoenen_shortcodes'));      **Javascript:**                   public function add_js() {           ?>               <?php     }      **Shortcode**                public function register_schoenen_shortcodes() {                 add_shortcode('schoenen_zoeken', array($this, 'schoenen_zoeken_shortcode_output'));              }      **PHP AND HTML**                 public function schoenen_zoeken_shortcode_output() {             global $wpdb;                        if ($_POST) {             $q = mysql_real_escape_string($_POST['search']);             foreach ($wpdb->get_results("SELECT plaatsen FROM wp_plaatsen WHERE plaatsen LIKE '%$q%'") as $key => $row) {                      $plaatsnaam = $row->plaatsen;                 $b_plaatsnaam = ''.$q.'';                 $final_plaatsnaam = str_ireplace($q, $b_plaatsnaam, $plaatsnaam);     ?>
                    <?php echo $final_plaatsnaam; ?>
     <?php                  }        die();                  }                  ?>

                     <form action="" method="POST">

                                     <input type="text" class="search" id="searchid" name="search" placeholder="Zoek schoen" />

                     </form>

     <?php     }

body: How can I update the table structure of the wordpress plugin on reactivation of the plugin. what is the code for change the structure of the existing table in my plugin. ?

body:
I need paging on news archives page. Data is coming correctly if display all records on same page. But if i add paging code, then pagination values (such as 1,2,3,...16) coming correctly, but if i click on page 2 then it displays the same post title as on page 1.
News

         <?php         $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;     $all_posts = get_posts(array(         'post_type' => 'news',      'posts_per_page' => 20,       'orderby' => 'date',         'order' => 'DESC',         'paged='. $paged,     ));              // this variable will contain all the posts in a associative array         // with three levels, for every year, month and posts.              $ordered_posts = array();              foreach ($all_posts as $single) {                $year  = mysql2date('Y', $single->post_date);           $month = mysql2date('F', $single->post_date);                // specifies the position of the current post           $ordered_posts[$year][$month][] = $single;              }              // iterates the years         foreach ($ordered_posts as $year => $months) { ?>

<?php echo $year ?>

             <?php foreach ($months as $month => $posts ) { // iterates the moths ?>

<?php printf("%s (%d)", $month, count($months[$month])) ?>

                   <?php foreach ($posts as $single ) { // iterates the posts ?>
                       <?php echo mysql2date('F j', $single->post_date) ?> <a href="<?php echo get_permalink($single->ID); ?>"><?php echo get_the_title($single->ID); ?>  (<?php echo $single->comment_count ?>)

                        <?php } // ends foreach $posts ?>

             <?php } // ends foreach for $months ?>
              <?php if(function_exists('wp_paginate')) {             wp_paginate();         }  ?>
 <?php         } // ends foreach for $ordered_posts         ?>
      here is the screen shot:- ![enter image description here](http://i.stack.imgur.com/2oHvm.png)

body:
I'm using a plugin, NextGEN gallery, to display photos. Each gallery from this plugin corresponds to a different sub-page, so I'm using conditional shortcodes to assign the right gallery to it's corresponding sub-page. Problem is, it's not working. I've used this exact setup before without issue, which leads me to believe that whatever is causing the problem now is probably something small I'm overlooking. I think a pair of fresh eyes would help out a lot. Thanks in advance. _ETA: I've also tried putting the corresponding shortcode directly in the sub- page, which needless to say didn't work._ **gallery.php**

PARLOUR GALLERY

REBECCA HAEHNLE | CHRIS KELLER | BILLY MALLOY | VERONICA JONES | ABBEY CASTELLANO | QUARTIA FUTRELL | ROOSEVELT OXENDINE | NICOLE LUESCHOW | MEREDITH NOWLIN | MARICEL YALUNG | STEPHANIE BRANDT | JANNAH DIXON

                     <?php                              if( is_page( 39 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=1]');                         } else {                           // output standard content here                         }                          ?>                     <?php                              if( is_page( 41 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=2]');                         } else {                           // output standard content here                         }                          ?>                     <?php                              if( is_page( 43 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=3]');                         } else {                           // output standard content here                         }                          ?>                     <?php                              if( is_page( 45 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=4]');                         } else {                           // output standard content here                         }                          ?>                     <?php                              if( is_page( 47 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=5]');                         } else {                           // output standard content here                         }                          ?>                     <?php                              if( is_page( 49 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=6]');                         } else {                           // output standard content here                         }                          ?>                     <?php                              if( is_page( 51 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=7]');                         } else {                           // output standard content here                         }                          ?>                     <?php                              if( is_page( 53 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=8]');                         } else {                           // output standard content here                         }                          ?>                     <?php                              if( is_page( 55 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=9]');                         } else {                           // output standard content here                         }                          ?>                     <?php                              if( is_page( 57 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=10]');                         } else {                           // output standard content here                         }                          ?>                     <?php                              if( is_page( 59 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=11]');                         } else {                           // output standard content here                         }                          ?>                     <?php                              if( is_page( 61 ) ) {                           // make your stuff here                           echo do_shortcode('[nggallery id=12]');                         } else {                           // output standard content here                         }                          ?>

      **functions.php**               <?php function nggallery( $shortcode ){ echo do_shortcode( $shortcode ); /* NextGen Gallery */ } ?>

body: I used custom post type, where 'thumbnail', 'medium' and 'large' sized not required. I need to disable this sizes and create function or plugin, where i can set, which image size is required for each custom post type. My first step is hooking of get_intermediate_image_sizes function from wp- includes/media.php. I have added this code to functions.php but it not working :(               add_filter('get_intermediate_image_sizes', 'get_intermediate_image_sizes_fixed');     function get_intermediate_image_sizes_fixed() {         global $_wp_additional_image_sizes;         //$image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes         $image_sizes = array();         if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )             $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );     return apply_filters( 'intermediate_image_sizes', $image_sizes );     }         **UPD:** Editing this line in media.php is working. Default types after changes not generating.               $image_sizes = array('thumbnail', 'medium', 'large');      But how to make work my hook?

body: I've got custom template that I want to display paged blog posts. This is the beginning of my file:               $wp_query = new WP_Query($args);         if($wp_query->have_posts()){             while($wp_query->have_posts()){ $wp_query->the_post();                 //something...         <?php next_posts_link('Older Entries'); ?>         <?php previous_posts_link('Newer Entries'); ?>      It works fine - it displays OLDER and NEWER links when it should. On the first page it will display only a link to older entires. On the second page both to newer entries and yet older ones etc. But I don't want to overwrite current `$wp_query`... I want to use let's say `$wp_query2` for this loop. And the links don't appear at all if I do this. According to this: http://codex.wordpress.org/Function_Reference/next_posts_link they print a link to the prev/next set of posts within the current query. I assume that `$wp_query2` isn't my "CURRENT QUERY" but `$wp_query` always is. Can I change that somehow? UPDATE: Adding `&paged=2` manually to the link causes it to correctly go to the next set of posts (next page) and on second, third etc. page `previous_posts_link()` works even if I use `$wp_query2`. So, I'm just missing `next_posts_link()` functionality on every page.

body: I have installed some plugins with my WordPress site, some time i **modify a lot in the (.css or .php) files** of the plugin to get the results i want after that i can use them with more than one site, so **How can i keep all of these modification when updating the plugin without overwriting ?** so i don't need to do all the work again in all of my site. is there any way similar to the principle of using the child theme so i don't overwrite my costume code?

body: I have a function that redirects users to the login page (home) if they're trying to access any other page without being logged in, here's how it works:               function restrict_access_if_logged_out(){         if (!is_user_logged_in() && !is_home()){             wp_redirect( get_option('home') );         }     }     add_action( 'wp', 'restrict_access_if_logged_out', 3 );      Really simple and works fine, the problem is that is that I need to redirect them to the url they were trying to go to after they successfully log in, exactly like the WordPress backend works. Is there a way to do this? Thanks in advance!

body: > **Possible Duplicate:**   >  Menu items description? Custom Walker for wp_nav_menu() I'm familiar with WordPress and using the WordPress menu system. But I'm looking for a way to add custom HTML to wp_nav_menu. I'm trying to create a menu like this: http://www.achievers.com/ Notice how the drop down menu under products contains a image and a link. I'd like to re-create this. I've looked at a few plugins, but would rather code it. I don't mind hard coding the image and link, but I'd like to keep the flexibility of using WordPress to manage the menus. Any ideas? Thanks for reading Stephen Meehan

body: I intended to run a multi-author site, I don't want the posts from other authors to be shown in `/wp-admin/edit.php` page. I managed solve this problem by the codes from this thread. The code is like this:               function posts_for_current_author($query) {         global $pagenow;              if( 'edit.php' != $pagenow || !$query->is_admin )             return $query;              if( !current_user_can( 'manage_options' ) ) {             global $user_ID;             $query->set('author', $user_ID );         }         return $query;     }     add_filter('pre_get_posts', 'posts_for_current_author');      The codes work great, it hide the posts from other authors to be shown at here. But I do find another problem - the menu at top of the page doesn't change the associated number of posts by the author, it shows the number of all the post in my site. The menu I mean is like this:               Mine () | All () | Published () | Draft () | Trash ()      How to change the number in the `()` to reflect the number only associated to the author?

body: Setting up a WP multisite instance - the client has an existing ontology / set of categories that they want to classify all content across the set of blogs. Also the desire is that any new categories would be added at the 'network blog' level and synced to the other blogs. What's the best way of doing this?

body: I couldn't find a way to change this in an upgrade friendly way, and I know I mustn't touch the core! I need to change the value 'number' to 10 in `wp-includes/default-widgets.php`               wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy, 'number' => 10) ) );      How can I do this without changing the core?

body: i need to excute posts from 2 search keywords & put all in one loop to showing by using WP-Query i have trying `array_merge` but this not worked for me so my last code is: **please note: i need to excute posts from 2 seprated keywords not one keyword containing 2 words & put the posts from keyword1, keyword2 in the same loop**               $argssss=array('s'         => 'keyword1');     $argsss=array(     's'         => 'keyword2',     'orders'    => 'DESC',      'showposts' => 60     );     $argss=array_merge( $argssss, $argsss );         $queryy = new WP_Query($argss);          if ( $queryy->have_posts() ) :     while ( $queryy->have_posts() ) :         $queryy->the_post();         $do_not_duplicate = $post->ID;         the_title( '<p>', '</p>' );     endwhile;          wp_reset_postdata();     endif;          i have also tried to put `s` in array but not worked like this `array('keyword1','keyword2')` so how can i excute posts from 2 different keywords this answer is very very good it solved my problem by merging 2 wp_query in one Combining queries with different arguments per post type **another note this answer is very very good because it is really merged the two`wp_query` in one but i can't figure it with my filter Custom query with category exclusion and post-meta "whitelist"** but how can i use pagenavi with my custom query

body: How can I remove a filter that has been added the following way:               // Add the filter before executing the query         add_filter('posts_where', function( $where ) use ( $lat, $lng) {             return location_posts_where( $where, $lat, $lng );         },         12     );          // Execute the query       $the_query = new WP_Query( $args );        I tried this, but it does not seem to do the job:               // Remove the filter just to be sure its not used again by non-related queries       remove_filter( 'posts_where' , 'location_posts_where' );

body: > **Possible Duplicate:**   >  How should one implement add_settings_error on custom menu pages? The Settings API offers all sorts of labour saving features and future proof code. I find it really odd that it's not designed to work with plugins using custom admin menus. Is there any reason for this? Is the situation likely to change in future?

body: I'd like to have the backend of Wordpress in English and use a different locale for the frontend so far I figure out perhaps I could do it by setting in the wpconfig the locale I want to use in the frontend, then add in functions.php something like this:               add_filter('locale', 'mytheme_backendlocale');     function mytheme_backendlocale($locale) {         if ( is_admin() ) {             return 'en_US';         }         return $locale;     }      is this the best practice to achieve what I want or should I do it differently?

body: > **Possible Duplicate:**   >  Exclude Category From Home Page, Display Posts on It's Own Page? This is what I want to do:   1. I don't want posts from a certain category to show up in my blog. ie, category: shop   2. Instead I want to display them on a separate page not category archive. instead of only posts from a certain category to show I want a single category not to show on main blog. how do I do it?

body: > **Possible Duplicate:**   >  Shortcode always displaying at the top of the page I have a wordpress site with wp e-commerce plugin and gold cart plugin. I have created a worpdress page with following: ———————————————– some text some details about the page [shortcode] ———————————————– I have 2 different div blocks and shortcode is after the page content. But when the page renders the shortcode outputs first before the page content. Can anyone help me to output the page content first and then the shortcode? Thanks in advance for help. Jaspal Singh aka jsxtech

body: > **Possible Duplicate:**   >  Caption in Page adding unwanted 10px to width This is a screen capture from a post. I have given .wp-caption a black background so the extra 10px margin on the right can be seen. The 10px margin on the top is purposeful. **I don't know what is causing the 10px margin on the right and there is nothing else I can find in my code that would create it... I've even eliminated everything in my CSS to rid it of this margin but it still remains.** One solution is to set the image width to 100%, but this adds an adittional 10 pixels to my assigned image size in my posts and therefore makes the image distorted horizontally by 10 pixels. **This problem is only happening with captions, not general images.** You can see the problem here: http://themeforward.com/demo2/sample-elements/ ![http://imageshack.us/photo/my- images/217/prob1c.jpg/](http://i.stack.imgur.com/IURSR.jpg)               /*////////////////////////////////////////////////////////////////////      //  30. Images     ////////////////////////////////////////////////////////////////////*/     img {         border:0;         overflow:hidden;         z-index:5!important     }     #post_content img, p img {         height:auto;         z-index:5!important;         max-width:650px;         margin-top:9px!important     }     #content img {         display:block;         clear:both;         max-width:100%!important     }          /* Images - Aligning */     .aligncenter {         clear:both;         display:block;         margin:0 auto 10px     }     .alignleft {         display:block;         float:left;         margin:0 25px 10px 0     }     .alignright {         display:block;         float:right;         margin:0 0 10px 25px     }          /*////////////////////////////////////////////////////////////////////      //  31. Image captions     ////////////////////////////////////////////////////////////////////*/     .wp-caption img {         border:none;     height:auto;         background:#F5F5F5;         max-width:650px!important         }     .wp-caption p.wp-caption-text {         font-size:85%;         padding:0!important;         margin:2px 0 5px!important;         line-height:175%!important;         font-style:italic;         text-align:left     }     .wp-caption { background:#000 }          /* Image Captions */     .alignleft.wp-caption { margin:0 25px 10px 0 }     .alignright.wp-caption { margin:9px 0 10px 25px }     .aligncenter.wp-caption { }

body: > **Possible Duplicate:**   >  $ not defined using jQuery in Wordpress I need to trigger a alert box when video ends THis is the code i got from google               <script>     $("iframe[src^='http://www.youtube.com']").bind("ended", function() {     alert("I'm done!");      });     </script>      I am just using the oembed function of wordpress to play youtube videos I dont now why there are not working

body:
I'm in the middle of developing a site (http://he.leavingworkbehind.com/) which features a single post on the home page, as determined by the "Blog pages show at most" option in Settings > Reading. However, I've created a tag.php page where I'd like a complete list of posts (for the relevant tag) to be displayed. I've managed to find the code that can create that list:               <?php          if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

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

          <?php endwhile; endif; ?>      The list is only returning one result though -- presumably because of the aforementioned "Blog pages show at most" setting. So my question is this: how do I override this setting? To be more specific, **what exact code should I insert on tag.php?** I have a feeling that I may have already seen the answer here on Stack Exchange but am too ignorant of PHP coding to implement it successfully. Your help would be much appreciated! Cheers, Tom

body: Is there something like a function for letting the WP search form search for ONLY some tags you fill in. in example:               function wordpress_search{         //search for tagname1, tagname2, tagname3     }      If that is not possible, will it be possible to do the opposite? So to exclude tags from search? I have no idea where to begin and google only points me to plugins where you have to (un)check a checkbox in every article

body: My question is simple, I'm using WP_Query to retrieve some custom type posts filtering by a taxonomy using tax_query. Now my problem is I would like to orderby the taxonomy, but from documentation and searching in the web I can't find a solution. The orderby in WP_Query let's you order by a bunch of fields even custom meta fields but it doesn't seem to support taxonomy. Any pointers on the right direction? Thank you all.

body: IS there a way to show code only when a user is on a mobile device and it wont show up on the desktop. I found the wp mobile detect plugin that looks to do the trick my thoughts are 1\. Is this a good plugin do people have alternatives 2\. Is there a way to do this without a plugin, manul code wish?

body: I'm creating a blog to write my daily notes. Actually it's a Diary. So, I am the only one who writes it and only one who reads it. I don't need anyone else to see it. So, I need to lock my entire blog only for me. This is the process I'm looking to create. When I entered the blog url in the browser, I should see a login page. (such as wp back end login). So, I enter the PW and login. Then I should be redirected to the blog page. That's it. Since I'm already logged in, I should be able to add new posts without logging in again. Hope you all got it. So, please guide me how to do it. I'm very new to Wordpress. Thanks!

body: For example, if I create a post type called "destinations" does that automatically create capabilities like "edit_destinations" or "delete_destinations"?

body: > **Possible Duplicate:**   >  Error 310 too many redirects after switching domains Some of my pages are resulting in 310 errors. We recently switched domains from kgstiles.com to healthmasterysystems.com then discovered healthmasterysystems.com was listed as not trust-worthy by google and really strange popups kept coming up. Google had had a malicious site warning dating back to March - long before we got it, so yesterday we switched it back. if you go to http://www.kgstiles.com/pureplantessentials/, it redirects to kgstiles.com/missing/. I have installed all sorts of plugins to stop it, I have changed the permalink structure, cleared htaccess, repaired the database etc..etc.. nothing ever worked, so I restored the database and all of the files to before we switched domains and the problem still persisted! Is it safe to assume something outside of the website is affecting it? What could possibly be happening?

body: Besides installing W3 Total Cache or another caching plugin what steps can I take to make sure that my theme and site run as fast as possible.

body: I would like to have a single post on my front page (always the latest), but let normal paging work. So the front page has post 1, the next page should have post 2-11 (1-10 is fine too), then 12-21 or 11-20, and so on. I know I can change the number of posts depending on the context, but setting this to "1" on the homepage means the further pages also show only one post. My main problem is that `/page/2/` and so on works, but `/page/1/` always redirects to the real home page, `/`. This means posts 2-10 are always skipped, since page 2 shows 11-20. I currently solve this by linking to my archive, but this is not ideal when you come to the first posts of the year and there are fewer posts and no obvious way of continuing.

body:
> **Possible Duplicate:**   >  Top Commenters: exclude admin While back I found this hack here to display top commenters. It works fine. But I would like to exclude the admin from the commenters list. So Please help modify the code to exclude the admin Thanks. The code is:               function top_comment_authors($amount = 5) {               global $wpdb;           $results = $wpdb->get_results('              SELECT                  COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url              FROM                  '.$wpdb->comments.'              WHERE                  comment_author_email != "" AND comment_type = "" AND comment_approved = 1              GROUP BY                  comment_author_email              ORDER BY                  comments_count DESC, comment_author ASC              LIMIT '.$amount           );       $output = "
";          foreach($results as $result){              $output .= "
".(($result->comment_author_url) ? "comment_author_url."'>" : "").$result->comment_author.(($result->comment_author_url) ? "" : "")." (".$result->comments_count.")
";                    }          $output .= "
";           echo $output;       }

body: I am trying to generate a different image size of a parent themes functions.php within a child themes functions.php. Here is the code of the parents functions.php               // Parent Theme functions.php Code for Registering Thumbnails     // Register Thumbnails          /////////////////////////////////////                    if ( function_exists( 'add_theme_support' ) ) {          add_theme_support( 'post-thumbnails' );          set_post_thumbnail_size( 660, 400, true );          add_image_size( 'post-thumb', 660, 400, true );          add_image_size( 'medium-thumb', 400, 242, true );          add_image_size( 'small-thumb', 270, 164, true );          }      The image size I want to change is the post-thumb. I want to replace it with a 1000x350 instead of the 660x400               // Child Theme functions.php          function remove_parent_theme_features() {         remove_theme_support( 'post-thumbnails' );     }          add_filter( 'intermediate_image_sizes_advanced', 'remove_parent_image_sizes' );          function remove_parent_image_sizes( $sizes ) {         unset( $sizes['post-thumb'] );         return $sizes;     }          if ( function_exists( 'add_theme_support' ) ) {          add_theme_support( 'post-thumbnails' );          set_post_thumbnail_size( 1000, 350, true );          add_image_size( 'post-thumb', 1000, 350, true );          }      Unfortunately it does not seem to be effective. I am running a force regenerate thumbnail and the thumbs create are still at 660x400. Anyone can help me out? I think i have also done too much to achieve this. I believe the remove_theme_support call is actually not necessary... Thanks!

body: I read about 2 methods for initializing wordpress function outside of wordpress files so We can use these functions on any page or website outside the wordpress blog. Which one of these 2 methods is the correct one? And what is the uses for each method if both are correct? What is the deference between using this method or the other? Method 1 :               <?php      define('WP_USE_THEMES', false);     require('./wp-blog-header.php');     ?>      Method 2 :               <?php      define('WP_USE_THEMES', false);     require('./wp-load.php');     ?>

body:
I am displaying a div in the Edit Post screen using `add_meta_box()`. This function provides very limited positioning options via "priority" and "context" params and these are not sufficient for my needs. I need to be able to display the div below the Permalink but above the Insert Media button on Edit Post, specifically below the div "titlediv", above the div "postdivrich". How else can I position the meta box on the post edit screen? Can this be done through jQuery? Here's a partially working solution:               function admin_init(){       add_meta_box("wd_meta", "WD Meta", "wd_meta", "post", "normal", "high");     }     add_action("admin_init", "admin_init");          function wd_meta() {         global $post;         $custom = get_post_custom($post->ID);     ?>

Display a message here.

                <?php } ?>      The meta box is displaying on the page correctly, but the javascript is not positioning it correctly, even though it appears to work in demo: http://jsfiddle.net/kFTc5/11/

body: I have a custom post type of portfolio (slug portfolio) in my theme and all is working well except one thing. When people create a page with a slug of portfolio, eg: example.com/portfolio, the theme thinks I'm wanting to use the custom post type archive page, not my page created in the editor. Can I somehow "reserve" the slug portfolio when pages are saved to be sure it never gets used, maybe renamed to portfolio-page? My project uses the methods outlined in this tutorial, here's the conflict I'm referring to: > "Beyond having to patch the code there is one other catch here in that you > can’t call your Page slug the same thing as your custom post type slug. > Think of your custom post type slug as a reserved keyword; however, you can > make the title of your Page the same name as your custom post type slug just > as long as your Page slug is something different." - > http://wp.tutsplus.com/tutorials/custom-post-type-pagination-chaining- > method/ Thanks for any advice!

body: I have a search field for the blog posts, but I need an other for a custom post type. How can I create this _custom search form_ with a **_different** search result layout_?

body: > **Possible Duplicate:**   >  Hooking into add_submenu_page This plugin uses add_menu_page function to create an admin page and I was wondering is there a way to change the capability that is set by this function for this plugin?

body: I've been looking around the net for a long time on how to disable WordPress from creating multiple thumbnails. I've seen in most tutorials to set all the images to 0 in the media section. I have done that, but going to my uploads folder and it still creates multiple images. I can't find any solution for this. The reason I want this is to save space on my host account.

body: I have a blog that I often need to insert iframes into posts for various reasons (don't ask why just trust me!) When I use the "visual" view to edit my posts the WYSIWYG constatantly strips out my iframes ... I know I can keep the iframes in the post if I use the "html" view and only view/save from the "html" view ... however I'd **_really_** like to be able to use the normal WYSIWYG to edit my post **_without_** having to resort to the "html" view. Is there anything I can do to disable this behavior? I've see this post: http://wordpress.org/support/topic/wordpress-28-no-more-iframe Suggsting editing **wp-includes/js/tinymce/tiny_mce_config.php** but I'd really rather avoid doing something like that that would likely just break in a upgrade!

body: I am using FOREIGN KEY with dbDelta when activating the plugin (register_activation_hook()). It works great when creating the table for the first time, but outputs an error when updating the table (the table is already present but an alteration has to be done on the table). Any suggestions?                   if(GLOBAL_PLUGIN_VERION != get_option("GLOBAL_PLUGIN_VERSION")){           $sql = "CREATE TABLE `".TEST_TABLE."` (          `id` INT( 11 ) NOT NULL AUTO_INCREMENT,          `title` VARCHAR( 100 ) NOT NULL,          `description` TEXT DEFAULT NULL,          `location_id` INT( 11 ) NOT NULL,          PRIMARY KEY  (`id`),          FOREIGN KEY  (`location_id`) REFERENCES `".TEST2_TABLE."` (`id`)         );";        }      Error: > PHP Notice: Undefined offset: 1 in wp-admin/upgrade.php on line 1568 > > WordPress database error You have an error in your SQL syntax; check the > manual that corresponds to your MySQL server version for the right syntax to > use near 'FOREIGN KEY (`location_id`) REFERENCES `test2` (`id`)' at line 1 > for query ALTER TABLE test ADD COLUMN FOREIGN KEY (`location_id`) REFERENCES > `test2` (`id`) made by ... > > WordPress database error Multiple primary key defined for query ALTER TABLE > TEST ADD PRIMARY KEY (`id`) made by...

body: For a client we'll need 29,000 terms (all the highschool's in the US) and each term needs 6 meta items (address, phone...). My initial thought was to store the term meta information as suggested in this post but after looking through it again I will be using lots of terms and I wonder if it will overload the options table. Is there a good time to create a new table? Would this qualify? Other thoughts on how to relate the HS that a person attends to the 'post' that will be their academic profile? It was suggested that I make the 'terms' a Custom Post Type. I'm not opposed to that either but I fail to see how I'll relate the CPT to multiple 'authors' since a school will have more than one student that attends it. Because of the multiple ownership of the content terms just seemed to fit better.

body: I have a WordPress installation at the document root for a domain, and then an additional installation in an immediate subdirectory of that installation such that I may use different themes for the two. I want to link the two sites logins so that you don't have to login twice in order to use both sites. My coding skills are not great, so an easy fix or an of the shelf plugin are preferred.

body: I'm creating a wordpress theme that I aim to sell at some point. Now, I've discovered that some of the wordpress.org plugins would be great for things that I want to do. They already hold much of the functionality I aim to achieve, so I thought of using them directly (they are under GPL I suppose). I would probably need to adjust stuff, but I was wondering. Is there any universal-like way to include wordpress plugins inside my theme and not in the separate plugins folder ? That would be ideal, because I do not really want customers to have to copy to different folders. At first glance of the plugins, it seems not possible, but I suppose it never hurts to ask :)

body: Does anyone know how to code: if($userImagesCount > 500){               stop wp_media_uploader;      } not for admin but within the wp_media .edit-gallery Thank you

body: I have this code:               <?php     // List subcategories of category '4'     $subcategories = get_categories('&child_of=4');      foreach ($subcategories as $subcategory) {       echo sprintf(' %s •', get_category_link($subcategory->term_id), apply_filters('get_term', $subcategory->name));     }     ?>      This code retrieves a list of subcategories from category id 4. I have added this code in post loop(`have_posts()`). It is showing all tagged subcategories from that category on every post's box. What I want is to just show the subcategories from the category 4, which is tagged in that post. It shouldn't show all the subcategories from all categories tagged for all the posts. Thanks in advance

body: I am creating a submenu with the following code:               add_action( 'admin_menu', 'jp_create_admin_pages' );          function jp_create_admin_pages()     {         add_menu_page(             'Members',             'Members',             'manage_options',             'members',             'jp_handle_admin_members');              add_submenu_page(             'members',             'Membership Types',             'Membership Types',             'manage_options',             'jp_handle_admin_membership_types');     }      This creates a custom menu called 'Members' with two sub-menus: 'Members' and 'Membership Types'. I want to make it so that the first submenu is called 'All Members' instead of 'Members' (to mirror the built in menu types). Any ideas?

body: > **Possible Duplicate:**   >  How to Use the Function is_user_logged_in To Display Different Menus? I wish to create a log in page, that displays like an extended menu for example (the people who land on the page first will not see this extended menu) Now is it a case that i create a page that uses one menu? And another page that uses a different menu? However i have used the menu in the header, so would i need to create a different page template that calls one header showing X menu, and then another one that shows Y menu which the customers will be directed to when they "log in" Thankyou in advance. Kirsty

body: I would like to query my two custom post types and sort them by a custom field if it isset . they are 'job_ispaid' and 'blogger_ispaid' which are both either 0/1 and also displaying the post in date order? can i add an array to meta_vaule then orderby ?...                <?php             $post_type = array ('job', 'blogger');           $tax = 'job_category';    // I want to add 'blogger_category' here too ?           $tax_terms = get_terms($tax);           if ($tax_terms) {             foreach ($tax_terms as $tax_term) {               $args=array(                 'post_type' => $post_type,                 "$tax" => $tax_term->slug,                 'post_status' => 'publish',                 'posts_per_page' => -1,                 'orderby' => 'title',                 'order' => 'ASC',                 'caller_get_posts'=> 1               ); // END $args                    $my_query = null;               $my_query = new WP_Query($args);               if( $my_query->have_posts() ) {                      while ($my_query->have_posts()) : $my_query->the_post(); ?>

body: I am currently trying to create a wordpress search function that shows live results underneath the search bar. There is an example on the World Bank website (screens below). I'm not looking for an autofill like you would find on Google.com which completes words you type, rather I want it to find actual posts on the site. I tried doing a scrub through Wordpress Answers and other similar resources but have only run into implementing a Google type search which is not what I am looking for. Any help or points in the right direction would be greatly appreciated. ![search-before](http://i.stack.imgur.com/Bx8mY.png) ![search after](http://i.stack.imgur.com/DEICm.png)

body: > **Possible Duplicate:**   >  How to Rewrite Wordpress URL for a Plugin I'm creating a plugin for Wordpress. Is there any way or API to make plugin receive a path or URL so that it can trigger or output something. I mean something like this               add_filter('THE_FILTER_NAME', 'myPluginFunc');     function myPluginFunc($url)     {         if($url != 'mydesiredurl')             return;              echo "this URL path is handled by myplugin";     }      or               register_urlpath('mydesiredpath', 'mycallbackfunction');      and also, if applicable, this url path is registered to my plugin so users cannot assign any page using that url anymore, unless myplugin is deactivated. EDIT: additional info i'm creating plugin which need a path to be called as something like webservice, when the site is calling is a way, thedomain.com/myplugin, then what i want is the wordpress system understand that the URL requested is for myplugin, and therefore will execute a function myplugin supplied, which in my case, is simply send email to site admin. Thanks in advance.

body: We have a site with categories and subcategories. If anybody navigates to a content belongs to a subcategory the url will have the following form: `domain/main-category/sub-category/mycontent/` But we need another form: `domain/main-category/mycontent` where `mycontent` belongs a subcategory inside `main-category`, but we don't want the subcategory to be displayed in the URL. Is there any possible solution for this?

body: I'm using this code and getting only a forward slash for results. I'm trying to print the parent category of a WooCommerce product.               $prod_cat = get_category_parents($product->id);     echo $prod_cat;      Any idea how to modify it so it prints the parent categories name?

body: Is there any reason why Wordpress restricts the amount of posts you can administer at once to 20? Is there a way to display all posts? I want to change the category for about 1800 posts. I don't have the ability to change the post amount under screen options; see here: tinyurl.com/3npm5yz Using WP v3.1.3

body: I recently noticed that Wordpress tries to auto-complete a URL when it's not submitted in its entirety. E.g. I have a post URL that looks like this:               http://www.mysite.com/some-post-title      If I browse to the following URL:               http://www.mysite.com/some-post-ti      I can see that the URL is submitted to Wordpress but that Wordpress is doing a 301 redirect to `http://www.mysite.com/some-post-title`. How can I disable this behavior?

body: _Editors note: Twitter ID and Google Analytics only serve as examples and are exchangeable._ **TL;DR** I want to save external data in a user profile once or twice a day. I added two custom fields in my user profiles:   1. Twitter_ID (I manually put it from the dashboard)    2. test1 (external data got with php function) I would like to be able to do something like : Save once a day in `test1` for each user profile the external data I get from `Twitter_ID`. The main goal : I am working on a panel which will display statistics of my user websites (external website). For that, I use the Google Analytics API. I save the Google Analytics profile number in a custom profile field. For the moment, I run the script (statistics) each time my users want to see them (in front end). And it takes few seconds to generate them. My statistics change approx once a day (It's not hourly stats, but daily stats). So, the idea was to save once a day the statistics to the user profiles. So, like that, it won't take time to generate them each time the user will load a stats page. The solutions : So, I started to think about different solutions. But the best would be to save the data without any action from the users. Or maybe when someone visits the website, it would save the data for everyone once the day with wp_cron. For the moment, the only thing I succeed was to save the data when a user update his profile. But it will save only his data, and not for everyone, so it's not what I want. **EDIT** **I tried this :**               add_filter('cron_schedules', 'new_interval');          function new_interval($interval) {              $interval['minutes_1'] = array('interval' => 10*60, 'display' => 'Once 1 minute');              return $interval;     }               function InitiateMyCron() {         if (!wp_next_scheduled('MyCronAction')) {             wp_schedule_event(time(), 'minutes_1', 'MyCronAction');         }     }          function MyCronAction( $user_id ) {         $twitter_id = $_POST['twitter_id'];         $result = $twitter_id;         if ( !current_user_can( 'edit_user', $user_id ) )         return false;         update_usermeta( $user_id, 'test1', $result );     }          add_action( 'personal_options_update', 'MyCronAction' );     add_action( 'edit_user_profile_update', 'MyCronAction' );      But, the field "test1" is updated when I save the "Twitter_id". I don't know if it is updated every minute **EDIT 2**               if ( ! wp_next_scheduled( 'my_save_statistiques' ) ) {       wp_schedule_event( strtotime('tomorrow'), 'daily', 'my_save_statistiques' );     }           function my_save_statistiques( $user_id ) {               "blabla php"  =             $ga->requestReportData($num_analytics,array('pagePath'),array('visits'), null, null, $fromDate, $toDate);      $visites_totales = $ga->getVisits();                    if ( !current_user_can( 'edit_user', $user_id ) )     return false;     update_usermeta( $user_id, 'visites_totales', $visites_totales );     add_action( 'personal_options_update', 'my_save_statistiques' );     add_action( 'edit_user_profile_update', 'my_save_statistiques' );     }      **EDIT 3** I finally ended up with this but it's not working : (I changed 1 week to 30 seconds but the name are still the same)               add_filter( 'cron_schedules', 'myprefix_add_weekly_cron_schedule' );     function myprefix_add_weekly_cron_schedule( $schedules ) {         $schedules['weekly'] = array(             'interval' => 30, // 30 seconds             'display'  => __( 'Once Weekly' ),         );              return $schedules;     }          // Schedule an action if it's not already scheduled     if ( ! wp_next_scheduled( 'myprefix_my_cron_action' ) ) {         wp_schedule_event( time(), 'weekly', 'myprefix_my_cron_action' );     }          // Hook into that action that'll fire weekly     add_action( 'myprefix_my_cron_action', 'myprefix_function_to_run' );     function myprefix_function_to_run() {         function my_save_statistiques( $user_id ) {                  [...]             $visites_totales = $ga->getVisits();                  if ( !current_user_can( 'edit_user', $user_id ) )             return false;             update_usermeta( $user_id, 'visites_totales', $visites_totales );         }         add_action( 'personal_options_update', 'my_save_statistiques' );         add_action( 'edit_user_profile_update', 'my_save_statistiques' );     }      **Edit 4:** I discovered that **add_action( 'personal_options_update', 'my_save_statistiques' );** is the action when a user updates his own profile but it's not what I want... Because I want to save the data for all users once a day. So that's why (I guess), I thought that my previous code wasn't working. **Edit 5:** **FIRST STEP : 1/2 SUCCESS** The user will save his data each time he visits the website. The main goal was to update the data for everyone but it can work like that. Next step : Cron               function my_save_statistiques( $user_id ) {          $visites_totales = [myscript];         if ( !current_user_can( 'edit_user', $user_id ) )         return false;         update_usermeta( $user_id, 'visites_totales', $visites_totales );     }     add_action( 'wp_head', 'my_save_statistiques' );      **EDIT 6:** Is it correct ?               // Schedule an action if it's not already scheduled     if ( ! wp_next_scheduled( 'wp_head' ) ) {     wp_schedule_event( time(), 'hourly', 'wp_head' );     }     // Hook into that action that'll fire weekly     function my_save_statistiques( $user_id ) {      $visites_totales = [myscript];     update_usermeta( $user_id, 'visites_totales', $visites_totales );            }     add_action( 'wp_head', 'my_save_statistiques' );      **I found a different solution** **The solution :** Save the time when the action has been ran and check the difference with actual time :               function my_save_statistiques( $user_id ) {          $user_id = get_current_user_id();          $current_time = time();               if (empty($current_time)) {         update_usermeta( $user_id, 'last_analytics',  $current_time );         }              $last_analytics = get_user_meta( $user_id, 'last_analytics', true );         $diff = $current_time - $last_analytics;         $one_day = 86400;              if ($diff > $one_day) {              $visites_totales = [myscript]              update_usermeta( $user_id, 'last_analytics',  $current_time );         update_usermeta( $user_id, 'visites_totales',  $visites_totales );         }     }          add_action( 'wp_head', 'my_save_statistiques' );

body: In wordpress gallery(through add media) when i create a gallery it default shows the thumbnail size image. Instead of it i want to set to show the medium size image by default. It is not good and takes lot of time to edit the old post for the tag manually: `[gallery size="medium"]` So i want to show the medium size by default. It can be through `functions.php`

body: I am working on a theme with custom post type.   the issue currently is that i am saving the layout files in a folder called templates.. and in front-page.php i am using an options check to see which type of layout did the user selected from theme panel.. and include that file..   Right now in the custom post type template, pagination isn't working.. i am using this loop :                   global $wp_query;          $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();     $wp_query->query('post_type=portfolio&paged='.$paged);                     if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post();          ......         <?php endwhile; endif; ?>         ..             <?php                      if (function_exists("pagination")) {             pagination($additional_loop->max_num_pages);}                 ?>           <?php $wp_query = null; $wp_query = $temp;?>      The pagination shows up but shows link as /page/2/ .. which gives 404 on running.. in my opinion it is showing the main query's page 2, as not many posts added so giving 404. I have also tried :               $paged = 1;       if ( get_query_var('paged') ) $paged = get_query_var('paged');       if ( get_query_var('page') ) $paged = get_query_var('page');          Didn't work..   My Custom Post Register Structure :               function my_custom_post_portfolio() {         $labels = array(             'name'               => _x( 'Portfolio', 'post type general name' ),             'singular_name'      => _x( 'Portfolio', 'post type singular name' ),             'add_new'            => _x( 'Add New', 'book' ),             'add_new_item'       => __( 'Add New Item' ),             'edit_item'          => __( 'Edit Item' ),             'new_item'           => __( 'New Portfolio Item' ),             'all_items'          => __( 'All Items' ),             'view_item'          => __( 'View Items' ),             'search_items'       => __( 'Search Portfolio' ),             'not_found'          => __( 'No Portfolio found' ),             'not_found_in_trash' => __( 'No Portfolio found in the Trash' ),              'parent_item_colon'  => '',             'menu_name'          => 'Portfolio'         );         $args = array(             'labels'        => $labels,             'description'   => 'Holds our Portfolio and product specific data',             'public'        => true,             'menu_position' => 5,             'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),             'has_archive'   => true,             'rewrite' => array( 'slug' => 'portfolio', 'with_front' => true ),             '_builtin' =>  false, // It's a custom post type, not built in!             'query_var' => true,             'taxonomies' => array('portfolio', 'post_tag') // this is IMPORTANT         );              register_post_type( 'Portfolio', $args );        }     add_action( 'init', 'my_custom_post_portfolio' );        Help is appreciated! Thanks :)

body: I have a custom post type named 'itineraries' and its slug is being rewritten to 'destination' My urls to a single itinerary post look like this: _/destination/%post-name%/_ I have a custom taxonomy named 'location' to organize the itineraries. I would like my urls to look like this: _/destination/%location-name%/%post- name%/_ Any ideas how to achieve this?

body: I'm using WP User Frontend Pro, but the pro version lacks the feature of letting admins edit registered users profiles from front end. I'm building a web app using WordPress, and the administrator will not have access to the WordPress Dashboard. I've created the features that I need and put them all on the front-end. The only user with access to WordPress Dashboard will be the super administrator (me). But I will only manage the system. The web app administrator will need to edit users from font end. Is there a way to achieve this? Or is there a plugin with this feature? I appreciate all help, since this is the last thing I have to do before putting the web app live.

body: > **Possible Duplicate:**   >  wordpress query causing load In the site I'm trying to optimize, I noticed several queries that are rather slow and start with **`SELECT SQL_CALC_FOUND_ROWS`** Searching this site, the relevant question **wordpress query causing load** has no adequate answer, in my opinion. Can I somehow disable `SQL_CALC_FOUND_ROWS` without breaking too many things - if possible breaking nothing? It seems that pagination relies on this. @Wyck advised me to read this core ticket: **#10964**. After reading it, I can't really understand if the ticket been completely resolved, it seems not. In any case, is there a way to disable `SQL_CALC_FOUND_ROWS`?

body: > **Possible Duplicate:**   >  How do you debug plugins? I have an issue that the posts table shows "no posts found" right after the installation although I can see "All (1) | Published (1)" right above it. Now I'm not asking how to fix this very issue, I'd rather **learn how to troubleshoot such issues in general**. Is there a log file? (Haven't found one.) Is there some plugin that would help with seeing which SQL commands are executed and what data is returned? Something to display PHP warnings? Thanks.

body:
Something like this. I would like to get only the second level menu items, not their parent items. Home   * Sub Menu Item 1   * Sub Menu Item 2 About   * Sub Menu Item 3   * Sub Menu Item 4 For example, from this list I'd like an output of something like.

Sub Menu Item 1

Sub Menu Item 2

Sub Menu Item 3

Sub Menu Item 4

      I have been at this for weeks now, no answer I found on this site or any other has helped.

body: How can a report/flag post function be actioned? A link or button should appear which allows visitors to report the post to admin to remove or update. Plugins I have found are out of date (2009) and extremely sluggish.

body: I have publications and I want to simply add year and month to the permalink. Currently the year and month of publication is added to the post as a meta value. I've set up publications as a custom post type and created taxonomy for the specific title of the publication. I would like the permalink to be: publications/publication-title/year-published/month-published/name-of-post I simply want to add the meta values for the publication year and month to the permalink. So far, I've been able to pull the year and month published and add it to the url but unfortunately I keep getting a 404 when I try to access posts. I think I'm taking a wrong turn with one of my steps below ... Any help would be appreciated. These are the steps I did in the following order:   1. Since I was adding publication-year and publication-month to the url, I was reading that I had to make WordPress aware of these custom querystring variables. I added the following functions to register these custom variables:              function pubyear_register_rewrite_tag() {           add_rewrite_tag( '%pubyear%', '([0-9]{4})');       }            add_action( 'init', 'pubyear_register_rewrite_tag');          function pubmonth_register_rewrite_tag() {          add_rewrite_tag( '%pubmonth%', '([0-9]{2}');       }            add_action( 'init', 'pubmonth_register_rewrite_tag');      2) Added the year and month to the permalink structure:               add_filter('post_type_link', 'pub_term_permalink', 10, 4);          function pub_term_permalink($permalink, $post, $leavename, $sample)     {         if ( false !== strpos( $permalink, '%publication-title%/%pubyear%/%pubmonth%' ) ) {               //get the publication-title          $publicationtype = get_the_terms( $post->ID, 'publication-type' );               //get the year of the publication          $pubyear = date('Y', get_post_meta($post->ID, 'pub_date', true));               //get the month of the publication          $pubmonth = date('m', get_post_meta($post->ID, 'pub_date', true));               $rewritecode = array(              '%publication-type%',              '%pubyear%',              '%pubmonth%',              $leavename? '' : '%postname%',          );               $rewritereplace = array(              array_pop($publicationtype)->slug,              $pubyear,              $pubmonth,              $post->post_name          );               $permalink = str_replace($rewritecode, $rewritereplace, $permalink);               }         return $permalink;     }      3) Add rewrite rules:               function pub_add_rewrite_rules() {           add_rewrite_rule(  '^([^/]*)/([0-9]{4})/([0-9]{2})/([^/]+)?', 'publications/index.php?pagename=$matches[3]', 'top' );       }            add_action( 'init', 'pub_add_rewrite_rules' );      4) Made sure the custom post type is registered and includes this rewrite array:               'rewrite' => array         (                 'slug' => 'publications/%publication-type%/%pubyear%/%pubmonth%',         'with_front' => false              ),

body: I'm currently working on a Magazine style website and on the main page I have three different sections where I display the latest news. Slider, latest news and more news. The problem is I can't figure out how to avoid duplicate posts on each one. Here is a sample of the query:               // build query     query_posts( $this->getQueryParams($type, $esc_category, $this->escapeText($data['number_of_posts'])) );     // loop     while (have_posts()) : the_post();      Each section is called as a "Module" so this same code applies for the rest of the queries. Thanks!

body: I am building a Wordpress website where I need a custom registration page with extra fields which sends extra fields in a email. My idea was to create the custom form then in the posted script use Wordpress' functions such as wp_create_user to create the user. I have created the form and am trying to set up the custom script which processes the form. I think that I need to include wp-load.php but I am receiving errors (the location of my custom script is in my Theme folder). I've tried various code such as require("wp-load.php"); require("/home/sites/mysite.co.uk/public_html/wp-load.php"); I read that I may need a absolute path so I put this code in a php file to get the path:                    echo $_SERVER['DOCUMENT_ROOT'];      Then added the wpload.php after, but still an error. I have also tried: require("../../../wp-load.php"); But an error. The error which shows is: Warning: require(/home/sites/mysite.co.uk/public_html/wp-load.php): failed to open stream: No such file or directory in /home/sites/mysite.co.uk/public_html/testsite/wp- content/themes/Phenomenon/scripts/register-process.php on line 5 Fatal error: require(): Failed opening required '/home/sites/mysite.co.uk/public_html/wp- load.php' (include_path='.:/usr/share/pear53:/usr/share/php:/usr/share/ZendFramework') in /home/sites/mysite.co.uk/public_html/testsite/wp- content/themes/Phenomenon/scripts/register-process.php on line 5 I've never done this kind of thing before so any help is much appreciated. Thank you.

body: i try to run a custom post type query to match following criteria:   sort movies first by year in descending order,   after that ("inside" the year order) by title alphabetically. desired output:   movie title A, 2006   movie title Z, 2006   ...   movie title A, 1996   movie title Z, 1996 i use the following code:               $wp_query = new WP_Query();     $wp_query->query( array(     'post_type' => 'movies',                            'distribution' => 'companyA',                            'meta_key' => 'year',                           'orderby' => 'meta_value_num title',                             'order' => 'DESC',                            'posts_per_page' => -1,                            'post_status' => 'publish',     ));      i tried several things but i can only get this "inverse" result: movie title A, 1996   movie title Z, 1996   ...   movie title A, 2006   movie title Z, 2006 if i change DESC, ASC it only changes the title sorting. but i need to apply it to the year and not to the title. is it the right way to use two orderby values? or do i have to use a meta_query or custom SQL ? thx in advance! Here is the resulting SQL Query from `$GLOBALS['wp_query']->request` SELECT wp_posts.*   FROM   wp_posts          INNER JOIN wp_term_relationships                   ON ( wp_posts.id = wp_term_relationships.object_id )           INNER JOIN wp_postmeta                   ON ( wp_posts.id = wp_postmeta.post_id )    WHERE  1 = 1          AND ( wp_term_relationships.term_taxonomy_id IN ( 24 ) )           AND wp_posts.post_type = 'movies'           AND ( wp_posts.post_status = 'publish' )           AND ( wp_postmeta.meta_key = 'year' )    GROUP  BY wp_posts.id   ORDER  BY wp_postmeta.meta_value + 0,             wp_posts.post_title DESC

body: I'm effectively taking down a site and replacing all pages with a single "Goodbye" page which I'd like to have all requests for the many other pages on the site redirect to. I'd like to have them all redirect to the goodbye page, which has been set to be the front page. I'd like to include the 404 page in this. In other words, ALL requests for existing or non-existing pages get redirected to www.mysite.com/ I can't seem to do this within htaccess because then all the requests for js and css/etc needed in the goodbye page will not be available. What I'd like is similar to the maintenance mode plugin, except to have it simply pull up the chosen page that I've created. Is there a clever way to do this using the WP backend, or programmatically, or even in htacess? Any advice on how to do this would be appreciated.

body: I'm developing a plugin to display stats for downloads and various other information that developers might want to display on their sites about what they have developed. I've found documentation on some of what I need and dug up some other undocumented resources I can use, but the one thing I still haven't been able to dig up is where I can retrieve the downloads today information that is shown on a plugin's stats page. All the other stats in the history table could be parsed from the URL below, but that link provides no information on a day that is currently in progress: `http://api.wordpress.org/stats/plugin/1.0/downloads.php?slug=[plugin-slug]` For those curious, the other APIs already being used are: `http://api.wordpress.org/stats/plugin/1.0/[plugin-slug]` (plugin versions in use) and `http://api.wordpress.org/stats/plugin/1.0/` (POST requests return a bunch of data about plugin) I know there are some solutions out there that involve just scraping the HTML page for the data needed, but unless there really is no other option (which seems unlikely) I don't wish to take that approach. As a side note, the documentation in the Codex for the WP.org API is almost non-existent. It would be amazing if someone with some knowledge of the system could fill it out some! A lot of how it works doesn't seem intuitive to me. _NOTE: This was previously posted on thewp.org forum for a week with zero responses so I thought I would try for a better result over here._

body:
> **Possible Duplicate:**   >  How to load wp_editor() through AJAX/jQuery I know that this has been asked before but it has not been answered fully or accurately or descriptively. I know how to load the wp_editor on page load like this:               <?php wp_editor( $content, 'bio', $settings = array() );  ?>      But that doesn't work when loading the editor via ajax. My plugin loads a list of football players. When a player is clicked, the wrapper div on the page is replaced with the data for that specific player. Part of that needs to be an instance of wp_editor. The wrapper div is replaced with the form below. The last row in the form needs to have the wp_editor loaded in it. This jQuery replaces a the 'tfb_replace' div with the response which in this case is a form.               $.post(ajaxurl, data, function(response) {       $('.tfb_replace').html(response);     });      And here is the form:                   <form method="POST" action="" name="edit_player_form" enctype="multipart/form-data">

                 Profile Image	                 <input name="player_pic" value="<?php echo $object->player_pic; ?>" />

                 Height	                 <input name="player_height" value="<?php echo $object->player_height; ?>" />

                 Weight	                 <input name="player_weight" value="<?php echo $object->player_weight; ?>" />

                 Years in School	                 <input name="player_year" value="<?php echo $object->player_year; ?>" />

                 Category	                                      <select name="player_cat">                         <option value="<?php echo $object->player_cat; ?>"><?php echo $object->player_cat; ?></option>                         <option value="Mayor">Mayor</option>                         <option value="Intermedia">Intermedia</option>                         <option value="Juvenil">Juvenil</option>                     </select>

                 Bio

         <input type="button" name="edit" value="Save Edits" class="button-primary" />            <input type="button" name="remove" value="Remove Player" class="button-primary" />         <input type="hidden" name="player_id" value="<?php echo $object->id; ?>" />     </form>

body: Trying to get a post to show up at http://beernews.org/supporter/rare-beer- club/ but am getting 404 instead. An example of what the page should look like is: http://beernews.org/brewery/5-rabbit-brewery/. When I do a search, it shows up as an excerpt in the results. Just can't get the template single- supporter.php to trigger for some reason. I have set up the post type (And corresponding taxonomy) exactly like every other post type and taxonomy. I have flushed the cache and CDN. I don't have a live server testing environment for this but the same exact code works on localhost. Because it is live with heavy traffic, I am reluctant to turn on debugging features that would show on front end. Register post type code in functions.php                 $labels = array(         'name' => _x('Supporters', 'post type general name'),         'singular_name' => _x('Supporter', 'post type singular name'),         'add_new' => _x('Add New', 'supporter'),         'add_new_item' => __('Add New Supporter'),         'edit_item' => __('Edit Supporter'),         'new_item' => __('New Supporter'),         'all_items' => __('All Supporters'),         'view_item' => __('View Supporter'),         'search_items' => __('Search Supporters'),         'not_found' =>  __('No supporters found'),         'not_found_in_trash' => __('No supporters found in Trash'),          'parent_item_colon' => '',         'menu_name' => 'Supporters'            );       $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => true,         'rewrite' => true,         'capability_type' => 'post',         'has_archive' => true,          'hierarchical' => true,         'menu_position' => null,         'taxonomies' => array ('beer','category'),         'supports' => array('title','editor','author','thumbnail','excerpt','trackbacks','custom-fields','page-attributes','revisions','comments','post-formats')       );        register_post_type('supporter',$args);      Register taxonomy code in functions.php                  // Add new taxonomy, make it hierarchical (like categories)       $labels = array(         'name' => _x( 'Supporters', 'taxonomy general name' ),         'singular_name' => _x( 'Supporter', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Supporters' ),         'all_items' => __( 'All Supporters' ),         'parent_item' => __( 'Parent Supporter' ),         'parent_item_colon' => __( 'Parent Supporter:' ),         'edit_item' => __( 'Edit Supporter' ),          'update_item' => __( 'Update Supporter' ),         'add_new_item' => __( 'Add New Supporter' ),         'new_item_name' => __( 'New Supporter Name' )       );            register_taxonomy('supporter',array('beer','post'),         array(         'hierarchical' => true,         'labels' => $labels,         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'supporters-bp' )       ));

body:
I am an admin of this site. This blog uses the FB comments plugin since around 1 year. Since I enabled the July Breaking Changes, I: -am not receiving any more new comments notifications on FB; -New comments are not appearing in the Comments Moderation Tool -However everything in the blog seems to be working fine, people are commenting, admins can reply, etc. This is the code in place:

                    <div class="fb-comments" data-href="<?php the_permalink() ?>" data-num-posts="6" data-width="580">
      And these are the og tags for the post pages:               <meta property="fb:admins" content="617488311,100000919127291"/>     <meta property="fb:app_id" content="184823298231084"/>     <meta property="og:type" content="article"/>     <meta property="og:url" content="<?php the_permalink() ?>"/>     <meta property="og:image" content="<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ) ?>" />     <meta property="og:title" content="<?php single_post_title(''); ?>"/>     <meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />      I hope you can take a look and are able to figure out where the problem is. I'd really appreciate your hints. Do you see any error in the code I used? Thanks

body: I want to check for an appropriate template in the theme folder before falling back to the file in my plugin directory. Here’s my code:               add_filter('template_include', 'sermon_template_include');     function sermon_template_include($template) {         if(get_query_var('post_type') == 'wpfc_sermon') {             if ( is_archive() || is_search() ) :                if(file_exists(TEMPLATEDIR . '/archive-wpfc_sermon.php'))                   return TEMPLATEDIR . '/archive-wpfc_sermon.php';                return dirname(__FILE__) . '/views/archive-wpfc_sermon.php';             else :                if(file_exists(TEMPLATEDIR . '/single-wpfc_sermon.php'))                   return TEMPLATEDIR . '/single-wpfc_sermon.php';                return dirname(__FILE__) . '/views/single-wpfc_sermon.php';             endif;         }         return $template;     }      Problem is, it doesn’t work! :-) It always picks the file in my plugin folder. Any idea what to do? I’ve tried alot of variations but I can’t seem to get anything to work! Thanks in advance! Jack **EDIT** I'm expecting the archive-wpfc_sermon.php to be returned from the theme folder if it exists. However, the file from my plugin always gets returned. Thanks for your help! This is from my Sermon Manager plugin available in the repository.

body: The file named `footer.php` contains the copyright info:               Designed by ...      Is it OK to remove theme credits from footer? Is it legal?

body: I'm trying to find a way to send via a simple form a message to an author (from frontend, everyone can message) without having the author email address visible in html. Do you know if there is a plugin to manage that or we have to manually code a php function? Thanks

body: I have just changed the theme on my blog, and because of a small page width, it breaks the layout. Most of my earlier images (attached in posts) are around 600px in width, and now I need to resize all of them them proportionately to 450px. How do I resize them all at one shot? Is there a plugin for this? P.S.: Writing a CSS rule is a good option, and I've already done that. But I figure resizing the images would also knock off the download overhead for each page!

body: I have created a custom loop with WP_Query and I am trying to display only 4 posts. I do not need pagination or anything similar. Just the four posts. I am using `posts_per_page => 4` to do this, but it's giving me six posts. Even when I play with the number and put 9 instead of 4 it puts out 10 posts. For some reason it's not giving me the exact number requested in the `$args`. What could be causing this? Am I using `posts_per_page` wrongly? There is another custom loop on the page, but I used `wp_reset_query` to make sure the two don't interfere with each other. Could it be that? Here is my code:               $args = array( 'posts_per_page' => 4, 'paged' => get_query_var( 'paged' ) );             $fromblog_posts = new WP_Query($args);          if( $fromblog_posts->have_posts() ) : while( $fromblog_posts->have_posts() ) : $fromblog_posts->the_post(); ?>     ...      I'd be grateful for any help.

body: This code does not work correctly and returns time using timezone from computer and ignoring timezone stored in WordPress options:               date_default_timezone_set( get_option( 'timezone_string' ) );     $hours = date( 'H', strtotime( $timestamp ) );     date_default_timezone_set(@date_default_timezone_get());      WordPress saves timezone in options section but 'timezone_string' option in wp_options table is empty. Also the code generates warnings. **How to get date using timezone saved in options correctly?** **Where does WordPress store an Timezone which can be edited in options section?**

body: I am using the "The-Bootstrap" theme and getting the below message in the dashboard and also while viewing the site, please let me know what can be done.               Strict Standards: Declaration of The_Bootstrap_Nav_Walker::start_el() should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = Array, $id = 0) inwordpress/wp-content/themes/the-bootstrap/inc/nav-menu-walker.php on line 0      Thanks again Praveen

body: For some reason my RSS feed is repeating the site title twice without a space, obviously quite annoying. BlognameBlogname for example. Is there any hook i can use to have a custom title for the RSS Feed? So i could have a title 'This is My RSS Feed for Blogname' or anything i wanted? Is this possible or am i stuck with the double name. Thanks for any help.

body: I have a problem when using Wordpress 3.4. My "Products" custom post type pagination doesn't work. Here is the code I use               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $loop = new WP_Query( array(     'post_type' => 'products',     'posts_per_page' => PER_PAGE_DEFAULT,     'paged'=>$paged     ) );      That code works well in previous WP version (Wordpress 3.3.2) but not in current version i.e. 3.4. What am I doing wrong?

body: I'm altering my main wp_query in a pre_get_posts filter in order to improve my site search capabilities. I've successfully achieved searching in taxonomies, but I fail when it comes to the post date ranges. Even the example query in the wp docs don't work for me.               $datequery = array(             array(                 'after'     => 'January 1st, 2013',                 'before'    => array(                     'year'  => 2013,                     'month' => 2,                     'day'   => 28,                 ),                 'inclusive' => true,             ),         );     $query->set('date_query', $datequery);      If I print_r the content of `$wp_query->request`, it doesn't contain anything related with dates, except for the ordering. What's wrong? PS: WP 3.6.1

body: Right now, the Title is the first thing at the top of the page, then we have next the WYSIWYG Editor. I would like to add a Custom Meta Box and insert it **before** the title or WYSIWYG editor.   How can I move them around?

body:
I edited my loop in archives.php in order to work with pagination and with the Category Post List Widget. I basically pieced it all together from random code and ideas and am now so far from the default post query that I'm having trouble getting back to square one. The reason I need to get back to square one is that I need two things: 1) My code is messing up my category posts when the post has two category tags. When that happens, they get placed in the wrong categories (or don't get placed at all). 2) By doing this custom coding, I lost the query for 'tags' as well so the tag pages don't work correctly. I need to get back to square one so I can set up tags and category posts to be displayed correctly but within the correct `<li>`s that I style. I'm not sure if I even need the Category Post List widget anymore because, if I'm not mistaken, I can call the `set_post_thumbnail_size();`, `the_title();`, `the_excerpt()`, etc. without the widget and just style my own list items. Anyhow, here's the code I've got, I imagine I need to scrub a bunch of it to get back where I need to go. Thank you so much for the help, I really appreciate it.               <?php if (have_posts()) : ?>
          <?php     if ($paged == 0)       $offset = 0;     else       $offset = ($paged - 1) * 11;     global $post;     $category = get_the_category($post->ID);     $category = $category[0]->cat_ID;     $myposts = get_posts(array('numberposts' => 11, 'offset' => $offset, 'category__in' => array($category), 'post__not_in' => array($post->ID),'post_status'=>'publish'));     foreach($myposts as $post) :     setup_postdata($post);     ?>

             <a href="<?php the_permalink(); ?>"><?php set_post_thumbnail_size( 200, 200 );     the_post_thumbnail(); ?>

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

<?php the_excerpt(); ?>

          <?php endforeach; ?>     <?php wp_reset_query(); ?>
               <?php while (have_posts()) : the_post(); ?>          <?php endwhile; ?>          <?php if (function_exists("pagination")) {         pagination($additional_loop->max_num_pages);     } ?>         <?php else :                  if ( is_category() ) { // If this is a category archive             printf("

Not Found: Sorry, but there aren't any posts in the ·%s· category yet.

", single_cat_title('',false));         } else if ( is_date() ) { // If this is a date archive             echo("

Not Found: Sorry, but there aren't any posts with this date.

");         } else if ( is_author() ) { // If this is a category archive             $userdata = get_userdatabylogin(get_query_var('author_name'));             printf("

Not Found: Sorry, but there aren't any posts by ·%s· yet.

", $userdata->display_name);         } else {             echo("

No posts found.

");         }          endif; ?>      ## EDIT Alright, I edited it and I can't figure out where I'm off. I'm using my tag.php template as an example here (not the category.php). Here's what I've done so far (based off the code provided by Chip in the answers):               function wpse63424_filter_pre_get_posts( $query ) {         if ( ! is_main_query() ) {             return $query;         } else {             if ( is_category() || is_tag() ) {                 $query->set( 'posts_per_page',11 );             }             return $query;         }     }     add_filter( 'pre_get_posts', 'wpse63424_filter_pre_get_posts' );          $tag = get_query_var('tag');     $myposts = get_posts('tag__in' => array($tag));     foreach($myposts as $post) :     setup_postdata($post);      My thinking was that I've set a filter of 11 posts per page, I query for a specific tag, set the posts to the tag in that array and then set up the posts accordingly. When I just run get_posts(); it returns 11 posts per page unfiltered so I know that Chip's code works fine. I guess I'm not understanding how the functions are called correctly yet...

body:
is there a way to load plugin with ajax? I want to load Quick Chat plugin which supports initializing with PHP and Shortcode               [quick-chat height="400" room="default" userlist="1" userlist_position="left" smilies="1" send_button="0" loggedin_visible="1" guests_visible="1" avatars="1" counter="1"]      OR               <?php     global $quick_chat;     if(is_object($quick_chat) && method_exists($quick_chat, 'quick_chat')){         echo $quick_chat->quick_chat(400, 'default', 1, 'left', 0, 0, 1, 1, 1, 1);     }     ?>      > My JS side               key = '1';     jQuery.ajax({         type : 'POST',         url : apfajax.ajaxurl,         data : {             action : 'loadMyChat',             key: key         },         dataType: "json",         success : function(data) {             jQuery("#chatModal").find(".modal-body").html(data.html);         },         error: function(MLHttpRequest, textStatus, errorThrown){                 alert(textStatus);         }     })      > PHP Side               function loadMyChat() {         $key = $_POST['key'];         $count = 1;         $html = 2;         global $quick_chat;              //$ak = $quick_chat->quick_chat();         $ak = $quick_chat->quick_chat('300', 'default', '1', 'left', '0', '0', '1', '1', '1', '1');         die(json_encode(array(             'html' => $ak,             'count' => $count         )));     }      > OUTPUT:

LOADING...

      As you see container only includes loading block, where are the other blocks? textarea and history? Okay, one more interesting point, here is a public function for initialising chat.               public function quick_chat($height = 400, $room = 'default', $userlist = 1, $userlist_position = 'left', $smilies = 1, $send_button = 0, $loggedin_visible = 1, $guests_visible = 1, $avatars = 1, $counter = 1) {         $content = '';         ob_start();              echo '<div class="quick-chat-container" data-quick-chat-id="'.wp_generate_password(12, false, false).'" data-quick-chat-height="'.$height.'" data-quick-chat-room-name="'.$room.'" data-quick-chat-userlist="'.$userlist.'" data-quick-chat-userlist-position="'.$userlist_position.'" data-quick-chat-smilies="'.$smilies.'" data-quick-chat-send-button="'.$send_button.'" data-quick-chat-loggedin-visible="'.$loggedin_visible.'" data-quick-chat-guests-visible="'.$guests_visible.'" data-quick-chat-avatars="'.$avatars.'" data-quick-chat-counter="'.$counter.'">';             echo '
'.__('LOADING...', 'quick-chat').'
';         echo '
';              if(!isset($this->options['hide_linkhome'])){             echo '
'.__('Powered by Quick Chat', 'quick-chat').'
';         }         $content =  ob_get_contents();         ob_end_clean();         return $content;     }      judging from this, my script returns everythign corectly. no js is loading or any ajax handlers are set. in my opinion the problem is `data-quick-chat-id`. I did small trick like return quick_chat function on page load which is hidden and after my user sets his cookies (user and room) I request my ajax and change this div with ajax returned. Of course it still does not work, but I didn't change change `data-quick-chat- id` but that's because I don't know how to change data attribute inside my `data.html` (returned from my ajax) before I insert it in html. Am I going in right direction? Just wanted to update, thanks

body: > **Possible Duplicate:**   >  Prevent Width and Height Attributes in Image Tag Output i would like to remove the width="512" height="128" attributes on an attachments this method is fine on images displayed in the_content : Filter to remove image dimension attributes? but i can't find a way to make it work on an attachement i call outside of the_content with wp_get_attachment_image. how can i do this ?

body: The code i am pasting is supposed to run the function exporting once on activation of plugin and then hourly. But it doesn't run on activation nor hourly. I do see it in the list of cron jobs that are scheduled.                 register_activation_hook(__FILE__, 'my_activation');       register_deactivation_hook( __FILE__,'run_on_deactivate');             function run_on_deactivate() {        wp_clear_scheduled_hook('my_excel_event');           }           function my_activation() {      //exporting(); if i uncomment this line the function runs once     wp_schedule_event( current_time( 'timestamp' ), 'hourly', 'my_excel_event');       }       add_action('my_excel_event', 'exporting');      I know my site is getting page visits, what can be the reason for function not running at all in wp_scheduled_event ?

body: I've been trying to figure out if this can be done through Multisite, but I'm pretty new to this concept so please forgive any ignorance. I'm looking for a way in which my client can easily archive a WP conference site, by year, to subdomains. In other words: The site will be set up at http://www.domain.com for the client's 2011 conference. In 2012, the client will use the same templates to set up their 2012 site, but before they do that, they'll want to archive the 2011 site to 2011.domain.com. As an example, check out evoconference.com. They have their 2010 site linked to from their current 2011 site, and clicking on it brings you to 2010.evoconference.com. Is there a way I can set this up via multisite? I can set up 2011.domain.com, but how can I make it easy for my client to transfer http://www.domain.com to 2011.domain.com, once they are ready to implement the 2012 site? Thanks in advance for any help anyone can provide.

body: > **Possible Duplicate:**   >  Getting archive pages in WP's AJAX internal link finder? Are there any hooks for the new internal links box that was created in WP 3.1? I'm trying to modify it in my plugin.

body: I read, well, everywhere, that it is necessary to use the built in WP_Nonce feature when submitting AJAX requests. as such:               wp_enqueue_script('my-ajax-request', plugin_dir_url(__FILE__) . 'js/ajax.js', array('jquery'));     wp_localize_script('my-ajax-request', 'MyAjax', array('ajaxurl' => admin_url('admin-ajax.php')));     wp_localize_script('my-ajax-request', 'MyAjax', array('ajaxurl' => admin_url('admin-ajax.php'), 'postCommentNonce' => wp_create_nonce('myajax-post-comment-nonce'),));      and validating it in the PHP as such:               $nonce = $_POST['postCommentNonce'];     if(!wp_verify_nonce($nonce, 'myajax-post-comment-nonce')) { die('Busted!'); }      This is great...... but if I leave the page open for 24hrs and then try again, it will return Busted! and not work until refresh. This leads me to believe that I should only use the nonce when I'm updating / inserting records - and NOT when I'm simply "loading more posts". What is the proper procedure for this?

body: So, i have a function in my template file functions.php which cache a search form that contain a custom taxonomie terms. I want to flush cache (or delete one cache group) when I add/delete/edit terms of a specific taxonomie. Is it possible? maybe with do_action, but for which hook? thx

body: > **Possible Duplicate:**   >  how to upload and allow downloads of .mobi and .epub formats I am considering the feasibility of converting a client site from a large number of hand-built web pages to a WordPress installation. Many of the articles contain links to the PDF, mobi, and epub versions of the article. They are direct links which trigger a download. Are there any plugins which might make this process easier to manage long term and easier as I convert the content over to WordPress? It seems like I ought to be able to create libraries with the media manager and drag-and-drop the links into the post/page. Any recommendations? Thank you! A related question posted here how to upload and allow downloads of .mobi and .epub formats gives a partial answer. Definitely something to explore.

body: I have a Wordpress database which was installed in a development environment... thus, all references to the site itself have a fixed IP address (say 192.168.16.2). Now, I have to migrate that database to a new Wordpress installation on a hosting. The problem is that the SQL dump contains a lot of references to the IP address, and I have to replace it with: my_domain.com. I could use `sed` or some other command to change the that from the command line, the problem is that there are a lot of configuration data which uses JSON. So what? Well, as you know, JSON arrays uses things like: `s:4:` to know how many chars an element has, and thus, if I just replace the IP with the domain name, the configuration files will get corrupted. I used an app for Windows some years ago that allows to change values in a database and takes care of the JSON arrays. Unfortunately, I forgot the name of the app... so the question is: do you know any app that allows me to do what I want?

body: How to show file size of featured image in post on single.php? For example: File size of featured image is: xx kb/Mb I need size of featured "full" rezolution, also file size of "medium" resolution would be great? Best regards.

body: Yoasts SEO plugin adds a metabox to the post edit screen. I'm trying to remove this for users who aren't editors or above. I've tried putting a `remove_meta_box` call in on admin_init, trying to remove the action on $wpseo_metabox but to no avail. How do I remove this metabox without requiring user intervention (the user should never know the metabox existed, so clicking on screen options is not an option )

body: I'm using a dropdown menu on my Wordpress page which shows all the pages. If you hover over it, the subpages of that particular page are shown. Say I have five pages that each have a couple of subpages. Is it possible to show the subpages on the same page as the page itself and have the dropdown menu link to the section of the page where the subpage is listed? Hope this is clear. thanks.

body: If my plugin has multiple php files in its plugin folder, how does WordPress know which is the main php file ?

body: I need to change the template on several hundred pages on my site. Does anyone know if there is a command to do it programmatically? See the following code snippet; I'd like to replace my comment inside the loop with a function that will change the template of the current page:               query = new WP_Query($args);     while ( $query->have_posts() ) : $the_query->the_post();       if ( has_tag('tag-slug') )       {          /* CHANGE TEMPLATE OF $post */       }     endwhile;     wp_reset_postdata();

body: I'm wondering if it is possible to add different classes to second/third/fourth/etc-level items that have children in Appearance > Menus tree? That's how I call the menu:                <?php $menu_args = array(         'container'       => '',          'menu_class'      => '',          'menu_id'         => 'my-menu',         'walker'          => new Description_Walker);              wp_nav_menu($menu_args );         ?>      I know every link owns different ID like `<li id="menu-item-3230">`, but I want the solution to be dynamic so I won't have to edit code every time I change something. I guess the easiest way will be to attach additional class to these items but how? ![enter image description here](http://i.stack.imgur.com/CgqhZ.png)

body: Does anyone know how to get ID's of images from wordpress gallery in post? I have search entire internet and there is nothing to this subject. Thx for your time :)

body: Is there any filter which can be used in a plugin to process the content of the text widget before it is rendered?

body: I have two simple functions that load stuff using `wp_enqueue_style()` and `wp_enqueue_script()`, something like these:               function admin_custom_css()     { wp_enqueue_style( 'stylesheet_name', 'stylesheet.css') };           function admin_custom_js      { wp_enqueue_script( 'javascript_file', 'script.js') };      ... and a few admin pages, created with `add_menu_page()` and `add_submenu_page()`               function my_menu() {        add_menu_page('Page 1', 'bar', 'something', 'else', 'foo');        add_submenu_page( 'theme_menu', 'Subpage 1', 'Subpage', 'something', 'else', 'foo');      }     add_action('admin_menu', 'my_menu');       **How do I load my two functions only on these pages?** Right now I'm using:               add_action('admin_init', 'admin_custom_css' );      add_action('admin_init', 'admin_custom_js' );        But it loads my files on every admin page, which is not nice at all. Can I do this via one simple line in `functions.php` or have to enqueue them within my pages separately (I prefer the first option strongly, since I'd have to edit a lot of admin-page-creating-functions). Thanks!

body: I want to disable comments on my pages. That means there should be no comment form, no message asking to log in in order to post comments, nothing. Under `Settings > Discussion` is the option "Allow people to post comments on new articles." That implies that disabling comments on pages is possible, assuming that "article" means "post or page." Unfortunately, a comment form still appears despite my unchecking this box. I thought that the option might be overridden on the page itself, but there are no relevant options on the page edit screen. I really don't want to hack my theme when the facility to disable comments clearly exists already. How can I accomplish this?

body: I tried to add the pagination in `get_post` in the following method               <?php     $paged = get_query_var('paged') ? get_query_var('paged') : 1;     $the_posts = get_posts(array('post_type' => 'image', 'posts_per_page' => '2', 'paged' => $paged));         foreach ($the_posts as $required) {     // did something          }         ?>      I make the above thing as with shortcode. I am not sure how to make the pagination like `1 2 3 4 5` like that in wordpress get_post way. Thanks.

body: We have a standard Wordpress installation being used as a CMS. We're using standard pages with basic permalinks (e.g., /page/ or /parent/page/). We'd like to have that exact same content mapped to a virtual subdirectory as well (e.g., /vip/page/ or /vip/parent/page/). Now, obviously, I could duplicate the pages in Wordpress, but that's too much of a pain to manage. The content in both versions would be identical, but we'd do a few minor things in the Wordpress template to display things slightly differently based on the detected URL. I'm fairly certain there should be a way to do this using .htaccess, but I can't find the right combination of Google keywords to find my answer. Can someone point me in the right direction? EDIT: It's also worth noting that I'm aware of the potential penalties for SEO, but I plan on supplying canonical meta tags for Google's purposes. The separate URL system is predominantly for marketing and tracking purposes only.

body: Thank you for your help! functions.php               function excerpt($limit) {     $excerpt = explode(' ', get_the_excerpt(), $limit);     if (count($excerpt)>=$limit) {     array_pop($excerpt);     $excerpt = implode(" ",$excerpt);     } else {     $excerpt = implode(" ",$excerpt);     }     $excerpt = preg_replace('`[[^]]*]`','',$excerpt);     return $excerpt;     }      index.php               <div class="post excerpt <?php echo (++$j % 2 == 0) ? 'last' : ''; ?>">

body:
I'm using this code to display the thumbnail (featured picture) of the previous and next post (a custom post type called Blocks). (A custom loop)               <?php // Create and run custom loop         $custom_posts = new WP_Query();         $custom_posts->query('post_type=blocks&location=Front Page&section=Mainbar');         while ($custom_posts->have_posts()) : $custom_posts->the_post();     ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
     <?php endwhile; ?>              <?php // Display previous and next posts thumbnails              ?>
 <?php                 $prevPost = get_previous_post();                 $prevthumbnail = get_the_post_thumbnail($prevPost->ID);                 previous_post_link('%link', $prevthumbnail);         ?>
              <?php // Get thumbnail of next post         ?>
 <?php                 $nextPost = get_next_post();                 $nextthumbnail = get_the_post_thumbnail($nextPost->ID);                 next_post_link('%link', $nextthumbnail);         ?>

      This is the chronology: ![enter image description here](http://i.stack.imgur.com/gQlf6.png) And this is the output:

Mainbar

Sidebar

      It doesn't matter in which single post I am. The thumbnails of `Mainbar Left` and `Mainbar Right` are always displayed) Any suggestions? **EDIT:** Full code:               <?php     /**      * The Template for displaying all single posts.      *      * @package WordPress      * @subpackage Starkers      * @since Starkers 3.0      */              get_header(); ?>              <?php get_sidebar(); ?>
             <?php // Create and run custom loop                 $custom_posts = new WP_Query();                 $custom_posts->query('post_type=blocks&location=Work&section=Intro');                 while ($custom_posts->have_posts()) : $custom_posts->the_post();             ?>
                     <?php the_post_thumbnail('large'); ?>
             <?php endwhile; ?>                  <?php // Create and run custom loop                 $custom_posts = new WP_Query();                 $custom_posts->query('post_type=blocks&location=Work&section=Tagline');                 while ($custom_posts->have_posts()) : $custom_posts->the_post();             ?>
                     <?php the_content(); ?>
             <?php endwhile; ?>             <?php wp_reset_query(); ?>                  <?php // Create and run custom loop ?>
                 <?php // Display the thumbnail of the previous post ?>
 <?php                         $prevPost = get_previous_post();                         $prevthumbnail = get_the_post_thumbnail($prevPost->ID); ?>
<?php previous_post_link('%link', 'Previous'); ?>
                         <?php previous_post_link('%link', $prevthumbnail); ?>
                      <?php // Display the thumbnail of the next post ?>
 <?php                         $nextPost = get_next_post();                         $nextthumbnail = get_the_post_thumbnail($nextPost->ID); ?>
<?php next_post_link('%link', 'Next'); ?>
                         <?php next_post_link('%link', $nextthumbnail); ?>

                  <?php // Create and run custom loop                 $custom_posts = new WP_Query();                 $custom_posts->query('post_type=blocks&location=Front Page&section=Sidebar');                 while ($custom_posts->have_posts()) : $custom_posts->the_post();             ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
                     <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail(); ?>
<?php the_excerpt(); ?>

<?php echo get_post_meta($post->ID, "Other_Work", true); ?>

             <?php endwhile; ?>                  <?php // Start the main loop                 if ( have_posts() ) while ( have_posts() ) : the_post();             ?>
                     <?php the_content(); ?>
             <?php endwhile; // end of the loop. ?>                  <?php get_sidebar('secondary'); ?>
              <?php get_footer(); ?>

body: This is a two parts problem. 1) I want to replace the custom post type with custom taxonomy term on my permalink. By default my URL structure is: `http://example.com/holiday/remote-brazil` holiday = CPT remote-brazil = CPT item I also have a custom taxonomy term for that. adventures = CTT My desired URL is: `http://example.com/adventures/remote-brazil` I **solved** the problem simply adding this line on the custom post type registration:               'rewrite' => array('slug' => '%holiday_category%','with_front' => false),      holiday_category = custom taxonomy. It seems to be too easy :-) Is it that or am I missing something? 2) Now the problem. I'm using a commercial theme with regular updates (that's good), but if I make any changes there I'm surely that will lose them. My question is how do I write a plugin that will overwrite(or add) that specific line on the CPT from my theme? Cheers.

body: > **Possible Duplicate:**   >  Software for WordPress Theme and Plugin Development? What do you use or carry with you in your "toolbelt" when approaching an existing WordPress site that you've got to extend or maintain? Is there a good Windows debugger? Are there essential addons you install, things you FTP right away?

body: > **Possible Duplicate:**   >  Long option names fail silently? The WordPress Transients API makes it easy to save expensive values and look them up later. If you install an object backend (such as APC object cache, memcache or W3 Total Cache) you can cache these values between requests, gaining even more. But I've noticed that when the name of a transient field is too long, it simply doesn't bother caching it. Aside from being somewhere in the region of 50 characters, I don't know what the maximum length of these names is. Is this documented somewhere? Does it depend on what backend you're using?

body:
I am making my first custom walker to build an accordion menu. To start with I used this example: http://bitacre.com/2025/custom-nav-menu-walker-for- wordpress-themes There are two functions. First start_lvl and then start_el. In start_el the ID get's implemented by $item->ID. Does anybody know how I can do this in start_lvl as well? I need to give the (surrounding lower level navigation) an ID so I can trigger it to collapse in the accordion menu. What I'm trying to generate is something like this:               Titel 2
Lower Level Menu 2
     Titel 3
Lower Level Menu  3
      My code for the start_lvl function:               // add id's and classes to ul sub-menus     function start_lvl( &$output, $depth, $item ) {         // depth dependent classes         $indent = ( $depth > 0  ? str_repeat( "\t", $depth ) : '' ); // code indent         $display_depth = ( $depth + 1); // because it counts the first submenu as 0         $pgid = ; // How to get ID in here??         $classes = array(             'sub-menu',             ( $display_depth == 1  ? 'accordion-body collapse' : '' ),             ( $display_depth % 2  ? 'menu-odd' : 'menu-even' ),             ( $display_depth >=2 ? 'sub-sub-menu' : '' ),             'menu-depth-' . $display_depth             );         $ids = array(             'collapse' . $pgid             );         $class_names = implode( ' ', $classes );         $id_name = implode( ' ', $ids );              // build html         $output .= "\n" . $indent . '
' . "\n";     }

body: > **Possible Duplicate:**   >  What hooks/filters are there to alter selected terms on post save? I have some meta that I want to store in a different table each time i post or update an article. For example, I have "products" table with 2 rows: id (wordpress post id), price (meta data added when i posted the article). When i publish the article, post id and the price meta should pe posted in products table as well. When i update the article, should update in products table too. I don`t have any idea where to start from. Is this possible anyhow? Regards

body: I have a sole image gallery inserted into a page as the content. I want to process the images with regular expressions before echoing them. When I get the content with $post->post_content only one image is returned, which is the thumbnail image in the editor field of the page. When I use the_content() function, all the images are echoed out straight away before I could process them. Is there any way to assign the image gallery data to a variable as string without echoing it straight away?

body: > **Possible Duplicate:**   >  How do I amend the fixed "author" part in the URL? Hullo, I'm needing to have custom URLs for authors so for example mysite.com/team/johndoe would be the eventual URL. This should list that particular user, but I was hoping to use the author.php template to do so. The following gives further details, but it doesn't really clarify whether this is possible as it's not designed to: http://codex.wordpress.org/Author_Templates Is there any fancy way of doing URL rewriting for this case?

body: I have a very big multisite. And I got a request to enable option that multiple users can use the same email. I found a plugin "Allow Multiple Accounts" which doesn't work properly. I should figure out some other solution for that. I know that I could use something like adding +sometext to every email, so it will show different to Wordpress. Do you have some other solution, that can be done here?

body: > **Possible Duplicate:**   >  Refine custom posts by author I need a way to display author archive pages for custom post types. I already know how to include custom post types into the default authors archive page that's not what I'm trying to achieve. Example: **By default author archive pages are like this:** www.mysite.com/author/username **Here's what I want:** www.mysite.com/author/username/post-type Whatever post type is specified at the end will display all the posts published by the author for that specific post type. I would also like to target that specific template like this **author-{post- type}.php** In addition I'm using the following snippet to alter the author page URL. `function change_author_permalinks() {               global $wp_rewrite;          // Change the value of the author permalink base to whatever you want here     $wp_rewrite->author_base = 'profile';          $wp_rewrite->flush_rules();      } add_action('init','change_author_permalinks');` However this is achieved, needs to be compatible with the above function.

body: I need some help customizing a walker function. I don't fully undrestand it, but it's helped me get half of what I need.               class themeslug_walker_nav_menu extends Walker_Nav_Menu {                   // add classes to ul sub-menus         function start_lvl( &$output, $depth ) {             // depth dependent classes             $indent = ( $depth > 0  ? str_repeat( "\t", $depth ) : '' ); // code indent             $display_depth = ( $depth + 1); // because it counts the first submenu as 0             $classes = array(                 ' dropdown',                 /*?>( $display_depth % 4  ? ' ' : '' ),                 ( $display_depth >=4 ? '' : '' ),                 '-' . $display_depth<?php */                 );             $class_names = implode( ' ', $classes );                  // build html             $output .= "\n" . $indent . '<ul class="' . $class_names . '">' . "\n";         }          }      Here is what I have so far, and it works great to add a submenu to the ul at the 2nd and third levels. I need to figure out how to add a custom class to the parent ul. I can do it in query but it's not quite the solution I would like. Any help is appreciated.

body: I have a shortcode [foo id="1"]. I want to display the usage of this shortcode without using the shortcode itself in this single case. Is that even possible?

body: I have multiple WYSIWYG editors on a page using wp_editor. I am trying to add the setting 'teeny' => true, but it seems to only apply to the first editor instance. All subsequent editors are just plain text areas and I get a javascript error in the console. `"Uncaught TypeError: Cannot set property 'innerHTML' of null"`               <?php                 $content = $field['url'];                 $settings = array(                                 'textarea_name' => 'url[]',                                  'teeny' => true,                                 'raw' => true,                                  'editor_class' => 'movie_description_editor'                                       );             ?>                  <?php wp_editor($content, 'movie_description-'.$num, $settings ); ?>

body: how to change the default login page of wordpress from wp-login.php to custom login page. So that any request for login by any user should redirect to custom login page instead of wp-login.php.

body:
Let's say I have nested shortcode where the outmost shortcode is just HTML but the inner one is the one who displays the data.               [outer_shortcode][inner_code url="#" title="Hello"][/outer_shortcode]      In this case, the count of inner items is one. In the following one:               [outer_shortcode][inner_code url="#" title="Hello"][inner_code url="#2" title="Hello2"][/outer_shortcode]      The inner count is two. How can I determine this on the functions that I work with? I currently have (outer shortcode that calls the inner):               return '

'.do_shortcode($content).'

';      And as inner:                       $the_stuff .= '
';                  $the_stuff .= ''.$title.'';             $the_stuff .= '
';                  return $the_stuff;      That's what I want. To count the **list items.** How can I accomplish this?

body: Scoured the web looking for this solution. Come to realise that the posts page, even though you change the settings under Reading > Settings and then tell your posts page to use a different template, it still reverts to using the index.php page where I would like it to use the page-two-column.php I have created. Is there another way I can force this as I don't want to have to use index.php when I am using conditional checks in my two column layout to display all the content of my other 'pages'? I read through this post which asked a similar question but that was not much help. I've posted another question similar to this but that was to do with custom post templates. Is it not possible to do something like this in the index.php file:                <?php get_header(); ?>             <?php if (is_page('news')): ?>             <?php get_template_part ('page-two-column'); ?>         <?php endif ?>           <?php get_footer(); ?>      Although my page-two-column.php also has the get_header() and get_footer() function.

body: I've read through variations of this question, and seen a few plugin suggestions, but haven't been able to get anything to work. Basically I have a multisite network set up and working. The set up is domain.com and sub.domain.com (the subdomain is mapped to otherdomain.com) What I want to do is echo certain posts that are on the main site onto the subdomain e.g. domain.com/category/the-post be replicated on sub.domain/category/the-post. I'm ideally looking for a non-plugin way of doing this. Any suggestions welcome.

body:
i have a function in my plugin `append_the_content($content)` this is used to display my function inside the post, but it is coming before the post, i want to make it after the post, for this i tried this code, but then too its not coming               function parse_twitter_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) {       $feed = str_replace("<", "<", $feed);       $feed = str_replace(">", ">", $feed);       $clean = explode("<content type=\"html\">", $feed);            $amount = count($clean) - 1;            echo $prefix;            for ($i = 1; $i <= $amount; $i++) {         $cleaner = explode("</content>", $clean[$i]);         echo $tweetprefix;         echo $cleaner[0];         echo $tweetsuffix;       }            echo $suffix;     }          function the_twitter_feed($username) {       // $username = "Mba_"; // Your twitter username.       $limit = "5"; // Number of tweets to fetch.            /* These prefixes and suffixes will display before and after the entire block of tweets. */       $prefix = ""; // Prefix - some text you want displayed before all your tweets.       $suffix = ""; // Suffix - some text you want displayed after all your tweets.       $tweetprefix = "".$username.":  "; // Tweet Prefix - some text you want displayed before each tweet.       $tweetsuffix = "
"; // Tweet Suffix - some text you want displayed after each tweet.            $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=" . $limit;            $twitterFeed = get_transient($feed);       if (!$twitterFeed) {         $twitterFeed = wp_remote_fopen($feed);         set_transient($feed, $twitterFeed, 3600); // cache for an hour       }       if ($twitterFeed)         parse_twitter_feed($twitterFeed, $prefix, $tweetprefix, $tweetsuffix, $suffix);     }          function append_the_content($content) {         if(get_option('tweetID')!=null){         $content .= "

".the_twitter_feed(get_option('tweetID'))."

";            echo $content;           }            else{            return $content;            }     }          add_filter('the_content', 'append_the_content');          add_action('admin_menu','tweet_fetch');          function tweet_fetch(){     add_options_page('Tweet','Tweet', 8, 'tweet', 'tweet_fetcher');     }     function tweet_fetcher(){     ?>
Tweet Fetcher options

     <form method='post' action='options.php' style='margin:0 20px;'>     <?php wp_nonce_field('update-options'); ?>
Twitter UserID:	<input type="text" name="tweetID"  value="<?php echo get_option('tweetID'); ?>" <?php echo get_option('tweetID'); ?> />
          <input type='hidden' name='action' value='update'/>     <input type='hidden' name='page_options' value='tweetID'/>

     <input type='submit' name='Submit' value='Update Options »'/>

     </form>     <?php     }      how can i make it after the post???

body: My pages have a sidebar with too many widgets, and it looks bad when the content is short and the sidebar is too long. I want to randomize the widgets I'm showing in the sidebar. Meaning I will add all the potential widgets to the sidebar, and it will randomly only display a few. I would also like some control over this, for example to have a few widgets always appear, and only the rest randomized. I tried finding relevant plugins, but the only ones I found just randomized images or posts.. never different types of widgets.

body: I would like to add a custom bulk action to a custom post type. I came across the filter `bulk_actions-screenid`, ~~which according to itsdocumentation, would do exactly as I wish~~. However, after about two hours of debugging I found the following comment `// This filter can currently only be used to remove actions.` on line 278 of class-wp-list-table.php - great! I figured I could hack it by using jQuery to inject the action as an option               /**      * Hack to add a custom bulk action.       */     public function admin_footer() {         if($_GET['post_type'] != self::POST_TYPE) return;         ?>          <script type="text/javascript">             jQuery(document).ready(function() {                 jQuery('<option>').val('create_invoice').text('Bill').appendTo("select[name='action']");             });         </script>         <?php     }      This works. The action now appears in the bulk actions menu. I was under the assumption I could then add some logic into `admin_init` to do the necessary processing - however, it appears that `create_invoice` is never posted. Is there something I'm doing wrong? === UPDATE === I updated the code to use the `load-*` hook. When I apply the bulk action on users.php - I see `create_invoice` is passed through the request. However, on edit.php `create_invoice` is never printed.               function a39x2_admin_footer() {         ?>         <script type="text/javascript">             jQuery(document).ready(function() {                 jQuery('<option>').val('create_invoice').text('Bill').appendTo("select[name='action']");                 jQuery('<option>').val('create_invoice').text('Bill').appendTo("select[name='action2']");             });         </script>         <?php     }     add_action('admin_footer', 'a39x2_admin_footer');               function a39x2_load() {         echo "<pre>" . print_r($_REQUEST, true) . "</pre>";     }     add_action('load-edit.php', 'a39x2_load');     add_action('load-users.php', 'a39x2_load');

body:
This is the code which is registering the function for **rewrite_endpoints()** :               function wpa121567_rewrite_endpoints(){          add_rewrite_endpoint( 'comments', EP_PERMALINK );          add_rewrite_endpoint( 'stats', EP_PERMALINK );          }          add_action( 'init', 'wpa121567_rewrite_endpoints' );      **NOTE** I don't know if this matters but I will write it. I have **single-CPT.php** which is calling **/inc/post-format/single-CPT.php** like this:                   <?php while ( have_posts() ) : the_post(); ?>          <?php           get_template_part( 'inc/post-format/single-debate');          ...      This is the code which is checking if **array key exists** , which is inside my **/inc/post-format/single-cpt.php** :               ?php     if( array_key_exists( 'comments', $wp_query->query_vars ) ){      the_field('comments_section');           } elseif( array_key_exists( 'stats', $wp_query->query_vars ) ) {           the_field('stats_section');       } else {     // the request is for the main post      }       ?>      This is my **comments.php** :
     <?php     // If CPT and not logged in, display a message:     if ( 'debate' == get_post_type() && ! is_user_logged_in() ) {     echo '
You must be logged in to post a comment.' . '
';          echo do_shortcode("[upme_login]");           }     ?>         <?php if ( have_comments() ) : ?>
                      <?php                     printf( _n('%d comment', '%d comments', get_comments_number(), 'outbox' ),                         number_format_i18n( get_comments_number() ) );                 ?>

                      <?php                     wp_list_comments( array( 'callback' => 'outbox_comment' ) );                 ?>
                  <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through? If so, show navigation ?>
 <?php echo get_previous_comments_link( __( 'Older Comments', 'outbox' ) ); ?>

<?php echo get_next_comments_link( __( 'Newer Comments', 'outbox' ) ); ?>
                          <?php endif; ?>              <?php endif; // have_comments() ?>              <?php             // If comments are closed and there are comments, let's leave a little note, shall we?             if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :         ?>
<?php _e( 'Comments are closed.', 'outbox' ); ?>
         <?php endif; ?>             <?php      // Don't output the comment form if CPT and user isn't logged in     if ( 'debate' != get_post_type() || is_user_logged_in() ) {      comment_form();     }          ?>
     <?php } ?>       This is how the comments template is included inside my **single-CPT.php** :               if ( comments_open()  )          comments_template( '', true );      I want to disable comments if `if( array_key_exists( 'comments', $wp_query->query_vars ) ){` How can I do this?

body:
I have used a loop for my theme homepage, but when I go to page 2 or 3, 4, etc., I get the same random posts in all pages. I want to make the loop generate different random posts each page.               <?php query_posts("showposts=8&orderby=rand"); ?>          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>             <-- quotes content -->      <?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
      <?php endif; ?>

body: I've recently heard someone say WordPress does send data about your blog to back home. Is that true? and if so what data is that or where in the code can I see what's exchanged?

body: Just wondering, how can remove slugs from some URLS. I'm using a custom post type called exhibitors, and some taxonomies to define those exhibitors (eg: featured-guests, publishers etc.): Right now I have this: `http://thisurl.com/exhibitor_filters/featured-guests/` I would like this: `http://thisurl.com/featured-guests/` I've been playing around with the rewrite / slug in wp, but so far no dice. Suggestions? Thanks! **-Edit-** Fun times, now I'm just getting 404 errors for _everything_ involving custom- post-types and taxonomy-terms. I'm going to see if I can at least get this thing to stop barfing-out so much first...thanks for your general suggestions guys.

body: This code is being used to generate the date of a post in wordpress:               Posted: <?php echo get_the_time('F d, Y'); ?>      However it is not resutning the date, it is returning the text instead: ![enter image description here](http://i.stack.imgur.com/yXFdv.png) How can I fix this issue?

body: I have created a template named `product.php` with the following header:               <?php     /*     Template Name: Product Page     */      How can I list, in a sidebar, every page that uses the "Product Page" template? I have tried reading the `wp_list_pages()` function documentation, but it only seemed possible to list filtering by `post_type`, not by template used.

body: > **Possible Duplicate:**   >  Toggle admin metabox based upon chosen page template Is this possible to change editor screen immediately after someone picks some template from the drop down? I need a metabox shown only when page template is `page-portfolio.php`. I know I can use this code: `$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;` `$template_file = get_post_meta($post_id,'_wp_page_template',TRUE);` And than add my boxes using `if` statements. The problem is it doesn't work immediately. Is this even possible without very complex coding to do "catch" moment when user changes templates list without saving?

body: I am inserting an array of terms into my custom taxonomy programmatically. Some terms have parents/children. After each term has been entered, I then insert an array of posts into my custom post type. After inserting each post, I then set each post to it's proper taxonomy terms (parent terms and child terms). After that entire sequence completes, when I navigate to the custom taxonomy management page. (Ex: `./edit- tags.php?taxonomy=my_custom_taxonomy&post_type=my_custom_post_type`) It only shows the parent terms, with the number of posts in those parent terms. None of the child terms show up. If I edit a post from the custom post type, it shows that it has the proper parent/child terms selected. Here's the strange part. If I edit one of the parent terms from the taxonomy management page and don't change anything, just click update. All of the sudden, all of my parent and children terms show up correctly. It seems like WordPress should be flushing all these cached items automatically when these tasks are executed, but it's not. Is this a WordPress bug? Am I doing something wrong, or forgetting to do something?

body: If I want to create a link that will always show the latest post how can i do that? Lets say I have three post types and there is three lists with posts names likes a nav list to those post types. How do I make it dynamic? I can't make it like this blah.com/post Because it always will be always changing.

body: I was trying to search entire Google, Yahoo and Bing, but also can't get the answer i want. That is why i am here to ask for help. Now, i make searches on my website, the results are returned from Title and Content. Is it possible to get it return from Tags only(without plugin if possible)? Appreciate your help from everybody does. Thank you!

body: I am working with site that is done with WordPress, and I need to add some parts that are outside WP, and to check user login, Logging users outside WP. I tried with md5 of password but it's not... I tried this code:               require_once( 'wp-includes/class-phpass.php' );     $wp_hasher = new PasswordHash( 8, TRUE );     $password = "passwordhere";     $hashed_password = $wp_hasher->HashPassword( $password );     $encryptedpass = md5($hashed_password);      But this is only for first time creating password, and it's always different. I need code that can be used in this:               SELECT * FROM wp_customers WHERE email = "ccc@aaa.com" AND password = "<what goes here?>"      Is this possible anyhow? Thanks.

body: On my WP site (which sells retail products), I have large images (up to 4000x4000 px) so people can zoom in. Unfortunately, when adding images to a page and using the Media Library, the images all load up at full quality (though resized down). This makes the Media Library page load up really slowly, and make my browser slow to a crawl. Why is it doing this? Why isn't the ML page using thumbnails? If I click on "Media" on the left admin menu, that list of images are proper thumbnails, but when adding media to a page, the list that comes up is using full quality images. Is this a bug in WP?

body: I declared an action for a single event in Wordpress which accepts an array as an argument:               $asins = array(); //I had to declare this since I'm getting a notice of undefined variable if I don't          add_action('z_purge_products_cache', array($this, 'purge_products_cache', $asins));      I also tried this one, but it doesn't perform the action either:               add_action('z_purge_products_cache', array($this, 'purge_products_cache'));      Then I schedule it:               wp_schedule_single_event(time() + 20, 'z_purge_products_cache', $asins_r);      Then here's the function that will be called once wp cron executes the action:               public function purge_products_cache($asins){       //send email here     }      Any ideas?

body:
I am pretty new in WordPress theme development and I have the following question about the **page.php** page contained into templates files (the file that describe the template for the static pages) I am analazyng the **page.php** file contained into the **twentythirten** default theme, the code of this file is:               <?php     /**      * The template for displaying all pages      *      * This is the template that displays all pages by default.      * Please note that this is the WordPress construct of pages and that other      * 'pages' on your WordPress site will use a different template.      *      * @package WordPress      * @subpackage Twenty_Thirteen      * @since Twenty Thirteen 1.0      */          get_header(); ?>

                      <?php /* The loop */ ?>                 <?php while ( have_posts() ) : the_post(); ?>                          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                                                      <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
                                 <?php the_post_thumbnail(); ?>
                             <?php endif; ?>
<?php the_title(); ?>

                             <?php the_content(); ?>                             <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentythirteen' ) . '', 'after' => '
', 'link_before' => '', 'link_after' => '' ) ); ?>
                                                           <?php edit_post_link( __( 'Edit', 'twentythirteen' ), '', '' ); ?>
                          <?php comments_template(); ?>                 <?php endwhile; ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>      My doubts are: 1) **page.php** is the default template for the static pages but this file contain the posts loop:                <?php while ( have_posts() ) : the_post(); ?>      Why?

body: I am trying to return a menu in alphabetical order and not the order set by the user in the backend. I have this code but it is not alphabetical:               $args = array(         'order'                  => 'ASC',         'orderby'                => 'title',);     $menu= wp_get_nav_menu_items($menu->term_id, $args);

body: > **Possible Duplicate:**   >  How to add a custom metabox to the Menu Management admin screen? In the backend of Wordpress, under Appearance -> Menus it allows you to add different post types by clicking on checkboxes and then "Add to Menu". Normally it will display Pages, Posts, and Custom Links - it will also display Custom Post types that are added. Pages are based on hierarchy, however in the list they are not organized this way. This makes it difficult if you have many pages with the same name (that are common subpages of unique parents). Is there anyway to modify this behaviour to add hierarchy to the listing? Is there a wordpress function that can be overwritten, or even a new module that can be added to support Page hierarchy in the Menu section?

body: I use the WooCommerce theme Mystile, and there is a lightbox function built into that theme (or Woocommerce). I have deactivated this lightbox from the WooCommerce settings by unchecking this " Enable Lightbox" Now my problem is when, I click on one of the small thumbnails (below the big product image) it just open these images in a blank new tab. How can I make it, so when I click on one of these small thumbnails they rotate, so the one I click on become the big product image. ![enter image description here](http://i.stack.imgur.com/uDAqL.png)

body: I tried google and used #wordpress.   Is there a way to preset categories for my new posts (post-new.php) via GET- parameters? If not how can I achieve this?

body: I get this error due to one of the plugins which I rely on. Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. What does this error mean and how do you fix it? Mind due that this is not a critical error. It only appears when I put WP into debug mode. The full plugin-code is below. It's one heck of a plug in that makes it a breeze to deal with the highly complicated and hierarchical cats. I'm posting it not _just_ for the sake of debugging where the bloddy error is but _also_ to hope that it helps someone.               <?php /*          **************************************************************************          Plugin Name:  Category Collapse     Description:  Makes children categories hidden on the Write screens until an icon is clicked.     Version:      2009.02.12     Author:       Viper007Bond     Author URI:   http://www.viper007bond.com/          **************************************************************************/          class CategoryCollapse {              // Plugin initialization         function CategoryCollapse() {             if ( !is_admin() ) return;                  wp_enqueue_style( 'category-collapse', plugins_url('/category-collapse/category-collapse.css'), array(), '2009.02.12', 'screen' );             add_action( 'admin_head', array(&$this, 'edit_form_advanced') );         }                   // Output the Javascript (it's not in an external file due to the dynamic image URLs)         function edit_form_advanced() { ?>          <?php         }     }          // Start this plugin once all other plugins are fully loaded     add_action( 'plugins_loaded', create_function( '', 'global $CategoryCollapse; $CategoryCollapse = new CategoryCollapse();' ) );          ?>

body: Is there a method of displaying a post that is a draft when not logged in? For example I have created a mailer template for my news...               <?php     if ( isset($_GET["mailer"]) )     get_template_part( 'mailers/template', 'news' );     else {     get_header(); ?>              <!-- WEB TEMPLATE -->          <?php get_footer();     } ?>      This is on my `single-news.php` template. As you can see my news mailer template is pulled in when I use this variable... `?mailer`               http://www.example.com/my-news-reports/?mailer      But I would like to be able to still use the mailer template even when in draft mode. Is this possible with adding a variable like this.. `?mailer&draft=true` I understand the 404 template is retrieved, and this may cause issues. Just wondering if there was a method I could adopt to get round this draft issue. Thanks

body:
I'm building a custom search form with keywords and drop down lists (categories, date, and country (have a separate plugin for this)). In the searchform.php I have the input field and then select>option tags.                         <form action="/" method="get">                  <input type="text" name="s" id="search" value="<?php the_search_query(); ?>" />                  <select name="category">                      <select name="country">                        <option value=""></option>                        <option value="UK">UK</option>                        <option value="USA">USA</option>                        <option value="Brazil">Brazil</option>                        <option value="Poland">Poland</option>                        <option value="Canada">Canada</option>                      </select>                      <select name="year">                        <option value=""></option>                        <option value="2012">2012</option>                        <option value="2011">2011</option>                        <option value="2010">2010</option>                      </select>             </form>                    <?php          // search.php (results)          $args = array(                  's' => $_GET['s'],                        'country' => $_GET['country'],                  'year' => $_GET['year']          );                    $the_query = new WP_Query( $args );                    if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                  // Do Stuff
<?php country_tag($post->ID); ?><a href="#" data-siteurl="<?php bloginfo('url'); ?>" rel="<?php the_ID(); ?>" title="<?php the_title_attribute(); ?>" class="search-post-title"><?php the_title(); ?>
                    <?php           endwhile;          endif;          ?>      **Problem:** Currently if I leave the selects empty it sends them as empty strings in the get url (`?s=keyword&country=&year=`). This means that nothing will be found in the search. (I am guessing because its saying 'find matching posts with 'keyword' AND an empty string). So I want `?s=keyword` to be passed if others are unused. Perhaps I've setup the code wrong, likely as I've just started playing around with WP_Query.

body: In the Comments page ( **`/wp-admin/edit-comments.php`** ), every logged in user can see all the site comments.   ![comments page](http://i.stack.imgur.com/vZgkD.png) * * * I'd like the users to see only his/her own comments and the comments that are left to his/her posts. How can I filter this?

body: I'm having some trouble with this. I'm not sure how to do it the correct way, and I read so many different techniques and ways to do it that I don't know what to make of it. Some questions and troubles I have:   \- Should I deregister the jQuery that is included in WordPress at all?   I'm doing it right now with the following code:               function uw_load_scripts() {         // De-register the built in jQuery         wp_deregister_script('jquery');         // Register the CDN version         wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), null, false);          // Load it in your theme         wp_enqueue_script( 'jquery' );     }     add_action( 'wp_enqueue_scripts', 'uw_load_scripts' );      This works. Should I do this for everyone, like this, or for everyone but admin (so that backend uses the WordPress version?):               if (function_exists('load_my_scripts')) {       function load_my_scripts() {           if (!is_admin()) {           wp_deregister_script( 'jquery' );           wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), null, false);          wp_enqueue_script('jquery');            }       }       }       add_action('init', 'load_my_scripts');      This version doesn't work at all actually, I get the WordPress jQuery-version and not the Google one. Also, how do I add my own scripts (slider scripts, modernizr and my own custom.js) the correct way? I guess I should do this via functions.php as well and not in the header like I'm doing it now, but I'm unsure of how I would do that.

body: Is there any way to add help for users when adding a control to Customize with               $wp_customize->add_control(...);

body: I'll be having users publish posts through a form. Once they publish I'd like to automatically set the category to match the title of the post, creating one for it if it doesn't already exist. (I know that sounds strange but it's a dictionary site so each post will be a definition organized using the terms as categories.) I've found plenty of info on assigning category based on author, but nothing yet for post title. Any suggestions are much appreciated!

body: I want to edit a file `style.css` but the theme editor shows this:               /* ---------- Reset Tags ----------- */     @import url("css/reset.css");          /* ---------- Reset Tags ----------- */     @import url("css/prettyPhoto.css");          /* ---------- Shortcodes ----------- */     @import url("css/shortcodes.css");          /* ---------- Site Styles ---------- */     @import url("css/style.css");      Is there any way to edit `css/style.css` via the Theme Editor?

body: I'm sure this is a simple oversight but I cannot seem to narrow it down:                global $wpdb;      $tablename = $wpdb->prefix . "icrm_folders";      $sql = $wpdb->prepare( "SELECT * FROM %s", $tablename );      //$sql results in SELECT * FROM 'wp_icrm_folders'      $result = $wpdb->get_results( $sql );      This seems to result in nothing! My debugger shows an error on $wpdb object under last_error:               You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''wp_icrm_folders'' at line 1      Now I ran the query `SELECT * FROM 'wp_icrm_folders'` directly in phpmyadmin and that gives me an error because wp_icrm_folders is inside `'` the query executes fine if I remove the apostrophes or replace them with the grave accent/character. PHP Version 5.3.3-7 MySQL Version 5.1.63 WordPress 3.5.1

body: Is it possible to use a variable to rewrite a Custom Post Type permalink FROM wp_terms -> slug? > **WPDB:** wp_terms -> slug = healthy-living **A1) Current Custom Post Type args:**               'rewrite' => array( 'slug' => 'issues/resources' ),      **A2) Current Permalink (works great!):**               http://localhost/issues/resources/title-of-resource.html      **B1) Desired Custom Post Type args (is this possible?):**               'rewrite' => array( 'slug' => 'issues/$WP_TERM_SLUG_VAR/resources' ),      **B2) Desired Permalink:**               http://localhost/issues/healthy-living/resources/title-of-resource.html      If you have any suggestions, your time is appreciated!

body: i have a page in wordpress called "video". its page id is 6, and its slug is "video" in my theme ive set it up to show content based on GET variables here is the URL rewrite im trying to set up: heres the original URL with the GET variables inside: mysite.com/video/?video_id=102230&video_title=FC+Emmen+v+AGOVV+Apeldoorn&video_src=MTAyMjMw heres the URL i want it rewritten to so it can be indexed: mysite.com/video/102230/MTAyMjMw/FC+Emmen+v+AGOVV+Apeldoorn heres my htaccess file that is not working:               # BEGIN WordPress     <ifmodule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     RewriteRule ^video/(.*)/(.*)/(.*)$ ?page_id=6&7video_id=$1&video_src=$2&video_title=$3 [NC]     </ifmodule>     # END WordPress      what happens is, when i try and visit mysite.com/video/102230/MTAyMjMw/FC+Emmen+v+AGOVV+Apeldoorn, it simply automatically goes to mysite.com/video and removes everything after /video edit - now it is not removing everything after /video, but its telling me "Nothing found for Video 102230 MTAyMjMw FC+Emmen+v+AGOVV+Apeldoorn"

body: I have a custom post type with only 3 custom fields in it.               $post_types = get_post_meta($post->ID,'post_types',true);     $post_taxonomies = get_post_meta($post->ID,'post_taxonomies',true);     $post_terms = get_post_meta($post->ID,'post_terms',true);      I want to check if already exist post with this $post_types value, and if exist -> show message without publishing. I created a metabox for this custom fields, which already have function for save_post action hook.               function sidebars_meta_save( $id )  {           if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;                if( !isset( $_POST['sidebars_nonce'] ) || !wp_verify_nonce( $_POST['sidebars_nonce'], 'save_sidebars_meta' ) ) return;           if( !current_user_can( 'edit_post' ) ) return;                $allowed = array(               'p' => array()           );                    if(isset( $_POST['post_terms'] )){                         //check_exist_term - simple boolean function which check if                          //a post with this term already exist             if(!check_exist_term($_POST['post_terms'])){                 if( isset( $_POST['post_types'] ) ){                       update_post_meta( $id, 'post_types', wp_kses( $_POST['post_types'], $allowed ) );                  }                 if( isset( $_POST['post_taxonomies'] ) ) {                      update_post_meta( $id, 'post_taxonomies', wp_kses( $_POST['post_taxonomies'], $allowed ) );                 }                     update_post_meta( $id, 'post_terms', wp_kses( $_POST['post_terms'], $allowed ) );                 }             }else{                             //if I will use wp_delete_post here, the message will not show                 //wp_delete_post($id);                 //wp_redirect('post-new.php?post_type=sidebars');                 //exit;             }         }     }       add_action( 'save_post', 'sidebars_meta_save' );        My redirect location function :               function sidebars_redirect_location($location,$post_id){     if( isset( $_POST['post_types'] ) ){           if(check_exist_term($_POST['post_terms'])){             $status = get_post_status( $post_id );             $location = add_query_arg('message', 21, $location);                         //if I will use wp_delete_post here, I will be not able                          //to return to post edit page, because page will be already deleted         }     }     return $location;     }     add_filter('redirect_post_location','sidebars_redirect_location',10,2);      My post updated messages function :               function sidebars_custom_messages($messages){     $messages['sidebars'][21] = 'Looks like you tried publishing a post with term which already exist!';     return $messages;     }          add_filter('post_updated_messages', 'sidebars_custom_messages');          1) Where I should use wp_delete_post() If I want to first of all to show a message that this post already exist and just then delete this post and stay on this page? 2) How to show red message instead of yellow?

body:
I have a custom template displaying an "archive" of terms. When a term is clicked it takes the user to a list of all the posts assigned that term. I am not using a traditional loop to achieve my term archive. Below is my code. Is there a way to force pagination after 12 terms are displayed on my archive page?
              <?php              $libargs=array(             'orderby'           => 'name',               'order'             => 'ASC',             'hide_empty'        => 0,               'exclude'           => array(16, 20, 22,25, 27, 28, 30, 4, 42, 7, 43 ), //* Enter ID's of parent categories to exclude from list             'taxonomy'      => '100list',             'parent'                   => '',                  );                    $libcats=get_categories($libargs);                    $i = 0;                  foreach($libcats as $lc){                                if( $i % 3 == 0 ) {                  echo '

';                 }               $i++;                 echo '
';                      $termlink = get_term_link( $lc->slug, '100list' );             ?>

<?php echo  $lc->count  ?>

 Symbols

 <a class="label label-default" href="<?php echo $termlink; ?>"> View Group

    <?php the_field('basictext', '100list_'.$lc->term_id); ?>

                                       <?php                           $attachment_id = get_field('taximage', '100list_'.$lc->term_id);                          if ($attachment_id) {                         $image = wp_get_attachment_image_src($attachment_id, 'industrygroup-img');                              if ($image) {                             ?>                             <img class="img-responsive" src="<?php echo $image[0]; ?>" />                             <?php                          }                      }                       ?>

 <a href="<?php echo $termlink; ?>"> <?php echo $lc->name; ?>
                <?php   echo '
'; }?>

body: I can't provide you with any code since I not really know where to start. I like to add some programmatically created widgets (or just html) after the 1st Widget inside my sidebar. Right now I have it that I have to include this widgets before all others, that was pretty easy of course.

body: I am finding some problem trying to center horizontally an image into a page using `Tiny MCE Advanced` editor. So if you go here you can easy understand what is my problem As you can see in the page there is an immage (named `Hum_righ_big.jpg`). I tryed to use `Align Center` into `Tiny MCE Advanced` alignment but it remains on the left. I also try to do: > Mouse click on the image ---> click on the edit icon --> Align: Center But I obtain the same problem. It remains on the left. Why? What am I missing? How can I center this immage?

body: I want to restrict the access to the wp-admin.php (dashboard) for all non- admins. I found different ways but the also restrict the subscribers to upload files. Is there a secure way (not only hide the admin-bar) to avoid the access to the dashboard? Thank you very much Cheers Marco

body: I am receiving this warning when I try to run a database query: > **Warning:** Missing argument 2 for wpdb::prepare() The offending query is:               $result = $wpdb->get_var(         $wpdb->prepare(             "SELECT DISTINCT meta_value FROM $metatable             WHERE meta_key LIKE '%matchme%'             AND meta_value IS NOT NULL             AND meta_value <> ''"          )     );      Is there a way to remove the error by modifying the above query?

body: > **Possible Duplicate:**   >  paginate_links() don’t properly work in search.php? I'm trying to make a simple pagination nav menu, using the following code:               global $wp_query;                         $total_pages = $wp_query->max_num_pages;                              if($total_pages > 1) {                                  $current_page = max(1, get_query_var('paged'));                                  echo paginate_links(array(                                 'base'  =>  get_pagenum_link(1).'%_%',                                 'format'    =>  'page/%#%',                                 'current'   =>  $current_page,                                 'total'     =>  $total_pages,                                 'prev_next' =>  false,                                 'type'      =>  'list'                                  ));                         }      But when I click on a page link it's reffering me to: **Not Found** **The requested URL /wptest/page/2 was not found on this server.** I know that it's probably something simple that I missed but I don't know what is it.

body:
> **Possible Duplicate:**   >  Programmatically add widgets to sidebars Is it possible to develop a theme that has certain widgets automatically activated when the theme is activated? For example: I’ve got a sidebar defined in my functions.php:               if ( function_exists('register_sidebar') )     register_sidebar(array(         'name' => 'Default Sidebar',         'id' => 'default-sidebar',         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
'     ));      Now in the WP backend there would be an empty sidebar called “Default Sidebar” in the Widgets section under Appearance. Instead of an empty sidebar, I’d like to have a sidebar filled with pre-activated widgets that I defined e.g. in the functions.php with something like that:               activated_by_default( array(         'WP_Widget_Tag_Cloud',          'WP_Widget_Archives') );      I know there’s a solution by “hardcoding” the widgets in the theme:
         <?php if ( ! dynamic_sidebar() ) : ?>
<?php wp_tag_cloud( $args ); ?>

<?php wp_get_archives( $args ); ?>
         <?php endif; ?>
      But that doesn’t fit to my esp. not to the user’s needs because the user a) gets an empty sidebar in the backend although there are widgets displayed in the frontend which maybe confuses him and b) when he adds a widget to the sidebar through the backend the pre-defined will disappear which maybe confuses him a bit more. I could delete the               <?php if ( ! dynamic_sidebar() ) : ?>       and put the dynamic sidebar below the widgets I want to be displayed by default, so that the pre-defined widgets won’t disappear when the user adds one through the backend. But I want the user to be able to order ALL widgets which wouldn’t be possible when some are hardcoded.

body: I am using the post to display attorney verdicts and case details. The post title is the verdict amount entered as a string. (no $ "," or ".") I am formatting the title using PHP number format:               EX: User enters 360137 in the post title.         $number = get_the_title();          $ammount = number_format($number);              echo '<h1>$'. $ammount . '</h3>';          Returns $360,137      This is working as expected. Using get_posts() I can 'orderby' => 'title' and 'order' => 'DESC' or 'ASC'               $args = array(      'category' => 64,      'orderby' => 'title',      'order' => 'DESC' );           $myposts = get_posts( $args );      foreach ( $myposts as $post ) : setup_postdata( $post );      While this is working it does not recognize the length of the value. For example it will display 30,000 before 2,100,000. How do I get this list sorted by ASC or DESC AND by string length? I want to show the largest verdicts first. 9,000,000 2,100,000 90,00 3,000

body:
I'm creating a new Page Template. I want to change margins, fonts, font sizes, and things like that. I don't know if I've done things right. Is the following process that I've followed sound?:   1. I created a new file 'salespagetemplate.php' and placed this in the active theme (twentyeleven-child).   2. In the file 'salespagetemplate.php', I have the following code, and only this code:              <?php     /**      * Template Name: Salespage      */     wp_enqueue_style( 'my-page-template', get_template_directory_uri() . '/css/page-template.css' );     ?>

                  <?php the_post(); ?>                  <?php get_template_part( 'content', 'page' ); ?>

      (some of that code isn't appearing in this post -- don't know how to make it appear.)   1. I created a new file 'page-template.css', which is referred to in the code above, and which if I understand correctly, I can edit to change css for the page template. And, in case I'm supposed to be referencing any of the existing files and am doing so incorrectly, here is the list of file names I have in the active theme folder: content.php functions.php page.php salespagetemplate.php single.php style.css page-template.css

body: I'm using the `transition_post_status` hook to perform some operations after publishing a post. In some conditions I would like to show an error message in a red box under "Edit Post" and above "Post published": ![Post pushlished](http://i.stack.imgur.com/dRuVQ.png) How can I do that?

body: I have a main parent page with multiple sub-pages. The main parent page has some custom fields (meta boxes?) with specific values. My intent is to add dynamically these custom fields and their values to all sub-pages. I searched a solution but without success. Is this possible? And how?

body: TL;DR: How do I use something similar to get_template_part from within my plugin? I've created a custom filtering course listing for a school that queries posts to display what matches the user's query. This is located at mysite/courses. If you click on one of the courses, you'll be shown the same page, but with that one course shown instead of the listing of all others, and it will have the url mysite/courses/mycourse. This process is similar for a number of other options (ie. mysites/departments/mydepartment). Everything is done within a plugin, including the page templates. Is there a way I can reuse my already-written code for various templates within my plugin? get_template_part only works for me if I'm using it in the theme directory.

body: I have two wordpress installations with same host with different folders. Each installation uses its own database. I mean, database are separated. I am not using one database for two wordpress installations. My Problem: I have two different member databases. Because my wordpress installation databases are not shared. So i want to use wpA database as my main database for sharing users only. And my second wpB installation must use its own table, but only must use members from wpA database. How can i do that ? ### Summary   * I have wordpress installations in different directories.   * I have different databases for both installations.   * I want to use wp installation b use wp installation a members as a default members.   * If somebody wants to register on wordpress b, he should registered on database A automatically.   * If somebody logged in wordpress site A using database A, they can be verified on wordpress site b without extra registration. I don’t know English very well so if I made mistakes, I am sorry.

body: I would like to hide **Pages** and **Comments** from the editor. I tried to override them with my custom types' _menu_position_ but it doesn't work in **WordPress 3.7.1** any more. I found another way: removing the entries from **admin menu** by altering the global _$menu_ variable on _menu_order_ **filter**. Unfortunately it produces errors in _menu.php_ : _array_flip()_ gets passed a _null_. I'm guessing that WordPress assumes that default values are still there. Is there some way of filtering the menu entries **when** they are **rendered**? Even better: is there a way of setting the **default post** types _public_ option to **false**?               class RemoveAdminMenuItems {          /**      * List of values used for key identification      *       * @var array      */     public $remove_keys = array();          /**      * List of values used for key identification. Identified keys will be removed.      *       * @param array $remove_keys      */     public function __construct($remove_keys)     {              $this->remove_keys = $remove_keys;              add_filter( 'custom_menu_order', '__return_true' );         add_filter( 'menu_order', array($this, 'reconstruct_menu'));          }          /**      * Method modifies the admin menu before it gets rendered.      *       * @global array $menu      */     public function reconstruct_menu() {              global $menu;              foreach ($menu as $menu_key => $menu_value) {             foreach ($this->remove_keys as $remove_key) {                 $key = array_search($remove_key, $menu_value);                 if ($key) {                     unset($menu[$menu_key]);                 }                     }         }          }           }

body: My favorite part of the Wordpress template hierarchy is the ability to quickly create template files for pages by slug, without having to edit the page in Wordpress to select a template. We can currently do this: > page-{slug}.php But I would like to be able to do this: > single-{post_type}-{slug}.php So that, for example, in a post type called `review`, I could make a template for a post called "My Great Review" at `single-review-my-great-review.php` Has anybody set this up before? `single-{post_type}-{slug}.php`

body: > **Possible Duplicate:**   >  When to use WP_query(), query_posts() and pre_get_posts I just noticed today that the documentation for query_posts() mentions some "disadvantages" of using query_posts for altering the main Loop, notably: 'causes additional SQL queries'. This seems to imply that there's another way / a better way. Obviously there's get_posts() and WP_Query for secondary loops, but I don't see them as addressing the "disadvantages" listed in the Codex documentation. I can see that by waiting until you're in the template to run query_posts, WordPress has already run a query once and this is now a second query that clobbers the first one (the first one being basically ignored). This definitely DOES sound inefficient (though perhaps not a big deal, who knows?) My question is: is there an alternative to query_posts that does NOT add "additional SQL queries" or is the Codex documentation simply deceiving?

body: > **Possible Duplicate:**   >  Easily Move a WordPress Install from Development to Production? I Setuped a Wordpress site on http://domainname.com/test/ now I want to move everything to main domain http://domainname.com/ How to do this without loosing anything? and most important thing http://domainname.com is live site so moving should take very less time if possible. Any suggestion would be appreciated? Wordpress version is 3.0.3 and Hosting is Dreamhost. I have access to everything. FTP, Database.

body: I'm trying to use ajax function to my theme. I think i can't just put the javascript code in my functions.php, i have to register it properly and enqueue it. So i store the javascript file with `.js` extension and enqueue it from my themes js directory. Now `ajax_url` is only available globally in admin section not in front end. To get the url we have to use `<?php echo admin_url('admin-ajax.php'); ?>` for front end Reference. How can i use it in the file as it is a `js` file? Php can not be interpreted. Is there any other way to define the ajax_url in my js file for front end. OR should i include it in the header.php with no option?

body: I try to use this function i have created when a post is published for the first time.               function a_new_post($post){       $post_id = $post->ID;            if ( !get_post_meta( $post_id, 'firstpublish', $single = true ) ) {           // ...run code once           update_post_meta( $post_id, 'firstpublish', true );       }     }     add_action( 'draft_to_published', 'a_new_post' );      I can't see anything wrong with it, but when i try to create some sample posts i check the database and the field "firstpublished" has not been created. Does anyone see anything wrong?

body:
I am using wordpress 3.2 and I did a query post like this:               <?php query_posts("posts_per_page=1post=type&page=post_parent=10");?>      Then I try to echo out the date of this post I queried like this.               <?php echo the_date(); ?>      It gives me the title of the post and the excerpt and the permalink but no date. What do you think the problem is. I'm sure it's something quite embarrassing. Here is the code in my template file for the video page:                   <?php query_posts("posts_per_page=1post=type&page=post_parent=10");?>
Recent Video

<?php echo the_date(); ?>

<?php echo the_title(); ?><?php echo the_excerpt(); ?>

<a href="<?php echo the_permalink(); ?>" class="more2">Watch Now
      Here I try to put the query in a loop:               <?php query_posts("posts_per_page=1post=type&page=post_parent=10");?>     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
Recent Video

<?php echo the_date(); ?>

<?php echo the_title(); ?><?php echo the_excerpt(); ?>

<a href="<?php echo the_permalink(); ?>" class="more2">Watch Now
     <?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
     <?php endif; ?>      the_date() did not work but the the_title() and other functions worked. By the way this changed my query to the_post() which is not what I'm wanting. I want to query the latest video like I did above the loop. By the way I used the_date function earlier in the page and it worked. Could that be the problem? Here is it before the code that I had a problem with. ##
         <iframe id="video" src="http://www.youtube.com/embed/videoseries?list=<?php print get_post_meta($post->ID,"playlist_id", true); ?>" width='560' height='350' frameborder="0">

<?php echo get_post_meta($post->ID,"speaker", true); ?>

<?php echo the_date(); ?>

body: > **Possible Duplicate:**   >  setting comments off as default for pages and custom post types? When I create a new page, I want these two checkboxes (from the "Discussion" meta box) to appear unchecked by default. Can this be done programmatically? !["Discussion" meta box](http://i.stack.imgur.com/GMzqz.png)

body: I tried to update my WordPress on my local environment, but now WordPress would require me to enter some FTP server and user name and password. How should I enter that information?

body: I know how to set the size of an image type:               set_post_thumbnail_size( 150, 150 )      ..or using the media settings, but how do I get the image with and image height that have been set for an image size? I'd like something like:               get_post_thumbnail_size(); // return array(150, 150)      how should this be done? Is it by using get_option(), and what would the options keys be for thumbnail width and height?

body: I am stuck at `add_custom_background`. I can change background color/image but I only want to change my index page. Currently, the changes apply on the whole page. I want to make the changes from WP-admin. How can I specify it to a specific page ? Edit: I just checked im running 3.3.1. So my version is not supported to use add_theme_support( 'custom-background' ); instead I want to use add_custom_background.                 if ( is_front_page() )     {        add_custom_background();     }      Cant get it to work.

body: I develop my plugin over on github but when it comes to deployment I have to somehow copy my changes into the _Wordpress SVN_. Currently I do this manually and copy over each file in each directory individually, but this is time consuming and error prone. I have seen and tried a few scripts but I think I must be running them wrong as they either error or don't copy over the files correctly. So my question is has anyone achieved this automatically and if so how did you do it? Thanks!

body: I have a template which initially had one single loop and it was using query_posts, I added 2 more loops using the same method, However after reading allot about these it was concluded that I shall stop using it and everyone is against using it. **original query_posts loop (latest posts)**               <?php if ( !is_front_page() && tfuse_options(PREFIX.'_pagination_portfolio') ){         $cat = get_query_var( 'cat' );         query_posts( array ( 'posts_per_page' => -1, 'cat'=>$cat ) );     }     while (have_posts()) : the_post(); ?>         //blah posts here     <?php endwhile; ?>      **2nd custom get_posts loop (random posts)**               <?php if ( !is_front_page() ){         //$cat = get_query_var( 'cat' );         $args = array( 'numberposts' => 10, 'orderby' => 'rand' );         $rand_posts = get_posts( $args );     }     foreach( $rand_posts as $post ) : ?>         //blah posts here     <?php endforeach; ?>      **3rd custom get_posts loop no working (most viewed posts)**               if ( !is_front_page() ){         $cat = get_query_var( 'cat' );         $args = array( 'v_sortby' => 'views', 'v_orderby' => 'DESC', 'numberposts' => 10, 'cat'=> $cat);         $most_viewed_posts = get_posts( $args );     }     foreach( $most_viewed_posts as $post ) :          //blahblah     <?php endforeach; ?>      The problem is that the third loop doesnt show the right posts, as if it doesnt recognize the post meta, however if i use query_posts then it works! > views v_sortby, v_orderby Any help is appreciated, I am quite new to this. **Update** According to similar question asked on this site. below is another way of achieving it using query_posts with meta keys. I guess there is a better way of rewriting the code to use meta keys + wp_query or get_posts someone care to? I am very new to this, looks too chunky? :S               <?php $posts_per_page = get_query_var('posts_per_page'); ?>     <?php $paged = intval(get_query_var('paged')); ?>     <?php $paged = ($paged) ? $paged : 1; ?>     <?php $args = array(     'posts_per_page' => $posts_per_page,     'paged' => $paged,     'more' => $more = 0,     'meta_key' => 'views',     'orderby' => 'meta_value_num',     'order' => 'DESC',     ); ?>     <?php query_posts($args); ?>     <?php if (have_posts()) : while (have_posts()) : the_post() ;?>     <div <?php post_class() ?> id="post-<?php the_ID(); ?>">

body: > **Possible Duplicate:**   >  Removing the "Powered by WordPress" Link? i have a bit odd question but here it goes: Due to page styling issues with the copyright logo, i deleted the whole div that says: "Powered by Wordpress (logo)". Now due to my SEO plugin, the source doesn't include the meta- generator tag. Now am i in violation of the Wordpress License, or im ok (although i do look irresponsible)?

body: I'm trying to figure out the best way to add custom menu attributes without using a plugin. I have a site using a custom theme and need to make sure this is setup at theme activation vs needing to setup a plugin as well. Is there a function I can plug into for this?

body: Can I prevent enumeration of usernames on my wordpress site? I can see users at the moment using the WPScan tool.

body: I am looking to achieve something which I figured would be fairly simple to accomplish but it seems there are no real examples available to achieve my needs. Essentially I have a custom post type of "Articles" for this custom post type I have a new taxonomy which I have registered which was created so that source publications can be added. My goal was to be able to add an article through this custom post type and then select the applicable "source publication" from the term list so I could display where the article came from. Now, the problem I am having seems to be simple... All I am trying to do is add some additional fields to the page where you can enter each taxonomy term. In this case I would like to add a field for "URL" and include an image for each source so I can add a logo. So the question here is... how would I go about adding an additional field to each term? I am assuming if wordpress does not allow for this functionality naively that somehow the "description" field could be utilized as a type of custom fields area and thus that the data can be stored there. Then I am trying to of course extract the data out and display it. I was able to customize the taxonomy column titles in case anyone is interest in the same way that columns can be modified for custom post types like this:               // CUSTOM TAXONOMY COLUMNS FOR CONTENT SOURCES        add_filter("manage_edit-content_sources_columns", 'content_sources_columns');            function content_sources_columns($content_sources_columns) {         $new_columns = array(             'cb' => '<input type="checkbox" />',             'name' => __('Name'),     //      'source_image' => '',             'description' => __('URL'),             'slug' => __('Slug'),             'posts' => __('Posts')             );         return $new_columns;        }

body: I have a multi-author website of which I am the administrator. I was wondering whether it is possible to have a notification in the admin bar when an author submits a new post? Can be a plugin if necessary.

body: In order to refrain from possible duplicate URLs or conflicting URLs, I really want to use "postname" for a clean URL structure, EXCEPT for the blog ... for the blog and it's posts, I always want /blog/ to be apart of the URL. This makes total sense, and I don't quite understand why it doesn't function like this when you specifically select a Page to represent the blog.               http://www.mydomain.com/this-is-a-page/          http://www.mydomain.com/blog/     http://www.mydomain.com/blog/my-blog-post/

body: Could it be done or not? E.g. I want to be ble to upload an image when creating a new taxnomy term. So, when I create a new term called **Mercedes** in my custom made taxonomy called **brands** how can I add a file picker field to that term so I can upload an image of Mercedes logo? Is it even possible to upload a file for taxonomy?

body: > **Possible Duplicate:**   >  How To Add Custom Form Fields To The User Profile Page? I'm current removing some user fields with the following code in the functions.php file:               function adjust_contact_methods( $contactmethods ) {       unset($contactmethods['aim']);       unset($contactmethods['jabber']);       unset($contactmethods['yim']);       unset($contactmethods['twitter']);       return $contactmethods;     }     add_filter('user_contactmethods','adjust_contact_methods',10,1);      I'd like to additionally remove the website and Google+ fields, but I can't find the correct keyword. Any advice?

body: I am trying to set up a wordpress multisite with MAMP Pro that will allow me to have two different domains (one domain for each language): dev.domainenglish.com dev.domainfrench.com I have already set up the primary english virtual host and secondary virtual french host. I have installed the wordpress multi site on the primary English virtual host. Next I created a "sub site" within the primary english domain multi site that has the location dev.domainenglish.com/french/ Then I tried to use the MU Domain mapping plugin to make it so that when you visit dev.domainfrench.com the theme and content posted on dev.domainenglish.com/french/ will be visible. As of now when you visit dev.domainfrench.com the page loads the standard MAMP Pro index.html instead of my wordpress subsite: > the virtual host was set up successfully. > > If you can see this page, your new virtual host was set up successfully. > Now, >web contents can be added and this placeholder page1 should be > replaced or >deleted." I understand that this plugin was built for live sites. But is there anyway I can achieve my goal of having two domains under one Wordpress multisite on my localhost? Thank you for your time!

body: I am creating the oh-so-common _Events_ custom post type and I want to use the **published date** as my event date. Eventually, in my archive, I will make sure to display posts with the **scheduled** status. I know I can add a custom metadata, and I am already doing it for other datas, but I believe that in this case using the publishing data is the best. First of all, it will allow me to easily query for _upcoming events_ or _past events_ ; secondly, nobody really cares of when an event was _published_ ; and thirdly, but most importantly, I want my archives permalinks to have the `/date/post/` structure (ex. `/2013/10/awesome-event`) and it makes much more sense to have the event date there rather than the published date. I browsed a bit through the WP core file that creates that metabox, and I couldn't find any filter that I could hook in to edit that label. Titles of the metaboxes are easily editable, but it looks like labels not so much. Any suggestions on how to achieve something like this.

body: hey guys a few days ago i asked my question but i didnt getting it work. simple question. i got this in my theme:                   $querystr = "         SELECT $wpdb->posts.*          FROM $wpdb->posts, $wpdb->postmeta         WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id               AND $wpdb->postmeta.meta_key = '_wp_page_template'          AND $wpdb->postmeta.meta_value = 'templates/front-page.php'              AND $wpdb->posts.post_status = 'publish'          AND $wpdb->posts.post_type = 'page'";              $pageposts = $wpdb->get_results($querystr, OBJECT);      i added a new theme and asked how do i get these second theme shown. matthieu helped me and coded this:               $querystr = "       SELECT $wpdb->posts.*      FROM $wpdb->posts, $wpdb->postmeta, $wpdb->postmeta AS mt1     WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id           AND ($wpdb->postmeta.meta_key = '_wp_page_template'        OR $wpdb->postmeta.meta_value = 'templates/front-page.php')     AND mt1.meta_key = '_wp_page_template'     AND mt1.meta_value = 'templates/front-page-excerpt.php'          AND $wpdb->posts.post_status = 'publish'      AND $wpdb->posts.post_type = 'page'";          $pageposts = $wpdb->get_results($querystr, OBJECT);      but now my backend shows every page and post and not just those wich have value:   1. 'templates/front-page.php'   2. 'templates/front-page-excerpt.php' would be nice if you guys have some ideas . thank you so much

body: > **Possible Duplicate:**   >  WordPress and $_GET Params I developing plugin in which i receive the value from query string against specific product and show the result please tell any idea or suggestion . like" http://localhost/business/?product_id=5"

body: My old permalink structure is like this:               domain.com/POSTNAME/      My new permalink structure was switched to this:               domain.com/CATEGORY/POSTNAME/      I need to set up a 301 redirect in htaccess that correctly redirects the old posts. Any help on how to do this?

body: I have a website that is powered by WordPress, e.g. `example.com`. I would like to install a separate WordPress installation with a separate database, themes, etc in a subdirectory on my website though, for example on `example.com/blog`. Will this cause problems with displaying both installations properly? For example if I try to go to `example.com/blog` or `example.com/blog/post` will this cause installation A to throw up a 401 error since it didn't find a page within the original `example.com` WP installation?

body: > **Possible Duplicate:**   >  WordPress SEO by Yoast: Hide Meta boxes in posts for non-admins I was wondering how to remove Meta-boxes from the post page. I would like that only administrators or editors could see these. I saw similar topics on the forum, but none of them appears to be working. Any suggestions?

body: I have added a featured image column to my posts in the WP admin. This all works fine except when using the Quick Edit feature. Upon update, the column disappears, or rather isn't returned by the ajax save function. The column header remains, but the row being updated no longer has a featured image cell, resulting in a "blank" cell at the end of the row (all the default cells shifts left). I'm unsure where to look to address this issue and haven't had any luck finding an answer. Thanks for any help. EDIT: Here is the code to add the custom column. The filter and action are called in the plugin's __construct                   // Set featured image columns         add_filter('manage_edit-post_columns', array($this, 'set_custom_columns'));         add_action( 'manage_post_posts_custom_column', array( $this, 'set_custom_column_data' ), 10, 2 );              /**          * Function to create featured image column          * @param $columns          * @return array          */         public function set_custom_columns($columns)         {                  if ( !is_array( $columns ) ) {                 $columns = array();             }                  $new_columns = array();                  foreach( $columns as $key => $label ) {                 if ( $key == 'title' ) { // Put the Thumbnail column before the Title column                     $new_columns['featured-image'] = __( 'Image', $this->plugin_slug );                 }                      $new_columns[$key] = $label;             }                  return $new_columns;         }              /**          * Display custom column data          */         public function set_custom_column_data( $column_name, $post_id ) {                  // If featured image column and a featured image exists, display it             if ( 'featured-image' == $column_name ) {                 if ( has_post_thumbnail( $post_id ) ) {                     echo get_the_post_thumbnail($post_id, 'thumbnail');                 }             }         }

body: I have written a custom plugin that use a specific 3rd party plugin code, so I want to declare my plugin depends on this 3rd party plugin, is it possible? What would be normal approach to this issue?

body: I'm developing a theme especially for Bānglā blog posting, and it'd be under GNU license. I questioned about a Calendar Widget translation with some problems today, and got a comment saying: > _I'm just wondering, is this not covered in theBangla translation?_ And after the s_ha_dum's answer I thought I can make a translation-ready theme. Then I can translate all the necessary Texts for my theme. I followed:   1. **Internationalizing And Localizing Your WordPress Theme**   \- by Konstantinos Kouratoras -- WP.SmashingMagazine.com   2. **Translating Your Theme**   \- by Robert Treacy -- WP.TutsPlus.com And now I made a complete translation-ready theme and it's working when I change the `WPLANG` to my language in `wp-config.php`. But except this step the whole thing is automatic. So if this step can be automatic, it'd be nice for me. I want to place a filter that can hook the WPLANG and overwrite with `bn_BD` like:               define('WPLANG', 'bn_BD');      when the theme is activated. So that I can simply say: "Install the theme, and it'll do everything for you. You don't need to have access into your cPanel to make change into the `wp- config.php`." I've read the WPSE thread Trigger language change in Wordpress, but if you now get me, I'm on a different track. So, is that possible?

body: I've set a global variable in `functions.php` like so:               $cat_args = array('cat1', 'cat2', 'cat3');      and tried to use it in a template file:               global $cat_args;     if is_cat($args):     //do stuff     endif;      The conditional returned false. If I `echo $cat_args` I get an array. Is there an extra step to passing it to the conditional / is what I'm trying to do possible? Thanks!

body: I've searched to see if anyone came up with a solution to a peculiar problem I'm having but did not find anything that was close to what was happening in my case. I have two custom post types - let's call them Diary and Journal. Both have been setup correctly with **has_archive** to _true_ , **rewrite** with a same named slug and **with_front** to _false_. My permalink structure is set with _year/month/post-name_. I've setup place holder pages, with the slugs 'diary' and 'journal' for each so any posts I make to either types load up fine with archive.php - so if I go to domain/diary/ or domain/journal they load up accordingly. I'm not making any additional templates here - just creating a child theme of twentyeleven and using archive.php. I needed to use the **wp_get_archives** to work with the custom post types and got that to work with the added option **post_type** , I took it a step further and created a **custom_wp_get_archives** function so that I can customize it's output as I will need that later on. Now here is where the problem begins, either with the default **wp_get_archive** with the added *post_type* option, or using **custom_wp_get_archives** \- the url that gets output by either is _domain/year/month_ which returns a 404 when I go to it. Fair enough, but if I add '?post_type=POST_TYPE' to that/any url generated I get results accordingly - fair enough again. So I used my **custom_wp_get_archives** to insert '?post_type=POST_TYPE' into the output url and that worked. My question is - is there a way to get **wp_get_archives** to output the correct urls with the conditions stated above? Also I have looked into **add_rewrite_rule** as well as **generate_rewrite_rules** as a fix - ie: domain/post_type_slug/year/month - and followed almost any example I have found here and other places and it's simply not working. I have flushed the permalinks also - no go. The code that I have found that seems to be close to what I want it to do with rewriting the rules doesn't work either here it is:               function register_post_type_rewrite_rules($wp_rewrite) {          $args = array('public' => true, '_builtin' => false);   //get all public custom post types     $output = 'names';     $operator = 'and';     $post_types = get_post_types($args,$output,$operator);          $url_base = ($url_base == '') ? $url_base : $url_base . '/';     $custom_rules = array();          $post_types = implode('|', $post_types);         $custom_rules = array( "$url_base($post_types)/([0-9]+)/([0-9]{1,2})/([0-9]{1,2})/?$" =>                 'index.php?post_type_index=1&post_type=' . $wp_rewrite->preg_index(1) . '&year=' . $wp_rewrite->preg_index(2) . '&monthnum=' . $wp_rewrite->preg_index(3) . '&day=' . $wp_rewrite->preg_index(4),       //year month day                                      "$url_base($post_types)/([0-9]+)/([0-9]{1,2})/?$"  =>                 'index.php?post_type_index=1&post_type=' . $wp_rewrite->preg_index(1) . '&year=' . $wp_rewrite->preg_index(2) . '&monthnum=' . $wp_rewrite->preg_index(3),          //year month                                 "$url_base($post_types)/([0-9]+)/?$" =>                 'index.php?post_type_index=1&post_type=' . $wp_rewrite->preg_index(1) . '&year=' . $wp_rewrite->preg_index(2)   //year                             );          $wp_rewrite->rules = array_merge($custom_rules, $wp_rewrite->rules); // merge existing rules with custom ones          return $wp_rewrite;     }          add_filter('generate_rewrite_rules', 'register_post_type_rewrite_rules', 100);      Any clue on any of this will be great.

body: I have a series of posts, all with featured images, but I need to be able to customise the crop top right corner. In this instance, I need them to be cropped from top right, but it would be useful to also know how to position that point myself. At present, the add_image_size() function is taking its crop from the centre of the image. Not always pretty!!

body:
I've created a simple theme options page for my site. The options page contains three input fields. I can output the the fields by using get_option. The three fields are called using the following:               <?php echo get_option( 'map_zoom' ); ?>     <?php echo get_option( 'map_longitude' ); ?>     <?php echo get_option( 'map_latitude' ); ?>      These variables are for controlling the zoom level, the longitude and latitude of a map. I have a javascript file that renders the map using the google maps api. I'd like to put these variables into that javascript file. When I put the javascript into a php file and add these variables the map renders but I lose all the rest of my map functions which are considerable. Also I then have to call the script php in the header instead of using wp_enqueue_script in the functions file. Here is the map javascript:               var infowindow = new google.maps.InfoWindow();     var shadow = new google.maps.MarkerImage('/wp-content/themes/re-aligned/images/shadow.png', new google.maps.Size(37, 34) );               var markers = [];     var categories = [         {             name: 'People',             slug: 'people',             url: 'marker-people.png'         }, {             name: 'Works',             slug: 'works',             url: 'marker-works.png'         }, {             name: 'Discourse',             slug: 'discourse',             url: 'marker-discourse.png'         }, {             name: 'Other',             slug: 'other',             url: 'marker.png'         }     ];          String.prototype.endsWith = function(suffix) {         return this.indexOf(suffix, this.length - suffix.length) !== -1;     };          function initialize() {              jQuery('body').append(jQuery('

Map Categories

'));              // add checkboxes to toolbar         for (var i = 0; i < categories.length; i++) {             jQuery('#toolbar').append(                 jQuery('<input />', {                     type: 'checkbox',                     id: 'tog-marker-'+categories[i].slug,                     name: 'tog-marker-'+categories[i].slug,                     class: 'squaredTwo',                     value: i,                     checked: true                 })             );             jQuery('#toolbar').append(                 categories[i].name             );         }              jQuery('#toolbar > input[type=checkbox]').click(function() {             for(var i = 0; i < markers.length; i++) {                      if(markers[i].icon.url.endsWith(categories[jQuery(this).val()].url)) {                     if(jQuery(this).is(':checked')) markers[i].setVisible(true);                     else markers[i].setVisible(false);                      }             }         });              // Create an array of styles.         var styles = [                  {                 "featureType": "landscape.natural",                 "stylers": [                     { "color": "#ff412d" },                     { "visibility": "on" }                 ]             },{                 "featureType": "administrative.land_parcel",                 "stylers": [                     { "visibility": "off" }                 ]             },{                 "featureType": "administrative.neighborhood",                 "stylers": [                     { "visibility": "off" }                 ]             },{                 "featureType": "administrative.province",                 "stylers": [                     { "visibility": "simplified" }                 ]             },{                 "featureType": "administrative.country",                 "stylers": [                     { "visibility": "on" }                 ]             },{                 "featureType": "water",                 "stylers": [                     { "color": "#ffebc5" }                 ]             },{                 "featureType": "road",                 "stylers": [                     { "visibility": "simplified" },                     { "color": "#ffebc5" }                 ]             },{                 "featureType": "poi",                 "stylers": [                     { "visibility": "off" }                 ]             },{                 "featureType": "road.highway",                 "stylers": [                     { "visibility": "off" }                 ]             },{                 "featureType": "administrative.locality",                 "stylers": [                     { "visibility": "off" }                 ]             },{                 "featureType": "administrative.country",                 "elementType": "geometry",                 "stylers": [                     { "visibility": "off" }                 ]             }         ];              // Create a new StyledMapType object, passing it the array of styles,         // as well as the name to be displayed on the map type control.         var styledMap = new google.maps.StyledMapType(styles,             {name: "Styled Map"});              // Create a map object, and include the MapTypeId to add         // to the map type control.         var mapOptions = {             zoom: <?php echo get_option( 'map_zoom' ); ?>,             scrollwheel: true,             center: new google.maps.LatLng(<?php echo get_option( 'map_latitude' ); ?>, <?php echo get_option( 'map_longitude' ); ?>),             mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'map_style'],             mapTypeControl: true,             mapTypeControlOptions:  {                 style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,                 position: google.maps.ControlPosition.BOTTOM_CENTER             },             panControl: false,             panControlOptions: {                 position: google.maps.ControlPosition.TOP_RIGHT             },             zoomControl: true,             zoomControlOptions: {                 style: google.maps.ZoomControlStyle.LARGE,                 position: google.maps.ControlPosition.LEFT_CENTER             },             scaleControl: false,             scaleControlOptions: {                 position: google.maps.ControlPosition.LEFT_CENTER             },             streetViewControl: false,             streetViewControlOptions: {                 position: google.maps.ControlPosition.LEFT_TOP             }         };         var map = new google.maps.Map(document.getElementById('map'), mapOptions);              var oms = new OverlappingMarkerSpiderfier(map);              //Associate the styled map with the MapTypeId and set it to display.         map.mapTypes.set('map_style', styledMap);         map.setMapTypeId('map_style');              oms.addListener('click', function(marker, event) {             infowindow.setContent(marker.desc);             infowindow.open(map, marker);         });                   for (var i = 0; i < locations.length; i++) {             var marker = new google.maps.Marker({                 position: locations[i].latlng,                 desc: locations[i].info,                 icon: locations[i].marker,                 shadow: shadow,                 map: map             });             oms.addMarker(marker);             markers.push(marker);         }          }      How can i correctly output the variables into the javascript file? **UPDATE:** After taking on board the information about wp_localize_script I've done the following: I've put this in my functions.php               wp_enqueue_script( 'map-script' );         $object = array(             'zoom' => get_option('map_zoom'),             'longitude' => get_option('map_longitude'),             'latitude' => get_option('map_latitude'),         );       wp_localize_script('map-script', 'JSObject', $object);         }       and used JSObject.variable in my map javascript like so:               var mapOptions = {             zoom: JSObject.zoom,             scrollwheel: true,             center: new google.maps.LatLng(JSObject.latitude, JSObject.longitude),             mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'map_style'],             mapTypeControl: true,             mapTypeControlOptions:  {                 style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,                 position: google.maps.ControlPosition.BOTTOM_CENTER             }      But that returns the error: `Uncaught Error: Invalid value for property <zoom>: 9` 9 is the actual zoom variable so it appears to be working sort of...

body: > **Possible Duplicate:**   >  Remove navigation from header in custom page template Is there some way to remove `wp_nav_menu` in a page template? I can't find anything related to page templates other than redirect default theme files etc. I know that just placing the `header.php` content in the page template will do the trick but this seems a awkward hack. Thanks for any clue.

body: Is it possible to set session in wordpress. If yes can you please tell how to do it? My sample code is.               <?php     session_start();          if(!isset($_SESSION['impression'])) {         $_SESSION['impression'] = 100;       }else {         if($_SESSION['impression']<=0)             $_SESSION['impression'] = 100;     }          echo $_SESSION['impression']    = $_SESSION['impression'] -1;          ?>

body: Hi I was translating one of my plugins in "CodeStyling Localization". when I update my plugin my translation erased. Is there anyway to find it ? And How can I backup my translation (I don't want to waste my time next time :))

body: I'm wondering what the preferred method is for dealing with AJAX calls. Should one use the same plugin php file to process the POST or a separate one? Which is cleaner or safer?

body: > **Possible Duplicate:**   >  Performance and styles not working fine after changing permalink structure Fist I was using default option of permalink and everything was fine (speed is ok, my own created theme is working fine) but now I change default structure to post name structure of permalink now I am not getting 404 error but the problems are : 1 - Whole website is loading very slow (pages,post) . 2 - My custom theme is not working fine means styles are not working on single page or single post. I checked my .htaccess file where the code is :               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /wordpress_1/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wordpress_1/index.php [L]     </IfModule>          # END WordPress      **Note** : wordpress_1 is directory name.

body: I have posted this on StackOverflow too, not sure if that's allowed - if not let me know and I'll remove one (I don't want to look like I'm spamming). Anyway.... I have a custom post type and have used the Verve Meta Boxes plugin to create some custom meta values for the post type. The meta box is called 'Subjects' and has a checkbox list of subjects to assign values to it. For example, I have ticked Math, English and Science. Now I want to perform a WP_Query which will take an array of subjects selected by the user as an array, compare those subjects to those selected for the custom post type, and return posts if any of them match. Here's the code so far:               $subjects_array = explode("_", $_GET["subjects"]);          $args = array(                 'post_status' => 'publish',                 'post_type' => 'any',                 'meta_query' => array(                   // Not sure what type of meta query to do                         )             );               $query = new WP_Query($args);      To cut a long story short, I just need to know if there's a way to perform a meta_query which will compare an array against whatever format the data in the meta box is in? If this is not possible, I just need to know then I'll look at a different way of doing it, but I'm thinking there's perhaps some meta_query ability I don't know about. Any help would be much appreciated.

body: By now there is a considerable amount of WordPress code around that is meant to be re-used by other developers. Unfortunately there is little to none practical and solid information on it and generally you are stuck going through frameworks one by one until you find the first you like or think they all suck terribly (whichever comes first). Let's make community writeup on **which frameworks and parent themes we really use and why**. Please include:   * **purpose** (parent theme, theme framework, helper code, etc)   * **strong features** (which make it interesting and useful)   * **downsides** (what it does inconveniently or different from usual)   * **licensing and pricing** (if not free)

body: I used to have a self hosted wordpress blog but I switch to a wordpress.com one. I can't seem to find the plugins area. Any help?

body: I have a problem with WP database synchronization between development and production and I am wondering how other people solving it. I am aware about this question but it doesn't really cover the nastier and more realistic use case. Say I have a life WP website. I took a dump of everything, replicating it on our dev environment. I started making changes. 1 week later I am ready to deploy my updates. In the meantime production has changed(new posts, new comments, etc.). How do I synchronize changes between production and development during the rollout and is it possible to automate(somewhat at least) this process?

body: how to set without user loging inner pages is disable or display message please loging Frist **Ex.** I want if user not loging and open abouts us page and display message please loging Frist and don't see any countain. When user login click on about us page see all countain

body: On http://wordpress.barrycarter.info/index.php/page/7/ I disabled comments for "USDCAD options vs CADUSD options arbitrage?", but it still has a "Leave a Comment" link. Clicking the link takes you to http://wordpress.barrycarter.info/index.php/2011/02/25/usdcad-options-vs- cadusd-options-arbitrage-2/#respond where it, of course, shows that you can't leave a comment. The timeline page correctly does not show the 'comment' link: http://wordpress.barrycarter.info/index.php/2011/02/ How to fix?

body: I'm wondering how to add a new box underneath the Post Box (Publish Box) in the admin section of WordPress? Am hoping to add a few custom field text inputs there.

body: I love admin-ajax.php. But I hate having to localize in order to point frontend scripts to it, and I wish there was an equivalent, easy-to-find file for themes. (It also just bothers me to see frontend requests go through "/wp- admin/". No practical reason, just looks ugly IMO.) So I've simply copied admin-ajax.php to the root dir at "/ajax.php", adjusted the include paths and removed the WP_ADMIN constant definition. Seems to work like gangbusters (I can now just direct all my frontend AJAX requests to /ajax.php! And I can still use the normal wp_ajax hooks in my plugins!). But is this safe? What might go wrong? Since this isn't built into core, I assume there's a good reason as to why not. But looking through the code, I can't see any immediate problems. You're smart--tell me if this approach is crazy. Or if there's a simpler method that I'm overlooking.

body: I'm one of authors of a WP blog and I'd like to export my posts to PDFs, each post to a single file incl. images. There are about 400 posts. I tried to talk about it with the owner but he doesn't want to do anything. I'm not an admin, I haven't got access to the WP administration, only to my profile. But I have access to phpMyAdmin and full FTP access too.

body: I have a wordpress Multi site set up so I can have a number of Wordpress sites with one install of Wordpress. Is it possible to use posts from one site in the multi site on another site in the same multi site set up. I have one site that is like a directory for the other sites. I would like to show post from the other sites on this directory site. I'm sure this is possible but I can't fins the explantion of it.

body: > **Possible Duplicate:**   >  Looking for a Table of Contents (TOC) plugin for WordPress I have been trying for some time to do one thing: I need a navigation menu inside a Wordpress post which will guide the user to different subsections of my post, and then maybe use a "Top" button to go back to the top. Let me give you an example: Title Introduction "jnkdjajkfa" Menu _Section one - this is a link_ _Section two - this is a link_ _Conclusion - this is a link_ **Section one** "bdsjkbdfsjbfjkasbjkbfasbjf" _Back to top - this is a link_ **Section two** "dnjsdkfhbsjukfbajfkbjkfbkasbfjk" _Back to top - this is a link_ **Conclusion** "ndjasndkasnj" _Back to top - this is a link_ I know I can do this in the code, but it's really a pain to do it on every post. Do you know a plugin, method to easily do this? Any help is very appreciated.

body: One of the most common security best practices these days seems to be moving `wp-config.php` one directory higher than the vhost's document root. I've never really found a good explanation for that, but I'm assuming it's to minimize the risk of a malicious or infected script within the webroot from reading the database password. But, you still have to let WordPress access it, so you need to expand `open_basedir` to include the directory above the document root. Doesn't that just defeat the entire purpose, and also potentially expose server logs, backups, etc to attackers? Or is the technique only trying to prevent a situation where `wp-config.php` would be shown as plain-text to anyone requesting `http://example.com/wp- config.php`, instead of being parsed by the PHP engine? That seems like a very rare occurance, and it wouldn't outweigh the downsides of exposing logs/backups/etc to HTTP requests. Maybe it's possible to move it outside the document root in some hosting setups without exposing other files, but not in other setups? * * * **Conclusion:** After a lot of back-and-forth on this issue, two answers have emerged that I think should be considered the authoritative ones. Aaron Adams makes a good case in favor of moving wp-config, and chrisguitarguy makes a good case against it. Those are the two answers you should read if you're new to the thread and don't want to read the entire thing. The other answers are either redundant or inaccurate.

body: How can I make sure that WordPress doesn't lose too much quality on uploaded images that are scaled down? Here are some samples. You can clearly see that an image resized in Photoshop comes out with better quality than the same image resized within WordPress.   * **Original screenshot** at 700px width ![Original screenshot at 700px width](http://i.stack.imgur.com/Cy7DY.png)   * **Photoshop resized** at 600px ![Photoshop resized at 600px](http://i.stack.imgur.com/lSeTA.png)   * **WordPress resized** at 600px ![WordPress resized at 600px](http://i.stack.imgur.com/m2wxA.png)

body: I followed the beginner steps for creating a child theme. The child theme was created and it appears as an option on my Themes page. But unlike the other Themes on the page (including its parent), there is no preview. The other themes ("Twenty Twelve," "Twenty Thirteen," and "Twenty Fourteen") are all listed with an image preview. My child theme ("Twenty Fourteen Child") does not have any image. The child theme can be applied without issue. This issue arises when I create child themes from other themes as well. Any ideas why this is happening and if I can resolve?

body: I want to let users upload a logo. I've tried a few things. Currently there is a broken image until a logo is uploaded. I need to set the default as logo.png in my theme folder. Here's how it stands now, functions.php:               $wp_customize->add_setting( 'img-upload' );     $wp_customize->add_control(     new WP_Customize_Image_Control(     $wp_customize,     'img-upload',     array(         'label' => 'Logo Upload',         'section' => 'logo',         'settings' => 'img-upload',         'default-image'  => get_template_directory_uri() . '/logo.png'             )         )     );      index.php:               <img src="<?php echo get_theme_mod('img-upload');?>" alt="<?php bloginfo('name'); ?>" class="logo" />

body: I have a website for which we are trying to be discreet about the fact that we are using WordPress. What steps can we take to make it less obvious?

body: We run a 20+site WPMU, and have ~16 super admins. Today we made a new admin and before we could even talk to her, she updated the site to 3.8, which we weren't on yet due to lots of silly bureaucratic reasons. I am personally grateful she updated, but we can't let this happen again. Is it possible to turn off the ability for site admins to update and throw a global function on the site that only allows specific users to upgrade? The only idea I have so far is to hide the update bar in the CSS and show it for the specific users.

body: I've noticed that my process is rather slow and i'd like to speed it up. I want to be able to duplicate my database from my domain which is blueharlequin.com and work locally thus speeding up the process. The reason I want to do that is because our website has specific loops that I cannot duplicate without knowing the category ID as well as other things. I've already downloaded wp-db-backup and uploaded the .sql into PHPmyAdmin however everything I click will link me to my website which is not what I want. My question is how do I make it work locally?

body: It seems every major app platform from Android to iOS has great stats for developers. However, if you publish a plugin via WordPress.org you are not allowed to include any 3rd Party tracking code (for good reasons). So what can I do to track Active users by day / week / month ?   and ...   How can get the raw data behind the graphs for downloads by day ? I also have plugins using the plugin update checker via Janis / w-shadow because they are _not hosted on WordPress.org_ ... so how do other plugin developers track downloads and active users? Currently .. the only way I've found to track active users is via Google Campaign Tracking tool. I create tags which mean anyone clicking a link from a plugin settings page to my website is tracked in GA as 'plugin-installed' and anyone clicking a link from a Readme.txt has a different tag. This is not reliable as many people may install the plugin and never click back to my website ... So what can be done? Will WordPress.org offer a Developers Console?

body: > **Possible Duplicate:**   >  problem with short code **Shortcodes are broken.** For those of you playing at home, heres an easy step by step to replicate my problem. * * * 1) Open a fresh Wordpress install (3.4.2). 2) Go into twentyeleven/functions.php and add the following:               function test() {     echo '-TEST-';     }     add_shortcode('testshortcode', 'test');      3) Edit the 'hello world' post to say:               Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!      [testshortcode]      foobar      4) Save and view, my results look like the following:               -TEST-     Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!     foobar      when it should look like this:               Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!     -TEST-     foobar      **What on earth is going on here?**

body: I want to add an image to the sidebar, where widgets are displayed. How can I do it?

body: I've coded a plugin that adds a meta box to the post page. When the post is published, the plugin will generate a random ID for the post, and insert the random ID and the post guid to a custom table in the database. After publishing, or upon editing, the plugin queries the custom table to retrieve the random ID for the post based on the post guid, and prints out the random ID in the meta box. Everything works great until I change the post type in the add_meta_box function from 'post' to 'quilt'. The plugin will generate the random ID and save it and the post guid to the table, but presents this error in the meta box: > Notice: Trying to get property of non-object in > /home/qultshow/public_html/wp-content/plugins/randomID/randomID.php on line > 126 instead of the random ID. If I use               var_dump( $query );     $wpdb->print_error();      to try to debug, I see: > NULL > > WordPress database error: [] SELECT * FROM wp_customtable WHERE qrci_guid = > "http://testsite.com/?post_type=quilt&p=213" If I copy the query from the Wordpress database error directly and run it in phpmyadmin, a row is returned as expected. So, the query is coded correctly, and the plugin works on the default post type of "post" but not on the custom post type of "quilt". The only change in the plugin is in this code: `add_meta_box( 'randomid_sectionid', 'Random ID', 'cd_meta_box_cb', 'quilt', 'normal', 'high' );` where 'post' was changed to 'quilt'. Is there something odd or different about querying the database from a custom post type that I need to know about to make this work? Notes: This plugin is not for usage by anyone but me on one website where I need this weird functionality. Also, this is a multi-site installation of wordpress if that makes any difference. I can't use post metadata for this since I need to be able to query this data without querying every postmeta table on the network, so it has to be a custom table in the database. Thanks for any help! P.S. Yes, I posted code related to this issue in another question, but I'm hoping that being a bit more clear about what the objective is and how it's working with the default post type but not working with custom post types will find someone who might have the answer to why this isn't working, where posting the code did not.

body: I am working on this website and the "Useful Links" section at the bottom (second footer widget area) is not working because somehow the current page links got added to the links (please hover on the links and see the bottom left on your browser to see what I mean). I check the widget and the links should work, here are some of the code inside the text widget               www.ordre.psy.qc.ca/en/     www.cpa.ca     www.nimh.nih.gov/index.shtml      Can anyone tell me what is happening? Currently I am checking the JS files to see if the links are added by Javascript. Thanks in advance.

body: currently, I use CSS specificity to override plugin styles. I prefer this to editing the plugin as it makes for less headaches when you update. What would be nice is if my style sheet loaded after the plugins, so that I only have to be as specific, not more. This would make my stylesheets much prettier.

body: I created a **Custom Post Type** called **News** , which supports **Title** , **Editor** , **Thumbnail** and **Custom Fields**. One of the Custom Fields is `URL`. What I need now is to turn the `Title` in a external link in the loop, using the URL provided in the `URL` Custom Field. Any ideas?

body: I have 5 categories and I would like to show All posts. But I want to show "news" category posts at top of page and after other posts in other categories. How I can do this?

body: Use case: I have a post type that relates to a music show. The 'show time' is grabbed through the post publish date which is set to some time in the future. I've found a function that takes future dated blog posts and leaves the date but marks the post as published on save but haven't been able to figure how to customize it for a custom post type. The function is below.               <?php         function setup_future_hook() {             // Replace native future_post function with replacement             remove_action('future_post','show', '_future_post_hook');             add_action('future_post', 'show', 'publish_future_post_now');         }              function publish_future_post_now($id) {             // Set new post's post_status to "publish" rather than "future."             wp_publish_post($id);         }              add_action('init', 'setup_future_hook');     ?>

body: With WordPress 3.9 coming soon it's bringing along TinyMCE 4.0. I'm running my plugins and functions through some testing and found that one of my functions seems broken / not working with the new tinyMCE               function myformatTinyMCE( $in )     {         $in['theme_advanced_buttons1'] = 'bold';         $in['theme_advanced_buttons2'] = 'formatselect';         $in['wordpress_adv_hidden'] = false;         return $in;      }     add_filter( 'tiny_mce_before_init', 'myformatTinyMCE' );      The above function used to limit the buttons in the tinyMCE to specific buttons, I've simplified it a bit to make it easier for testing. If I print out `$in` it shows the correct values in the correct spots, but when I actually load up a page it just defaults to the normal buttons. I've also tried to use the example in the TinyMCE Codex which also didn't seem to have any effect. I'm using the WordPress Beta Tester Plugin and I do have TinyMCE Advanced installed but disabled. With the new TinyMCE how can I continue using / customizing, and are there any 'Gotchas' that have changed from the previous TinyMCE Version? **EDIT** Looks like `$in['wordpress_adv_hidden'] = false;` is not longer being used - No idea how to unhide the Kitchen Sink.

body: I'd like to build an advanced **search form** for a specific custom post type, having **filters** for that custom type's **custom fields** and custom **taxonomies** AND for **another custom type's properties** (fields and taxonomies) **that is linked** (with a relationship type custom field) **to the first** custom post type. I have recently started off with WP's custom post types, fields and taxonomies, I love it so far but to make the best of it I'd like to be able to search it properly. Do I need to do it manually (if so, how?), is there a plugin that addresses this? PS. If it matters, I'm using Advanced Custom Fields and Custom Post Type UI ![wordpress custom search form filtered by custom fields and custom taxonomies](http://i.stack.imgur.com/NuvOU.png)

body: I have developed some calculators (in php) for my website and I need Wordpress integration. The calculators have a form and, after submission, the result is shown. The result depends on a query in the database. **Is it possible to create "static pages" (at least static URLs) that provide to the user dynamic content?** Just to clearfy, I want something like:               website/blog         website/forum        website/calculators     website/calculators/one     website/calculators/two      I heard about Pages, but I cannot include php code on it. Worth point out that the calculators aren't static, the result will change everyday.

body: I have created one theme. The theme was denied today for the following reasons: > Theme Review: > >   * Themes should be reviewed using `define('WP_DEBUG', true);` in `wp- > config.php` >   * Themes should be reviewed using the test data from the Theme Checklists > (TC) > `wp-config.php` is the WordPress setting file. How do I alter my custom theme? >   * the theme registers some custom functionality in the function > `warmHome_setup()` however this function in not hooked so the functionality > is not available. Recommend hooking the theme to the `after_setup_theme` > hook. > The following is my themes `warmHome_setup()` function. How should I alter it?               function warmHome_setup() {              // This theme styles the visual editor with editor-style.css to match the theme style.         add_editor_style();              // Add default posts and comments RSS feed links to head         add_theme_support( 'automatic-feed-links' );              // Make theme available for translation         // Translations can be filed in the /languages/ directory         load_theme_textdomain( 'warm-home', TEMPLATEPATH . '/languages' );              $locale = get_locale();         $locale_file = TEMPLATEPATH . "/languages/$locale.php";         if ( is_readable( $locale_file ) )             require_once( $locale_file );              // This theme uses wp_nav_menu() in one location.         register_nav_menus( array(             'primary' => __( 'Primary Navigation', 'warm home' ),         ) );              // This theme allows users to set a custom background         add_custom_background();         }

body: > **Possible Duplicate:**   >  Removing the "Website" Field from Comments and Replies? In looking at suggestions on how to remove the website (URL) field from the comment to help reduce comment spam, most recommend editing the comment template to remove the field. But I also found a couple sources saying spamming tools may be bypassing the comment template altogether making this approach only a partial fix. If that is true is there any additional steps that can be taken?

body: When it comes to excerpts, do you believe TimThumb or WordPress thumbnails is the way to go? And why? Answers will not be graded (but may be criticized).

body: > **Possible Duplicate:**   >  Retrieve 1st image in post and set it as featured image, when post is > saved/updated   >  VT-resize image and display it ok guys, I have this script which I modified in order to crop the image before being displayed.               // Get URL of first image in a post     function catch_that_image() {     global $post, $posts;     $first_img = '';     ob_start();     ob_end_clean();     $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);     $first_img = $matches [1] [0];          // no image found display default image instead     if(empty($first_img)){     $first_img = "/images/default.jpg";     }           $first_img = vt_resize( $first_img, '', 608, 250, true );               return $first_img;     }      this is the code I use to display it:               <img src="<?php echo catch_that_image() ?>" width="608" height="250" />      The vt_resize function is already built in within the theme. However the code is not returning the url, it just return an array. What am I doing wrong? I hope a nice person answers to my question, thank you =)

body: > **Possible Duplicate:**   >  User registration then auto login I am trying to create a fully customized multiuser site! And i want users automatically login to their site after site creation... Please help me.. Thank you...

body: I am currently building a WordPress theme where I am using jQuery to append and prepend some ornate images to a h4 tag with a class of beechheader in the page template markup. Before turning the static html files into a WordPress theme, the code below worked great. The code is in a separate file called test.js The jQuery code appears to be enqueued correctly in the functions file and I have called the test.js code using                     right before the closing body tag. Here is the code that worked fine statically but now doesnt work                // prepend some images to the headers     $(function() {          $("h4.beechheader")         .prepend('')         .append('');     });      I tried adding               <?php echo get_template_directory_uri(); ?>      before the trailing slash before images as you would in the html file. My research leads me to believe jQuery files may need to be handled a bit differently but I am unsure of the syntax or what to do. Can anyone help?

body: I have a custom post type (called contacts). Since this post type is not working like a post, I don't want to show SAVE DRAFT, PREVIEW, Status, Visibility or Publish Date. The only options I want to show are PUBLISH & Move to Trash buttons. Is there a way to hide these other options? If not, how do I create a new PUBLISH & Move to Trash that I can add to a new metabox?

body: I've been thinking about what other large community wiki post site can benefit from. Questions about books come up all the time and I think it will be beneficial to have one large list to consolidate available literature on WordPress. Please include:   * **title**   * **author** (s) (preferably with links and cred)   * **topic** (s) covered   * **user level** targeted   * **form** (paper/ebook)   * **pricing** (if applicable)   * **link** to home site (if available) Please **one book per answer** so it is easier to edit, discuss and vote on. Please **keep it civil with affiliate links**. I don't particularly mind those, but we all want to see books that are genuinely useful, not those with large commission.

body: I need to set the publishing date of many posts with the post date (the creation date). I know that I can do it editing the single post and changing the **Published on** value but this procedure is problematic if I have some hundreds of posts Exist some clean way to do it or have I to changing these value on the database (using PhpMyAdmin) avoiding to editing each post? Tnx

body: > **Possible Duplicate:**   >  WP plugin updates I wrote a plugin for WordPress which requires regular updates. Is it possible to notify user of new version being available (some of the other plugins have some kind of this option - when new version is available user can see it in his admin panel and update - everything using some built-in WP functions...)

body: I am working on a site that will have up to 30 templates in it. I don't want to have all those templates at the root of my theme folder cluttering up everything. I know how I can modify the `get_page_templates()` function in the file `wp- admin/includes/theme.php` to make it scan sub dirs in my theme folder. But I do not want to change core files manually - how can I apply a filter to `get_page_templates()` with a filter that I put in `functions.php` ? As the code you see below is my first attempt at this but it doesn´t work yet when I put the code inside `function.php`. I can however put these changes into the core file `wp- admin/includes/theme.php` but that is not good practice and should always be avoided right, as auto update can wipe it out.               function get_page_templates_override()      {     $themes = get_themes();     $theme = get_current_theme();     $templates = $themes[$theme]['Template Files'];     $page_templates = array();          if ( is_array( $templates ) ) {         $base = array( trailingslashit(get_template_directory()), trailingslashit(get_stylesheet_directory()) );              foreach ( $templates as $template ) {             $basename = str_replace($base, '', $template);                  // modifide this by commenting it out so that sub dirs arent blocked             // if ( false !== strpos($basename, '/') )             //  continue;                  // modified this with FILE_USE_INCLUDE_PATH so sub dirs get scanned             $template_data = implode( '', file( $template, FILE_USE_INCLUDE_PATH ));                  $name = '';             if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) )                 $name = _cleanup_header_comment($name[1]);                  if ( !empty( $name ) ) {                 $page_templates[trim( $name )] = $basename;             }         }     }     return $page_templates;     }     add_filter('get_page_templates','get_page_templates_override', 1);

body:
Right now I do this …
         <?php              $blog_list = wp_get_sites();             foreach ($blog_list AS $blog) {                 global $blog_id;                 $currentblog = get_blog_details( $blog['blog_id'] );                 echo "blogname . "'>".$currentblog->blogname."";             }         ?>
      Is it possible to list all Blogs alphabetically. How would I do that?

body: > **Possible Duplicate:**   >  Rewrite rule for Custom post type Monthly and Yearly archive I'm not sure if I'm missing something or what! But I've been trying to get this right for past couple of hours, and I'm in a time crunch. I have two custom post types, "Photos" and "Videos". All I want to do is have a Month / Year Archive list for each of the post types. So if I'm viewing the content in the "Photos" post type, I want a Month / Year list that contains posts from ONLY the "Photos" post type, and the same goes for video. I'm sure this is possible right? I'd like to not use a plugin if possible. Thanks in advance!

body: I've never gotten `is_active_sidebar()` to work, no matter if there's widgets in the sidebar or not I always get false returned. Currently I'm creating a sidebar for each top level page: http://pastebin.com/fX3Rv20f I create my own widget(s): http://pastebin.com/Bz9hv41z And I'm testing whether the sidebar is active like so:               if(is_active_sidebar(get_the_title()))         echo 'active';     else         echo 'not active';      Even when I manually put the title in: `is_active_sidebar('Test');` it always returns false. Am I using the conditional wrong? Do I need to add some sort of setting? Why would `is_active_sidebar()` fail?

body: > **Possible Duplicate:**   >  don't publish custom post type post if a meta data field isn't valid A custom post type is being developed in wordpress. It is needed that some fields should be made mandatory. Is there a method in Api using which posts fields could be made mandatory? Or it would need to be done using custom code? Working: I am making a custom post type for an Event. Now when creating a new Event it is mandatory that the user enters the date, otherwise it should not allow to save him the event.

body: Even though this question sounds like others here is my problem: The site I am updating **had** a permalink structure of `/%postname%`, during this time I created a custom post type of "popups" (rewrite slug = 'popups') so the urls were:               /popups/the-post-name      **Now** the site has a blog, and the permalink structure has been changed to `/blog/%postname%`, this changed the custom post type url structure to:               /blog/popups/the-post-name      I want to keep the blog permalink structure as `/blog/%postname%` but I want to have a custom url structure for my custom post type that is not tied to the blog permalink. So instead of the urls for my custom post type of popups showing up as:               /blog/popups/the-post-name      I want it to show up as:               /popups/the-post-name      while retaining the blog permalink of `/blog/%postname%`

body: Is there a plugin that allows me to change the url of domain.com/ **wp-admin** to domain.com/ **whatever-iwant** ? Curious if there is an easy solution to this by now.

body: As part of a theme for a client, **I want to be able to show a custom menu** (defined via the admin) **in a select box that automatically changes pages after changing the selection**. Is there a plugin (or a handy code snippet) that will accomplish this?

body: Is there any way to get wordpress to check for, download private theme updates? I found this plugin for private plugin updates.... http://w-shadow.com/blog/2010/09/02/automatic-updates-for-any-plugin/ I'm looking for the same thing but for themes.

body:
I have no problem doing this in a comment, as an administrator:               bold test italics test     underline test  color test      But the subscribers can't underline, add color to words nor add images. Is it that only the admin can use more HTML tags than those suggested under the comment form?                     <acronym title="">
      <q cite="">            How to enable the subscribers to add color to text, and add images?

body: in `category.php` I have:               if ( is_category('cat-1') ) {         $the_query = new WP_Query( array ( 'post_type' => 'mueble', 'category_name' => 'cat-1' , 'posts_per_page' => 3 ) ) ;     }     if ( is_category('cat-2') ) {             $the_query = new WP_Query( array ( 'post_type' => 'mueble', 'category_name' => 'cat-2' , 'posts_per_page' => 3 ) ) ;         }          if ( is_category('cat-3') ) {             $the_query = new WP_Query( array ( 'post_type' => 'mueble', 'category_name' => 'cat-3' , 'posts_per_page' => 3 ) ) ;         }                while ( $the_query->have_posts() ) : $the_query->the_post();      ...               endwhile; wp_reset_postdata();      Is there any clean and smart way to make it more simple and beautiful? I have 23 categories... Hope you help me, thanks

body: Is there any order an short code should execute? When i inserted it at the end, it is shown at the beginning of the post

body: I have a custom role that allows access to only a sigle custom post type. This is all well and good, but now it is only showing up for this role, not for admin and super admin. I'm having a hard time getting it to show up in the admin dashboard.               add_role( 'artists_relations', 'Artist Relations', array( 'post_artists' ) );     function add_theme_caps() {         $role = get_role( 'artists_relations');         $role->add_cap('delete_artists');         $role->add_cap('delete_published_artists');         $role->add_cap('delete_others_artists');         $role->add_cap('edit_artists');         $role->add_cap('edit_published_artists');         $role->add_cap('edit_others_artists');         $role->add_cap('publish_artists');         $role->add_cap('read');         $role->add_cap('upload_files');         $role->add_cap('manage_artist_categories');     }     add_action( 'admin_init', 'add_theme_caps');      works great. I tried many suggestions from the internet, but none worked. The latest attempt, though, looked like this               function add_admin_caps() {         $role = get_role( 'administrator');         $role->add_cap('delete_artists');         $role->add_cap('delete_published_artists');         $role->add_cap('delete_others_artists');         $role->add_cap('edit_artists');         $role->add_cap('edit_published_artists');         $role->add_cap('edit_others_artists');         $role->add_cap('publish_artists');         $role->add_cap('read');         $role->add_cap('upload_files');         $role->add_cap('manage_artist_categories');     }     add_action( 'admin_init', 'add_admin_caps');      I've read a few posts that mentioned removing filters. I don't understand why this would work for a new role but not let me augment an existing one. But isn't admin supposed to have rights to everything without having to specify it anyway? \-- EDIT -- (adding post type registration)               function register_artists_post_type() {         register_post_type('artists',array(             'labels' => array(                 'name' => __( 'Artists' ),                 'singular_name' => __( 'Artists' ),                 'add_new' => __( 'Add Artist','Artist' ),                 'add_new_item' => __( 'Add New Artist' ),                 'edit_item' => __( 'Edit Artist' ),                 'new_item' => __( 'New Artist' ),                 'view_item' => __( 'View Artist' ),                 'search_items' => __( 'Search Artists' ),                 'not_found' => __( 'No Artists Found' ),                 'not_found_in_trash' => __( 'No Artists In Trash' ),                 'parent_item_colon' => ''             ),             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'has_archive' => true,             'supports' => array( 'title','editor','excerpt','custom-fields','thumbnail' ),             'rewrite' => array('slug' => 'artists','with_front' => false),             'taxonomies' => array('large_feature','small_feature'),             'capability_type' => 'post',             'hierarchical' => false,             'capabilities' => array(                 'publish_posts' => 'publish_artists',                 'edit_posts' => 'edit_artists',                 'edit_others_posts' => 'edit_others_artists',                 'delete_posts' => 'delete_artists',                 'delete_others_posts' => 'delete_others_artists',                 'read_private_posts' => 'read_private_artists',                 'edit_post' => 'edit_artists',                 'delete_post' => 'delete_artists',                 'read_post' => 'read_artists',                 'manage_categories' => 'manage_artist_categories',             )         ));     }     add_action('init','register_artists_post_type');

body:
I'm customizing a WordPress template and I would implement the following behavior in the excerpt posts visualization in my homepage: **If a post contains images (one or more), in the homepage post preview show at the begining a thumbnail of the first image that is in the post, then show the excerpt of the post.** At the moment I have the following code that, inside a WordPress loop, show the excerpts of all posts in homepage:                            <?php else : ?>
                 <?php the_excerpt(); ?>                 <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'admired' ) . '', 'after' => '
' ) ); ?>
      As you can see this code snippet show the excerpt of a post. Is it possible to find the first image in the post, put it into a variable and show it inside a span (or some other HTML tag) before the excerpt visualization?

body: > **Possible Duplicate:**   >  Using short codes I have a template for contact page and I have a post for the contact form. I am echoing that post in the template but it is showing short code of that form not the form I am calling my post content like this               <?php                     $post_id        =   76;     $posts_array = get_post($post_id);      echo $posts_array->post_content;                      ?>      whre in the post having id = 76, I have the short code `[contact_form]` any help will be appreciated

body: **What I have:** A custom post type. A front end posting form which creates new posts with `post_status = pending` until they are manually reviewed and status changed to published. **What I need:** While I can go to the listing of posts and see if there are any with "Pending" to authorize; what I want is to add a round icon with a number inside just like what WordPress does when there are new comments. I can write the code to extract the number of pending posts but I have no idea how to insert it in the admin menu. This is the code created by wp when a new comment is added:               1      A screenshot which shows one new comment, i need the same at Items.![](http://i.stack.imgur.com/f1phS.jpg) I have been looking for a solution to this for a while now and cannot find it anywhere; my next stop if no one can answer me here is to take apart the WP core and see how they do it there.

body: I see the following pattern over and over, on this site and on other places:               add_action( 'save_post', 'wpse14169_save_post' );     function wpse14169_save_post( $post_id )     {         if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {             return $post_id;         }         // Other code...     }      Why should I return `$post_id`? `save_post` is an action, and the return value of an action handler is ignored. The WordPress core itself doesn't do it either. The Codex example does return the `$post_id`, but it would not be the first incorrect (or outdated) line in the Codex. Am I missing something? Do I need to return `$post_id`? Was there a there a time when this was needed?

body: > **Possible Duplicate:**   >  How do I export my WordPress blog as a book? I would like to know how can one export all the posts content to a PDF file or Word or similar that includes all the pictures. Thanks

body: We have just updated to WordPress 3.1.3 by following the WP manual install tutorial. Note: This is a **Network-enabled (multi-site)** install. After uploading the new files, we now get the following error for ALL pages in the blog:               Error 101 (net::ERR_CONNECTION_RESET): Unknown error.      Any ideas? Here are the examples of our logs when the error occurs, and some of the WP-important files: error_log               [Tue Jun 07 15:40:01 2011] [error] [client 10.10.0.3] PHP Warning:  require(/var/www/html/root/wordpress/wp-includes/load.php) [function.require]: failed to open stream: No such file or directory in /var/www/html/root/wordpress/wp-settings.php on line 19     [Tue Jun 07 15:40:01 2011] [error] [client 10.10.0.3] PHP Fatal error:  require() [function.require]: Failed opening required '/var/www/html/root/wordpress/wp-includes/load.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/root/wordpress/wp-settings.php on line 19     [Tue Jun 07 15:40:01 2011] [error] [client 10.10.0.4] PHP Warning:  require(/var/www/html/root/wordpress/wp-includes/load.php) [function.require]: failed to open stream: No such file or directory in /var/www/html/root/wordpress/wp-settings.php on line 19     [Tue Jun 07 15:40:01 2011] [error] [client 10.10.0.4] PHP Fatal error:  require() [function.require]: Failed opening required '/var/www/html/root/wordpress/wp-includes/load.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/root/wordpress/wp-settings.php on line 19      wp-config.php               define('WP_HOME','http://www.mysite.com');     define('WP_SITEURL','http://www.mysite.com');          define( 'MULTISITE', true );     define( 'SUBDOMAIN_INSTALL', false );     $base = '/';     define( 'PATH_CURRENT_SITE', '/' );     define( 'SITE_ID_CURRENT_SITE', 1 );     define( 'BLOG_ID_CURRENT_SITE', 1 );      .htaccces file (in wordpress root directory)               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]

body: How do I add a filter to the username field to stop new users from registering using unwanted words such as `administrator` or general profanity? Ideally, if I could add a large list of words that are blocked with the option to add asterisk (*) as a wildcard like `genitals*`.

body:
I am having a little trouble trying to figure out how I can accomplish this: I have a container with two colums in it, a right and a left column. Each column will have 3 posts with a short excerpt stacked in it. Ideally I would like to add one into the right and one into the left until it reaches 3 rows of posts(although if that proves to be alot more of a difficult task than I am fine with posting to the first column than the second. I am able to loop through the posts and add them to one column, but I am having trouble figuring out how one will loop into two separate divs, without repeating the divs. Here is how I am attempting it, so far this code will loop into the left column. The first left side is using the loop to display the title(excerpt will come after) and the right side is just using html. Can anyone help me figure this one out?
Popular posts

Showing the most popular posts.

        <?php            query_posts('meta_key=post_views_count&orderby=meta_value_num&order=DESC&posts_per_page=10&post_type=pop');            if (have_posts()) : while (have_posts()) : the_post(); ?>
                  <a href=<?php the_permalink(); ?>><?php the_title(); ?>
Popular post. This is a popular post, it really is.

        <?php            endwhile; endif;            wp_reset_query();         ?>

                   This is a popular post
Popular post. This is a popular post, it really is.

                       This is a popular post
Popular post. This is a popular post, it really is.

body:
<?php     function register_mysettings() {         register_setting( 'cr-settings-group', 'post_type' );     }          function cr_settings_page() {     ?>

Your Plugin Name
              <form method="post" action="options.php">             <?php settings_fields( 'cr-settings-group' ); ?>

                     New Option Name	                          <?php                         $options = get_option( 'post_type' );                            $post_types = get_post_types( array( 'public' => true ) );                           foreach ( $post_types as $post_type ) { ?>                              <input type="checkbox" name="post_type[]"  value="<?php echo $post_type; ?>" "<?php echo checked(1, get_option('post_type[]')) ;?>"/><?php echo $post_type; ?>                          <?php } ?>

                 <input type="submit" class="button-primary" value="<?php _e('Сохранить настройки','wp_panda') ?>" />
              </form>
     <?php }      ;?>

body: I need to call a sidebar into my header. I've switched to the new twenty twelve theme and created my own child theme. With this new theme I decided to keep things organised and together, so I put my widgets functions, stylesheet and two new sidebar templates (one for header and one for footer widgets) in one folder called `pgwidgets`. This is the call i used in my header               <? if ( is_front_page() ) : ?>       <?php get_sidebar( 'homepage' ) ; ?>     <?php endif ; ?>      This calls the `sidebar-homepage.php` file into my header from the themes' root directory. How do I change the `get_sidebar( 'homepage' )` part to call the sidebar from the pgwidgets folderfolder (`pgwidgets/sidebar-homepage.php`)

body: I have added a column to the user list using two wordpress hooks: manage_users_columns and manage_users_custom_column. That's working fine. Now I would like to filter the user list based on a custom user meta key. How can I add a custom filter to the admin user list? WP provides filters based on roles. Can I hook into them somehow?

body: > **Possible Duplicate:**   >  Sort plugins by rating Just curious if anyone knows of a plugin or a way to add sorting for Plugin searches in the Administration of a Wordpress site. I find myself searching through all kinds of plugins, ultimately just wanting to see what has the best rating or highest number of downloads. Kind of surprised Wordpress hasn't added this feature already. Anyone know of a fix?

body: i have a custom post which has a meta tag that needs to be using a file upload (for video files). I am wondering, what is the correct way of adding an Upload button that points to the wordpress media uploader and set the url of the selected uploaded file to the text field that caused that associates the upload button. I am not looking for code on creating the actual meta tag option, but for a way to actually add a Wordpress media upload button properly.

body: I'm using example from here to get latest posts from the WP network: http://www.smashingmagazine.com/2011/11/17/wordpress-multisite-practical- functions-methods/ The function:               function wp_recent_across_network( $size = 10, $expires = 7200 ) {        if( !is_multisite() ) return false;             // Cache the results with the WordPress Transients API        // Get any existing copy of our transient data        if ( ( $recent_across_network = get_site_transient( 'recent_across_network' ) ) === false ) {                // No transient found, regenerate the data and save a new transient           // Prepare the SQL query with $wpdb           global $wpdb;                $base_prefix = $wpdb->get_blog_prefix(0);           $base_prefix = str_replace( '1_', '' , $base_prefix );                // Because the get_blog_list() function is currently flagged as deprecated            // due to the potential for high consumption of resources, we'll use           // $wpdb to roll out our own SQL query instead. Because the query can be           // memory-intensive, we'll store the results using the Transients API           if ( false === ( $site_list = get_site_transient( 'multisite_site_list' ) ) ) {              global $wpdb;              $site_list = $wpdb->get_results( $wpdb->prepare('SELECT * FROM wp_blogs ORDER BY blog_id') );              set_site_transient( 'multisite_site_list', $site_list, $expires );           }                $limit = absint($size);                // Merge the wp_posts results from all Multisite websites into a single result with MySQL "UNION"           foreach ( $site_list as $site ) {              if( $site == $site_list[0] ) {                 $posts_table = $base_prefix . "posts";              } else {                 $posts_table = $base_prefix . $site->blog_id . "_posts";              }                   $posts_table = esc_sql( $posts_table );              $blogs_table = esc_sql( $base_prefix . 'blogs' );                   $query .= "(SELECT $posts_table.ID, $posts_table.post_title, $posts_table.post_date, $blogs_table.blog_id FROM $posts_table, $blogs_tablen";              $query .= "tWHERE $posts_table.post_type = 'post'n";              $query .= "tAND $posts_table.post_status = 'publish'n";              $query .= "tAND $blogs_table.blog_id = {$site->blog_id})n";                   if( $site !== end($site_list) )                  $query .= "UNIONn";              else                 $query .= "ORDER BY post_date DESC LIMIT 0, $limit";           }                // Sanitize and run the query           $query = $wpdb->prepare($query);           $recent_across_network = $wpdb->get_results( $query );                // Set the Transients cache to expire every two hours           set_site_transient( 'recent_across_network', $recent_across_network, 60*60*2 );        }             // Format the HTML output        $html = '';        foreach ( $recent_across_network as $post ) {           $html .= 'blog_id, $post->ID ) . '">' . $post->post_title . '';        }        $html .= '';             return $html;     }      But it doesn't work. It gives following error: Warning: Missing argument 2 for wpdb::prepare(), called in.... I don't understand what is the problem. Something to do with this part: $query = $wpdb->prepare($query);? Anyone can guide on correct path here? Thanks.

body: > **Possible Duplicate:**   >  How to implement a customizable free OpenID authentication? Is there any WordPress plugin that provides OpenID authentication for comments that works in WordPress 3.0? The OpenID plugin appears to be broken in WP 3.0 and no longer in active development (10 months since last update).

body: I want to reorder stuff in a custom post. I got the meta box and editor working together, but currently the editor is above the meta box   and I need it to be the other way around. This is the code for my meta box:               // adding the meta boxes     add_action("admin_init", "tl_admin_init");     function tl_admin_init(){       add_meta_box("testimonial_description-meta", __('Testimonial Description', 'sagive'), "testimonial_description", "testimonial", "normal", "core");     }               // getting, setting and displaying PROJECT DESCRIPTION meta box     function testimonial_description() {         global $post; // this is a must!         $custom = get_post_custom($post->ID); // this is a must!         $testimonial_description = $custom["testimonial_description"][0];         ?>         <textarea name="testimonial_description" style="width: 98%; height: 10em; " /><?php echo $testimonial_description; ?></textarea>         <label><?php _e('Write a Simple 2 Line Description of your client testimonial without html for clean design.', 'sagive'); ?></label>         <?php     }      I tried removing the editor and re-instating after this function   but I guess that`s an over simplistic solution since it doesn't work. I've removed the editor using this:               /* This will help me get rid of the editor */     function tl_remove_pages_editor(){         remove_post_type_support( 'testimonial', 'editor' );     }        add_action( 'init', 'tl_remove_pages_editor' );      Then added it again using `add_post_type_supports`. Any suggestions anyone ?

body: I have several custom widgets that are installed as part of my theme. I'd like to execute conditional code inside each widget's admin panel (not the public side, I'm just interested in the admin panel inside function form($intance)), depending on which sidebar the widget is inserted into. How can I obtain a reference to the current sidebar id which holds the widget, from within the widget's function form($instance) handler?

body: The requirement is where i have a taxonomy State which is the parent and it has a child sub-taxonomies they are the Cities, Need to display the state as a drop down, when i select the particular state tax i have to display the corresponding child cities of the state tax in the second drop down.....kindly help me.. I found the solution for the above problem, but it works partial........anyone with solution kindly help me.... Add the below code at the top of the template page after get_header(), as you can see i added a custom taxonomy 'state' in the wp_dropdown_categories....               <?php get_header(); ?>     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>     <script type="text/javascript">     $(function()     {     $('#main_cat').change(function()     {         var $mainCat=$('#main_cat').val();              // call ajax         $("#sub_cat").empty();         $.ajax         (             {                 url:"<?php bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php",                      type:'POST',                 data:'action=my_special_ajax_call&main_catid=' + $mainCat,                      success:function(results)                 {                     //  alert(results);                     $("#sub_cat").removeAttr("disabled");                            $("#sub_cat").append(results);                   }             }         );                                         });     });                    <style type="text/css">     #content{width:auto; height:400px; margin:50px;}     </style>     <div id="content">     <?php       wp_dropdown_categories('show_count=0&selected=-1&hierarchical=1&depth=1&hide_empty=0&exclude=1&show_option_none=Main Categories&name=main_cat&taxonomy=state');     ?>     <select name="sub_cat" id="sub_cat" disabled="disabled"></select>     </div>     <?php     get_footer();     ?>      Add the below code in functions.php file........               function implement_ajax() {     if(isset($_POST['main_catid']))         {         $categories=  get_categories('child_of='.$_POST['main_catid'].'hide_empty=0');            foreach ($categories as $cat) {             $option .= '<option value="'.$cat->term_id.'">';             $option .= $cat->cat_name;             $option .= ' ('.$cat->category_count.')';             $option .= '</option>';           }           echo '<option value="-1" selected="selected">Sub Categories</option>'.$option;         die();         } // end if     }     add_action('wp_ajax_my_special_ajax_call', 'implement_ajax');     add_action('wp_ajax_nopriv_my_special_ajax_call', 'implement_ajax');//for users that are not logged in.      So now this is my structure.... State1   * CT1-1   * CT2-1   * CT3-1 State2   * CT1-2   * CT2-2   * CT3-2 State3   * CT1-3   * CT2-3   * CT3-3 im able to display the parent taxonomies when i select the parent taxonomy the second drop gets activated but it does not populate the child items except it shows the static output " Select "..... I'm not a Pro so kindly bare with me, Can anyone kindly resolve this issue

body: After searching for answers, I am still stumped. I am not very savvy but tried creating a php.ini file, editing .htaccess file, nothing lets me go above the 85 menu item mark. It seems to be a popular issue as posts range from 8 through 3 years ago to 3 weeks ago. Please help. Thanks.

body: I have a WordPress blog that is all user based Authors that submit content and such. Currently in the site, you can view other authors profiles but basically just view their content from the author.php template. Where would I even begin to build a plugin (or find a plugin) that allows authors to "follow" other authors and then on another page query the authors they follow to show certain content from their followed authors like comments they made, posts they made, etc. I don't want to add BuddyPress or go that route but I have seen similar plugins for BuddyPress but not for just WordPress. I imagine I need to do something like create an array of users they follow in their user meta then query those users to display the "activity". Is that sound right?. Any insights, tutorials, plugins etc that may help get my foot in the door for this? Thanks!

body: Is it possible to activate a 2nd theme functions.php using custom CSS code? I want to change files when the browser is above a certain size so this effects something else in my site. Thanks Jason

body: > **Possible Duplicate:**   >  Using customised language file for Event Organiser plugin? I'm using a wp plugin that includes an english .po file containing all the UI text strings. I'm not translating, but I'd like to leverage this to modify the displayed text. How can I override the .po in the plugin directory with a modified version in my theme directory?

body: This is now my homepage and my articles there is with full text this look bad e.g.: * * * ![enter image description here](http://i.stack.imgur.com/7UHcY.png) How i can edit this to look like from this photo so with images and e.g. some of text and after write ''read more'' or just ''...'' which redirect on articles * * * ![enter image description here](http://i.stack.imgur.com/tDwjQ.png) Thanks

body: > **Possible Duplicate:**   >  How to Add Custom Fields to a Custom Post Type? I'm creating a custom post type for my wordpress site. But I want to remove the editor an put a field for uploading files. How do I do that?

body: The code below is from Wordpress SEO plugin by Yoast. I am trying to add the page number to the Meta description on paginated posts (to avoid duplication issues with Google).               function metadesc( $echo = true ) {             if ( get_query_var('paged') && get_query_var('paged') > 1 )                 return;                  global $post, $wp_query, $page;             $options = get_wpseo_options();                  $metadesc = '';             if (is_singular()) {                  $metadesc = wpseo_get_value('metadesc');                 if ($metadesc == '' || !$metadesc) {                     if ( isset($options['metadesc-'.$post->post_type]) && $options['metadesc-'.$post->post_type] != '' )                         $metadesc = wpseo_replace_vars($options['metadesc-'.$post->post_type], (array) $post );                 }             }                   $metadesc = apply_filters( 'wpseo_metadesc', trim( $metadesc ) );                  if ( $echo ) {                 if ( !empty( $metadesc ) )                     echo '<meta name="description" content="'.esc_attr( strip_tags( stripslashes( $metadesc ) ) ).''.Page .''.$page.'"/>'."\n";                 else if ( current_user_can('manage_options') && is_singular() )                     echo '<!-- '.__( 'Admin only notice: this page doesn\'t show a meta description because it doesn\'t have one, either write it for this page specifically or go into the SEO -> Titles menu and set up a template.', 'wordpress-seo' ).' -->'."\n";                       } else {                 return $metadesc;             }              }      I have added $page as a global variable and can output the page number like so:               <meta name="description" content="Wordpress SeoPage3"/>      I would like the output to omit the page number if on Page0 (i.e. first page) then add spaces and separator (pipe or dash) so it reads               <meta name="description" content="Wordpress Seo Page | 3"/>      Thanks..

body: I'm looking to change the comments form title (my theme defaults this to "Leave a Comment" or "Leave a reply to"). I thought perhaps I could add a hook to comment_form_defaults but my snippet below isn't working... any thoughts?                   <?php      add_filter('comment_form_defaults', 'askQuestion');          function askQuestion($defaults) {       $defaults['title_reply'] = 'Ask a Question';       $defaults['title_reply_to'] = 'Your text %s';       return $defaults;     }     ?>      This is being added to the HTML editor of the page editor within wordpress. We are using the ExecPHP plugin to compile code within posts/pages. We are looking for a way to do this on just this page, not every comment form on our blog.

body:
This code works well to display child pages of the parent page while viewing both the parent page and child page. It doesn't apply the `current_page_item` CSS class to the parent while viewing it (and only it, not interested in it being applied while on the children) - any suggestions?
     <?php       if($post->post_parent)       $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");       else       $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");       if ($children) {     $parent_title = get_the_title($post->post_parent);?>
<a href="<?php echo get_permalink($post->post_parent) ?>"><?php echo $parent_title;?>
       <?php echo $children; ?>       <?php } ?>

body: On a site with premium user account subscriptions, I'd like to be able to limit logins to one computer at a time. The most straightforward way to accomplish this would be to limit by IP, but I haven't had any luck finding a plugin to accomplish this. Does anybody know of one I can use to get this functionality? Related: Login security question - Does WP show me if I'm logged in from multiple locations?

body: I use this Javascript code to create a dialog box to ask some thing to user and after decide what to do depending of the response.               function dialogToCont()     {         var retVal = confirm("Do you want to continue ?");         if( retVal == true )         {             alert("User wants to continue!");             return true;         }else         {             alert("User does not want to continue!");             return false;         }     }      and in my plugin I want to call this to show the dialog box to the user. In my php code I want to do something if the response of the use is true or false like this :               $tmp = "<script type='text/javascript'>dialogToCont();</script>";     //it is not correct this..     if ( tmp )     {...      // do something...     }      I have already registered my javascript code with wp_enqueue_script method.

body: I downloaded the latest version of WordPress (3.5) and created a custom theme. I plan to upload and install it for multiple clients. Is it possible to customize the default settings such as not have the sample post, page, and comment added when it's installed? And set the default theme that is activated? I looked at upgrade.php and schema.php and it looks like that is where the sample post, page, and comment is being added but I cannot find where the default theme is being chosen. Is there an article on how to edit these files or some tips on what to do?

body: I wonder if there is any way to show all post types in the same table of posts. Let's say I've got 3 different post types: Movies, Books and Videogames. Is there any way to show them all in a single table of posts?

body:
I have an archive page showing all blog posts (in a specific category). With a growing number of posts, I want to separate these by publish year. For example (simplified), I'd like the following: ### 2012   * post   * post   * post ### 2011   * post       I'm testing this system by changing my oldest post's publish date to mid-2011. Currently the structure appears to be mostly working, but all posts are showing up under 2012, and none under 2011, despite the oldest post's publish date being set to 2011. To illustrate, I'm getting this: ### 2012   * post   * post   * post   * post (2011 post) ### 2011    I'm using the code below (some extra stuff has been removed to simplify, but it doesn't affect the result). Can anyone see why the old post is showing up under 2012 and not inside the 2011 `<ul>`? Thanks for your help.               <?php global $query_string; query_posts($query_string . '&posts_per_page=-1'); // Show all posts ?>     <?php if (have_posts() {     if (is_category('210')) { ?>
         <?php $firstyear = '2011';         $currentyear = date('Y');         $postyear = get_the_time('Y', $post->ID);         for ($i = $currentyear; $i >= $firstyear; $i--) { ?>
<?php echo $i ?>

                 <?php while (have_posts() && $postyear == $i) {                     the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?><?php the_time(get_option('date_format')); ?>
                 <?php } // end while ?>
             <?php } // end for ?>
     <?php } // end if (category)     } // end if (have_posts)     wp_reset_query() ?>

body: After the last update of the plugin "List Category Posts" the first post item under each category is just text, no link. This request is made at the request of the plugin author as per the help file associated with the plugin as the means to get answers from HIM. See example here: http://oneangrycitizen.me/categories/ So the category links work but the post links are not working on the first link...

body: > **Possible Duplicate:**   >  Using WordPress functions on other sites I have an external script that needs to load up WordPress in order to have access to WordPress functionality. In the past I have successfully done this by including wp-load.php. However, when using MultiSite, this does not work. It appears to be logged as a bug here. Does anyone have any work arounds or solutions?

body: Hi and thanks for reading. I want to insert the post author into my custom post type slug. Example: `http://example.com/charts/%author%/` Any ideas how to accomplish this? Here is my custom post type:               register_post_type('charts', array(       'label' => 'Charts',       'description' => '',       'public' => true,       'show_ui' => true,       'show_in_menu' => true,       'capability_type' => 'post',       'hierarchical' => false,       'rewrite' => array('slug' => '/charts/author'),       'query_var' => true,       'supports' => array(         'title',         'editor',         'trackbacks',         'custom-fields',         'comments',         'author',       ),       'labels' => array (          'name' => 'Charts',         'singular_name' => 'Charts',         'menu_name' => 'Charts',         'add_new' => 'Add Charts',       ),     ));      bless jnz

body: WordPress default setting is, most recent post is the first post of the blog. But, I need to "Most commented post should be the first post in the blog". ( Categories page as well as home page)

body: I can remember that (at some time) there was a box display (LightBox? GrayBox? ThickBox?) for displaying images when clicking on them. Example: http://opus-irae.com/blog/2011/11/photos-blast-of-eternity-2011/ I want the image to appear in a *box I click on it, with "next" and "prev" buttons to navigate through the gallery. The images are included with the `[gallery]` tag, by the way. How can I achieve this? Is this a (non) feature of my theme? Or a WordPress feature? Or do I need a plugin?

body: Which file (or files, if more than one) do I need to edit to re-arrange the Product Page? I want to make some basic layout changes to the default Woocommerce product page. Specifically, I want to put the Order stuff just below the Price, and push the description down. In other words, swap the Short Description with the Order Stuff (Attributes, Add to Cart, SKU, etc.) Here is a screenshot of what I want to do: http://d.pr/i/YGAY

body: took a look at the questions but I couldn`t find a similar one. I need to change the custom error messages that are displayed when user tries to login with a wrong username or password. Like, change this: " **ERROR** : The password you entered for the username **%1$s** is incorrect. Lost your password?" to this "Wrong information" (just an example) I tried to use the "add_filter" but I`m not familiar with it, so, any help will be appreciated! Thanks

body: Basically if I call `wp_editor` via ajax it acts funny, I noticed it does not include 2 scripts it DOES include if i call it normally within a form (NOT thru ajax). I found some anwers like tinemce needs to be reinitialized and whatnot so that WP would call again the necessary scripts, but I can't figure it out. My ajax call:               $.ajax({                 type: "POST",                 async: true,                 url: vkrwps_admin.ajax_url,                 data: {                     action: 'EDIT_PROD',                     sv: sv,                     preload: vkrwps_admin.preloader                 },                 cache: false,                 beforeSend: function() {                     $('div.mule').html(u);                 },                 success: function(response){                     var r = (new Date()).getTime();                          $('div.mule').html(response).find('img').prop('src', function(_, src) {                          return src + '?v=' + r;                     });                     // call chosen on select                     $('select').chosen({                         // placeholder_text: "Choose a product..."                         'disable_search': true                     });                           // $('select.dropsearch').val(4).trigger('change');                 },                 complete: function() {                     // $('select.dropsearch').one().val(cf).trigger('change');                 }             });      From what I found here: How to load wp_editor() through AJAX/jQuery I tried putting the following on top of my script that has the ajax call in it:               $.fn.tinymce_textareas = function(){       tinyMCE.init({         skin : "wp_theme"         // other options here       });     };      and then I changed my success to:               $('div.mule').html(response).tinymce_textareas();      But then I get an error:               ReferenceError: tinyMCE is not defined      How do I make WP call the necessary scripts?

body: menu a link to its parent, for example: I have the following menu: Parent 1   \- Child 1   \- Child 2   \- Child 3 I wish to add to it (on the fly, not throw the wordpress cms) link to the parent: Parent 1   \- Parent 1   \- Child 1   \- Child 2   \- Child 3 I've searched a lot but got only to this piece of code and I do not know how to continue:               /* Duplicate the parent in a menu */     add_filter( 'wp_nav_menu_objects', 'duplicate_parents' , 10 , 2 );     add_filter( 'wp_nav_menu_items'  , 'duplicate_parents' );          function hasSub($menu_item_id, &$items) {         foreach ($items as $item)          {             if ($item->menu_item_parent && $item->menu_item_parent==$menu_item_id)              {                 return true;             }         }         return false;     }          $menu_item_parents = array();          function duplicate_parents( $items , $args ) {           if ( !($args->duplicate_parents) )        return ($items);                foreach ($items as $item)      {         if ( hasSub($item->ID, &$items) )          {            // here I have the parent object, but I do           //  not know how to add to it data.         }           }                return ($items);             }

body: I tried including taxonomy.php from wp-includes folder in my custom php script (which is called by jquery) but I get this error: Fatal error: Call to undefined function add_action() in /home/studiom4/public_html/realestate/wp-includes/taxonomy.php on line 121 I tried various combinations to include a file and this is how it works at the moment:               include_once($_SERVER['DOCUMENT_ROOT'] . '/wp-includes/taxonomy.php');      Did I do anything wrong? Why the add_action() is undefined? I was about to use get_term_children() and get_terms() functions hence I needed taxonomy.php

body: Question not related anymore.. First I tought about the relation OR/ AND for results, but I believe I should work with 'operator' => 'NOT IN'. I would like to query the results that meet multiple taxonomies instead of displaying all results that meet 1 of the tax. **New question has been made.**               <?php      function page_content($filters, $is_search = false,  $pg = 1, $cat = -1, $post_type) {          if (!$is_search) {     $filters = explode(',', $filters);     $query_args = array(         'posts_per_page' => 30,         'post_type'      => $post_type,         'post_status'    => 'publish',         'paged'          => $pg      );          $terms = array();     foreach ($filters as $f) {         if (!empty($f) && is_numeric($f) && $f > 0) {         $terms[] = $f;     }}          if (!empty($terms)) {                 if (!is_array($query_args['tax_query'])) $query_args['tax_query'] = array();                 $query_args['tax_query'] = array(     'relation' => 'OR', // NOT WORKING, STILL SHOWS 'AND' RESULTS     array(                     'taxonomy' => $post_type . '_filters',                     'terms'    => $terms,                     'field'    => 'id',                          ));             }          $queried_items = new WP_Query($query_args);     } else {     global $wp_query;     $queried_items = $wp_query;     }          foreach ($queried_items->posts as $p) {     $taxonomy = str_replace('%#%', $p->post_type, '%#%_filters');     $p->taxonomy = array();     $pfields = array("fields" => "all");     $terms = wp_get_post_terms($p->ID, $taxonomy, $pfields);     $assgined_terms = array();     if ($terms && is_array($terms) && !empty($terms)) {         foreach ($terms as $term) {     if (!in_array($term->parent, $assgined_terms)) {         $p->taxonomy[] = $term;         array_push($assgined_terms, $term->parent);     }}  }     }}

body: I use PageLines free version, with WordPress 3.3.1, for this website: http://new.teleosis.org/?page_id=76 **I want the background color of the whole page to be light green, and the background color of my content area to be white** (screenshot).   * I configure the **Page Background Color** in the PageLines settings, which affects the whole page. Whereas **Body Background Color** affects what they call the "Page content areas" like the footer. (screenshot)   * But I don't find the setting to change the background of a page body, is it even available in PageLines?  I hope I don't have to go into the CSS files for such a simple thing, but if I do, I appreciate any suggestions regarding which CSS file to modify and which properties to change/add. Thank you!

body: > **Possible Duplicate:**   >  Adding default post content for category Been struggling with this for a while now, but thought I'd give it one last go. I have some default html content (a few divs to split up the post) which I would like to automatically insert into the main post content for posts of one or maybe two categories. I have already seen some script which will add some default content, but it is added to all new posts regardless. I understand the main problem is that any default content is added when a post is first created (before a category is chosen). Attempting to get around this I was reading this thread about adding a drop-down menu to choose a category BEFORE the post is created. Force category choice before creating new post? I've tried this and it works, but I really need help with a bit of script that says: "If the new post is in category "products" then add this html content. Otherwise don't add anything" Hope some genius out there can help! Cheers

body: Is there an easy way to include an upload box to your settings page? I am building an Open Graph options page and I like users to upload a standard image directly from that page.

body: I want the start page to be editable from a template. At the moment I can only edit the content by directly editing the HTML. Setup:   * Settings » Read » "Front page displays Your latest posts"   * The template that shows in the startpage is `index.php` I want to be able to create a page edited from the Pages list that will show as the start page. I've tried to create a new page called MyStartPage. Set its template to Startpage (`index.php`). I've tried setting Settings » Read » Front Page displays Static page MyStartPage I've made sure the `index.php` has The Loop that makes the calls to get Title and Content as is working in other templates.

body: > **Possible Duplicate:**   >  wp_enqueue_script isn't connecting my custom js file I am really confused as to how wp_enqueue_script works. I have the following code in my header, and when I inspect it in safari in the resources tab I can see it, however in the source code for the html there is nothing linking to it. So I don't understand how it shows up in the resources tab without a file linking to it. Also how would I link multiple js files using this method. I have been stuck at this all day.               add_action('template_redirect', 'add_my_script');          function add_my_script() {         wp_enqueue_script(             'my-script',             plugins_url('my-script.js', __FILE__),             array('jquery'),             '1.0',             true         );     }

body: I am using responsive design on my website. Everything is fine except for the fact that on a mobile phone, my website is just too long. There is just too much content for a mobile screen - too much vertical space gets taken up by the sidebar which contains a lot of widgets like popular posts and recent comments and many others. To make the website smaller, I want the sidebar to not load at all if viewed from a small screen. And I don't want to apply display:hidden to the sidebar container. That would be stupid. So the most efficient way would be to load the sidebar using AJAX and exclude it if the viewport is less than 800px wide. Could anybody please tell me if this possible? If this can be done please give some examples and links to some tutorials. I have googled a lot for this but found just one tutorial which I think is not enough as I want to learn from several examples.

body: I need my WP permalinks display months _without_ using any zeros in the URL i.e. /1/ instead of /01/ for January. I'm moving my blog from Squarespace to Wordpress and I obviously want to keep all my existing URLs intact. Wordpress does a perfect copy of the Squarespace permalinks, with one exception; it shows months as ‘01’ whereas Squarespace shows them as ‘1’. Current Wordpress permalink: `http://example.com/home/2014/01/30/welcome` Old Squarespace permalink: `http://example.com/home/2014/1/30/welcome` i.e. `/1/` instead of `/01/` Without changing that, I'm guessing that when I point my DNS to my new WP blog, all the links will break. I've spent the last 3 hours scouring the Wordpress.org support .docs, to no avail. Help!

body:
I'm relatively new to wordpres development and am stuck at this issue. I have created a custom post type which shows up in the admin menu. I need a metabox in it with a file upload field. The metabox shows up fine but the file is not being saved. I am using the following code for it. Any help would be greatly appreciated.               //////////////////Best Practices///////////////          add_action( 'init', 'wpb_register_cpt_best_practices' );          function wpb_register_cpt_best_practices() {              $labels = array(             'name' => _x( 'Best Practices', 'best practices' ),             'singular_name' => _x( 'Best Practice', 'best practice' ),             'add_new' => _x( 'Add New', 'best practice' ),             'add_new_item' => _x( 'Add New best practice', 'best practice' ),             'edit_item' => _x( 'Edit best practice', 'best practice' ),             'new_item' => _x( 'New best practice', 'best practice' ),             'view_item' => _x( 'View best practice', 'best practice' ),             'search_items' => _x( 'Search best practices', 'best practice' ),             'not_found' => _x( 'No best practices found', 'best practice' ),             'not_found_in_trash' => _x( 'No best practices found in Trash', 'best practice' ),             'parent_item_colon' => _x( 'Parent best practice:', 'best practice' ),             'menu_name' => _x( 'Best practices', 'best practice' ),         );              $args = array(             'labels' => $labels,             'hierarchical' => false,                  'supports' => array( 'title', 'editor',  'revisions' ),                  'public' => true,             'show_ui' => true,             'show_in_menu' => true,                       'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => true,             'capability_type' => 'post'         );              register_post_type( 'best practice', $args );     }     $key_bp = "best practice";     $meta_boxes_bp = array(              "document" => array(             "name" => "document",             "title" => "Best Practices Document",             "description" => "Attach the best practices document.",             "type" => "file")          );          function wpb_create_meta_box3() {         global $key_bp;              if( function_exists( 'add_meta_box' ) ) {             add_meta_box( 'new-meta-boxes', ucfirst( $key_bp ) . ' Document', 'display_meta_box3', 'best practice', 'normal', 'high' );         }     }          function display_meta_box3() {         global $post, $meta_boxes_bp, $key_bp;         ?>
                  <?php             wp_nonce_field( plugin_basename( __FILE__ ), $key_bp . '_wpnonce', false, true );                  foreach($meta_boxes_bp as $meta_box) {                 $data = get_post_meta($post->ID, $key_bp, true);                 ?>
                     <label for="<?php echo $meta_box[ 'name' ]; ?>"><?php echo $meta_box[ 'title' ]; ?>                     <input type="file" name="<?php echo $meta_box[ 'name' ]; ?>" value="<?php echo (isset($data[ $meta_box[ 'name' ] ]) ? $data[ $meta_box[ 'name' ] ]  : ''); ?>" />
<?php echo $meta_box[ 'description' ]; ?>                         <?php //print_r($data);                         ?>

                  <?php } ?>
     <?php     }          function wpb_save_meta_box3( $post_id ) {         global $post, $meta_boxes_bp, $key_bp;              foreach( $meta_boxes_bp as $meta_box ) {             if (isset($_POST[ $meta_box[ 'name' ] ])) {                 $data[ $meta_box[ 'name' ] ] = $_POST[ $meta_box[ 'name' ] ];             }         }              if (!isset($_POST[ $key_bp . '_wpnonce' ]))             return $post_id;              if ( !wp_verify_nonce( $_POST[ $key_bp . '_wpnonce' ], plugin_basename(__FILE__) ) )             return $post_id;              if ( !current_user_can( 'edit_post', $post_id ))             return $post_id;              update_post_meta( $post_id, $key_bp, $data );     }          add_action( 'admin_menu', 'wpb_create_meta_box3' );     add_action( 'save_post', 'wpb_save_meta_box3' );

body: I'm trying to create a function that would allow me to change the title of an established meta box (i.e, change Meta Box title 'Authors' to 'Team', etc.) I didn't want to use JS or have to unset the original meta box and re-add it. I started off with the following as per another thread that listed the code like so:               // hook to the 'add_meta_boxes' action     add_action('add_meta_boxes', 'change_meta_box_titles');     function change_meta_box_titles($post_type, $post)) {         global $wp_meta_boxes; // array of defined meta boxes         // cycle through the array, change the titles you want     }      I'm stuck on the part to "cycle through the array and change the titles you want". What would be the best way to accomplish this? Using a foreach to loop? Or a Switch/Case scenario? I'm fairly new at this, could anyone provide an example of how to accomplish this? **Update:** Stephen Harris's example does work for Core Meta's (thanks!):               add_action('add_meta_boxes', 'change_meta_box_titles');     function change_meta_box_titles() {         global $wp_meta_boxes; // array of defined meta boxes         // cycle through the array, change the titles you want              $wp_meta_boxes['post']['normal']['core']['authordiv']['title']= 'Team Member';     }      **Update: Fixed For Custom Meta's** To get this to work with your custom meta's change your add_action as follows so that it fires your change title code after the meta box has been added:               add_action('add_meta_boxes', 'change_meta_box_titles', 999);

body: i have 2 custom page template name: custom-login-page.php and custom-register- page.php I creat 2 page in wordpress using these 2 page template and try to login and register it, it' work. Problem is i want people go to `http://domain/wp-login.php` or `http://domain/wp-login.php?action=register` will no longer work, and have to go to this link: `http://domain/custom-login- page/` and `http://domain/custom-register-page/` How can i do that? (I dont want use plugin because im designed 2 template as i said)

body: Is there a way to limit search to post titles? I know I can modify query.php core file but there must be a way to do it with hooks right? Thanks in advance!

body: I found several plugins (like this one and this one) to get the ability to attach a picture to a WP user. But these plugins are not maintained any more. Since there's apparently no plugin that does it today, is there an easy way to do it manually?

body:
I am trying to make a function but (because the lack of my knowledge) can't figur out how to do. The codex shows an example for using 1 taxonomy and 1 term and as output nice showing 1 Taxonomy / 1 Term without hyperlink (which is what I want to achieve but then with multiple taxonomies/terms) in one function.   At that point I am totally stucked, also tried `wp_get_post_terms()` but there probably must be used an array, and there mylack of knowledge hops in again :(   I can't find anywhere a sample, not in the codex, not through google neither here on stackexchange. Maybe I did not search well enough, if so then I want to apologize but still look for an answer/help. Below a sample which absolutly **not** is working but giving at least an idea about what I want to achieve. Result is not showing an error? The "article" information is overwriting the school information and the last (teacher) information the "article" information.               function my_function($content) {     if ( is_single() && in_category( '5' ) ) {              global $post, $school, $article, $teacher;                  $terms = get_the_terms ($post->ID, 'school');             $terms = get_the_terms ($post->ID, 'article');             $terms = get_the_terms ($post->ID, 'teacher');              if ( $terms && ! is_wp_error( $terms ) ) :             $school_links = array() && $article_links = array() && $teacher_links = array() ;                  foreach ( $terms as $term ) {                 $school_links[] = $term->name & $article_links[] = $term->name & $teacher_links[] = $term->name;                  }                  $school = join( ", ", $school_links ) & $article = join( ", ", $article_links )  & $teacher = join( ", ", $teacher_links ) ;          ?>
       <?php the_post_thumbnail('thumbnail', array('class' => 'top-post-img' )); ?>     School: <?php echo $school; ?>
     Article: <?php echo $article; ?>
     Teacher: <?php echo $teacher; ?>
     <?php                endif;         return $content;     } else {          return $content;         }     }     add_filter('the_content', 'my_function');       Appreciate all time/effort and help to find an answer. _Note:   I am absolutely not a coder just know how to us google :D_

body:
I'm using the following code to show one post in a page (Blog pages show at most is set to 1 post):               <?php     /**      * Template Name: Front Page      * @package WordPress      * @subpackage Prominent      * @since Prominent 1.0      */     get_header(); ?>

                 <?php while ( have_posts() ) : the_post(); ?>
                         <?php the_content(); ?>
                 <?php endwhile; ?>                 <?php /* Display navigation to next/previous pages when applicable */ ?>                 <?php if (  $wp_query->max_num_pages > 1 ) : ?>                     <?php next_posts_link( __( '← Older posts', 'twentyten' ) ); ?>                     <?php previous_posts_link( __( 'Newer posts →', 'twentyten' ) ); ?>                 <?php endif; ?>

     <?php get_footer(); ?>      So now I got a prev and next link in my front page. I would like to know if is possible to add a first and latest posts link? **EDIT:** By First and Latest posts I mean, for instance, Since I only allow one post per page, only one post will be shown. I would like a link for post number 1 and 8 in the example below: **1** 2 3 4 5 6 7 **8**

body: I've already inserted htaccess code to disallow searching for users by numeric id. However, one can still manually input a user name to view/browse by author, e.g. http://mywpsite.com/author/peter/ If the user name exists, my site will show the user's nickname on the page (the user name is already in the URL). This confirms the existence of the account name. For security reasons, I'd like to disable this Wordpress feature. Does anyone know if it's possible? I'm using Apache. **Update** : maybe this? http://wordpress.org/plugins/remove-author-pages/

body: Hi I've created a custom post type called shows. here is the code for it.               <?php     add_action('init', 'show_register');          function show_register() {             //arguments to create the post type.             $args = array(                     'label' => __('shows'),                     'singular_label' => __('Show'),                     'public' => true,                     'show_ui' => true,                     'capability_type' => 'post',                     'hierarchical' => true,                     'has_archive' => true,                     'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),                     'rewrite' => array('slug' => 'shows', 'with_front'                     => false), );                     //Register type and custom taxonomy for type.                     register_post_type( 'shows' , $args );                          register_taxonomy("Show-type", array("shows"),                     array("hierarchical" => true, "label" => "Show                     Types", "singular_label" => "Show Type", "rewrite"                     => true, "slug" => 'show-type'));     }     ?>      I've created 2 files that follow accordingly to the wordpress hierarchy and called them `archive-shows.php` and `single-shows.php`. These should automatically link to the correct pages however for some reason they both default back to index.php. The normal `single.php` and `archive.php` work as normal. Fix's tried Permalinks Flushed has `archive = true` please any suggestions.

body: > **Possible Duplicate:**   >  Being notified when some YouTube video in some post becomes unavailable I asked this question almost one year ago. Perhaps now somebody has developed some plugin to do that : receiving a notification when a YT video embedded in some page of my website becomes unavailable. I have many YT videos on my site, and I want to know very quickly if one of them was deleted by YT, so that I can fix the problem right away. This is a very common problem for which I suspect a lot of people would like a solution.

body: I've created a simple loop. And I have the following array for the query:               $live_tags = array(         'tag' => 'live',         'showposts' => 5,         'post_type' => 'post',         'post_status' => 'publish',         'orderby' => 'date',         'order' => 'DESC'         );      Where it says `'tag' => 'live'`, I need a logic that asks:               if ('tag' == 'live' || 'category' == 'candy')      But I am unsure how to do that within the WP_Query array. Anyone know how to retrieve posts from either tag, or category?

body: I have over 1500 posts I imported from Tumblr. While the images were imported into the gallery, I need to make sure there's a featured image for each. How do I make the images (12 per post minus 30 that don't have images) a featured image automatically?

body: In my current installation, the DB user has been granted full privileges. ![Complete list of his privileges.](https://dl.dropboxusercontent.com/u/5301947/Screenshot.png) I am pretty sure that not all of them are required to run WP, but I am not sure which privileges are definitely needed. Any suggestions?

body: I want to use a dropdown to sort a list of posts in WordPress. The results will display on multiple pages. So how do I pass the query on to the second, third, fourth, etc. pages? Here's an example of my form.               <form method="post" id="order">       <select name="sort" onchange='this.form.submit()'>         <option value="">Sort by</option>           <option value="zip">Sort by Zip Code</option>         <option value="type">Sort by Property Type</option>       </select>     </form>      Thank you, John

body: I am building an add-on to an events module that checks for availability, since there wasn't a function for that in that module. Now that I have built the logic, there are three emails I will need to send:   * One if the post is being submitted for the first time (ie 'New appointment')   * One if the post has been published by the site admin, as normal users won't be able to publish by themselves (ie 'Your appointment has been approved')   * One for if the post has been edited, AFTER it has been published already (ie 'Your appointment has been edited') I have hooked into save_post and publish_post for those first two, but I want an entirely different email sent upon editing a PUBLISHED post. How can I test for whether the post is already published and this is just an edit, versus it being published for the first time?

body: I searched a lot of thread regarding my problem, but unfortunately I found nothing works, and this my final option. I want to add some custom fields on my comment form. How can I do that?

body:
I'm trying to re-edit my website, and convert it's content into wordpress. I have the layer slider in which I've selected `<div/video>` option to add a NowPlaying html div which is loaded dynamically via jquery from an external file on my dropbox. I'm using this function to load the external file into my webpage:                     I've copied the following two javascript helper files, required for this content. I've copied these two lines into the header of my theme...                          And this is the div that's supposed to be replaced with the dropbox file..:

Now Playing    Winamp Update: 0 minutes ago!

Artist - Song Title

      The dropbox file contains some text based code and html data:                                        nowplaying content here...           That's mostly all... This works perfectly on my website, but does not function on the wordpress... I'm using xampp with localhost url for my wordpress... Please could someone suggest method to load this content into wordpress? Thanks! -

body: > **Possible Duplicate:**   >  How to query posts based on lat-lng coordinate as post meta? I want to create a $wpdb query that select the closest places (custom post type) near the current coordinates ($lat and $long) but I'm not able to get two custom field values simoultaneously (wpfc-latitude and wpfc-longitude)... how can i change my query to get also the longitude?               SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->terms.name, $wpdb->postmeta.meta_value AS latitude     FROM $wpdb->posts     LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id)     LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)     LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)     LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id)     WHERE $wpdb->postmeta.meta_key = 'wpcf-latitude'     AND $wpdb->posts.post_status = 'publish'      AND $wpdb->posts.post_type = 'places'     AND $wpdb->term_taxonomy.taxonomy = 'countries'      # UPDATE - THE FIXED QUERY Thanks to s_ha_dum I succesfully have both values and I can now calculate the distance and order my result. My final query is:               SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->terms.name, wpcflat.meta_value AS latitude, wpcflong.meta_value AS longitude,         6371 * 2 * ASIN ( SQRT (POWER(SIN(($lat - wpcflat.meta_value)*pi()/180 / 2),2) + COS($lat * pi()/180) * COS(wpcflat.meta_value *pi()/180) * POWER(SIN(($long - wpcflong.meta_value) *pi()/180 / 2), 2) ) ) as distance     FROM $wpdb->posts         LEFT JOIN $wpdb->postmeta as wpcflong ON ($wpdb->posts.ID = wpcflong.post_id)         LEFT JOIN $wpdb->postmeta as wpcflat ON ($wpdb->posts.ID = wpcflat.post_id)         LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)         LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)         LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id)     WHERE $wpdb->posts.ID NOT IN ($post->ID)     AND wpcflat.meta_key = 'wpcf-latitude'     AND wpcflong.meta_key = 'wpcf-longitude'     AND $wpdb->posts.post_status = 'publish'      AND $wpdb->posts.post_type = 'places'     AND $wpdb->term_taxonomy.taxonomy = 'countries'     ORDER BY distance     LIMIT 20      Is it a heavy query to load? Do you know if is there a way to optimize it?

body: I was just wondering if calling get_bloginfo too many times was going to harm performance in a theme and if the data should just be put into its own var?

body: While this is a question, it is as well a **serious warning** to publishers that separate their posts using `<!--nextpage-->`. Bare with me. I run a highly trafficked multiple author platform that rank very high on search engines. While making SEO related improvements, I noticed that only the first page of an article that is separated into several pages is being indexed by Google. How did I notice this? Because someone grabbed the content of the unindexed pages of an article and posted it in their own site. This resulted in them ranking higher than me on that particular keyword. Actually, let me rephrase that, my site's article is not even indexed beyond the first page. My question is, how can I make the search engines index the whole article if it is separated into several pages? Ideally, a script that displays the full article **if** the visitor is a search engine (if that would not be harmful for SEO). Other suggestions are welcome. On a side-note, if I was into Black Hat techniques, there would be a goldmine of content out there that I could exploit. _Think_ about it. And on a personal note, this issue should be addressed in a future update of Wordpress. **Update** : A similar question that detailed how _Wordpress creates the same canonical URL for all pages in a paginated sequence_ was asked here, however the answer that was posted and marked as correct does not answer the question. That solution works for paged comments only, not paginated posts. **Update 2** : According to this blog post by Google, we can use `rel=”next”` and `rel=”prev”` to indicate the relation between pages. So for instance, this is what we should include in `<head>` on **page 2** :               <link rel="canonical" href="http://domain.com/article/2" />     <link rel="prev" href="http://domain.com/article/1" />     <link rel="next" href="http://domain.com/article/3" />      And there should not be a rel="prev" or "next" if there isn't a page after/before it.

body: I just installed the advanced custom field plugin, but it wont show up in the admin sidebar, for the life of me I cant figure it out. How do I go about debugging, this, this is a fresh install with no other plugins and I have tried defaulting the twenty eleven theme. Help.

body: To change the upload directory I have to do this:               define ( "upload", "<new upload location>" );      How can you change the themes location? I like to create a folder themes in the root directory.

body: I'm sorry if this is an obvious question, but I've tried looking everywhere and can't seem to find an answer. Are WordPress themes automatically Child Theme-able? Or is there a process to make a theme ready for Child Themes?

body: I have two author templates, one for normal users and one for special users. Special users are those with user role 'special', so when someone wants to view their author page, they need to use the template author_special.php so, if the author we are about to see (for instance, example.com/author/whatever) has the role 'special' the template used will be author_special.php, if the role is not 'special' the template used should be author_normal.php I tried this in author.php, but it won't work:               <?php     if ($author_roles == 'special') {          include (TEMPLATEPATH . '/author_special.php');     } else {         include (TEMPLATEPATH .'/author_normal.php');     }     ?>      What should I do? thanks

body: I have decided not to use a plugin to create a simple contact form on my site and used some php code to do the same job. This was so i could style the form exactly how I wanted to. However when I test the form and submit it, the user is sent to the 404 error page despite the url at the top of the browser indicating the contact page that exists. I'm not sure why that would be the case.? I followed this tutorial to create the template page on my site http://wpmu.org/how-to-build-your-own-wordpress-contact-form-and-why/ Here is the form on my test site http://sandpit.jonathanbeech.co.uk/contact-2/

body: Hi i got custom post type and meta key 'tf_elements' which is an array and look like this:               a:28:{s:22:"Mikrofon bezprzewodowy";s:3:"Tak";s:19:"Mikrofon przewodowy";s:3:"Tak";s:39:"Sprzęt do tłumaczenia symultanicznego";s:3:"Tak";s:10:"Magnetofon";s:3:"Tak";s:13:"Odtwarzacz CD";s:3:"Tak";s:5:"Scena";N;s:8:"Mównica";N;s:12:"Zaciemnienie";N;s:12:"Klimatyzacja";N;s:17:"Światło dzienne";N;s:19:"Obsługa techniczna";N;s:29:"Business centre + sekretariat";N;s:21:"Minibar konferencyjny";N;s:21:"Rzutnik multimedialny";N;s:13:"Rzutnik folii";N;s:16:"Rzutnik slajdów";N;s:15:"Magnetowid i TV";N;s:5:"Ekran";N;s:9:"Flipchart";N;s:6:"Kamera";N;s:21:"Tablica suchościerna";N;s:18:"Wskaźnik laserowy";N;s:8:"Komputer";N;s:16:"Wideokonferencje";N;s:7:"Telefon";N;s:3:"Fax";N;s:19:"Łącze internetowe";N;s:26:"Wi-Fi (bezprzew. internet)";N;}      I got search box on page with multiply checkboxes and i want to check search thru this array for example i check two options: Mikrofon Bezprzewodowy = "TAK" AND Miktofon przewodowy = "TAK" AND ETC. Is there any simple way to accomplish that ?

body: Why does wp add slashes to $_POST values? All my quotes in my $_POST are escaped.. is there a reason for that??

body: A site has more than 5000 images (without the automatically from WP generated ones) in the /uploads folder. The site is very slow, I want to move the images into the /uploads/year/month structure, and rewrite the image paths to the new ones inside the database tables. I found a similar question in the forum, but that wasn't the same. Can someone recommend me a way how can I do this? Or a plugin, which moves the image from one folder to another, and the same time rewrites the path in the database? Thanks

body: I am pretty new to WP (I came from Joomla) and I am finding some difficulties trying to put on my local web server an old backup of a website (made using WP 3.5) I have performed the following operation: 1) I have put the website backup into a directory named **blog** into my Apache **www** directory on my Ubuntu local system. 2) Then I have put the database backup on my MySql local server 3) Finally I have change the values in the **wp-config.php** file to use my local DB The problem is that when I try to open the URL to see the website I see noting (a white screen) Into the Apache log file (/var/log/apache2/error.log) I found the following errors messages:               [Fri Jan 10 22:04:50 2014] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.9 with Suhosin-Patch configured -- resuming normal operations     [Fri Jan 10 22:05:08 2014] [error] [client 127.0.0.1] PHP Warning:  require_once(/var/www/blog/wp-load.php): failed to open stream: No such file or directory in /var/www/blog/wp-blog-header.php on line 12     [Fri Jan 10 22:05:08 2014] [error] [client 127.0.0.1] PHP Fatal error:  require_once(): Failed opening required '/var/www/blog/wp-load.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/blog/wp-blog-header.php on line 12     [Fri Jan 10 22:38:37 2014] [error] [client 127.0.0.1] PHP Warning:  require_once(/var/www/blog/wp-load.php): failed to open stream: No such file or directory in /var/www/blog/wp-blog-header.php on line 12     [Fri Jan 10 22:38:37 2014] [error] [client 127.0.0.1] PHP Fatal error:  require_once(): Failed opening required '/var/www/blog/wp-load.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/blog/wp-blog-header.php on line 12     [Fri Jan 10 22:38:38 2014] [error] [client 127.0.0.1] PHP Warning:  require_once(/var/www/blog/wp-load.php): failed to open stream: No such file or directory in /var/www/blog/wp-blog-header.php on line 12     [Fri Jan 10 22:38:38 2014] [error] [client 127.0.0.1] PHP Fatal error:  require_once(): Failed opening required '/var/www/blog/wp-load.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/blog/wp-blog-header.php on line 12     [Fri Jan 10 22:38:39 2014] [error] [client 127.0.0.1] PHP Warning:  require_once(/var/www/blog/wp-load.php): failed to open stream: No such file or directory in /var/www/blog/wp-blog-header.php on line 12     [Fri Jan 10 22:38:39 2014] [error] [client 127.0.0.1] PHP Fatal error:  require_once(): Failed opening required '/var/www/blog/wp-load.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/blog/wp-blog-header.php on line 12     [Fri Jan 10 22:38:40 2014] [error] [client 127.0.0.1] PHP Warning:  require_once(/var/www/blog/wp-load.php): failed to open stream: No such file or directory in /var/www/blog/wp-blog-header.php on line 12     [Fri Jan 10 22:38:40 2014] [error] [client 127.0.0.1] PHP Fatal error:  require_once(): Failed opening required '/var/www/blog/wp-load.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/blog/wp-blog-header.php on line 12      Why? what could be the problem? How can I try to solve it? Tnx Andrea

body: How to make Next and Previous attached image navigation on the attachment page? ' . __( 'Previous Image', '$text_domain' ) . '' ); ?> ' . __( 'Next Image', '$text_domain' ) . '' ); ?> working great :)

body: I have come across a few WordPress plugins on http://wordpress.org/extend/plugins/ with this warning: > This plugin hasn't been updated in over 2 years. It may no longer be > maintained or supported and may have compatibility issues when used with > more recent versions of WordPress. Is there a way to "adopt" or "verify" a plugin like this? I do have one plugin on wordpress.org so I understand the process. What is the correct process to bring an old or possibly abandoned plugin current?

body: I'm looking for a function to add a "new" label in front of my custom post type name in my navigation menu. The code is :               <?php $args = array( 'numberposts' => '1' );     $recent_post = wp_get_recent_posts( $args );          if (strtotime($recent_post[0]['post_date']) > strtotime('-7 days'))         $class = "new!";     ?>      I beginning to understand... I'm trying to change `$class = "new!"` by a simple text like `echo 'test',` It works but the text isn't just in front of the post-type name... same thing using `H1 class` or something like that... So my last step is to uderstand how to use `$class = "new!"` to display the "new!" text just next to my "books" name in the menu... Sorry again for my bad english...

body: I am using pie register to create a custom registration page for my users, I am having a problem which is I want to add an option where when my user selects from a radio button either they have kids or not, and if the user has kids then another option would pop up asking about the ages of each child. can you tell me how I can add such a feature in my website? Is there any other plugin that can do so? or can i do it by adjusting the code? Thanks

body: I need a method to automatically create pages (using `<!--nextpage-->`) in posts based on number of words. For example... A post containing 1200 words should be broken down into 6 pages with page break coming after every 200 words. I understand that I can do it manually. But this functionality is needed for a site powered by WordPress that would contain archives of imported data in multiple languages. Tried searching for a plugin that would accomplish something like this. Could not find it.

body: I have another database which stores post's IDs and I want do display them using WP_query to use the WP default pagination. I'm using _orderby => none_ to preserve the original order, but the result reorders them by IDs.               $ids = array (60, 23, 78, 46, 105, 130)          $args = array (         'posts_per_page' => -1,         'post__in' => $ids,         'orderby' => 'none'     );          $query = new WP_Query ( $args );          while ( have_posts() ) : the_post();         echo '<li>';         the_title();         echo '</li>';     endwhile;      Could anyone help me? Thanks, Romulo De Lazzari

body: I've started using the dashicon fonts in my theme options page for WP 3.8+ users. To take care of users on < 3.8, I've added the dashicon fonts to my theme folder and also an entry at the top of my custom admin stylesheet:               @font-face {         font-family: 'dashicons';         src: url('fonts/dashicons.eot');     }          @font-face {             font-family: 'dashicons';             src: url(data:application/x-font-woff;charset=utf-8;base64,xxx) format('woff'),             url('fonts/dashicons.ttf') format('truetype'),             url('fonts/dashicons.svg#dashicons') format('svg');         font-weight: normal;         font-style: normal;     }      (I've left out the base64 encode for brevity) This works great, however, I'm getting a bit of strange behavior with the fonts. When I leave the admin open in a tab and go away for a bit, then come back, every once in a while, the webfonts have turned to squares, as if the font is missing. This does not happen every time. It appears to be somewhat random. In those cases, simply doing a mouseover the page usually returns the webfonts to their proper symbols. The screenshots below show the issue. The first screenshot is what I see when the problem occurs. The second screenshot is what I'm expecting to see when things go well. Notice in the first shot, how the wordpress labels themselves have gone to a default serif font. ![Here's what it looks like gone bad](http://i.stack.imgur.com/l7m1X.png) ![Here's what it SHOULD look like](http://i.stack.imgur.com/o5QbX.png)

body: I've got a really simple problem here, and i'm sure that the solution is going to be really simple. Here is the code:               function the_fat_lady_sings() {         echo 'this plugin is a far harder than i imagined';     }     add_action( 'publish_post','the_fat_lady_sings' );      I just want to echo that line, and it simply does not work. Please help, i have no idea what's wrong. If I use `init` instead of `publish_post`, it works.

body: I keep getting a response of `0` instead of `string`, which is my function echoes. Why? code from `functions.php`               // enque test.js     function add_script() {         wp_enqueue_script(             'test',             get_stylesheet_directory_uri() . '/js/test.js',             array( 'jquery' )         );         wp_localize_script('test', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' )));     }     add_action( 'wp_enqueue_scripts', 'add_script' );          // ajax function     function my_AJAX_processing_function(){        echo 'string';     }     add_action('wp_ajax_nopriv_ACTION_NAME', 'my_AJAX_processing_function');      code from `test.js`               $(function () {              var data = {             action: 'ACTION_NAME'         };              jQuery.post(ajax_object.ajax_url, data, function(response) {             alert('Got this from the server: ' + response);         });          });

body: One of the big problems my site staff has had with tags is the overwhelming number of similar or duplicate tags, due to the write-in ability. I'm about to add new custom taxonomies to my site for them to use, but I'd like to avoid the problem we had with tags. I'm curious to know if I can turn off write-ins, so they can only be added manually through that taxonomy's part of the admin area. It's non-hierarchical, so they can still type in and the system will auto-complete and search for tags they might be looking for, which is great. I just don't want them to be able to create new tags from the post screen. Is this possible? I was looking at the Taxonomies and register_taxonomy() pages in the Codex, and thought maybe the "rewrite" function might be what I'm looking for, but I don't think it is now.

body: > **Possible Duplicate:**   >  Add inline HTML to posts published within last 24hrs I've been searching through the codex and Google and cannot not find a conditional tag based on age of post. I'm looking to display a graphic overlay on top of a featured image if the post is less than three days old, for example. Thanks very much.

body:
> **Possible Duplicate:**   >  How to mark every 3rd post   >  Style every four posts differently Is it possible to repeat this loop after four posts? (post 5 = post 1 css, post 6 = post 2 css, etc..)               <?php     if (have_posts()):             while (have_posts()) :                the_post();                $count++;                if ($count == 1) : ?>
Styled post 1
                <?php elseif ($count == 2) : ?>
Styled post 2
                <?php elseif ($count == 3) : ?>
Styled post 3
                <?php elseif ($count == 4) : ?>
Styled post 4
                <?php else : ?>                <?php endif;             endwhile;     endif; ?>

body: I have an issue saving a multi-dimensional array using update_post_meta. Here's my code ($meta_key and $userID are set up above):                   $read_notices = get_user_meta($userID, $meta_key);              if (null === $read_notices) {             $read_notices = array();         }              $read_notices[] = $postID;              update_user_meta($userID, $meta_key, $read_notices);      My problem is that the data is nesting every time so I end up with... Any ideas?               Array     (         [0] => Array             (             [0] => Array                 (                     [0] => Array                         (                             [0] => 1823                         )                          [1] => 1762                 )                  [1] => 1762         )     )

body: I am trying to create a custom theme settings page for a wordpress theme, so that I may hopefully continue to reuse it on the future websites I make. Unfortunately, I'm falling at the first hurdle. I'm attempting to add the page to the menus using this code :               add_menu_page('Theme Settings', 'Theme Settings', 'manage_options', 'kitleyhouse/ether_settings.php');      But I can't seem to get it to let me use an actual PHP file (not just a function) for the page content. It would be much easier, and nicer to work on if I could contain all the files for the settings page within a subfolder in my theme (e.g. themename/admin-settings/ or something). The menu item is being displayed in the admin panel, however when clicked it takes you to a 404 page. I have the file currently stored in the root of my theme folder (I started out with it in a subfolder). I have tried putting just the file name, the theme folder name and filename (as shown), I've tried pulling in the full theme URI, and using get_bloginfo('template_url'), get_theme_root... EVERYTHING I could think of, but no one else seems to be having this problem. So am I just being a massive idiot, or is there some other problem I'm not seeing. Thanks you in advance, this has caused me such a headache.

body: I just did an action on the query using `pre_get_posts` and it didn't work. When I removed the `$query->is_main_query()` it did work. So, how do you know that what is the main query. I know there is the function `is_main_query`. What I am asking is there a way to tell which one you are looking at? How does WordPress know which one is the main query? If you have three or four going for different reasons such as categories, post types, pages. which is the main?

body: I'm using a script that inserts a lot of terms at once. It always has a parent and child term and checks if they exists and add them. The problem now is that the term urls don't work and the taxonomy page only shows the parents unless I save a term or add a new one. It doesn't seem to involve transients and the three taxonomy tables are unchanged.               $parent = term_exists( $columns['B'], 'custom_tax' );     if ( $parent == 0 || $parent == null ) {          $parent = wp_insert_term( $columns['B'], 'custom_tax', array( 'description' => $columns['A'] ) );     }          $child = term_exists( $columns['D'], 'custom_tax', $parent['term_id'] );     if ( $child == 0 || $child == null ) {          $child = wp_insert_term( $columns['D'], 'custom_tax', array( 'parent' => $parent['term_id'], 'description' => $columns['C'] ) );     }          wp_set_post_terms( $post_id, array( $child['term_id'] ), 'custom_tax' );

body: I am trying to change the checkboxes for the terms on the backend to radiobuttons. I found this topic: Altering the appearance of custom taxonomy inputs however wich helped me doing this. However, this will turn ALL terms checkboxes to radio buttons. Is it possible to apply this only for one taxonomy? My code:               add_action('add_meta_boxes','mysite_add_meta_boxes',10,2);     function mysite_add_meta_boxes($post_type, $post) {       ob_start();     }     add_action('dbx_post_sidebar','mysite_dbx_post_sidebar');     function mysite_dbx_post_sidebar() {       $html = ob_get_clean();       $html = str_replace('"checkbox"','"radio"',$html);       echo $html;     }      thanks

body: For my website, I am using a static home page page Home (template front- page.php) and for posts- page News (template home.php) I need to show all the post titles and exceprts on that page News (templ. home.php), but also show the original title and the_content from that page News itself. This code below while statement shows all the posts, which is good, but the top `the_title` also shows the title from the first post, not from the News page itself. How to achieve what I need?               <?php get_header(); ?>              <?php         the_title();               the_content();         ?>          <?php if(have_posts()) while(have_posts()) : the_post(); ?>                  <?php             the_title();             ?>                  <?php             the_content();             ?>              <?php         endwhile;         ?>            <?php get_footer(); ?>

body: I'd love to be able to hide meta boxes using screen options, instead of removing them or restricting them to user roles, the goal is to just "uncheck" the meta box for the user. I see how this would be tricky since any code that would make a DB change for a user wouldn't be allowed to run every time they hit the page because it would just reset. But smarter people than I code the core, so maybe there's a way. And if there is, I'm dying to know. Any ideas?

body:
I am still learning settings API so please forgive my noob question. I have three fields: a checkbox, colorpicker and text field (they are **working** ), but I would like to do this: when the theme is installed add **"checked" state** to my checkbox but allow user to "unchecked" it ,and if empty add **default color** to my colorpicker... I have no idea how to do this so please help me! My code looks like this now ( **thanks** to @Chip Bennett! ) :               <?php     add_action('admin_menu','create_theme_options_page');     function create_theme_options_page(){     add_options_page('Theme Options','Theme Options','administrator',__FILE__,'build_options_page');     }        function build_options_page(){        ?>

My options page
        <form method="post" action="options.php">        <?php settings_fields('plugin_options');?>        <?php do_settings_sections(__FILE__); ?>
        <input name="Submit" type="submit" class="button-primary" value="<?php esc_attr_e('Save changes');?>"/>
        </form>
        <?php        }               add_action('admin_init','register_and_build_fields');          function register_and_build_fields(){          register_setting('plugin_options','plugin_options','validate_setting');          add_settings_section('main_section','

Main Settings','section_cb',__FILE__);          add_settings_field('banner_heading','Banner Heading:','banner_heading_setting',__FILE__,'main_section');          add_settings_field('display_sidebar','Display Sidebar:','display_sidebar_setting',__FILE__,'main_section');          add_settings_field('display_colorpicker','Display Colorpicker:','display_colorpicker_setting',__FILE__,'main_section');          }            //Install Iris colorpicker            add_action( 'admin_enqueue_scripts', 'mw_enqueue_color_picker' );            function mw_enqueue_color_picker( $hook_suffix ) {            // first check that $hook_suffix is appropriate for your admin page            wp_enqueue_style( 'wp-color-picker' );            wp_enqueue_script( 'my-script-handle', get_template_directory_uri() . '/js/my-script.js', array( 'wp-color-picker' ), false, true );            }                   //Colorpicker              //Now how to add a default color on theme install?              function display_colorpicker_setting(){              $options = get_option('plugin_options');              echo"<input type='text' id='color1' name='plugin_options[display_colorpicker]' value='{$options['display_colorpicker']}'/>";              }                    //Sidebar checkbox               //Now how to add a default state "checked" on theme install?               function display_sidebar_setting(){               $options = get_option('plugin_options');               echo "<input type='checkbox' name='plugin_options[display_sidebar]' {$options['display_sidebar']} id='display_sidebar' />";               }                      //Banner Heading                 function banner_heading_setting(){                 $options = get_option('plugin_options');                 echo "<input name='plugin_options[banner_heading]' type='text' value='{$options['banner_heading']}'/>";                 }                   //Validate our settings here                   function validate_setting($plugin_options){                      return $plugin_options;                   }                         function section_cb(){                    }     ?>

body: i've made a simple code here to fetch and insert the last news from a feed Rss:               <?php // Get RSS Feed(s)     include_once"wp-config.php";     include_once"wp-load.php";     include_once"wp-includes/wp-db.php";          if(function_exists('fetch_feed')){     $uri = 'http://rss.cnn.com/rss/edition.rss';     $feed = fetch_feed($uri);     }          foreach ($feed->get_items() as $item){          $titlepost = $item->get_title();     $content = $item->get_content();     $description = $item->get_description();          $my_post = array();     $my_post['post_title'] = "$titlepost";     $my_post['post_name'] = "$titlepost";     $my_post['post_content'] = "$content";     $my_post['post_status'] = 'publish';     $my_post['tags_input'] = $thetags;     $my_post['post_author'] = 1;     $my_post['post_type'] = 'post';     $my_post['post_excerpt'] =  "$description";          $post_id = wp_insert_post($my_post);          }          ?>       I would want check the feed regularly and insert new posts only if the post does not exist already. Should I then insert a rule that first checks if the title exists and, in this case, declare not to insert anything, else, have regular wp_insert_post. Can we help Me ?

body: I'm using a WordPress page to display this week's notice. This page will need to be updated weekly. I would love to have a box on the WordPress dashboard (similar to QuickPress) that would allow the admin, to simply update the content easily. I've added custom content on the dashboard before and I guess I could add a link to that page admin, but I'm not sure if I can add a box that would allow for this. Is this possible?

body: > **Possible Duplicate:**   >  Load Balanced WP with single server admin access I am planning to install wordpress in a multi-server environment. 2 load balancers/front end servers with a database server. Using CDN for all gallery uploads. any ideas if this is going to work? Is there any tutorial or article explaining this process?

body:
I'm trying to put search results into a div with ajax. The issue is I'm getting errors saying `undefined function have_posts()` when the the search template is accessed. It also took issue with `get_header()` which was in the search-results.php but I took it out. Here's how I have it setup.
        <form role="search" method="get" id="searchform" action="http://myurl.com/" >         <input type="text" value="" name="s" id="s" />         <input type="submit" id="searchsubmit" value="Search" />        </form>

             And here is the `search-results.php` template. I'm wondering if maybe I'm not passing the search results to the template.
      <?php if (have_posts()) : while (have_posts()) : the_post();  ?>
<a title="Permalink to this post" href="<?php echo get_permalink(); ?>"><?php the_title(); ?>
           <?php endwhile; endif; ?>      <?php if (!have_posts()) { echo('
No results to show.
'); } ?>

body:
I am using the following code to output a list of items in my 'documents' Custom Post type by Year and Month.
     <?php     $post_type = 'documents';     global $wpdb;     /**/     $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = '".$post_type."' ORDER BY post_date DESC");     foreach($years as $year) :     $years_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = '".$post_type."' AND YEAR(post_date) = ".$year.";" ) );     ?>
<?php echo $year; ?> (<?php echo $years_count; ?> Posts)
         <? $months = $wpdb->get_col("SELECT DISTINCT MONTH(post_date) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = '".$post_type."' AND YEAR(post_date) = '".$year."' ORDER BY post_date DESC");         foreach($months as $month) :         $months_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = '".$post_type."' AND YEAR(post_date) = ".$year." and MONTH(post_date) = ".$month.";" ) );         ?>
>             <a href="<?php echo get_month_link($year, $month)."?post_type=".$post_type; ?>"><?php echo date( 'F', mktime(0, 0, 0, $month) );?> (<?php echo $months_count; ?> Posts)                  <?php  $theids = $wpdb->get_results("SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_type = '".$post_type."' AND post_status = 'publish' AND YEAR(post_date) = ".$year." and MONTH(post_date) = ".$month.";");                     foreach ($theids as $theid):                                  ?>

<?php echo $theid->post_title; ?>

                                                          <?php                         endforeach; ?>
         <?php endforeach;?>

     <?php endforeach; ?>
      Currently this is working as expected but I am having problems trying to do the same thing for a specific category within my documents post type. How would I refine this code for my category 'cascade-campus-docs' within my 'documents' post type.

body: I'm new to WordPress and have a question regarding taking a production instance of WordPress and creating a local instance. I'm helping a friend out who has a WordPress site live on the web and I would like to be able to create a local instance on my machine. I was able to create the local instance, however all of the links are broken. They take me to the live site. Is this fixed by a WordPress configuration or an Apache Virtual Host?

body: I am using this code to shorting the title:               function short_title( $after = '', $length ) {         $mytitle = get_the_title();         if( strlen( $mytitle ) > $length ) {             $mytitle = substr( $mytitle, 0, $length );             echo $mytitle . $after;         } else echo $mytitle;     }      and i call it with:               <?php short_title( '...', 40 ); ?>       The script works fine but i am having character problem. See the picture. Any idea how to solve it?

body: > **Possible Duplicate:**   >  categories on attachment page How can I display post categories on image attachment page i.e. `image.php`. I have used the_category function, but it is still blank!! I guess the problem is that the attachment is not associated with the category of the post? Thanks

body: I'm writing my first WordPress theme and have a question about the use of The Loop in page templates. The page templates I've looked at all follow basically the same pattern (example from Twenty Twelve):               <?php while ( have_posts() ) : the_post(); ?>     <?php get_template_part( 'content', 'page' ); ?>     <?php comments_template( '', true ); ?>     <?php endwhile; // end of the loop. ?>      But a page will only have one post associated with it so iterating through the posts seems unnecessary. My page template is more readable and seems to work fine:               <?php     the_post();     the_title('<h1>', '</h1>');     the_content();     ?>      Is this a good practice? Are there any downsides?

body: In a plugin class I want to provide simple fields for public data: email, phone number, Twitter etc. The list can be extended. See the plugin Public Contact Data on GitHub for details. To keep the usage simple, I also want to offer shortcodes which are easy to type:   * `[public_email]`   * `[public_phone]`   * `[public_something]` The only difference is the second part. I don’t want further arguments for the shortcodes because they are error prone. So I register **one** shortcode handler for all fields in my plugin class:               foreach ( $this->fields as $key => $value )     {         add_shortcode( 'public_' . $key, array( $this, 'shortcode_handler' ) );     }      Now `shortcode_handler()` has to know which shortcode has been called. My question is: How do I do this? My current workaround is another function:               protected function current_shortcode()     {         $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS );         return $backtrace[3]['args'][0][2];     }      This … works for `the_content()`. But it is neither elegant nor robust.   I have read `wp-includes/shortcodes.php`, but I cannot see right now how to do it better.

body: > **Possible Duplicate:**   >  How to remove or replace the log-in link for comment replies? I want to get rid of the unnecessary "log in to reply" link from every individual comment when a user is logged out. I found the function in the `wp- includes/comments-template.php` but I'm confused on how to edit it out in my functions.pho. I read about 5 questions on here regarding it but most argued against not editing core functions. Is there a safe way to do edit this function without causing any issues on updates?

body: My Wordpress site was hacked today. When I investigated, I noticed that there were some malicious files under wp-content/uploads/ folder. I had set the permission of uploads folder to 777 for uploading images from the administration interface. And, I believe this was abused using the possible misconfiguration of the Apache server. What should the permission of uploads folder be? How should Apache be configured in order to enable image uploading through the administration interface and prevent accessing the content of the folder by unauthorized people?

body: I must be blind but I can't find for the life of me the full instructions for getting Disqus comment count to work. All I want displayed is just the comment count number. I've checked the "Output JavaScript in footer" option. I have custom loops but I have no idea what I supposed to put in them to activate the comment count. My loop.php file is:               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>         <?php if ( comments_open() ) : ?>             <a href="<?php echo get_permalink($post->ID); ?>#disqus_thread" class="post-disqus">                                <?php echo $post->comment_count; ?>                      <?php endif; ?>     <?php endwhile; ?>     <?php endif; ?>      Disqus's footer javascript code is:

body: I have built my own theme, which integrates quite well with WooCommerce, but I want to know how to properly get rid of the notification on top of my theme that said my theme didn't support WooCommerce / properly declare support (going a bit further than just clicking away the message).

body: > **Possible Duplicate:**   >  Any way to use a custom Parameter for youtube embed without using an > iframe? I have been trying to figure out the best way to do this, and I'm wondering if someone can tell me the best solution. I want to be able to embed a youtube video into a wordpress post, take off the title (currently using "showinfo=0" on the end of the iframe embed), allow people who subscribe via RSS to either see the video in their rss reader, or have a link to direct people back to the post to watch the video, and also not have to worry about having problems with resizing the iframes when I change designs or themes at some point in time. I've been trying to find a solution, but can't seem to find one. Everything I read seems to contradict something else. Does anyone out there know what the best way to do this? I do a video every single day, so it's really important to me that the videos work well. Thanks.

body: Is it possible to make custom page templates available from a plugin?

body: I am trying to remove the WordPress version number from the file extensions for security purposes. Some of the enqueued files include the WordPress version number on the end of them, which can be seen from the inspector. For example: `<link rel="stylesheet" id="admin-bar-css" href="http://sitename.com/wp- includes/css/admin-bar.min.css?ver=3.8.1" type="text/css" media="all">` As you can see, ver=3.8.1 was apended. I've come across a few filters that remove the WordPress version number from the header and footer etc, but not from the included files. That filter looks like:               function remove_version() {         return '';      }     add_filter('the_generator', 'remove_version');      But that does not remove the version number from linked files. Does any one know of a way to remove this version number?? Thanks

body: I'm using roots starter theme and create an archive-news.php file to show posts from my custom post type called "news". Works fine. Now, I want to show posts by month. Then I created a list of month. Each link has this similar structure: site.com/news/2014/04 But when I click in some month, I got page not found.

body: I'm trying to add a new footer widget area to my theme. I was able to add the new footer widget area and it works correctly. But I would like to limit what can be done with the widget area by the end user, right now the user can add any widget that they wish to the new footer widget area. I would like to limit the widget area to a line of text only such as a copyright statement. Is this possible with widget areas? How should I go about limiting it to just a line of text?

body: I'm building a plugin that has a meta box. Some of the fields in the meta box are required. Is using Jquery the only method for achieving this? Can I require that a field is filled in using php? Thank-you.

body: When I input my url and add a word on the end it will take me to a post that most matches the word on the end e.g. http://www.blurrygames.com/blog takes me to a post called "Blog Moved to WordPress". I want to avoid this. If a url is input which doesn't match a page in my blog exactly it should go to a 404 page. How do I make this happen?

body: I am working on a store locating Wordpress template where I have 5 categories for services. In each category I have 500 cities. I have rewritten my url from:               http://www.website.com/post-type/post      to:               http://www.website.com/post-type/term-name/post      So for example I have in 3 categories the city London, but now Wordpress sees it as double posts and set the url post slug to /post-2               http://www.website.com/filter/bikram-yoga/london/     http://www.website.com/filter/kundalini-yoga/london-2/     http://www.website.com/filter/pregnancy-yoga/london-3/      etc. etc. My question is: Is there a way to rewrite the url without the -2 etc. behind it and Wordpress still sees the posts as different post, so distinguish by term?

body: I want to organize themes like:   1. `wp-content/themes/themeshop/theme1`   2. `wp-content/themes/themeshop/theme2`   3. `wp-content/themes/themeshop/theme3` Now from my understanding, this organization works perfectly at the folder level. I dropped themes in subdirectories and everything seems to work fine. Now is it possible to duplicate this categorization in the Administration backend on the themes page?

body: I have a page to show my product, now i want to load further posts using "infinite scroll".

body: In plugin development, what is the best practice to prevent jQuery component collision on the front end? For instance, let's say I include the jQuery Apprise dialog in a plugin that loads this on the front-end for something, yet another plugin may do the same. Because this gets loaded and declared twice, or perhaps one is forked and customized while mine is not, we get Javascript errors on the frontend (I assume). (Note that I'm doing the best practice of using the wp_register_script() and wp_enqueue_script() strategy via a wp_head() action event in order to load a jQuery component on the frontend.)

body: Is it worth loading the JS for i dunno turning on a responsive menu via the is_mobile conditional? As technically its only going to be used on a mobile device, would it be good practice or improve loading on the desktop side of things?

body: > **Possible Duplicate:**   >  How to show a post single post in page template im trying to understand how to target a template for an individual post. if i use the following hierarchy for my site,               homepage     services         - track car         - race car         - road car         - fast road         - paddock services     about     contact      what i really want to do is create and style the template for the post i've created for "track car" which is a post belonging to category "services". I've worked out that if i create category-services.php then i can style an overview page which covers all of the services on one page, but what template do i create if i want to style a page which will show the service requested. what template will cover the following requests "somewebsite.com/services/track-car/" "somewebsite.com/services/race-car/"

body: I am using a ticker jQuery plugin and having trouble loading my script files correctly. If I add the scripts in directly into the theme's `header.php` file my scripts work correctly.   Example:               <script src="<?php bloginfo('template_directory'); ?>/js/jquery-ticker.js"></script>     <script src="<?php bloginfo('template_directory'); ?>/js/site.js"></script>      If I try to load the scripts from a WordPress plugin I receive an error. Plugin code:               function bbc_frontend_script() {     wp_enqueue_script('jquery');     wp_enqueue_script('ticker', plugins_url("/js/jquery-ticker.js", __FILE__));     wp_enqueue_script('js', plugins_url("/js/site.js", __FILE__));     }     add_action( 'wp_enqueue_scripts', 'bbc_frontend_script' );      The error I receive is the console outputs that in`site.js`               Uncaught Reference error:Jquery is not defined .      Can you please help me understand why I am getting the console error when loading the scripts from a WordPress plugin?

body: I'm providing front-end login in a template, using the function wp_login_form. It handles the redirection after login and logout pretty neatly! But if the username / password mismatch, or are non existent, the user is redirected to the admin login page, with the shaky js error. Also same is the case when I'm trying to reset the password, it takes me to the me backend page where I have to enter my email for resetting the password. I want to show both these activities on my template. Is there a way I could do this? Thanks for any help in advance.

body: > **Possible Duplicate:**   >  Adding submit or update button to custom metabox? I added a Meta Box Like So:               add_action('add_meta_boxes', function() {         add_meta_box('CNMeta', 'Custom MetaBox', 'CNCustomMeta', 'post');     });      I also added a thing that saves all of the meta information like this:               add_action('save_post', function($id) {         if(isset($_POST['CNPrice']) ) {             update_post_meta( $id, 'CNDetails', strip_tags($_POST['CNDetails']) );         }     });      So they can save it by updating the post, it would be nice if I could add a submit button at the bottom of the meta box that also updates the post (and doesn't popup a warning saying "You are about to leave this post unsaved" How would I do something like that?

body: > **Possible Duplicate:**   >  Semantic URL Custom Post Type and Taxonomies permalinks I created custom taxonomy. And my urls/permaliniks at the moment look like this: custom-post-type/post- name I want it to look like: custom-post-type/custom-taxonomy-parent/custom- taxonomy-child/post-name btw. same problem is present with categories. I don't see any hierarchy! Is this possible? if yes can you please forward me to the right documentation in codex? I'm searching for an hour cannot find anything to solve this problem! ty.               //Create custom post type Other Cities     add_action( 'init', 'create_post_type_othercities' );     function create_post_type_othercities() {         register_post_type( 'other-cities',             array(                 'labels' => array(                     'name' => __( 'Other Cities' ),                     'singular_name' => __( 'City' )                 ),             'public' => true,             'has_archive' => true,             'capability_type' => 'post',             'publicly_queryable' => true,             'hierarchical' => false,             'show_ui' => true,             'supports' => array("title", "editor", "thumbnail", "author", "custom-fields", "excerpt", "comments")             )         );     }     //Create taxonomy(category) for Other cities     register_taxonomy("other-cities", array("other-cities"), array("hierarchical" => true, "label" => "Cities", "singular_label" => "City", "rewrite" => true));      edit. I noticed I have same url for other-cities slug for taxonomy and custom post types. This is definitely causing 404 errors.

body: > **Possible Duplicate:**   >  Stackoverflow type of badge plugin giving warnings in Wordpress 3.5 I'm getting an error on my site that says: `Warning: Missing argument 2 for wpdb::prepare(), called in /home/blahblahblah/public_html/wp-content/mu-plugins/domain-mapping.php on line 489 and defined in /home/blahblahblah/public_html/wp-includes/wp-db.php on line 990` It's my understanding this is because now in WP 3.5 `wpdb::prepare()` requires you to use an array. Here is the offending code on line 489 of domain- mapping.php:               $olddomain = $this->db->get_var( $this->db->prepare( "SELECT option_value FROM {$this->db->options} WHERE option_name='siteurl' LIMIT 1 /* domain mapping */" ) );      How can I change this to be an array so it stops causing errors? In this thread several other people had similar but different problems. There are fixes posted but I'm having trouble translating it into a solution for me. If it helps to provide context here is the code for the whole function:                   function swap_mapped_url($url, $path, $plugin = false) {         global $current_blog, $current_site, $mapped_id;              // To reduce the number of database queries, save the results the first time we encounter each blog ID.         static $swapped_url = array();              if ( !isset( $swapped_url[ $this->db->blogid ] ) ) {             $s = $this->db->suppress_errors();             $newdomain = $this->db->get_var( $this->db->prepare( "SELECT domain FROM {$this->dmt} WHERE domain = %s AND blog_id = %d LIMIT 1 /* domain mapping */", preg_replace( "/^www\./", "", $_SERVER[ 'HTTP_HOST' ] ), $this->db->blogid ) );             //$olddomain = str_replace($path, '', $url);             $olddomain = $this->db->get_var( $this->db->prepare( "SELECT option_value FROM {$this->db->options} WHERE option_name='siteurl' LIMIT 1 /* domain mapping */" ) );                  if ( empty( $domain ) ) {                 $domain = $this->db->get_var( $this->db->prepare( "SELECT domain FROM {$this->dmt} WHERE blog_id = %d /* domain mapping */", $this->db->blogid ) );             }                  $this->db->suppress_errors( $s );             $protocol = ( 'on' == strtolower( $_SERVER['HTTPS' ] ) ) ? 'https://' : 'http://';             if ( $domain ) {                      $innerurl = trailingslashit( $protocol . $domain . $current_site->path );                 $newurl = str_replace($olddomain, $innerurl, $url);                 $swapped_url[ $this->db->blogid ] = array($olddomain, $innerurl);                 $url = $newurl;             } else {                 $swapped_url[ $this->db->blogid ] = false;             }         } elseif ( $swapped_url[ $this->db->blogid ] !== FALSE) {             $olddomain = $swapped_url[ $this->db->blogid ][0];             $url = str_replace($olddomain, $swapped_url[ $this->db->blogid ][1], $url);         }              return $url;               }

body: I have a page where users filter results from the Ultimate WP Query Search Filter plugin. The results are shown in a DIV via an AJAX call. This is working 100%. However I have another AJAX function attached to each result in the query allowing users to create a new post from search results. (See this post for how I got that to work Create new Wordpress post [wp_insert_post] based on results of a WP_Query) The problem I am having now is that when I view the wp_query results - I have a button on each record to "Add" to. When I trigger the button on the first item it works 100%. However when I click on any of the subsequent items - it still creates the post, but ignores all the values attached to it. I am guessing I need to reset the AJAX function after each call, but unsure how to do that? Here is the code for adding the posts: https://gist.github.com/stankobrin/4d15c29024e306b2ea43 Here is the JS / AJAX code: https://gist.github.com/stankobrin/61843fefef464e8778a3 Any help on this would be appreciated - I have spent countless hours trying everything! S

body: I have registered a custom post type and created a file called **archive- myCPT.php** and another one for single posts called **single-myCPT.php**. What I want to do is to create a page where I will show just few posts from my custom post type. Inside my **archive-myCPT.php** I will have a link called let's say "Special Posts" and this link will the the custom page which will be a little bit different from **archive-myCPT.php** , the only difference is that here I will use a custom query for the posts. The only way to do this seems to create a page template, but the problem here is that I can not assign a page template to pages within my CPT. I saw a plugin which may help me with the page template support for CPT, but is pretty old and I don't know if it's compatible with the latest version of WP. Is this the only way to do this ? Is this a good practice? Do you recommend something else ?

body: I'm using twentytwelve theme with 1.0 version. I saw many codes like following,               'name' = __('page','twentytwelve');      If I give,               'name' = 'page';      It's also working fine. Then why using `__()`?   What is use of that?

body: > **Possible Duplicate:**   >  Where is it better to start learning how to develop for Wordpress? Hi I have recently started learning WordPress threw these video series WP101 on wptuts+ and after that I took the default theme and arras theme and started customizing theme a bit to get a feel of how to work with WordPress. My goal is to learn as much about the platform as possible in the next 3 months that includes theme development and even plugin development.I have one year experience in working with html/css/javascript and 4 months in PHP&MySql. What is a good book or resource on theme development?What about plugin development? I prety much managed to familiarize myself with every component on the admin panel is that enough to move forward to theme development?If not can someone post some resource to familiarize myself better with the panel. I should mention I am trying to add WordPress to my skill bag because I am trying to get a job as a web developer and this days it seems that a knowledge of a CMS is require everywhere

body: I'm using the following code to `pre_get_posts`:                function order_programs ( $query ) {              // Check if on frontend and main query is modified         if( ! is_admin() && $query->is_main_query() && (($query->query_vars['category_name'] == 'programs-2014-new-york' ) || ($query->query_vars['category_name'] == 'programs-2013-new-york' ) || ($query->query_vars['category_name'] == 'programs-2012-new-york' ) || ($query->query_vars['category_name'] == 'programs-2012-new-york' ) || ($query->query_vars['category_name'] == 'programs-2012-new-york' ) || ($query->query_vars['category_name'] == 'programs-2011-new-york' ) || ($query->query_vars['category_name'] == 'programs-2010-new-york' ) || ($query->query_vars['category_name'] == 'programs-2009-new-york' ) || ($query->query_vars['category_name'] == 'programs-2008-new-york' ) || ($query->query_vars['category_name'] == 'programs-2013-amsterdam' )) ) {             $query->set('orderby', 'meta_value');             $query->set('order', 'ASC');             $query->set('meta_key', '_simple_fields_fieldGroupID_8_fieldID_3_numInSet_0');             $query->set('posts_per_page', '-1');         }          }      I really would like to order by a second Simple Fields value. Basically the first one is the date and second one would be the time. However I can't seem to get this query to work with multiple meta key values. Suggestions?

body: I have question which is so easy but if its wrong then I'll lost everything, well I have site which is working on WordPress 3.5.2 and now I got 3.8 version. and I want to update it which is so easy, but the problem is I don't have backup functionality. So is this safe to just update link to click or I can face any problem or I can lost all my data. Please advise what should I do? Should take a risk to click update it or ignore it to update my WordPress.

body: I'm really confused with `index.php`, `home.php` and `front-page.php`. In many cases even though I had an `index.php`, I overwrite it with `front-page.php`. But recently, I became aware about `home.php`.   * What's the difference between the `home.php` and `index.php`?   * What's the ideal condition to use a `home.php` than an `index.php`?   * What's the ideal condition to use a `front-page.php`?   * When I'm using a `front-page.php` then what specific task an `index.php` is doing for me then? I've read the Template Hierarchy in Codex. Please don't mix my question with Page Templates, I understand 'em, alHamduLILLAH.

body: I want my pages to not have comments enabled by default, only my posts. Is this possible?

body: XMLRPC is great for remote publishing to WordPress, but there has been many security issues attributed to it. How do it make it more secure? More specifically, only user from the intranet will be publishing through XMLRPC. WP is currently running on Lighttpd and php5.3.

body: I wonder is there is a way to create a custom template for a single product in Woocommerce. Let's say we have a product called 'apple' in a category called 'fruit'. I know that is possible to create a custom category page creating a file named `taxonomy-product_cat-fruit.php` in the woocommerce folder (using the slug of the category), but I'm not able to create a custom product page using `single- product-apple.php` (the slug of the product). Is there any way to do it?

body: I'm using the wp_oembed_get function to display embedded videos on a site I'm working on, what I'm trying to figure out is how I can use wp_oembed_get save the thumbnail of the embedded video to the WordPress library?

body: I have two custom taxonomies applied to two custom post types. the terms list on the sidebar just fine and will list all posts associated with it. However, if you search one of the terms in specific, it doesn't bring up a post with that term. Example: http://dev.andrewnorcross.com/das/all-case-studies/ Search for term "PQRI" I get nothing. Any ideas? I've tried using various search plugins but they either break my custom search parameters or just don't work.

body: I've been experimenting with creating a Custom Post Type as a plugin (because I've seen this recommended in various places). But I have a question **not about the how** , but rather **_the why_** of building CPT's as a plugin. **Yes...** Adding the CPT as a plugin does keep my functions.php nice and tidy. **But...**   1. Assuming I've enabled `has_archive` I still need to create `archive-cpt.php`, right?   2. Also: In order to display the CPT I need to create a custom loop, so I still need to create `single-cpt.php` ...right?   3. And these files need to be created **_in the theme_** , right? If I understand this correctly,   1. **If I disable the plugin:** I **_still_** have to remove (or hide or something) the `archive-cpt.php` and `single-cpt.php` pages.   2. **If I switch Themes** : I still have to add those two pages into the new theme. Right? I haven't even touched the issue of adding a CPT to the default loop (and it's implications on plugin-based cpt's). So, why a CPT **_plugin?_**

body: Now I cannot add any menu entry to my main menu structure, possibly because I attempted to modify it using a cache plugin. Anybody knows how I can fix that and make the menu editable again? Thank you

body: I'm working a custom WordPress site, and I've loaded all the required JavaScript file:               wp_enqueue_script('easing', get_stylesheet_directory_uri() .'/js/diapo/jquery.easing.1.3.js');      wp_enqueue_script('minified', get_stylesheet_directory_uri() .'/js/diapo/jquery.hoverIntent.minified.js');      wp_enqueue_script('diapo', get_stylesheet_directory_uri() .'/js/diapo/diapo.js');      wp_enqueue_script('mobilecustomized', get_stylesheet_directory_uri() .'/js/diapo/jquery.mobile-1.0rc2.customized.min.js');     wp_enqueue_script('startdiapo', get_stylesheet_directory_uri() .'/js/startdiapo.js');      The thing is if I view the site on a browser and I use view source to check if it is part of the html code, it is loaded there. But the problem I'm having is that the JavaScript codes is not performing the actions I want it to. What am I doing wrong?

body: How to add a meta box for a particular page, say: for only _About Us_ page. How shall i do? The current code adds the metaboxes for all pages:               function myplugin_add_custom_box() {         add_meta_box(              'myplugin_sectionid',             __( 'My Post Section Title', 'myplugin_textdomain' ),             'myplugin_inner_custom_box',             'post'          );         add_meta_box(             'myplugin_sectionid',             __( 'My Post Section Title', 'myplugin_textdomain' ),              'myplugin_inner_custom_box',             'page'         );     }

body: I have three custom post type:   * books   * magazine   * videos Now i want to limit the number of post for custom post type, for example:   * books => 3 post   * magazine => 2 post   * videos => 1 post I used a query post like this:               query_posts( array(         'post_type' => array(         'books',         'magazine',         'videos'     ),     'paged' => $paged,     'posts_per_page' => 6,      ));     $counter = 1;     if (have_posts()) :         while (have_posts()) : the_post();       if (($counter == 2) || ($counter == 3) || ($counter == 4)) {             $div = 'alpha';         } elseif(($counter == 6)) {             $div = 'omega';         } else {             $div = '';         }      The problems is i cant limit the numbers by custom post type. Any idea? Thank you :)

body: I need a single Wordpress installation to be available from both the main domain (www.example.com) via HTTP and a subdomain (secure.example.com) via HTTPS. Of course i can just map the subdomain to the Wordpress folder in Nginx config. But will Wordpress be aware that it is called via HTTPS and change all links on the pages to HTTPS ? Also, how i can i force certain pages to be automatically redirected to their HTTPS equivalent permalink (and then back again to HTTP) ?

body: When inserting media into a post, is there a way to change the default-view of the Media-Library from "All media items" to "Uploaded to this post"? ![borrowed Screenshot](http://i.stack.imgur.com/HnfW7.png) There is another thread where this question was extracted from: How to manage attachment relationships

body: I'm developing some additional functionality with a jQuery autocomplete form, some custom database tables, and PHP to query the tables. I have it working outside of the WordPress framework using mysqli for the database part. I've added the form to a WordPress page (and added the jQuery references to the header). When I run the Firefox Web Developer Web Console, I can see that the jQuery is doing its job up to the point of calling the PHP script. My PHP script is in the root directory of my Genesis child theme. The PHP script is where it hangs, and it appears that I'm not getting access to the information in `$wpdb`. I executed this script in the same directory as a test:               <?php          echo "got here";     global $wpdb;     print_r($wpdb);          ?>      I see "got here" but nothing else. Is there something else I have to do to get access to `$wpdb`? Apparently me declaring it `global` isn't enough.

body: I've been looking around for half a day now but no success so far. I've created a custom post type (recipe) and two custom taxonomies that go with it (type and cook). What I want is to be able to list all "cooks" from a group of recipes. I can do it for a single recipe but I'm stuck with multiple ones. Does anyone have any idea on how to achieve this?

body: > **Possible Duplicate:**   >  Can I add pages to my custom menu via script? My theme has a custom menu called "Custom Header Menu" and i've got a plugin that sets up site defaults and creates my static pages that I'd like to customize in order to seed the custom menu with posts and pages on the fly. So I'd like to add some code to the plugin so that each of the page's I'm creating gets added/assigned to the custom menu. I'm just looking for a point of reference on how to add pages to a custom menu on the fly via script... From wp-includes/nav-menu.php, I'm expecting to use this...               wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array() )      Where $menu_id is the id of my "Custom Header Menu" and $menu_item_data is an array of the pages I'm assigning to the menu.

body:
Given the user ID, how can I display all the blogs where this user is administrator? I tried:               <?php     $user_id = 2;     $user_blogs = get_blogs_of_user( $user_id );     echo '
';     foreach ($user_blogs AS $user_blog) {         echo '
'.$user_blog->blogname.'
';     }     echo '
';     ?>      However, it will return all the blogs where user has access to regardless if it is an administrator or just a subscriber. But all I want to display is those blogs where this user is administrator. Is this possible? If yes, How?

body: How do I use update_option to give me a new option name each time a form is submitted? The code I'm using now overwrites the database value. Instead I need to have a new address saved each time. The code:                                   // assign addrss to var                         $address = esc_html( $_POST['address'] );                              //assign JSON object to var using geocodeing function('address') input                          $address_results = boj_gmap_geocode($address);                              // transfer data to options array                         $options['py_name'] = $py_username;                         $options['address'] = $address;                         $options['coords']  = $address_results;                              // create and name the option_name and set fields with $options array                         update_option( 'py_menu_item', $options );

body:
How can i list all user registered on my website. If i have 300 users, i want to list only 10 on a page and list next 10 on other page..   * I want the user to have an image   * I want to list post added by the user   * I want to list the number of trailer's added by the user (custom post type - trailere)( if i click on the number it shoud get me on user page)   * I want to list the number of subtitrari's added by the user (custom post type - subtitrari )( if i click on the number it shoud get me on user page) This is wath i have try, it list ok but how can

                 Poza	                 Name	                 Inregistrat	                 Nume	                 User Level	                 User Role	                 Vezi Profil

                                     <?php                $wp_user_search = $wpdb->get_results("SELECT ID, display_name FROM $wpdb->users ORDER BY ID");               foreach ( $wp_user_search as $userid ) {                 $user_id = (int) $userid->ID;                 $user_info = get_userdata($user_id);                                                     $user_picture =  get_avatar($userid->ID, 40);                 $formid = $user_info->formid;                 $user = new WP_User( $user_id );                 echo '' . $user_picture .  '	';                 echo '' . $user_info->display_name . '	';                 echo '' . $user_info->user_registered . '	';                 echo '' . $user_info->nickname . '	';                 echo '' . $user_info->user_level . '	';                 echo ''; if ( !empty( $user->roles ) && is_array( $user->roles ) ) { foreach ( $user->roles as $role ) echo $role; } echo '	';                 echo '' . $userid->ID . '	';                                                     echo '
';               }                                              ?>

                 Poza	                 Name	                 Inregistrat	                 Nume	                 User Level	                 User Role	                 Vezi Profil

body: > **Possible Duplicate:**   >  Front-end Register Form i like to create custom register form like http://www.bharatmatrimony.com/ this page in worpress ... i have searched many plugins no one helps me ... How to do this any idea !

body: I am currently developing a theme with internationalization support, and would like to load stylesheets _after_ my theme's `rtl.css` (an alternative `style.css` loaded for languages with a right-to-left reading order). I am familiar with enqueueing my stylesheets and controlling their load order with dependencies using the `wp_register_style()` and `wp_enqueue_style()` functions, however `rtl.css` is loaded automatically by WordPress whenever the locale's language direction is `rtl`, and there doesn't seem to be a way to specify the stylesheet as a dependency. I know I can conditionally enqueue stylesheets using the `is_rtl()` function, however these stylesheets' `<link>` elements are still printed out before WordPress automatically prints `rtl.css`'s. I could also simply manually insert `<link>`s to the stylesheets that I wish to depend on `rtl.css` right after the call to `wp_head()` in my theme's `header.php` file, but I believe it's bad practice to do so, and I would like my theme to be commercial quality. How can I load stylesheets after WordPress loads `rtl.css`?

body: I'm writing an admin plugin which produces a pop up to give the user a preview of content. I tried to use thickbox as suggested here - http://codex.wordpress.org/ThickBox but it does not respect dimensions. My questions are - is this just broken, should i go custom, or is there now a better way to do this? Thanks in advance,                <?php add_thickbox(); ?>      View all";

body: I use nested/hierarchic pages purely for organizational purposes in the admin but on the main site I don't want a nested url structure. So if the page structure is /page/another-page/and-another-page, the url should only read http://domain.com/and-another-page. Is this possible? And if so, how? Should this be solved with a url rewrite? Thanks in advance! PS: this is not used for funny SEO business or anything. I just want to read the url like Wikipedia which always has a single url segment. I'm building a wiki like site but want to be able to nest pages so I can group them together more easily in the admin.

body: ### Initial Situation For a site I'm setting up I was looking into the whole field of securing uploads/downloads and restricting access to them based on user roles/capabilities. Of course I have read some of the previous questions related to the (general) topic on here, for reference reasons the most important/interesting ones I found:   * How to Protect Uploads, if User is not Logged In?   * How to restrict access to uploaded files?   * Restricting access to files within a specific folder   * How to make media upload private?   * Merging PHP download script into `functions.php` ### Supplementary notes Generally it is not a bad idea to additionally improve security of your wordpress installation - for example protecting your `wp-config.php` \- there are a lot of things you can and should do. There is a ton of information out there how to do it. I'm in the context of this question mostly concernd about my uploads/downloads. Wordpress uploads aren't secured, everybody can browse the `uploads` folder, unless you prevent it with a `.htaccess`:               Options All -Indexes      The `.htaccess` file has to be placed inside the `uploads` folder. But that isn't really securing them, it just makes it harder to find the files. Additionally you can prevent `hotlinking`, esentially restricting access based on `referrer` \- although that is little bit differnt case i thought i mention it, I'm not further elaborating, you can find plenty of information about that. Of course has the possibility to make posts private or create a custom post type with suitable template files to make that post type private, but thats not securing your files. Same can be said for wrapping the files in conditionals like `is_user_logged_in()` or `is_admin()`. On a sidenote there are plenty of plugins out there which are promising to make your files secure and protected, but many of them are just pretending to do so, some of the reasons are above. I'm just poiting that out because I'm pretty sure that it is not known by everyboby - so, be aware of that. ### Objective My intention was to be able to restrict access to (some) uploads and respectively downloads. And to make sure that nobody unwanted could have access to them, not by chance or if that someone knew the filename, the files should be really private and secure. After all only certain people should have access without exceptions. Additionally i had no need to privatize the whole site, indeed that would be counterproductive - it is used for public presentation purposes. Further more i wanted the solution to be easily usable, for the simple reason that some of the people working with it are not exactly computer experts, as it is often the case. ### Question Hence the question, is there an (relatively) simple way to restrict access to (some) uploads and the respective downloads? And like I carried out, that means a way to really protect and secure them?

body: I've spent a lot of time reading the other threads on this question, but I just cannot get my code to function properly. I'm building a plugin, and I've set up an upload form on my custom admin page, and I am using Media Uploader to process the upload. Please see below for simplified code:               class myPlugin() {       function __construct(){         add_filter('wp_handle_upload_prefilter', array( $this, 'handle_upload_prefilter') );         add_filter('wp_handle_upload', array( $this, 'handle_upload') );       }            function handle_upload_prefilter( $file ) {         add_filter('upload_dir', array( $this, 'custom_upload_dir' ) );         return $file;       }            function handle_upload( $fileinfo )   {         remove_filter('upload_dir', array( $this, 'custom_upload_dir' ) );         return $fileinfo;       }            function custom_upload_dir($args) {            $args['path'] = $args['basedir'] . "/mypath" . $args['subdir'];         $args['url'] = $args['baseurl'] . "/mypath" . $args['subdir'];         return $args;       }     }      The code above works, and it changes the upload directory to the path that I specify. However, it is changing the upload directory for ALL uploads. I'd like my code to run only when uploading from my custom admin page. This is what I've tried so far (and has not worked for me):   1. I've tried using conditionals to test for `$pagenow` and `get_current_screen` in my `custom_upload_dir` function, but that seems to fail every time and uses the default upload paths.   2. I've tried testing for conditional in my `__construct` but I get returned an error (I guess it's too early in the WP lifecycle).   3. Tried running the conditional in my `handle_upload_prefilter` function also to no avail.

body: I can't seem to figure out why untrashing a comment, calls my "approve_comment_callback"-action. Any ideas? I just don't want it to send two emails at the same time, when I untrash a comment. Here are the two (mail)functions that seem to collide...                   // Send mail to user when their comment has been restored     function untrash_answer_notification($comment_id) {     $comment = get_comment($comment_id);     if ( $comment->comment_parent != 0 ) return;     $author = get_userdata($comment->user_id);     $headers = "MIME-Version: 1.0" . "\r\n";     $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";     $headers .= "From: Blabla.com <bla@bla.com>" . "\r\n";     $subject = "Your comment was restored";     $message = "blabla";          wp_mail($author->user_email, $subject, $message, $headers);     }     add_action( 'untrash_comment', 'untrash_answer_notification' );          // Mail author if/when they're comment is approved     function approve_comment_callback($new_status, $old_status, $comment) {     if($old_status != $new_status) {     if($new_status == 'approved' || $new_status==1) {     if($comment->comment_author_email!=''){     $author = get_userdata($comment->user_id);     $headers = "MIME-Version: 1.0" . "\r\n";     $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";     $headers .= "From: Blabla.com <bla@bla.com>" . "\r\n";     $subject = "Your comment was approved";     $message = "blabla";          wp_mail($author->user_email, $subject, $message, $headers);         }         }             }     }     add_action('transition_comment_status', 'approve_comment_callback', 10,3);

body: Most people are aware that minimizing the number of plugins used is a good way to help keep a WordPress site running fast. However, does that general rule include deactivated plugins?

body: I'm working with WooThemes Canvas - and using a child theme, and I'd like two different post excerpt lengths on the home page. The Featured Post is to have a longer excerpt, and the rest on the grid (magazine grid), to have shorter. The client (in a perfect world) doesn't want to have to manually change excerpt length each time he posts. And in another perfect utopia, he doesn't want to touch categories - though this might be the backup plan. I'm no PHP guru, heck, I'm pretty green, but I can't find anything like this through searching and WooThemes says this is out of their parameters for support. I can change all of the excerpt lengths with this:               add_filter( 'excerpt_length', 'woo_custom_excerpt_length', 10 );          function woo_custom_excerpt_length ( $length ) {         $length = 200;         return $length;     } // End woo_custom_excerpt_length()      but I can't seem to target just the featured post... I tried with some laughable code (to at least show that I'm trying!), and predictably this didn't work:               add_filter( 'excerpt_length', 'woo_custom_excerpt_length', 10 );          function woo_custom_excerpt_length ( $length ) {         if ( isset( $woo_options['woo_magazine_featured_post_content'] ) ) { $length = 420; }         return $length;     }       Have a chuckle, and hopefully somebody can help. Thanks!

body: For many of the sites I do for clients, the designers will make pages with small pieces of text in various places. For example, the home page will have a headline, a tagline, and a small box with contact information. The about us page will have a main body of text, but then also a side box with a past client quote in it. The contact us page will have a short blurb before the form. The client wants the ability to edit all of these pieces of text later on. Are pieces such as these what widgets are supposed to be used for? If so, how would I allow the client to update the text later on? It seems messy to make a separate widget area for every static page, and it doesn't seem like this would allow the client to later edit the text very easily. Would concepts like custom post types, metaboxes, or shortcodes be useful here? I've tried many different methods but I'm not satisfied with any of them so far.

body: > **Possible Duplicate:**   >  Wordpress 3.1 - How does one add sticky post capabilities to post types What I had was normal posts...until I realized that custom posts are what I should use for my purpose. But then I noticed that I don't have the option to make a custom post sticky from the admin panel. Is there a way to get that feature working?

body: I have uninstall plugins and theme shall we are getting error in followinf code in capabilties.php in line 1158                    if ( ! $post_type->map_meta_cap )               {          $caps[] = $post_type->cap->$cap;             if ( 'read_post' == $cap )                $cap = $post_type->cap->$cap;                   }      Kindly look after the matter & resolve this issue.....

body: I'm developing a mobile site and the template I'm using is based off of Jquery Mobile. In the header.php file, the template I am using is making calls to CDN javascript files:               <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-     1.2.0.min.css" />     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>     <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>      Since I'm basically pulling in the JavaScript from those URLS and it's not actually some .js file in a folder on my web server - how would I go about adding additional javascript code? Do I add it to my header.php? Get a special plugin that'll allow me to add additional javascript? The template doesn't give my any option to add additional code. So, not sure where the code would actually go... Thanks in advance

body: > **Possible Duplicate:**   >  determining if the user is logged in Please check my site http://247ebookstore.com/sg3/monestatic-igues/ still working on it. If you check the given page you'll see "Visit Website" button there. I want that User must Logged In to view the website link. I don't know much coding so please anyone kindly tell me the code and place where to put it. Thanks.

body: I have my own activation mail for new users that are added via a plugin in the wp backend by an admin. The user is also added as an author to a post and I want him to activate the post (which will publish it) when he gets the email and clicks the link. Currently, the user receives an email with an activation link, but then has to log in and is not redirected to the activation screen. Is it possibly to authenticate the user by receiving the activation key and post id via the URL? The key is stored in his post as a custom field. I basically want this process to log him in automatically and allow him to access hist post from a front end page.

body: > **Possible Duplicate:**   >  Custom post type not displaying content from single-{custopm post type} > page I want to continue on the discussion -> Custom post type not displaying content from single-{custopm post type} page since I am not able to add more comments.   The solution suggested by user "I'm a" worked and from the admin dashboard, I am able see the CPT when "View" button is clicked.   The issue now is when I go to the page created from search shortcode from the plugin (index.php) the search stops working and displays "all" the CPT instead of the ones searched for.   Thanks in advance for you help on this.

body: > **Possible Duplicate:**   >  custom, static home page / landing page with Twenty Eleven theme? Live site. I'm trying to have a custom, static landing page added to the Twenty Eleven theme. So far, I've created a Landing page and selected that to be static front page, however when I go to the site my landing page is contained within Twenty Eleven's framework(header, container, etc.) How do I make the custom landing page show completely as I intended without the Twenty Eleven framework?

body: > **Possible Duplicate:**   >  How can I stop WordPress from prompting me to enter FTP information when > doing updates? I was just wondering why wordpress keeps asking for ftp login info whenever I go to install a plugin? I find it very irritating because it pretty much forces people into having to install an ftp server if they do not want to have to copy the plugins in the plugin directory manually. Would much rather use scp as it is more secure and efficient in my opinion, not to mention that im not about to hand over login credentials for my server over to wordpress just so I can install plugins easily :/

body: Enqueuing Google Web Fonts the usual way, i.e., using the `wp_enqueue_style` function like so...               function wpse_google_webfonts() {         wp_enqueue_style( 'google-webfonts', 'http://fonts.googleapis.com/css?family=Ubuntu+Condensed|Open+Sans:400italic,700italic,400,700' );     }     add_action( 'wp_enqueue_scripts', 'wpse_google_webfonts' );      ...results in a `link` tag placed in the header like so:               <link rel='stylesheet' id='google-webfonts-css'  href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed%7COpen+Sans%3A400italic%2C700italic%2C400%2C700&ver=3.5' type='text/css' media='all' />      As you can see, the resultant URL is **encoded**. I am pretty sure it poses no problems, but to keep things clean and clear, I would like to go ahead and ask -- Is there a way to enqueue Google Web Fonts (via `functions.php` and not a plugin) in a way that the URL output is not encoded? That's like so:               <link rel='stylesheet' id='google-webfonts-css'  href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed|Open+Sans:400italic,700italic,400,700?ver=3.5' type='text/css' media='all' />      ## Reason For Bounty @webaware's answer is near perfect, especially because it's similar to the method employed in enqueuing 'Open Sans' Google Web Font in the Twenty Twelve theme. The only problem in the output is that it's like this:               <link rel='stylesheet' id='twentytwelve-fonts-css'  href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed|Open+Sans:400italic,700italic,400,700&subset=latin,latin-ext' type='text/css' media='all' />      Notice the `&`? It should be `&`, otherwise the font-files served only have the `latin` glyphs (i.e. the `subset` parameter in the URL is neglected unless you use `&` and NOT its HTML entity). Anyone who can help modify @webaware's answer so that the output's looks like this...               <link rel='stylesheet' id='twentytwelve-fonts-css'  href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed|Open+Sans:400italic,700italic,400,700&subset=latin,latin-ext' type='text/css' media='all' />      ...wins the bounty.

body:
In my plugin, I would like to add two buttons to Media Manager (to the left of "Insert Into Post" in "media-toolbar-primary" section), and connect a jQuery action to it.   1. First one - The "Select All" button shoud allow to select all availabe images (only images), depending on option value selected (eg. All Media Items, Uploaded to This post etc). So if "All Media Items" is selected - all images available will be selected, if "Uploaded to This post" is selected - only images attached to current post will be selected.   2. Second one - "Custom Insert Into Post" - will get images data for all selected images (full size image source, alt text, size etc that are available) and while allowing to wrap them in aditional html code - return code to tinymce editor. Returned code for second button could look this way:

      As far as I understand, the only way is to use override appropriate Backbone view, but beside that, thats all I know for now. Thanks for help.

body: I have edited the pages and categories to all look the same and have a right sidebar, so when I click to a page or category they are same layout and also search results and archives and tag archives. However when I click on the post title or posted on date the layout is different (no sidebar). Does anyone know how I can make this look the same as other pages/categories with the right sidebar or which file I need to edit in the directory?

body: I have strange question. How Can I change or set a sql char set in wordpress. In wp_config.php I have:               define('DB_CHARSET', 'utf8');     define('DB_COLLATE', 'utf8');      In my plugin I have this:               global $wpdb, $charset_collate;     require_once ABSPATH . 'wp-admin/includes/upgrade.php';          if ($wpdb->get_var("SHOW TABLES LIKE '" . $ow_odczyty . "'") != $ow_odczyty) {             $query_one = "CREATE TABLE " . $ow_odczyty . " (                     id mediumint(9) NOT NULL AUTO_INCREMENT,                     data datetime DEFAULT '0000-00-00' NOT NULL,                     stan int NOT NULL,                     UNIQUE KEY id (id)                     ) $charset_collate;";                  $wpdb->query($query_one);             add_option("ow_db_version", $ow_db_version);      What it's wrong. When this plugin create above script I have `latin1_swedish_ci` and I don't know why. Sorry for my English. Best regards!

body: my code input insert media               <input type="text" name="Cat_meta[img]" id="upload_image" size="3" value="<?php if(isset ( $cat_meta['img'])) echo esc_html($cat_meta['img']) ?>"><br />     <button id="upload_image_button">Upload Images</button>      and im add js code               (function($) {         $(function() {             $('#upload_image_button').click(function() {                 formfield =$('#upload_image').attr('name');                 tb_show('', 'media-upload.php?type=image&post_id=&TB_iframe=true');                 return false;             });             window.send_to_editor = function(html) {                 imgurl = $('img',html).attr('src');                 $('#upload_image').val(imgurl);                 tb_remove();             }         });     })(jQuery)      and i have as picture: ![enter image description here](http://i.stack.imgur.com/5MCxX.png) How to echo as in add post: ![enter image description here](http://i.stack.imgur.com/9hfIA.jpg) Thanks

body:
I wrote a plugin that displays all products in a woocommerce store in admin settings option, now I want to add a link to download the products as CSV file. The problem is, when I click the link I get a permission error saying I don't have permission to view this page. Here's my code:               function extra_tablenav($which) {         if ($which == "top") {             echo '
'             . __('These products are currently in the database:')             . '
' .             '   ' .             '' . __('Export to CSV') . '';         }     }      How can I fix those permissions?

body:
I have read up on this and tried it myself, but I cannot seem to figure out how to override a parent theme function using my child theme. I need to know what I am doing wrong (and I am sure there are several wrong things). Here is the function in the parent theme:               function html5_insert_image($html, $id, $caption, $title, $align, $url, $size, $alt) {         $url = wp_get_attachment_url($id);         $src = wp_get_attachment_image_src( $id, $size, false );         $html5 = "
";         $html5 .= "";         if ($caption) {              $html5 .= "
$caption
";         }         $html5 .= "
";         return $html5;     }     add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );      Here is the function in the child theme:               function remove_html5_insert_image(){         remove_filter('init','html5_insert_image',1);     }     add_action('after_setup_theme','remove_html5_insert_image');

body: I use the built-in tag cloud widget and it's outputting the terms with a title attribute on hover that says "x Topics". How can I remove this title attribute, or better yet, change it to something more meaningful for the current terms. I have already tried this code, but it does not appear to be working:               // remove the title attribute from tag cloud widget     add_filter('wp_widget_tag_cloud', 'remove_tag_title_attributes');     function remove_tag_title_attributes($output) {         $output = preg_replace('title="(.+)"', '', $output);         return $output;     }

body: I'm using the following template code to display attachment links:               $args = array(         'post_type' => 'attachment',         'numberposts' => -1,         'post_status' => null,         'post_parent' => $main_post_id     );          $attachments = get_posts($args);          foreach ($attachments as $attachment)     {         the_attachment_link($attachment->ID, false);     }      but after the link I need to display the file's size. How can I do this? I'm guessing I could determine the file's path (via `wp_upload_dir()` and a `substr()` of `wp_get_attachment_url()`) and call `filesize()` but that seems messy, and I'm just wondering if there's a method built into WordPress.

body: I've been working for a while on our app portfolio. Because we are adding a lot lately i've been asking myself if it's possible to order by date instead of title in the admin panel. I have the following code:               <?php      add_action( 'init', 'register_post_type_apps' );     function register_post_type_apps()      {     /**     * Register some Custom Post Type(s).     *     */        register_post_type('apps',        array(           'labels' => array(              'name' => __('Apps'),              'singular_name' => __('apps'),              'add_new' => __('Nieuw app'),              'add_new_item' => __('Voeg nieuw apps item toe'),              'edit' => __('Wijzig'),              'edit_item' => __('Wijzig apps item'),              'new_item' => __('Nieuw apps item'),              'view' => __('Bekijk'),              'view_item' => __('Bekijk apps item'),              'search_items' => __('Zoek apps item'),              'not_found' => __('Geen apps item gevonden' ),              'not_found_in_trash' => __( 'Geen apps item gevonden in prullenbak' ),              'parent' => __( 'Bovenliggend apps item' ),           ),           'description' => __('Een apps item wordt gebruikt om de apps mee te vullen.'),           'public' => true,           'publicly_queryable' => true,           'exclude_from_search' => false,           'show_ui' => true,           'show_in_menu' => true,           'menu_position' => 20,           'menu_icon' => get_stylesheet_directory_uri() . '/images/cpt_apps_icon.png',           'hierarchical' => true,           'supports' => array(              'title',              'editor',              'excerpt',              'custom-fields',              'comments',              'thumbnail'),           'taxonomies' => array( 'post_tag', 'category', 'page'),           'has_archive' => 'true',           'rewrite' => array(              'slug' => 'apps',              'with_front' => false ),           'query_var' => true,           'can_export' => true,)        );     }          ?>      Does anyone know how to get this working?

body: I want to completely remove feeds from WordPress. I am using this little function from http://wpengineer.com/287/disable-wordpress-feed/               /**     * disable feed     */     function fb_disable_feed() {     wp_die( __('No feed available,please visit our homepage!') );     }     add_action('do_feed', 'fb_disable_feed', 1);     add_action('do_feed_rdf', 'fb_disable_feed', 1);     add_action('do_feed_rss', 'fb_disable_feed', 1);     add_action('do_feed_rss2', 'fb_disable_feed', 1);     add_action('do_feed_atom', 'fb_disable_feed', 1);      Still there is tons of transient options.. like `_transient_feed_mod` or `_transient_timeout_feed_mod` How can i completely remove feeds from WordPress?

body: The new "Customize" theme screen is a welcome addition in WordPress 3.4, however, I find it conflicts with my method of loading scripts loaded in the footer: In functions.php               if(!is_admin())     {     /* GET PUBLIC FUNCTIONS     *************************************************************/     require_once(TEMPLATEPATH . '/functions_public.php');     }      In functions_public.php               /* Move scripts to the footer, speeding up page loading time as per http://yhoo.it/IAL94Z     *************************************************************************/     if ( isset($_GET['page']) && $_GET['page'] == 'customize.php') echo "in customize.php"; else echo "NOT in customize.php";          if(!get_option('my_scripts_head')){         remove_action('wp_head', 'wp_print_scripts');         remove_action('wp_head', 'wp_print_head_scripts', 9);         remove_action('wp_head', 'wp_enqueue_scripts', 1);         add_action('wp_footer', 'wp_print_scripts', 5);         add_action('wp_footer', 'wp_enqueue_scripts', 5);         add_action('wp_footer', 'wp_print_head_scripts', 5);     }      This code branch moves those scripts from wp_head to wp_footer. When this option (my_scripts_head) is enabled, the "Customize" screen shows my theme preview without the scripts that are loaded in the footer. I find that when I disable this option, the "Customize" screen loads fine, including my scripts. When themes are previewed in customize.php, does wp_footer not fire?

body: I would like to take a stored array, from the meta_value `$custom_repeatable` and just display the line `'hamsters repeat one'`, but the following code doesn't display it how I'd like. Here is the code:               add_shortcode('clowns', 'this_is_attempt_two');       function this_is_attempt_two() {           $makethishappen = get_post_meta(31, $custom_repeatable, true);           $mpsresult =  print_r($makethishappen);       }        Here is what it displays:               Array     (         [custom_formmessagetype] => Array         (             [0] => hamsters message         )         [custom_formdescriptiontype] => Array         (             [0] => hamsters desc         )         [custom_formnametype] => Array         (             [0] => Hamsters name         )         [_edit_last] => Array         (             [0] => 1         )         [_edit_lock] => Array         (             [0] => 1366738036:1         )         [custom_repeatable] => Array         (             [0] => a:1:{i:0;s:19:"hamsters repeat one";}         )     )      My Question: How do I just display `'hamsters repeat one'` without anything else? **ADDED**   The custom_repeatable `meta_value` is being saved like this:               $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);       }

body: I have a WordPress install on a dedicated server with decent memory (upwards of 8GB) Since upgrading to 3.8, I started getting mysql disconnects/timeouts, better known as > MySQL server has gone away I enabled error_log for a bit, i.e.               ini_set('log_errors',TRUE);     ini_set('error_reporting', E_ALL);     ini_set('error_log', dirname(__FILE__) . '/error_log.txt');      This resulted in an immense file - basically the error_log grows by about a GB every 4 minutes or so. I AM caching queries               query_cache_type = 1     query_cache_limit = 8M     query_cache_size = 512M      I was able to temporarily fix the issue by setting               max_allowed_packet = 16M      Then I installed Debug Bar and checked queries on homepage. Debug Bar tells me there are 729 queries! The slow ones are:               SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'      > require('wp-blog-header.php'), require_once('wp-load.php'), > require_once('wp-config.php'), require_once('wp-settings.php'), > wp_not_installed, is_blog_installed, wp_load_alloptions #1 **7.5ms**               UPDATE`wp_options`SET`option_value`...WHERE`option_name`= 'wpseo_titles'      > require('wp-blog-header.php'), require_once('wp-includes/template- > loader.php'), include('/themes/weaver-ii-pro/page.php'), > weaverii_get_header, get_header, locate_template, load_template, > require_once('/themes/weaver-ii-pro/header.php'), wp_title, > apply_filters('wp_title'), call_user_func_array, WPSEO_Frontend->title, > apply_filters('wpseo_title'), call_user_func_array, > WPSEO_Frontend->title_test_helper, update_option **55.0ms**               UPDATE`wp_options`SET`option_value`...WHERE`option_name`= 'wpseo_titles'      > require('wp-blog-header.php'), require_once('wp-includes/template- > loader.php'), include('/themes/weaver-ii-pro/page.php'), > weaverii_get_header, get_header, locate_template, load_template, > require_once('/themes/weaver-ii-pro/header.php'), wp_head, > do_action('wp_head'), call_user_func_array, > Facebook_Open_Graph_Protocol::add_og_protocol, > apply_filters('fb_meta_tags'), call_user_func_array, > WPSEO_OpenGraph->facebook_filter, WPSEO_OpenGraph->og_title, > WPSEO_Frontend->title, apply_filters('wpseo_title'), call_user_func_array, > WPSEO_Frontend->title_test_helper, update_option **56.4ms**               UPDATE`wp_options`SET`option_value`...WHERE`option_name`= 'wpseo_titles'      > require('wp-blog-header.php'), require_once('wp-includes/template- > loader.php'), include('/themes/weaver-ii-pro/page.php'), > weaverii_get_footer, get_footer, locate_template, load_template, > require_once('/themes/weaver-ii-pro/footer.php'), wp_footer, > do_action('wp_footer'), call_user_func_array, WPSEO_Frontend->flush_cache, > WPSEO_Frontend->title, apply_filters('wpseo_title'), call_user_func_array, > WPSEO_Frontend->title_test_helper, update_option **56.0ms**               SELECT option_value FROM wp_options WHERE option_name = 'dismissed_update_core' LIMIT 1      > require('wp-blog-header.php'), require_once('wp-includes/template- > loader.php'), include('/themes/weaver-ii-pro/page.php'), > weaverii_get_footer, get_footer, locate_template, load_template, > require_once('/themes/weaver-ii-pro/footer.php'), wp_footer, > do_action('wp_footer'), call_user_func_array, wp_admin_bar_render, > do_action_ref_array, call_user_func_array, wp_admin_bar_updates_menu, > wp_get_update_data, get_core_updates, get_site_option, get_option **9.6ms** I do have lots (~50) plugins installed, and I use Weaver II Pro theme. Most of these plugins are essential to get what I need out of WordPress (I use WordPress as a CMS). This is a live install so I can't really disable everything and then enable one by one to see what's breaking things (if not core). Is there another way to figure out the problem by looking at the Debug Bar's output?

body: A friend has built a very powerful Wordpress plugin that was build mainly for his own use - and now he is considering opening it up to the public by selling it, but... But he's concerned that it will be pirated, and since this plugin is so powerful he really doesn't like that to happen... He doesn't want the plugin to just get into anybody's hands. So my question is: What are the best options out there for securing something like a Wordpress plugin? And how bulletproof can you make the security with it? I'm assuming at least a part of having strong security is when you use licence keys that need an internet connection to be validated, but I have no hands-on experience the complete picture, so I'm asking here.

body: I am trying to restrict access to wp-admin: only administrators and editors should be able to access it. At the moment I am using this function:               function restrict_admin(){     //if not administrator, kill WordPress execution and provide a message         if ( ! current_user_can( 'manage_options' ) ) {             wp_die( __('You are not allowed to access this part of the site') );         }     }     add_action( 'admin_init', 'restrict_admin', 1 );      But this does the job only for administrator, editors are not allowed to access this part of the site. What can I do?

body: Simple question but I can't find an answer - how do I find whether the current blog in a multisite network has a given plugin activated (speaking about plugins that are available to all sites on the network but are NOT network activated)?

body: I am trying to build custom user profile with the guidance of this tutorial: How to make a WordPress profile page I have successfully implemented it to my theme, everything is working well. Now what I want to achieve is to get the comment template in the user profile page, where other registered user can post comment on his profile page, kinda like facebook wall or last.fm shoutbox. I am trying it like this: In the author page I am added this line:               <?php comments_template(); ?>      But it does not show up. Then I tried this way: Get WordPress comments outside of WordPress It adds the comment template alright but, does not work. When you click on on the submit button it redirects to a blank page. I think the goal is not achievable easily, it requires custom database creation for each user to store the comments, since the comment system only stores comments of certain page or post, not for any other page like archive or author page. If anyone can show me the right direction, I will be forever grateful. Thanks Towfiq I.

body: How can I customise the the new user welcome email ? I tried 'http://www.sean-barton.co.uk/wordpress-welcome-email-editor/' however it conflicts with some of the other plugins I need to use, Cimy Extra Fields. There is one other plugin that is to old for wordpress 3.0.1. Will

body: I created a custom post type from a Plugin. Then in a function like `show_data()` I queried the post type along with its post meta data (Custom Fields). Then in Page Template I used the function to show the queried data. Within the loop I did something like:               while( $my_query->have_posts() ){        $my_query->the_post();             echo $post->ID;             echo get_the_id();             echo get_post_meta( $post->ID, 'my_field', true );             echo get_the_title();          }     wp_reset_postdata();      I did not return anything but simply those `echo`s. And in my Page Template I used simply:               show_data();      Now the problem is: the loop is showing the Post Title (`get_the_title()`) and the post ID from `get_the_id()` only. But the `$post->ID` is not showing the ID, so the post_meta is not showing too. What can cause the problem?

body: This question here is asking the same question as I am, but there were no adequate answers nor a selected correct answer so I am asking again hoping if I ask in a more coherent manner I might get a response. I am trying to implement the colour picker wheel as seen in the Wordpress Theme Customization API pane for selecting colours. Loading the scripts and styles works fine when using the hook, "admin_enqueue_scripts" works however trying to load these scripts on the front-end using the hook, "wp_enqueue_scripts" does not work. The style gets enqueued, but not the script. I want to avoid copying over files into my plugin duplicating what is already bundled with Wordpress. There must be a way to get the Iris colour picker working on the front-end that I am not seeing. And for those wondering why I want to do this, I am developing a plugin that adds a fly-out panel to the side of the screen which allows you to make realtime temporary styling changes to the site without having to login via the wp-admin panel.

body: Hi to the community,   is it possible to change the default username slug to nickname if is available? By default the url is something like: http://domain.tld/author/(admin) ,   is it possible to rewrite and change to http://domain.tld/author/(nickname) so if a user change his nickname from the profile page the slug it will change also to the new name given by the user? thanks a lot!   Philip

body:
With the PODS plugin in Wordpress, I've created a custom post type called `project`. Within project I've created a few custom fields. One of those is `project_thumb`. The thing is; When I want to display `project_thumb`, I just get `Array` instead of the actual value of the field. This is my code so far                   $projects = get_posts(array('post_type' => 'project', 'posts_per_page' => 6));         $thumb = get_post_meta($projects, 'project_thumb');              foreach ($projects as $project) {                  echo '
';             echo    'post_title . '">';             echo '
';         }      Any suggestions to fix this? Thanks in advance.

body: Is there any way I can take a URL of an image and find the attachment or post id of that image in the database? Here is the situation: I'm in a loop going over all the 'img' tags that are surrounded by 'a' tags in my post content. if the src attribute of the 'img' tag does not match the href attribute of the outer 'a' tag, then i want to replace the 'img' tag. In doing this, if the 'img' that is to be removed is in the gallery, i want to delete that post, and then put my replacement 'img' in its place. I tried using a function like this:               function find_image_post_id($url) {       global $wpdb;       $postid = $wpdb->get_var($wpdb->prepare("SELECT DISTINCT ID FROM $wpdb->posts WHERE guid='$url'"));       if ($postid) {         return $postid;       }       return false;     }      This apparently is not right because the guid is ironically not globally unique. I had (earlier in the same script) uploaded a file with the same name (why? because it was higher resolution and i am trying to replace low resolution versions of the same image) and although wordpress will save the image with a different name in the directory, the guid's were set to be the same. (possibly a bug). Is there another technique I can use?

body: When I go to the admin profile in Wordpress, I don't see a place to edit the photo for the admin. Would anyone be able to please suggest to me how to navigate to the place where I can change the admin/user profile photo? Thank you!

body: $args['meta_query'] =  array (              'relation'=>'AND',                 array(                 'key' => 'canonical',                 'compare' => 'NOT EXISTS'                 ),             array (             'relation'=>'OR',                 array (                  'key' => 'partner_option',                  'compare' => 'NOT EXISTS'                 ),                 array (                 'key' => 'partner_option',                 'value' => 'Select',                 'compare' => 'LIKE',                 )                  ),         );

body: When solving this issue ( Change admin language based on user (in single-site) ), I did a function so that the plugin would auto-hide from all users except one (me:). The flaw is that it only auto-hides when _active_. At first, it was a mu-plugin, but I had to enable/disable it manually. It really doesn't need to run all the time, as it may slow the site (?) or even contain some sensitive manipulation of the site's language (another question mark). But mainly the motivation is that I don't want the client activating/deactivating/deleting this plugin (is for my own use), and don't want it cluttering her own plugins list. So, decided to split the functions in two plugins:   * One is a Must-Use used to hide the regular one.    * The other will be activated/deactivated upon necessity and is the one from the above linked issue. But now I run into another question: **how to hide one plugin from the Must- Use listing**?

body: In this forum I´ve found this thread   http://bit.ly/17IuDBh but using the code in my WP MAXX theme doesn´t work.               <?php query_posts('cat_id'=>'3');?>     <--insert loop-->      I have commented the whole page code here http://pastebin.com/aw7z0Bgp I read that there´s some redirect techniques in the thread... but I prefer to stick to make WP filter a category (news , that´s cat=4) and show it as the custom home page. If someone can help, thanks a lot. I admit it´s a lack of skill in using the_loop and also querying the WP database at the start of the page...I´ve lost 2 mornings hitting my head on a wall with this. Regards, Mauro.

body: I have a front-end form I am creating to allow users to publish a variable product to my shop from the front end with predefined attributes and variations. I have found this very helpful question: here Which shows me how to set the product type as variable and assign my predefined attributes in the attributes section of the product data. However when I am on the backend of Wordpress/Woocommerce and editing the product I click on variations and none are set, I look at the attributes and my "resolution" attribute is set with my 3 items. How do I make this to where it will actually set those attributes to variations of my form? Do I need to use wp_insert_post? Looking in phpmyadmin it just looks like product variations are assigned to a parent_id (product id) and post type is product_varition and so on.               $new_post = array(     'post_title' => esc_attr(strip_tags($_POST['postTitle'])),     'post_content' => esc_attr(strip_tags($_POST['postContent'])),     'post_status' => 'publish',     'post_type' => 'product',     'tags_input' => array($tags)     );          $skuu = rand();     $post_id = wp_insert_post($new_post);     update_post_meta($post_id, '_sku', $skuu );          //my array for setting the attributes     $avail_attributes = array(         'high-resolution',         'medium-resolution',         'low-resolution'     );          //Sets the attributes up to be used as variations but doesnt actually set them up as variations     wp_set_object_terms ($post_id, 'variable', 'product_type');     wp_set_object_terms( $post_id, $avail_attributes, 'pa_resolution' );               $thedata = array(     'pa_resolution'=> array(                     'name'=>'pa_resolution',                     'value'=>'',                     'is_visible' => '1',                     'is_variation' => '1',                     'is_taxonomy' => '1'                     )     );     update_post_meta( $post_id,'_product_attributes',$thedata);          update_post_meta( $post_id, '_visibility', 'search' );     update_post_meta( $post_id, '_stock_status', 'instock');      So just to be clear (I tend to be confusing) the above does create my variable product from the front end, and when I look at the product in the backend it is a variable product, it has the resolution attribute set and has my 3 terms (high-res, medium-res, low-res) as attributes. I just need to take this a step further where they are actually set as variations so people can place an order. ![Adds attributes to product already](http://i.stack.imgur.com/wpmWG.png) ![need it to add variations as well](http://i.stack.imgur.com/HmRt5.png)

body: > **Possible Duplicate:**   >  How can I use WordPress functions in my stylesheet? For my wordpress blog, I would like to use some JS to load dynamic content into the sidebar of my cached pages. I was able to do it via jQuery/Ajax: I just load a .json file containing what I need, and then fill in the divs in my cached html page. Now the question is: so far, my json file is just a json.php file in the root of my wordpress installation, with a require_once('wp-load.php') in it. It works, but this is most probably not the right way to do it. What I would like is to put it somewhere where:   * It is correct to put it   * It can be displayed with a nice url (say blog.com/sidecontent.json)   * It can be cached by w3 total cache (and blown with custom rules) Or in other words: how can I create a custom .php file in my template, so that wordpress treats it like the others .php files in the template? Thank you very much, Nown UPDATE: Thanks to Toscho's answer, I was able to cook this plugin:               <?php # -*- coding: utf-8 -*-     /*     * Plugin Name: SidebarJson     * Description: ...     */     add_action( 'init',              'wpse_54583_sidebarjson' );     add_action( 'template_redirect', 'wpse_54583_sidebarjson' );     add_filter( 'request',           'wpse_54583_sidebarjson' );              function wpse_54583_sidebarjson( $vars = '' )     {         $hook = current_filter();              // load 'sidebarjson.php' from the current theme.         'template_redirect' === $hook             && locate_template( 'sidebarjson.php', TRUE, TRUE )             && exit;              // Add a rewrite rule.         'init' === $hook && add_rewrite_endpoint( 'sidebar.json');                // Make sure the variable is not empty.         'request' === $hook             && isset ( $vars['phpstyle'] )             && empty ( $vars['phpstyle'] )             && $vars['phpstyle'] = 'default';               return $vars;     }      I then activated it and visited the permalinks page to refresh the rules, as explained. Now, my /sidebar.json does show up correctly, but the slight drawback is that every single page of the website also displays the same json instead of the blog... I guess I did something wrong with the rewrite rule, but I cannot figure out why... Can somebody please help me?

body: I know how to program in PHP, but I don't know OOPS(Object Oriented Programming). Is it better to make themes in OOPS(Object Oriented Programming) or with normal coding? Is it better for performances, etc? Thank you!

body: I'd really love to be able to conditionally apply a CSS class to link elements of images embedded into posts, but I can't seem to figure this one out. Basically what I'd like to achieve is to replace the default embedded image link that links the image to the full size version of itself to opening it in a colorbox. I know I can achieve this with a bit of Javascript-trickery, but I'd love to figure out how to do this in the server side and then just attach the colorbox functionality in a straightforward manner. So, is there a filter I should add or what's the route to take here. Ideally I'd love to be able to write the code so that if a user embeds an image, the link opens the full size version in a colorbox but if the user specifies a custom link, it'll work like a regular link. This shouldn't be that hard. Thanks a lot for any help in advance!

body: I have a script that pulls the facebook likes via facebook graph and writes them in my DB. However it uses file_get_contents_curl for the request and this is causing problems, so I'd like to use the wp_remote_get() command. I've tried to change it but somehow I can't do it (I don't really have PHP knowledge). Here's the part of the script:               foreach($posts as $post)         {                  $fb = json_decode(file_get_contents_curl('http://graph.facebook.com/?id='.get_permalink($post->ID)));             if( !isset( $fb->likes) && isset($fb->shares) )             {                 $fb->likes = $fb->shares;             }             //$fb->likes = isset($fb->likes) ? $fb->likes : 0;             $myfblikes = sprintf("%04s", (int)$fb->likes);             update_post_meta($post->ID, 'fb_likes', $myfblikes);         }

body: I am inserting posts programmatically using wp_insert_post. A typical call would look like this:               $news_item = array (         'post_title' => $titleField,         'post_content' => $retrieve_result['content'],         'post_status' => 'pending',         'post_author' => $user->ID,         'post_type' => 'post',         'post_date_gmt' => $post_date_gmt     );          $post_id =  wp_insert_post( $news_item );      My question is about the parameter post_date_gmt, is this a correct use? Should I use post_date instead? What value is displayed on the screen? I need explanation of both. Documentation does not offer much. Thanks.

body: > **Possible Duplicate:**   >  Custom Taxonomy specific to a Custom Post type I have a custom Post type called " **Freebies** " which is displayed differently than rest of the posts (using **single-freebies.php** ). I also have a custom taxonomy called " **resources** " which contains different type of resources like " **icons** ", " **templates** " etc... All my posts in the post type are displayed at **www.example.com/freebies/post-name** every post in the custom post type has a resource attached to it. The goodies are also listed at **www.example.com/resources/resource-term** What I want to do is that the permalink post as **www.example.com/freebies/resource-term/post-name** resource-term is the resource to which the post belongs.... Till now I have figured out the following " **alternate** " methods   * **Alt. Method 1** \- (We are not using the custom post type in this method) Creating a category "freebies" so that the posts type will appear as **www.example.com/freebies/post-name** and using the resource taxonomy with a slug of freebies such that they are displayed at **www.example.com/freebies/resource-term** or for example **www.example.com/freebies/icons**. However this method will not involve creating the custom post type. This method works provided there is no post with post name same as the resource term to which it belongs otherwise there may be a conflict for instance **www.example.com/freebies/icons** where icons is the post name with resource same as icons.   * **Alt. Method 2** \- Making the slug of the custom post type and the custom taxonomy the same i.e. freebies. So the custom post type are displayed at **www.example.com/freebies/post-name** and the resources are displayed at **www.example.com/freebies/resource-name**.    * **Alt Method 3** \- Displaying the resources using **www.example.com/freebies/?resources=resource-name** and the freebies at **www.example.com/freebies/resource-name** using the same base or else cancel their display. We can also redirect **www.example.com/resources/resource-name** to **www.example.com/freebies/?resources=resource-name**.   * **Original Method** \- I know the process (iguess) but I dont know the htaccess rule for it.The process is as follows: Upgrading the the URL 1 level from **www.example.com/freebies/post-name** to **www.example.com/freebies/(resource-name to which the post belongs)/post-name**. I don't know whether dynamic HTACCESS rules exist for modifying and upgrading the URL according to the resource to which the post belongs. Please, suggest a way to achieve this...any other method is also highly appreciated.

body: I want to move all my content, posts and pics from Tumblr to Wordpress ..! What would be the best way to do this???

body:
I am trying to create a form that will allow users to update their information on the front end. I am just starting to learn PHP (I know C# very well). If I use this code to create a form on a WordPress page, how do I get the information from the user when they press the 'Update' button and then update the database?               function Insert_AccountTable_1()     {         $current_user = wp_get_current_user();              if ($current_user->ID != 0)         {             return <<<HTML                 <form class="AlumniForm" method="post">
Name

                             Username	                             $current_user->user_login	                             Usernames cannot be changed.

                             First Name	                             <input id="current_user_firstname" type="text" name="current_user_firstname" value="$current_user->user_firstname"/>

                             Last Name	                             <input id="current_user_lastname" name="current_user_lastname" type="text" value="$current_user->user_lastname"/>

                             Display Name(required)	                             <input id="current_user_displayname" type="text" value="$current_user->display_name"/>

Contact Info

                             E-mail(Required)	                             <input id="current_user_email" type="text" value="$current_user->user_email"/>

                             Website	                             <input id="current_user_email" type="text" value="$current_user->user_url"/>

                 <input type="submit" name="current_user_submitupdates">Update</input>                 </form>     HTML;         }         else         {             return <<<HTML
Error - User not logged in
     HTML;         }     }          add_shortcode('InsertAccountTableI', 'Insert_AccountTable_1');

body: I have a website with more than 50,000 posts. For SEO we use 'All in one SEO'. Unfortunately I have never written the META Title, META Description or META keywords for any of the posts. Now writing these META info for all the posts is a gigantic job. We have a specific solution in mind to update all the posts. To explain farther: If the heading of the post is: Bad Boy   * META title will be: Bad Boy   * META keyword will be: Bad Boy   * The META description will be: 1 2 3 4 5 6 Bad Boy 7 8 9 10. If the post category is : tree where '1 2 3 4 5 6' and '7 8 9 10' will be fixed values If the heading of the post is: Good Boy   * META title will be: Good Boy   * META keyword will be: Good Boy   * The META description will be: x y z m n Good Boy a v b o i. If the post category is : bee where 'x y z m n' and 'a v b o i' will be fixed values Can you give me the program snippet by inserting which, I can accomplish this?

body: Is it possible to rename the wp-admin folder? I know I could just rename it, but unless it's supported by the code lots of things would break. If I use a custom folder name, it will make it slightly more secure, security by obscurity and all that.

body: Is there an **easy to understand scheme** to decide what kind of code belongs to a plugin or the theme’s `functions.php`? There are many cases and many debates about that topic, mostly because there are some misconceptions about the inner workings of WordPress. I am asking for an answer based on facts, not on opinions. It should explain how to handle these points (and probably more):   * custom post types and taxonomies   * contact forms   * shortcodes   * custom widgets   * `add_theme_support( 'automatic-feed-links' );`   * SEO functions like custom `meta` elements   * theme switch There are often pros and cons for both sides. Our most popular question Best Collection of Code for your functions.php file got a lot of code snippets as answers that are at least debatable.   We need criteria a beginner can understand, maybe a check list – with reasons. See also the related question by Chip Bennett on our meta site: Questions specifically asking for a solution "without a plugin" Related: Where do I put the code snippets I found here or somewhere else on the web?

body: My site as of right now is a static website. I am planning on having a 'recent blog posts' section on it, with permalink to the main blog post/blog. example:               http://site.com/blog      I was wondering, because of having a recent blog posts section on the homepage, should I just have the entire website powered by WordPress and just add the homepage (and other pages, such as contact) as a word press 'page', and call recent blog posts on it? If I do it that way, am I still able to have the blog in `/blog`? I was also thinking of just adding the whole WordPress files to the /blog directory and call recent blog posts from the static file... I am new to Wordpress, so I am a bit confessed here. What is the best option?

body: If I write a private plugin, is there any way to use the WordPress auto-update mechanism to update it? I want to encapsulate the functionality, but it's specific to my own 5 or so blogs, so it's not a good candidate for the public plugins resource. But I love the easy-updating mechanism. Is there a way to do this?

body: I have this challenge, that i've found out that i'm not the only one in the WEB with the same issue, nevertheless, there are no solutions yet. I'm trying to remove shortcodes from my custom post types excerpts. here is my example: http://guidepaperback.com/city/new-century-hotel/ in sidebar there's the "in the neighborhood" widget that shows images with excerpts... some are showing this issue. Any tips? Thanks in advance

body: I'd like to attach files that aren't on the list of supported file types. In this case I'd like to upload files from the media manager that have the .RWP extension (which is used to package files in the Train Simulator 2012 game).

body: All I am using wordpress custom menu, and there is one menu as Logout. I know wordpress Logout function `<?php echo wp_logout_url(); ?>` But how can i use it in custom menu ?

body: Hi i'm using this code to call for a different stylesheet for a single post type but the problem is, It won't call the stylesheet. It's in header.php, i also tried placing it in single.php               <?php     if ( ! is_home() ) {          if ( is_single() == 'pretty-little-liars' )  {         echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-pll.css" type="text/css" media="screen" />';     }     }     ?>      can anyone tell me what the problem is?

body: I have this bit of php that calls a short code with the date of today in the format i need. `<?php $today = date('d.m');` `echo do_shortcode('[table id=1 column_widths="10%|10%|80%" filter="'.$today.'" /]'); ?>` I can put it in a page template and that works, but I would like to use it in a html/txt widget. How can I make a widget from the above?

body: I try to get the Picturefill solution described here running with the latest Wordpress install. One thing I wonder is the following. Would it be basically possible to only conditionally create image versions. Normally you have something like that in your functions.php:               add_image_size('res-small', 410, 9999);     add_image_size('res-medium',750, 9999);     add_image_size('res-large', 920, 9999);      But if you have different scenarios and constraints in one layout it might require more than 3 or 6 image versions (if you include the standard WP ones too)- e.g. 9 or even more. So would it be possible to conditionally create sets of images e.g. :               <?php     if($hook == x) {         add_image_size('bps1-small', 410, 9999);         add_image_size('bps1-medium',750, 9999);         add_image_size('bps1-large', 920, 9999);     }     else if ($hook ==y) {         add_image_size('bps2-small', 360, 9999);         add_image_size('bps2-middle', 520, 9999);         add_image_size('bps2-middle', 820, 9999);     }     else {         add_image_size('bp3-small', 220, 9999);         add_image_size('bp3-middle', 820, 9999);         add_image_size('bp3-large', 1200, 9999);     }     ?>      Would that basically work or does WP require to generate EVERY image size listed in the functions.php or is there an even more elegant way? Unfortunately I was unable to test it yet cuz i am out of ideas which would be a practical hook after which the if function could distinguish which set of images it should create. Any suggestions would be appreciated. Thanks a lot Ralf

body: I want to get a sidebar and save it in a Variable,   This is impossible with the get_sidebar function since it simply prints out   the sidebar, is there another function that I can use?

body: WordPress 3.5 changed the media management and now the Media Library edit screen uses the default post type UI. Taxonomies are very useful for WP installs with different users and attachments, giving more possibilities to find the attachment and/or add classification. I have seen Can I add a Category Metabox to attachment? on WPSE, but is not perfect to use with WP 3.5 and also have no information about the use of custom categories on attachments, not only the categories of posts. In short: is it possible to add custom category/tags to attachments to use in the Media Library with WP 3.5?

body: I want to make this blog COMPLETELY private, however because I am so illiterate in the manners of technology I am not positive how it could be done. I read a blog where they said to find the options on dashboard and I have, but I find the instructions very confusing. So could someone explain it in a detailed and simple way for me please?

body: WordPress keeps writing rewrite rules into .htaccess again and again till it causes an error and causes server to return 500 Internal server error... i.e. My .htaccess is a series of               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress     # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      repeated over and over and over again. By itself, that's not a massive problem (except that my .htaccess will grow to several MBs, slowing down the site significantly). But occasionally, there would appear some garbage in the .htaccess which takes the site down (500 Internal Server Error)

body: How can I add extra parameters after a permalink, specifically if I'm using a custom post type? For example, let's say `http://mysite/album/record-name` was the permalink. How can I make `http://mysite/album/record-name/related` not turn up a 404 or redirect? WordPress doesn't seem to call up the post template if the post doesn't exist... so I'm at a bit of a loss how to do this.

body: I have been looking for a solution to this, have seen some sort of add on called dynamic text but I don't think that suits my needs. Basically, I have a multi dimensional array. Basically what I want to do is pass a value from the array into the 'to' field in Contact Form 7. I know I could just write my own contact form but I'm using the plugin quite extensively on the site so for integration it would be nice to use it for this new thing I'm building too. Any clues, doesn't seem you can put php straight in to the to field, as this didn't work to well!:               <?php echo $passmein;?>

body: I am trying to do something similar to the above question. I am trying to make users post and upload images from front-end. I have already done the post form and its working. I just followed and tried the answer posted by Robin I Knight upload-post- thumbnail-from-the-front-end. Sadly i couldn't get it to work. Is there anything i'm suppose to change or edit? Thank you.

body: I have several custom post types, which are properly structured as `/%post_type%/%postname%/`, however I wish to have the same effect for regular blog entries: `/blog/%postname%/` If I prepend the permalink structure with `/blog/` it affects the custom post types as well, so currently my permalink structure is simply `/%postname%/` Which is the recommended way of doing this? I had a solution involving some rewrites, but the permalink shown in the post editor area does not reflect it.

body: This question might be wrong, I am not sure about it. Because I am not clear on this. I know `add_action` it is used to to hook our function to the specified function. For example `add_action('wp_head'.'myfunc');` now what ever code in `myfunc` will be executed in the `wp_head()`. This is clear but i am having doubt in `do_action` what it does? I think it is used to create our own hook like already available hooks(wp_head,wp_footer,..etc) If i am correct can anyone show me a simple understandable answer with simple example. I have tried the difference in internet but all are pointing to difference between add_action and add_filter. I don't want to go there because first i want to clarify this and then I’ll move there. Can anybody help me? **EDIT** after Question POST               function custom_register()     {         echo '<script>jQuery(document).ready(function(){alert("Learning Hooks");});</script>';          }     do_action('custom');          add_action('custom','custom_register');      I tried this in plugin but i didn't get the alert message. But when i hook the same function with `wp_head` then it is working fine               /******************working****************/     add_action('wp_head','custom_register');

body: I have this code for creating custom post type               add_action( 'init', 'create_sidebarone' );          function create_sidebarone() {         register_post_type( 'sidebarone',             array(                 'labels' => array(                     'name' => 'Sidebar One',                     'singular_name' => 'sidebarone',                     'add_new' => 'Add New',                     'add_new_item' => 'Add Sidebar One',                     'edit' => 'Edit',                     'edit_item' => 'Edit Sidebar One',                     'new_item' => 'New Sidebar One',                     'view' => 'View',                     'view_item' => 'View Sidebar One',                     'search_items' => 'Search Sidebar One',                     'not_found' => 'No Sidebar One found',                     'not_found_in_trash' => 'No Sidebar One found in Trash',                     'parent' => 'Parent Sidebar One'                 ),                 'public' => true,                 'menu_position' => 15,                 'supports' => array( 'title', 'editor', 'comments', 'thumbnail' ),                 'taxonomies' => array( '' ),                 'menu_icon' => get_template_directory_uri() . '/images/ggicon.png',                 'has_archive' => true             )         );     }      Now I want to achieve something to cater my needs, I want to create a custom admin screen or setting page for my custom post type, to be precise please refer to the image below: This is the illustration of the custom post type that i've created from the code above ![regular custom post type](http://i.stack.imgur.com/xJaz5.jpg) Now, I want to customize the admin screen or the setting screen of that post type, like the image below: ![enter image description here](http://i.stack.imgur.com/RGWL4.jpg) Now as you can see, the admin screen or the setting screen of that post type has been customize. (the second image is an assume of what im trying to achieve, image edited) So far, what i tried is the post type base from the first image from the codes above. Anyone, im open in any suggestion, recommendations and idea's. Very much thank you in advance.

body: My provider's database server recently had some downtime and my site was displaying the classic "Error establishing a database connection" message for about an hour. I knew what the problem was but realised it would be useful if I was able to replace that message with something a little friendlier (ideally a more verbose message contained within my site's template, so as not to scare users). My question is: are there any plugins that provide this functionality? Or does this error occur at too low a level for any plugins to be invoked? If so, I'll probably edit the WP core, but it would be nice to use something more pluggable. Many thanks, Biggs

body: > **Possible Duplicate:**   >  Update plugin from personal API I have seen wordpress sending alerts for the plugins those have upgrades available in the dashboard. this is done to the plugin hosted on the worpdress. But how we manage same alert notification system with the plugin that is not hosted on the wordpress. In other wordpress how paid plugins manage upgrade notification Thanks in advance

body: The situation is this: I'm using Video Thumbnails plugin to automatically get and set youtube/vimeo thumbnails as post featured image. The problem is that default youtube/vimeo thumbnail sizes are just a bit smaller than my theme main content width. So what I need is to scale them up. If I go to the Media Library, I can edit each image manually, then set my exact width and WordPress scales it up just right (I dont mind that the quality is a bit worse). So is there a way that WP would do that automatically each time an image is uploaded? This is my defined image size: `add_image_size('post-full', 688, 320, true);` Vimeo thumb size is 640x320.

body: **Note** _Use at your own risk, it is buggy and I have run across a couple instances where it would delete ALL attachments. Unsure why._ Is it possible to delete media associated with a page when that page is deleted? I know in the Insert Media page you can filter by images "Uploaded to this page" so could I get a list of those and just delete them as the page is being deleted? Right now I'm playing around with hooking into Delete Post. Right now... it does nothing but I think I'm getting somewhere with it.               function del_post_media($pid) {         $query = "DELETE FROM wp_postmeta                 WHERE ".$pid." IN                 (                 SELECT id                 FROM wp_posts                 WHERE post_type = 'attachment'                 )";         global $wpdb;         if ($wpdb->get_var($wpdb->prepare($query))) {             return $wpdb->query($wpdb->prepare($query));         }         return true;     }     add_action('delete_post', 'del_post_media');

body: I need to get the topmost term (top level ancestor) of a taxonomy term. Suppose the following term hierarchy:                   North America             United States                 New York                     New York City         South America              Mexico      I need to get the ID of "North America" term if I know the ID of "New York" I'm using an adapted function found on stackexchange and a few other places after searching Google. However, while using this function in my theme, the while loop turns out in a infinite loop for some reason, even if the $term_id and $taxonomy supplied are correct. Putting Wordpress in debug mode didn't help me to trace the issue. If I remove the while loop in the function, Wordpress restores to function properly (otherwise it hangs while outputting an infinite loop). However, I don't really how else I can get the topmost parent of a taxonomy term otherwise.               function get_term_top_most_parent( $term_id, $taxonomy ) {                  $child = get_term_by( 'id', $term_id, $taxonomy );                  if ( $child ) {                      $parent = get_term_by( 'id', $child->term_id, $taxonomy );                 $parent = $parent->parent;                      if ( $parent ) {                          while ( $parent != 0 ) :                              $parent = get_term_by( 'id', $parent, $taxonomy );                         $parent = $parent->parent;                          endwhile;                      }                      else {                               $parent = $child->term_id;                       }                      return $parent;                  }          }

body:
Hy, i make a slide for news, the question is how can i reduce the dathabase queries...ore how can i compress this code... http://s16.postimage.org/bswe0vrph/queries.jpg

     <?php     $recentPosts = new WP_Query();     $recentPosts->query(array(          'post_type' => 'stiri',         'showposts' => 1,         'offset'=>0,         'taxonomy' => 'stire',         'stire' => 'articole-speciale'         )     );     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>     <img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=50&w=80&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /><?php the_title(); ?>     <?php endwhile; ?>

     <?php     $recentPosts = new WP_Query();     $recentPosts->query(array(          'post_type' => 'stiri',         'showposts' => 1,         'offset'=>1,         'taxonomy' => 'stire',         'stire' => 'articole-speciale'         )     );     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>     <img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=50&w=80&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /><?php the_title(); ?>     <?php endwhile; ?>

     <?php     $recentPosts = new WP_Query();     $recentPosts->query(array(          'post_type' => 'stiri',         'showposts' => 1,         'offset'=>2,         'taxonomy' => 'stire',         'stire' => 'articole-speciale'         )     );     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>     <img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=50&w=80&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /><?php the_title(); ?>     <?php endwhile; ?>

     <?php     $recentPosts = new WP_Query();     $recentPosts->query(array(          'post_type' => 'stiri',         'showposts' => 1,         'offset'=>3,         'taxonomy' => 'stire',         'stire' => 'articole-speciale'         )     );     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>     <img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=50&w=80&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /><?php the_title(); ?>     <?php endwhile; ?>

     <?php     $recentPosts = new WP_Query();     $recentPosts->query(array(          'post_type' => 'stiri',         'showposts' => 1,         'offset'=>4,         'taxonomy' => 'stire',         'stire' => 'articole-speciale'         )     );     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>     <img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=50&w=80&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /><?php the_title(); ?>     <?php endwhile; ?>

             <?php             $recentPosts = new WP_Query();             $recentPosts->query(array(             'post_type' => 'stiri',            'showposts' => 1,            'taxonomy' => 'stire',            'stire' => 'articole-speciale'                     )                 );             ?>             <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>                 <a href="<?php the_permalink() ?>"><img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=325&w=664&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />

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

<?php $excerpt = get_the_excerpt();echo string_limit_words($excerpt,30);?><a class="detalii" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Stire %s'), the_title_attribute('echo=0')); ?>">...detalii

             <?php endwhile; ?>

             <?php             $recentPosts = new WP_Query();             $recentPosts->query(array(             'post_type' => 'stiri',            'showposts' => 1,            'offset'=>1,            'taxonomy' => 'stire',            'stire' => 'articole-speciale'                     )                 );             ?>             <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>                 <a href="<?php the_permalink() ?>"><img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=325&w=664&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />

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

<?php $excerpt = get_the_excerpt();echo string_limit_words($excerpt,30);?><a class="detalii" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Stire %s'), the_title_attribute('echo=0')); ?>">...detalii

             <?php endwhile; ?>

             <?php             $recentPosts = new WP_Query();             $recentPosts->query(array(             'post_type' => 'stiri',            'showposts' => 1,            'offset'=>2,            'taxonomy' => 'stire',            'stire' => 'articole-speciale'                     )                 );             ?>             <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>                 <a href="<?php the_permalink() ?>"><img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=325&w=664&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />

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

<?php $excerpt = get_the_excerpt();echo string_limit_words($excerpt,30);?><a class="detalii" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Stire %s'), the_title_attribute('echo=0')); ?>">...detalii

             <?php endwhile; ?>

             <?php             $recentPosts = new WP_Query();             $recentPosts->query(array(             'post_type' => 'stiri',            'showposts' => 1,            'offset'=>3,            'taxonomy' => 'stire',            'stire' => 'articole-speciale'                     )                 );             ?>             <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>                 <a href="<?php the_permalink() ?>"><img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=325&w=664&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />

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

<?php $excerpt = get_the_excerpt();echo string_limit_words($excerpt,30);?><a class="detalii" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Stire %s'), the_title_attribute('echo=0')); ?>">...detalii

             <?php endwhile; ?>

             <?php             $recentPosts = new WP_Query();             $recentPosts->query(array(             'post_type' => 'stiri',            'showposts' => 1,            'offset'=>4,            'taxonomy' => 'stire',            'stire' => 'articole-speciale'                     )                 );             ?>             <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>                 <a href="<?php the_permalink() ?>"><img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=325&w=664&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />

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

<?php $excerpt = get_the_excerpt();echo string_limit_words($excerpt,30);?><a class="detalii" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Stire %s'), the_title_attribute('echo=0')); ?>">...detalii

             <?php endwhile; ?>

body: I'm currently redesigning a site that has 700+ posts, divided into about 150 different categories. Some categories have 2 posts in them, other categories have 70. Now for every category, I want to add a tag to all the posts in that category. Does anybody know if there is a way to automatically add a specific tag to all the posts in a category? Or is the only way going through all the posts individually and adding a tag to each one, one by one? Any help much appreciated!

body: I've found several similar question but none of them explains why the below is giving me nothing with ASC order. It works with DESC. Basically it's a query that should list posts where the custom field values are equal or greater to the current date, then arrange it in reversed order, so the first post should be a post that's custom field are the closest the the current date.               <?php query_posts($query_string . '&showposts=4&order=ASC&post_type=custompost&meta_key=mydate&orderby=meta_value'); ?>         <?php if (have_posts()) : ?>         <?php while (have_posts()) : the_post(); ?>                  <?php $todays_date = date("Y/m/j"); ?>             <?php $today = strtotime($todays_date); ?>             <?php $exp_date = get_post_meta('mydate'); ?>             <?php $expiration_date = strtotime($exp_date); ?>             <?php if ($expiration_date >= $today) { ?>                      <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>              <?php } else { ?>         <?php };?>          <?php endwhile; ?>     <?php else : ?>     <?php endif; ?>       Also, I've tried many different queries but none of them worked, the above script is the latest I have.

body: > **Possible Duplicate:**   >  Linking Two Post Types I have a post type, referred to as "Press Release" and another called "People". I need to be able to connect the two together. MY end goal is to have a drop down of "People" post types within the "Press Release" post type that allows you to select an author. Is there a way to create relational post types and am I using that term correctly?

body: I have following links in content.php and i want to display in specific page with condition. Any ideas or suggestions? Thanks.   * Home   * Director’s speech   * Projects   * Our Vision   * Volunteers   * Inquiry

body: > **Possible Duplicate:**   >  Create more Meta Boxes as needed I’m having a hard time to write an efficient code for the below Metabox. Since I **do not** want to use any third-party class, I’m trying to do it by myself, but so far no luck. ![enter image description here](http://i.stack.imgur.com/Ka0dW.png) Could you show me an efficient way to create the Metabox as above? Number of sets and fields could be 3 or 10, so it should be flexible.

body: Is it at all possible to detect the list of plugins used on a WP site. Also, beyond my initial hunch, how can confirm for fact that a blog is indeed powered by WP?

body: I wanted to link images in a gallery to a custom URL. I know I could add an extra field and do it this way I found this ticket on Trac, though, that modifies the "Link URL" field to accept custom links. I like how that works and I'd like to make that work. Trouble is, I can't seem to figure out how to access the data. I'm using get_children to create an array to loop through. The Link URL is not included in the results. I've tried get_attachment_link - the trouble is, it doesn't just pull it from the field, the function generates the link itself. Any ideas? Thanks!

body: I'm coding a theme that uses the Twitter Bootstrap 3 files and in the header I want to include:               <!--[if lt IE 9]>      <script src="<?php echo get_stylesheet_directory_uri(); ?>/js/html5shiv.js"></script>       <script src="<?php echo get_stylesheet_directory_uri(); ?>/js/respond.min.js"></script>     <![endif]-->      I've been told by a theme reviewer that I can't put it in the header file (only one js is allowed). > Required: Theme can include only one JS within header.php, please enqueue > the additional > respond.min.js using the hook wp_enqueue_scripts in > functions.php as it is I have to enqueue it, but I don't know how to do this in a way that put's it in the "if it IE 9" statement. Please could someone help me? Thanks

body: If I have a store that offers flat rate shipping of `$10` and free shipping for orders over $100 and a customer orders over `$100` it doesn't make much sense for them to have to see both `free shipping` and `flat rate shipping` on the checkout page. Why would a user even choose `flat rate shipping`? How can I use a filter to detect if `free shipping` is available, filter the `flat rate shipping` label so it says something like `flat rate shipping (free)`, and then disable the `free shipping` method. The end result is that if a user orders less than `$100` they see `flat rate shipping $10` and if they order over `$100` they see `flat rate shipping (free!)`.

body: I think there used to be an out-dated plugin to do this. Is there any way to do this easily with just a little code? We prefer not to rely on a plugin since that makes us dependent on the developer to keep it up-to-date. We only have two parent categories we would like to remove for all of their child-category permalinks: "items" and "genres" (so it could be tailored to just removing two category IDs) I see that there was a solution with the individual posts here, but I don't think this works with the category permalinks as well, does it ?

body:
If I have a loop running from a category query like :               <?php $the_query = new WP_Query('cat=1&showposts=50&orderby=title&order=asc');?>
     <?php while ($the_query->have_posts()) : $the_query->the_post();?>
..
<?php wp_reset_query(); ?>     <?php endwhile; ?>
      How would I create an if clause that breaks the list at a certain interval, and starts a new one. So for example at the 10th post, return a `</ul>` and start a new one `<ul>` at 11. This is incorrect but to illustrate my objective:               <?php $count =0;         while($count <=50){             if ($count == 9){                 echo "
<a href='<?php the_permalink(); ?>'>                           <?php the_title(); ?>

";                 }              elseif ($count == 10){             echo "

<a href='<?php the_permalink(); ?>'>                               <?php the_title(); ?>
";             }             else {             echo "
<a href='<?php the_permalink(); ?>'><?php the_title(); ?>
";             }      What is the correct way to include this logic into the loop?

body: I'm having a problem I've never seen before. In a very new WordPress install, I uploaded a theme I had been working on for a friend's restaurant: CornerPocketPub.com The problem, as you can see, is that the jquery plugins for the homepage (.cycle) and the menu page (.easyAccordion) aren't being recognized as functions in Firebug. Now, I've been looking all around for answers, but I can't seem to get a solution that works for me. Please help, and thank you in advance for help and advice!