Closest thing to an is_widget() tag?

I have a custom widget with a WP_Query loop that's using `get_template_part()` to include some standard information that I also use in theme files. However, I need to make one small change to the widget's output that differs from the template file I grab with `get_template_part()`. I know I could copy the template file and modify it, but then I have to maintain two sets of that code. What I'd prefer is something like an `is_widget()` check that I could use like:               if( !is_widget() ) {         // include an extra goody     }      I know there is no `is_widget()`, but is there some other WordPress thing I can look for?


Wrap Post count in a span

I'm using this code:               $args = array(                 'hide_empty' => FALSE,                 'title_li'=> __( '' ),                 'show_count'=> 1,             );             wp_list_categories($args);      How can i wrap the post count in a span for further styling? Thanks


Show Post Excerpt in Image Attachement

I want to show excerpt from the post in the below image attachment, here's my code               <?php     /**      * Image Template      *      * Displays singular WordPress Media Library items.      *      * @package Thematic      * @subpackage Templates      *      * @link http://codex.wordpress.org/Using_Image_and_File_Attachments Codex:Using Attachments      */              // calling the header.php         get_header();              // action hook for placing content above #container         thematic_abovecontainer();         ?>
                  <?php             // action hook for placing content above #content             thematic_abovecontent();                  // filter for manipulating the element that wraps the content              echo apply_filters('thematic_open_id_content', '
' . "\n\n");                  // start the loop             while (have_posts()) : the_post();                      // action hook for placing content above #post                 thematic_abovepost();                 ?>                      <?php                 // creating the post header                 thematic_postheader();                 ?>                 <?php include 'share.php'; ?>

Posted In: <a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?>

                         <?php                         $parent = $post->post_parent;                         $attachments = array_values(get_children(array('post_parent' => $post->post_parent, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'DESC', 'orderby' => 'ID')));                              foreach ($attachments as $k => $attachment)                             if ($attachment->ID == $post->ID)                                 break;                              $next = $k + 1;                         $prev = $k - 1;                         $next_link = "";                         $prev_link = "";                              if (isset($attachments[$next])) {                             $next_exists = 1;                             $next_link = "ID) . "'> Next Photo >>";                             $img_link = "ID) . "'>";                         }                              if (isset($attachments[$prev])) {                             $prev_exists = 1;                             $prev_link = "ID) . "'> << Previous Photo";                             if (!$next_exists) {                                 $img_link = "ID) . "'>";                             }                         }                              if (!$next_exists and !$prev_exists) {                             $img_link = "ID) . "'>";                         }                         ?>
<?php echo $img_link;                     echo wp_get_attachment_image($post->ID, 'full'); ?>

<?php if (!empty($post->post_excerpt)) the_excerpt(); ?>

<?php echo $prev_link ?>

<?php echo $next_link ?>

             <?php             $post_parent = get_post($post->ID, ARRAY_A);             $parent = $post_parent['post_parent'];                  $attachments = get_children("post_parent=$parent&post_type=attachment&post_mime_type=image&orderby=menu_order DESC, ID ASC");             foreach ($attachments as $id => $attachment) :                 echo wp_get_attachment_link($id, 'thumbnail', true);             endforeach;             ?>

<a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment">Read Full Gossip Here >>

                  <?php             // creating the post footer             thematic_postfooter();             ?>
                          <?php                     // action hook for placing contentbelow #post                     thematic_belowpost();                          // action hook for calling the comments_template                     thematic_comments_template();                      // end loop                 endwhile;                 ?>
                  <?php             // action hook for placing content below #content             thematic_belowcontent();             ?>
              <?php         // action hook for placing content below #container         thematic_belowcontainer();              // calling the standard sidebar          thematic_sidebar();              // calling footer.php         get_footer();     ?>


Comments offset

I need to display comments starting from the second, omitting the first. With posts I did it using "offset" but I can't find anything similar for comments. Since I'm using threaded comments, must start from the second comment that is not a child (only parent comments). I'm using wp_list_comments with a callback. EDIT2: this is actual comments.php code, after replies:                     <?php      $i = 2;     if ( have_comments() ) :      if ( $i > 1 ) :     ?>
         <h3 id="comments-title" class="color-<?php $category = get_the_category(); echo $category[0]->cat_name;?>">
                   <?php                global $wp_query;           $comments_arr = $wp_query->comments;           $comments_arr = sort( $comments_arr);           $comments_arr = array_pop( $comments_arr );          $comments_arr = usort($comment_arr, 'comment_comparator');                           wp_list_comments('callback=gtcn_basic_callback', $comments_arr);               ?>                   <?php         $i++; // count up         endif; // If $i > 1         else : if ( ! comments_open() ) : ?>
<?php _e( 'Comments are closed.' ); ?>
              <?php            endif; // end ! comments_open()      endif; // end have_comments()  ?>
     <?php comment_form(); ?>      Result: comments are not anymore ordered by karma (comment_comparator function) and the first comment (comment with top karma that I want to hide) is still displayed.


Most liked page not displaying posts

I was looking for a post rating system for a while, then I stumbled across a great tutorial: http://wp.tutsplus.com/tutorials/how-to-create-a-simple-post-rating-system- with-wordpress-and-jquery/ I have it working (well, its recording clicks ok), but I cannot seem to get a "most liked" page. The tutorial said to use the following code, so made a page, but nothing appears (apart from logo, nav, footer etc)                   <?php     /*     Template Name: Top Rated     */     ?>     <?php get_header(); ?>              <?php query_posts('meta_key=votes_count&orderby=meta_value_num&order=DESC&posts_per_page=10'); ?>                <?php get_sidebar(); ?>          <?php get_footer(); ?>      Can anybody point me in the right direction? Thanks EDIT: Thanks rizqy22, here is how the index displays posts:               `<a href="<?php the_permalink(); ?>"class="img_hover_trans"><?php the_post_thumbnail('featured-small'); ?></a>           <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>`      EDIT2: Made more progress, got the thumb, title etc displaying using the following code (just incase anybody else searches and finds my ramblings) `<?php query_posts('meta_key=votes_count&orderby=meta_value_num&order=DESC&posts_per_page=10'); if (have_posts()) : while (have_posts()) : the_post(); ?> <a href="<?php the_permalink(); ?>"class="img_hover_trans"><?php the_post_thumbnail('featured-small'); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
 <?php endwhile; endif; wp_reset_query(); ?>`


WP plugin repository didn't parse readme.txt correctly

I just added a plugin on WP repository but it seems like my readme.txt wasn't parsed correctly. I even ran it through the validator but on the plugin page it shows `Description` text under all tabs - `Installation, Changelog, FAQ` Plugin - http://wordpress.org/extend/plugins/facebook-like-thumbnail/ Readme.txt - http://plugins.svn.wordpress.org/facebook-like- thumbnail/tags/0.1/readme.txt So did I do something wrong? Or readme file parser is to blame?


What are the Theme tags in style.css used for?

In the style.css file in the first comment block, there is a optional "Tags:" directive. What are these tags used for? When are they used?


Aggregate comments, with pagination

I want to build a page that would display _all comments_ , regardless of which post they're attached to. I also want that page to be paginated, since it'll potentially have 10,000+ comments. * * * I'm not sure how to go about it, but here are some of the functions I've studied so far:   1. `get_comments` \- If no `post_id` is passed in, it'll return all comments. However, I don't see a way to paginate these (there are `offset` and `number` options to fiddle with, but that's _very_ tedious to do manually).   2. `wp_list_comments` \- The documentation on this is pretty bad, but the source code suggests that we can loop over all comments if used in conjunction with `get_comments`, by passing in the `get_comments` array as a second argument. This however would still use `get_comments` to actually... well, get the comments, and there seems to be no way to paginate that.   3. `previous_comments_link` & `next_comments_link` \- These seem to only work in conjunction with `wp_list_comments` (with no second argument).   4. `paginate_comments_links` \- Also looks like it only works with `wp_list_comments` (with no second argument). * * * # What I've tried:   1. Simply using the `number` argument in `get_comments`:              $comments = get_comments(array(         'status'    => 'approve',         'number'    => '2'     ));          wp_list_comments(array(         'callback' => 'my_rendering_function'     ), $comments);          paginate_comments_links();      This does not display any pagination links.   2. The method suggested here: Display latest comments on page with pagination              $comments = get_comments(array(         'status' => 'approve'     ));          wp_list_comments('per_page=2', $comments);          paginate_comments_links();      This doesn't either work (it shows the first 2 comments, but no pagination). Also, I cringe at `get_comments` loading _all_ comments into memory. * * * # Question: How can I paginate _all_ comments? * * * **P.S.** I'm using WordPress 3.4.1 & PHP 5.3.2.


Performance problem with first load

I'm just trying to create my blog in WordPress hosted on my GoDaddy account (Windows Deluxe plan). WordPress is installed as subsite. When I check my blog after several hours of inactivity I have to wait more than 10 seconds before site opens. I checked it in Firebug and there is 10+ seconds delay between sending request and receiving response. I guess it has something to do with loading the application in IIS. Unfortunatelly I haven't found any setting in GoDaddy's management console to keep the site running. How to deal with this problem? Is there any trick to register my site somewhere and let it regulary check my site? I expect rare traffic to my blog so it would be pretty annoying for visitors to wait for each visit. **Edit:** This is not a problem of caching or too many plugins (my blog currently have one short post, one short page and All in one SEO plugin, nothing more). It is problem of slow response especially for the first call after long inactivity. Unfortunatelly Windows hosting does not offer Cron jobs. That is the reason why I'm looking for some additional service to regulary check my site. But anyway GoDaddy looks like pretty bad choice. It was recommended to me and I liked the idea of Windows multi site hosting because I can host several apps there including .NET ones. The hosting itself and management tools look pretty good. But by simply checking the response I see that there is delay 1,5+ seconds for almost any request. If I access my test blog hosted directly at Wordpress the delay is 300ms.


Target a specific category from a custom taxonomy?

I am trying to target a specific category from a custom taxonomy. This is for WooCommerce. So, the custom taxonomy is called "product_cat" and the category itself is called "adult-dvds". This is what I tried; however, it didn't work (nothing shows up between the comment tags):                            <?php if (is_tax('product_cat','adult-dvds')) { ?>
blah blah blah
         <?php } ?>               Is there something I missed?


Problem: Create a cron job to export posts to a WordPress XML file on server

I need a way to automatically export all WordPress posts from a specific date and have it output the file on the server that can be downloaded daily. The reason the XML format is needed is because the site is part of a large network of blogs and the parent site does not use WordPress but indexes the content in its search results. The parent company uses an XML parser that can't handle increments. It needs the full content of posts all at one time. My approach is to create a cron job using `wp_schedule_event` that fires export_wp and outputs the buffers into a file. The problem is that the file created is empty. My current code is:               register_activation_hook(__FILE__, 'c3m_my_activation');     add_action('c3m_export_daily', 'c3m_export_xml');          function c3m_my_activation() {         wp_schedule_event(time(), 'daily', 'c3m_export_daily');     }          function c3m_export_xml() {         $ob_file = fopen('server_path_to_my_file.xml','w');              $args=array(             'content' => 'posts',             'start_date' => 'october 2008',             'status' => 'published');                  function ob_file_callback($buffer)             {               global $ob_file;               fwrite($ob_file,$buffer);             }              ob_start('ob_file_callback');         export_wp($args);              ob_end_flush();     }      I have also tried it without adding any $args to export_wp but the file is still empty. I'm hoping this can be accomplished with export_wp so the whole thing doesn't have to be written from scratch.


Removing Line Break Tags from a Page

I am running the latest version of Wordpress on the Genesis Framework with the AgentPress theme. There is an annoying four line gap between the page title and the Wordpress Post Tab widget that I have installed. Using Firebug, I discovered that the gap is caused by four line break tags < br > , which seem to be automatically generated since I did not include them in the text editor. ![enter image description here](http://i.stack.imgur.com/KckUV.png)


Why won't wp_mail() let me set the From: header when plain old PHP mail() will?

When I use wp_mail( $to, $subject, $message, $headers ) (with values in place, of course), the email gets sent with a from name and email that isn't set anywhere I can find (not even in PHP or Apache settings). However, using mail( $to, $subject, $message, $headers ) instead works just fine. What could be happening with wp_mail() to cause this?


Is there a way to disable the sticky posts feature?

I want to turn this off as I have a custom ordering process using custom fields.


remove theme's name from dashboard .. How?

How are you every body how can remove name of theme in dashboard .. please .. ![enter image description here](http://i.stack.imgur.com/OCQZW.jpg) You are using K2 RC-8 theme with 10 widgets. how can remove 'K2 RC-8 theme' .. please


Home page is getting current-menu-item even if it's not home

After upgrading to 3.1 I am seeing this issue. I use custom post types and when you click on the menu items either Games, Entertainment or Tech it gets the class current-menu-item but home link still has it also. I am using the custom menu's built into WordPress and for the links and they are just custom links pointing to:   * Home: http://www.flesheatingzipper.com   * Games: http://www.flesheatingzipper.com/games/   * Entertainment: http://www.flesheatingzipper.com/entertainment/   * Tech: http://www.flesheatingzipper.com/tech/   * About: Links to page, about Here is the site: http://www.flesheatingzipper.com/


Why is my custom sidebar always open on the widgets screen in Admin?

I've created a custom sidebar with this code in my theme's functions.php:               register_sidebar(array(             'name' => __('Article - Below Content'),             'id' => 'zg-article-footer',             'description' => 'Use this sidebar to place widgets that will appear directly underneath the Article'         ));      When I navigate to Appearance > Widgets in my Admin, this sidebar is always the first one on the top of my list of sidebars, and it's always "open" (that is, you can see the description and the list of widgets attached to it). None of my other sidebars are open, and WP Admin doesn't seem to remember my last- opened sidebar. Is there an argument I should use when registering the sidebar that will tell it to default to closed? Or is there an option somewhere else entirely?


How to get the order attribute of a page

As we know we can sort pages in a query by their page order attribute, I can't figure out how to get this number to use it for a conditional and the max number listed Thanks,


Adjust which tempalte a page uses with a function?

I know if I had a page that had a permalink such as `/stories/` then I could create a page in my template called `page-stores.php` and it would load in place of the default `page.php` when that page loaded (see Template Hierarchy) What I want to know is if I had that two page templates, maybe `page.php` and `page2.php`, if I could use the `functions.php` file to specify that if a page had a permalink of `/stories/` it would use `page2.php`? I know there is an option when editing a page to let the end user choose the page template, but in this case I would like to set it specifically.


Make first letter of my taxonomy uppercase

I'm using               echo get_the_term_list( $post->ID, 'trpropcity', '', ' ', '' );      to show a taxonomy link, I'd like to make this instance of it only have the first letter capitalized, Cleveland not CLEVELAND, I realize I could just change the taxonomy, but I actually want it all caps everywhere else on the site, so I figured it would be best to just change it once. I've been playing with ucwords and strtolower but haven't had any success yet.


Count the posts number for every category

I'd like to count the number of posts created for every category, so:               12 Works (12 posts in works category)     36 Pictures (36 posts in pictures category)     17 Furnitures (17 posts in furnitures category)      How can I do that?


Custom Taxonomy back-end customizations

Using a hierarchal custom taxonomy associated with a custom post type, I need: (1) To change the admin meta-box to a drop-down menu to make sure the post has only one term associated. The drop-down menu should show just the latest children terms, so let us say, for example, I have those two hierarchical terms:   * **Zone X**    \--> **Package X** (Zone X's child)   \----> **District X** (Package X's child)        * **Zone Y**    \--> **Package Y** (Zone Y's child)   \----> **District Y** (Package Y's child) I want the drop-down to show only the latest children: **District X** and **District Y**. (2) To automatically select all parents of a selected child term when saving the post. So, let us say the user chose **District Y** in my previous example, then both **Package Y** and **Zone Y** should be selected as well, behind the scenes. Could anyone help me with that please, or point me out to any helpful reference?   Thanks in advanced,


Wordpress wp_head() crap

I know, wp_head() is important, but it inject so much crap into the header, i like to get it out... and just add manually the 2-3 line of code i need.. BUT, and there is always a but, i need the wordpress auto-generated code for :               <meta name="description" content="" />     <meta name="keywords" content="" />     <link rel='canonical' href='http://jlecologia.com/cms/' /> (why not!)     and     <meta http-equiv="Content-Language" content="fr-FR" />      How i can ask for the generation of that... ???? something like : bloginfo('name') will be fine for me Thanks


Creating a default Custom Post Template that a Theme can override

I'm in the midst of building a Wordpress Plugin that adds a custom post type, for which I'd like to include a default template to display. Essentially, this is an event management plugin, and the custom post type is for the Events. There's a handful of custom meta fields, as well as a child post type (Performances), so without a default template to display them, using it would be pretty unfriendly. But I would like theme designers to be able to create their own templates for these post types if desired. Is there a way to use the the template provided with my plugin unless the theme provides its own template? What's the best practice for doing so? **Edit:** Following the advice of Peter Rowell, I caught the template_redirect action and, if the post type was one of mine and a template for it did not exist in the current theme, defaulted to the plugin's template:               class FestivityTemplates {            public static function determineTemplate(){         global $post;         $standard_type = strpos($post->post_type, 'fest_');              if(is_single() && $standard_type !== false) {           FestivityTemplates::loadSingleTemplate($post);         }       }            private static function loadSingleTemplate($post) {         $template_name = 'single-'.$post->post_type.'.php';         $template = locate_template(array($template_name), true);         if(empty($template)) {           include(WP_PLUGIN_DIR . '/Festivity/lib/templates/' . $template_name);           exit();         }       }     }          add_action('template_redirect', array('FestivityTemplates', 'determineTemplate'));


Shopping Cart Integration -- Experiences with Popular eCommerce Solutions

Researching various shopping cart solutions for a WordPress based eCommerce website. Based on research, it seems that two plugins stand out:   * shopplugin.net    * phpurchase.com Can anyone share their experiences with these or offer some good alternatives? The list of requirements is too long to include here, but the store will be shipping goods (not digital products) and the ability to have a robust marketing/promotional campaign integrated into the shopping experience is important, as is financial reporting. Product recommendations, coupons, sale prices/discounts, email marketing and a customer database would all be nice features to have. I don't like WP-ecommerce or most of the other free options and the budget for software is as much as $1,000 (alternatively looking at shopify.com, a non-WP product). Thanks in advance!


how to add three default images to wordpress?

how to add three default images to wordpress **custom background**? ![enter image description here](http://i.stack.imgur.com/fNCQ4.jpg) now, i want to add three default images which can be selected one by the user.and it locates on the **upload Image** part.like this: the default background image: ![enter image description here](http://i.stack.imgur.com/CMlwd.jpg) how do i do thank you.


How to set classname for <li> tag in wordpress menu?

I am using.               <?php wp_nav_menu($args); ?>      for get menu from wordpress.it returns the menus with `<ul>` and `<li>` structure. In that i need to set class name for every `<li>` tag uniquely. thanks ravi


Add Class to Tag Cloud Links and Change Terminology

Is there a way to use functions.php to add a class name to all the tag cloud links? This topic does what I need, but it's not through the functions.php file. I was also hoping to change the tag cloud terminology from "2 topics" to "2 posts" for the title tag. Thank you!


How to get list of Scripts in Order of Dependencies

I was writing plugin for combining JS and CSS as three plugins I tried has not worked for me. Dependency problem is where I stopped. It look tough. Then I thought Wordpress can itself help. How to get list of files in order of dependencies? Is there any WP method for this? Can I use WP_dependency class externally? How? I am able to filter script files according to Header and Footer.


foreach loop displaying below content summary

I am trying to wrap my result with `<li>`, but when I do so as in the code, I get funny results, as the result display way below.               do_action( 'woocommerce_after_shop_loop_item' );     $value = get_the_terms( $product->id, 'pa_package');          foreach ( $value as $values ) {         echo "<li>";         echo $values->name;         echo "</li>";     }


Get All post that is in table

I have table that save in it the user id and post id. Now in some page i need to show all post for user_id (1) for example. how can i display all post that user_id is 1


Wordpress widget value not save?

all Now i create a widget plugin, here i have problem the checkbox problem, dont have save the value, then i search form Net, and found the answer, but now i dont have understand the means of `(bool)`.                       <label for="<?php echo $this->get_field_id( 'post_date' ); ?>">         <input class="checkbox" type="checkbox" name="<?php echo $this->get_field_name( 'post_date' ); ?>" id="<?php echo $this->get_field_id( 'post_date' ); ?>"  <?php checked( (bool) $instance['post_date'], true ); ?> />         <?php _e( 'Show post date' ); ?>       </label>


How to show only the most recent post on my custom post type archive?

I have registered a custom post type and inside my `archive-myCPT.php` I want to retrieve just the current published post. Here is a relevant snippet from my `archive-myCPT.php`:               <?php               if( have_posts() ){             $x = 1;             while ( have_posts() ){                 the_post();                  if ( 0 === (int) $post->post_parent ) {                     get_template_part( 'inc/post-format/content-debate');                 }      I've tried adding this : `query_posts('posts_per_page=1&order=DESC&orderby=date')` before the `if( have_posts() ){` but I'm getting the last post from the default blog posts not from my CPT and also it adds also a pagination. How can I retrieve **just** the most recent published post inside my CPT without the pagination?


Why on Earth am I getting "undefined_index" errors?

Right, I'm banging my head against a wall here. I'm sure it's something incredibly simple but I keep getting undefined index errors on all of these variables.               function meta_genus_species() {         global $post;              if (isset($post)) {             $custom = get_post_custom($post->ID);         }              if (isset($custom)) {             $genus = $custom["genus"][0];             $species = $custom["species"][0];             $etymology = $custom["etymology"][0];             $family = $custom["family"][0];             $common_names = $custom["common_names"][0];         }              ?>     Genus:     <input name="genus" value="<?php if(isset($genus)) { echo $genus; } ?>" />     Species:     <input name="species" value="<?php if(isset($species)) { echo $species; } ?>" />
Etymology:
     <textarea cols="50" rows="5" name="etymology"><?php if(isset($etymology)) { echo $etymology; } ?></textarea>
     Family:     <input name="family" value="<?php if(isset($family)) { echo $family; } ?>" />     Common Names:     <input name="common_names" value="<?php if(isset($common_names)) { echo $common_names; } ?>" />         <?php     }      I get this for every variable: > Notice: Undefined index: genus in [...]sf-species-profiles.php on line 207 Any ideas?


How to Clean Options Which is Not in Use from WordPress Options Table?

I first time reached here /wp-admin/options.php in admin panel and not a surprise that there are so many options came from various plugins. Many plugins I am not using today. How can I delete those unused option entries? Also, it there any performance impact of those living in my options table? Just few entries itself can live easily in DB!


Setting Post Date Returning "Notice: A non well formed numeric value encountered"

I am using `wp_insert_post` to create post. While executing that function, I also set post date to schedule the post publish date using some variables. Here is the part of my code:               //Intervals     $intsecond = (isset($_POST['awpht_time_second'])) ? $_POST['awpht_time_second'] : 0;     $intminute = (isset($_POST['awpht_time_minute'])) ? $_POST['awpht_time_minute'] : 0;     $inthour = (isset($_POST['awpht_time_hour'])) ? $_POST['awpht_time_hour'] : 0;     $intday = (isset($_POST['awpht_time_day'])) ? $_POST['awpht_time_day'] : 0;     $intmonth = (isset($_POST['awpht_time_month'])) ? $_POST['awpht_time_month'] : 0;     $intyear = (isset($_POST['awpht_time_year'])) ? $_POST['awpht_time_year'] : 0;          // Blog Local Time that can be splitted          $base_year = date('Y', current_time( 'timestamp') );     $base_month = date('m', current_time( 'timestamp') );     $base_day = date('d', current_time( 'timestamp') );     $base_hour = date('H', current_time( 'timestamp') );     $base_minute = date('i', current_time( 'timestamp' ) );     $base_second = date('s', current_time( 'timestamp') );          for($i=0; $i<10; $i++ ) {          $awyear = ($i * $intyear) + $base_year;     $awmonth = ($i * $intmonth) + $base_month;     $awday = ($i * $intday) + $base_day;     $awhour = ($i * $inthour) + $base_hour;     $awminute = ($i * $intminute) + $base_minute;     $awsecond = ($i * $intsecond) + $base_second;          $postdate = date($awyear.'-'.$awmonth.'-'.$awday.' '.$awhour.':'.$awminute.':'.$awsecond);               //Check If Post Already Exist/ Prevent Duplicates     if (!get_page_by_title($awpharritle[$i], 'OBJECT', 'post')){          $awpht_the_posts[$i] = array(       'post_title'    => $awpharritle[$i],       'post_content'  => $awpht_content{$i},       'post_date'     => $postdate,       'post_status'   => 'publish',       'post_author'   => 1,     );          // Insert the post into the database     $awpht_post_id = wp_insert_post( $awpht_the_posts[$i]);     }      Each time that code is executed, it always returning a notice:               Notice: A non well formed numeric value encountered in C:\xampp\htdocs\wordpress\wp-includes\functions.php on line 4028       What's wrong with the codes above and is there any other way/s to programmatically mass schedule post based on custom interval? Please don't suggest me a plugin. Best Regards


How to get comments from multiple post type?

How can I get comments from multiple post type? I want to display 5 comments from my different post types pages.               <?php           $defaults = array(         'number' => 5,         'post_type' => array('post','authors','movies')     );     $comments = get_comments($defaults);      ?>


Conditional On custom field plugin metabox

I've trying to run a conditional on the custom field I made with the Custom Fields plugin, I made a true and false check box. I just need to check if the box is true or false really. I've tried something like this but the word hello appears even when the               <?php         $premium = get_field('premium');         if ( !isset($premium)) {             echo 'hello';         }     ?>      Basically I've trying to change the page layout if this is ticked. I'm sure this is quite easy. Thanks for any input


Can't open Custom Post Types Link in navigation

I have a problem with the archives permalinks of custom post types: They won't open by clicking on the links in the header navigation. I am able to open the link directly in the browser by typing the url duftfaktor.de/wp/parfuemchecks. The page uses my template called archives- customposttype.php. But the link doesn't open, when I click on it in the header navigation that also uses the direct link duftfaktor.de/wp/parfuemchecks. I am not sure if it is a problem with wordpress or my own html/css style. What could be important is that I am using a z-index on the navigation area. I appreciate any help! Here is the code: The Navigation has to parts. 1) A horizontal menu when entering the page 2) A fixed menu that appears after a certain amount of scrolled pixels
                 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">                                                                    </button>

              <?php //wp_nav_menu(); ?>
Parfümchecks

Parfümwissen

Über Duftfaktor

<?php get_search_form(); ?>

             <?php //wp_nav_menu(); ?>
Parfümchecks

Parfümwissen

Über Duftfaktor

<?php get_search_form(); ?>


multiple values in an array for category__and does not work with WP_Query

So I'm looping with WP_Query and here is my code:               $country_posts = new WP_Query(get_direct_children($continent_cats));     if ($country_posts->have_posts())  : while ($country_posts->have_posts()) : $country_posts->the_post();      the get_direct_children function:               function get_direct_children($cat_name) {             if (gettype($cat_name) == 'string') : $category_id = get_cat_ID($cat_name);             elseif (gettype($cat_name) == 'integer') : $category_id = $cat_name;             endif;             $args = array('parent'   => $category_id);             $categories = get_categories($args);             $cats = wp_list_pluck($categories,'cat_ID');             $args = array (                   'category__and'                    => $cats             );             return $args;         }      $country_posts->have_posts() returns true only if 1 category gets returned from get_direct_children. This happens when I turn off all the children of $continent_cats (which is a string by the way) except 1. When only 1 child category is active:               var_dump(get_direct_children($continent_cats));      returns:               array(1) { ["category__and"]=> array(1) { [0]=> string(2) "72" } }      So yay this is what I want it to do. have_posts() is returning true and looping my 1 active subcategory. HOWEVER, when I enable another child category, have_posts() returns false(I think, it's just not posting any content). So this same function:               var_dump(get_direct_children($continent_cats));      returns:               array(1) { ["category__and"]=> array(2) { [0]=> string(2) "72" [1]=> string(2) "71" } }      when I have 2 child categories active. Since this looks like correct syntax AND category__and is taking in the correct variable type, why doesn't it loop those 2 categories? Why does it not even loop 1 category? Thanks


Ajax Request not coming back to class

I'm struggling with an ajax request. It's executed but not returning back to my class. My PHP:                   ...                 public function __construct()  {                     add_action( 'admin_print_styles', array($this, 'admin_styles') );                     add_action( 'admin_enqueue_scripts', array($this,'admin_scripts') );                     add_action( 'admin_menu', array($this, 'admin_menu' ));                     $this->dbHandler = DatabaseHandler::get_instance();                     add_action('wp_ajax_nopriv_add_vehicle', array($this,'add_vehicle'));                       add_action('wp_ajax_add_vehicle', array($this,'add_vehicle'));                   }                      public function admin_scripts( $hook ){                          wp_enqueue_script( 'admin_scripts', plugins_url( 'js/functions.admin.js', __FILE__ ), array('jquery') );                     wp_localize_script('admin_scripts', 'ajax_var', array(                           'url' => admin_url('admin-ajax.php')                         ,'nonce' => wp_create_nonce('ajax-nonce')                       ));                 }                      public function add_vehicle()                   {                       wp_die("RETURNED"); //NOT GETTING CALLED!                     $nonce = $_POST['nonce'];                            if ( ! wp_verify_nonce( $nonce, 'ajax-nonce' ) )                           die ( 'Busted!');                          $title = $_POST['id'];                     wp_die("TEST" . $title);                          exit;                   }         ...      My JS (functions.admin.js:               var addVehicle = function(){          $('.add-vehicle').click(function(){             var data1 = {                 action: 'add_vehicle',                 nonce: ajax_var.nonce,                 id: 1             };             $.ajax({                 type: "post",                 url: ajax_var.url,                 data: data1,                 beforeSend: function(jqXHR, settings){                     console.log(jqXHR);                     console.log(settings);                 },                 success: function(data, textStatus, jqXHR){                     alert('success.');                 },                 error: function(jqXHR, textStatus, errorThrown){                     alert(errorThrown);                 }             });                  return false;         });     };          jQuery(document).ready(function($){         addVehicle();     });      During execution, my AJAX Request was sent successfully. I received the success message. But my `add_vehicle` function is not called. I've checked a lot of articles, tried many different solutions, but none of them returned back to my class.


Only display posts with comments

I would like to query out only posts that have comments. So posts with comment_count = 0 won't show but anything above that will. This is what i query but it still picks out posts that doesen't have comments. Is there another way?               query_posts(array('comment_count' > 0, 'post_type' => 'letters', 'showposts' => 10, 'post_status' => array('publish'), 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1), 'meta_key' => 'letter_show_on_site', 'meta_value' => "yes"));


Masonry and Jetpack Infinite Scroll - overlap issue

I am trying to implement infinite scroll with Masonry on my archive pages on my theme and I have a couple of issues: 1) The "Load more posts" button is hidden behind the initial posts when you first load the page, see yellow circle: ![See yellow circle here - the little grey box is the button](http://i.stack.imgur.com/yCGF8.jpg) I feel a bit stupid asking this one but I don't know how to fix this because Jetpack is loading the button in the same container as the posts, which is just the default behaviour, and all the posts are absolutely positioned because of Masonry so I can't `clear` the button against them with CSS. I want the button to be below the posts. 2) (SOLVED, SEE BELOW ANSWER) When I click the button, the new posts overlap/load behind the initial posts, see picture: ![Overlapping posts](http://i.stack.imgur.com/xyfPY.png) I can't seem to get the Masonry to trigger a relayout after the new posts are loaded. I have looked at this post http://wptheming.com/2013/04/jetpack- infinite-scroll-masonry/ and this question Jetpack Infinite-Scroll + Masonry On twenty twelve overlap but I can't seem to find a solution to my problem. The markup before the click:

....

....

....

....

....
                      ...
                     Older posts

      The generated markup after the click:

....

....

....

....

....
                      ...                      ...
....

....

....

....

....

                     Older posts

      The PHP I am using for Jetpack (the post type in question is `mytheme_portfolio`) :               function mytheme_render_infinite_scroll() {         while ( have_posts() ) : the_post();                 if ('mytheme_portfolio' == get_post_type()) :                     get_template_part( 'content', 'archive-portfolio' );                 else :                     get_template_part( 'content', get_post_format() );                 endif;         endwhile;     }          function mytheme_jetpack_setup() {         add_theme_support( 'infinite-scroll', array(             'container'      => 'content',             'type'           => 'click',             'render'         => 'mytheme_render_infinite_scroll',             'wrapper'        => false,             'posts_per_page' => 5,         ) );     }     add_action( 'after_setup_theme', 'mytheme_jetpack_setup' );      The jQuery:               (function( $ ) {              $( document ).ready(function() {                  $('#content').masonry({               columnWidth: '.grid-sizer',               itemSelector: 'article',               gutter: '.gutter-sizer'             });                  $( document.body ).on( 'post-load', function () {                 $('#content').masonry({                   columnWidth: '.grid-sizer',                   itemSelector: 'article',                   gutter: '.gutter-sizer'                 });             });              });          }( jQuery ));      The CSS (although I don't think it's the problem as the initial posts are fine)...compiled with LESS, I'm using `calc()` to make things responsive:               article,     .grid-sizer {       width: calc(((100% - (4 - 1)*1.5em)/4)*(1) + ((1 - 1)*1.5em));     }     article.featured {       width: calc(((100% - (4 - 1)*1.5em)/4)*(2) + ((2 - 1)*1.5em));     }     .gutter-sizer {       width: 1.5em;     }      Thanks so much for any help anyone can give.


How should I setup the "Users" area to hand over to a client?

We're about to hand over a Wordpress site to a client; this is the first one we've built from scratch. Our "Users" area just consists boringly of the **admin** login with my work email like so: ![enter image description here](http://i.stack.imgur.com/inpCL.jpg). What's the best way to set this up to hand over to the client? We want to retain the ability for us to login and support them and have full powers but not look like we still own it. As things stand, if we just add a couple of their members of staff to it now it'll still look like we're still the supreme user. What do agencies normally do? This isn't a big project or client. They have a main person their end and a couple of junior users to help them.


How to to secure WordPress file and folder permissions

I've read articles about protecting wp-config.php using .htaccess as well as setting the correct file permissions but I want it all in one place. What should my .htaccess file look like and what folders is it safe to have 777 vs 755 permissions?


How To Consistently Enforce Rewrite Rule in Plugin Development

Let's say I create a customer support plugin that hijacks the /support part of the URL and redirects it to an MVC framework in my app folder of my plugin folder, like so:               RewriteRule ^support(.*)$ wp-content/plugins/csupport/app/$1 [L]      I know that I can do this in a blog's .htaccess right before the RewriteBase line, but not everyone has .htaccess turned on unless they add a custom permalink. I found a technique to force custom permalinks, but that's brute force and not recommended. **What is the recommended way for plugin developers to add a rewrite rule so that they can capture a subdirectory call like /support and redirect it to somewhere else?**


Advanced Custom Fields Plugin: how to use a checkbox to allow a post to show up in desired "zone"?

I am having issues getting the below code to work. I created an Advanced Custom Field (top_articles) with a checkbox containing three options: top_articles_left, top_middle, top_articles_right. I would it is so that when you are within a post you can check off that you want that post featured and it then shows up in the respective three zones I have designated. How could I accomplish this with ACF and have it fetch the correct post in WordPress?

Top Articles
                  <?php $articles_query = new WP_Query('category_name=main&posts_per_page=1');             while ($articles_query->have_posts()) : $articles_query->the_post(); ?>             <?php if (get_field('top_articles') == 'top_articles_left'): ?>             <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                 <a href="<?php the_permalink(); ?>">                     <?php the_post_thumbnail('large'); ?>
             <?php endif; endwhile; ?>                  <?php $articles_query = new WP_Query('category_name=main&posts_per_page=1');             while ($articles_query->have_posts()) : $articles_query->the_post(); ?>             <?php if (get_field('top_articles') == 'top_articles_middle'): ?>             <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                 <a href="<?php the_permalink(); ?>">                     <?php the_post_thumbnail('large'); ?>
             <?php endif; endwhile; ?>                  <?php $articles_query = new WP_Query('category_name=main&posts_per_page=1');             while ($articles_query->have_posts()) : $articles_query->the_post(); ?>             <?php if (get_field('top_articles') == 'top_articles_right'): ?>             <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                 <a href="<?php the_permalink(); ?>">                     <?php the_post_thumbnail('large'); ?>
             <?php endif; endwhile; ?>


Extract an embedded video from the content

I have added a post with the post format of video and I am trying to get to video so I can display the video in one div and the text in another like
the embedded video

the content
      Is there a way in wordpress to do this?


Add tinymce buttons to caption textarea in media uploader

I want to add some basic tinymce buttons ( Bold, italic, underline ) to caption textarea in media uploader in WordPress. (Shown in attached image) I dig a little bit into wordpress core in media.php and media-editor.js file in wp-includes but not getting any hint. Please help me, how can I add it. Thanks in advance. ![enter image description here](http://i.stack.imgur.com/dN1m1.png)


Guest posts with author's url and twitter photo

There's an urgent need for my school website to allow Guest Posts for essay assignments of students. The guest posts submitted by students should provide each student with his/her own url where one could see all posts submitted by them and their biography. I was able to get guest posts working i.e students can submit their essays without login. Is there any plugin or solution that will allow these students to have separate author urls without registering where we can see all the posts by them? And is there any way to get them to upload their avatars which get displayed rather than gravatars?


Create citation and url in post using 3 custom fields with conditions for each field... So close!

I am creating a new baseball blog. When submitting a post, I want Authors to cite their source for a news type of post. I have created a custom meta box with three custom fields:   * Source title, the title of the source. Field name - source_title   * Source URL, the URL of the source. Field name - source_url   * Source name, the name of the person or website of the information. Field name - source_name I want to display every bit of information the Author gives, so credit goes where it is deserved. The output of the code (with all fields present) will be something like:
source_title | source_name
      When the source_url is entered, but not source_title, the output should be:
source_url | source_name
      (it would be nice to trim the source_url to 25 or so characters and remove http:// if possible) Through searching and help elsewhere, this is what I have so far:               <?php      $seperator = '';          $name = get_post_meta($post->ID, 'source_name', true);     $url = get_post_meta($post->ID, 'source_url', true);     $title = get_post_meta($post->ID, 'source_title', true);          if($title != '' || $name != '' || ($url != '' && $title != '')){       $output = '
Source: ';       $output .= ($url != '' && $title != '') ? '': '';       if($title != '' && $name != '') {       $seperator = ' | ';     }       $output .=  $title;       $output .= ($url != '' && $title != '') ? '': '';       $output .= $seperator.$name;       echo $output . '
';     }     ?>      **What works:**   * When all three fields are entered everything is perfect.   * When title and name are entered, but not url everything is perfect.   * When title and url are entered, but not name everything is perfect.   * When only name is entered everything is perfect   * When only title is entered everything is perfect **The problems:**   * When url and name are entered but no title, only the name shows. In this case, I would like to display:
source_url | source_name
        * Similar is true when only the url is entered (no title or name), nothing shows. In this case, I would like to display:
source_url
      Thanks in advance for helping out this novice.


Find out which moderator approved comment?

Is there any way to find out what moderators have approved a comment, and then display that information on the front-end? e.g. John says: "This is a great article" \- Approved by Admin1


SELECT field options disappear when saving widget

I'm having an interesting problem that I can't seem to solve. While creating a widget, I have created a select field with options that can be chosen on the widget screen. It all works perfectly fine, except when I save the widget, all of the options in the select field vanish. They all come back, with my chosen option saved, as soon as I refresh. The code for each of the select options looks like this: `foreach ($posttypes as $option) { echo '<option id="' . $option->name . '"', $posttype == $option->name ? ' selected="selected"' : '', '>', $option->name, '</option>'; } ` In this case, $posttypes is an array of post types. When the select fields are rendered, they look like this: `<select name="option-name" id="option-name"> <option value="option- value">Option Value</option> <option value="option-value">Option Value</option> <option value="option-value">Option Value</option> </select>` Any ideas why they would vanish like this?


display jumps to the bottom, dosnt start at the top?

help! can anyone tell me why my blog post jumps down to the video near the bottom of the post? it does in on every browser and 2 different machines and it does it when you enter the primary domain http://rbarnes.com or the post url http://rbarnes.com/989/atlanta-bloggers-meetup/ click a link and let it fully load before you do anything, you'll see it jump I took the wistia video out and left the youtube video in and it still jumped down - then I took both videos out and it still jumps down i fixed a tag not closed - but no help... what is making it do this? big thanks if you can help. rb this theme is eleven40 child of Genisis


Integrate options in option page of wordress plugin

To add an option page I have used this codes.But I can't integrate any custom option of my plugin here. Suppose, in my plugin there is a shortocode, here, in a section, there is a background which can be changed by custom coding. e.g. ;               extract( shortcode_atts( array(             'category' => '',             'background'=> '#333'     'border-width' => '10px;'              ), $atts, 'photo_gallery' ) );              $q = new WP_Query(             array('photo_gallery_cat' => $category, 'posts_per_page' => -1, 'post_type' => 'photo-items')             );                   $list = '

';         while($q->have_posts()) : $q->the_post();      Here, in shortcode, I can use `background="#aaa"` to change the background color. With border-width also. But I want to create a option to change this by option page. How to integrate this in option page ? Also iI need to use active functions options, e.g this:               function active_least_gallery() {?>                    I want to use this true/false options on option page. Can anyone please advise me ?


Combined Category+Tag Archive Page

I am currently developing a music blog. I am using Wordpress categories for the _artists_ and the Wordpress tags for _featured artists_. I want to combine the archive pages for artists and features into one page. For example I currently have (using Kanye West as an example): www.example.com/artist/kanye-west   For songs where Kanye West is the _primary artist_ (i.e the category) **and** www.example.com/feature/kanye-west   For songs where Kanye West is the _featured artist_ (i.e the tag) I would rather consolidate them into one page: www.example.com/artist/kanye-west   Which would show both the primary and featured songs on the same page. The problem is, when the artist exists as a _feature_ but **not** an _artist_ the /artist/ archive page 404s. For example: I have made a post with a song that _features_ Kanye West, but I have never made a post with a song that is made by Kanye West, so the page /artist/kanye- west doesn't exist (because there is no category called Kanye West, only a tag), and it just 404s. Am I able to make a page which checks the slug (i.e _kanye-west_ ) against the artist **and** feature permalinks and will show the results accordingly?


Category Link to Post

I have a website with categories X, Y, Z...with the Search Everything plugin I can search based on the category name to return all the posts within a given category. I have the search results posts linking to their corresponding category using `the_category()`, but what I would like it to do is link the post to the category page the post is actually on - is that possible? Right now everything goes to the default category page, page 1...but some of the posts are on page 3, or page 2, etc. Thanks,   Josh


How to add media from front-end to an existing post?

Golden Apples Design created (as far as I know) the media upload function that many people on WP.A and elsewhere seem to recommend. But all of the Q&As I can find on StackExchange deal with creating an entirely new post. What is the best way to get this (or another snippet) to upload media from the front-end, attach it to the current post, generate the appropriate thumbnails, and then refresh the page showing the new image in the [gallery]? Here is Than's code: In functions file...               function insert_attachment($file_handler,$post_id,$setthumb='false') {            // check to make sure its a successful upload       if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();            require_once(ABSPATH . "wp-admin" . '/includes/image.php');       require_once(ABSPATH . "wp-admin" . '/includes/file.php');       require_once(ABSPATH . "wp-admin" . '/includes/media.php');            $attach_id = media_handle_upload( $file_handler, $post_id );            if ($setthumb) update_post_meta($post_id,'_thumbnail_id',$attach_id);       return $attach_id;      In page template header...               // set $post_id to the id of the post you want to attach     // these uploads to (or 'null' to just handle the uploads     // without attaching to a post)          if ($_FILES) {       foreach ($_FILES as $file => $array) {         $newupload = insert_attachment($file,$post_id);         // $newupload returns the attachment id of the file that         // was just uploaded. Do whatever you want with that now.       }     }      Upload form used...               <form method="post" action="#" enctype="multipart/form-data" >       <input type="file" name="an_uploaded_attachment">       <input type="file" name="another_uploaded_attachment">       <input type="file" name="yet_another_uploaded_attachment">       <input type="submit">     <form>


Making CURDATE() recognize current_time()

I'm trying to make this query pull a list of users 30 days from today that have a birthday. This query works as per below in WordPress, but excludes those who have birthdays as today. I believe the `CURDATE()` function is using the server time and not adjusting for the WordPress timezone in the Settings/General area. Any ideas for a fix?               $querystr = "     SELECT * FROM " . $wpdb->prefix . "usermeta     WHERE meta_key='bday_unix'     AND DATE_ADD(          from_unixtime(meta_value), INTERVAL YEAR( CURDATE() )          - YEAR( from_unixtime( meta_value ) ) YEAR      )     BETWEEN CURDATE() AND DATE_ADD( CURDATE(), INTERVAL 30 DAY )";


Wordpress best solution shared theme for consumers and businesses (two url's one instaltion)

What would be the best solution for a wp (cms style) site containing a sub site for consumers and businesses. I've made a wp theme and its almost finished. In essence its gives you two choice to visit as a consumers or as an business. Both have the same theme style but differ in some content used out of the wp database and some static content used. (so you've got two headers.php and different article categories for both optins) Now I've got it working by using a switch statement in the index.php in the theme file. All works fine but the url's you've get don't look very professional. I would like to have it worked like this: www.domain.com --> gives you two options one brings you to www.domain.com/consumers/ the other to www.domain.com/businesses/ I cant get this to work because for instance the articles use www.domain.com/articles/bla/etc. So what would be the best way to achieve this? I'm thinking about: -Multiple installations sharing the same database (dont like this idea because you've got more maintenance) \- setting it up in the .htaccess if this possible and how? thank you for any advice or solutions


need to increase pages width

please check out my blog http://cine-matt.com/archives/ and here http://cine-matt.com/news-and-rumors/ see the amazon ads? they cut off and the widget only comes in specific sizes. how do I increase the width of the pages so the ads don;t get cut off (i understand it can be done in css style sheets and have tried the custom css in the apperance - customize menu as well as the css jet pack editor, but i don;t know the css code i need to do what i want. can you help? thanks


BuddyPress Toolbar

Is there a way to call the toolbar or adminbar as you would a menu?               <?php          wp_nav_menu(              array(                  'container' => false,                  'menu_id' => 'nav',                  'theme_location' => 'primary',                  'fallback_cb' => 'bp_dtheme_main_nav'              )          );      ?>      I want to add the toolbar to a div within the header.php file. Currently the toolbar is being called in the footer.php and styled by the css to a fixed position in the body. Or perhaps is there a script I could run which would amend a div around the `<div id="wp-admin-bar">`? I am running the latest install of WordPress, 3.3.1 with BuddyPress as a plugin. Using a child-theme I created. I've noticed a few of the normal WordPress functions do not work well with the BuddyPress plugin.


Make forced line break in title of text widget

I am using text widget in page, my title is too long and i want to make (Br)break in particular place, but i can not. After saving (br)break is gone, also tried (nbsp) but same result came. How to overcome?


Weird problem on if statement

I'm facing a weird issue trying to do what I'm going to explain now. **Context**   **Plugins I'm using:** Custom Post Type UI / Advanced Custom Fields Functionality: I have a custom post type called "vendors". Within this post type I have several custom fields made on ACF. One of these fields is Called "Promote to Homepage" which is set as a checkbox. So the idea is simple, if that checkbox is checked show that post on the homepage. So this seemed to work fine, but when I tried to change that "Highlighted Vendor" to another one (unchecked current, checked desired to avoid conflicts I found that the post I was setting as featured wasn't showing, nothing was shown. I started testing then trying with other vendor posts, to find that this behavior is completely random, some of them published correctly to homepage, some others not. I tried to find out a pattern to identify what might be causing it and failed. Also tried to replicate the settings of a vendor that was failing to publish within a vendor that was publishing fine, and even setting the exact same things the vendor was still publishing. Finally I should mention that I have a page where I'm listing some kind of "directory" where all vendors are being shown. I added a simple code to check if the "promote_to_homepage" output was correct, something like "if the checkbox is checked, say hi" and found that the posts that aren't showing on homepage, pass the test on directory page. I'm running out of ideas about what this could be, that's why I'm trying here if someone can bring me some help. The code I'm using in the homepage is simple:               <?php query_posts('post_type=vendors');     while (have_posts()):the_post();      $featured = get_field('promote_to_homepage', $post -> ID, true);     if ($featured){?><!-- show the content here -->     <?php }; endwhile; ?>      That's all. Thanks in advance to anyone that can help me on this. Juan.-


wp_page_menu not working right?

I try to create simple menu in custom theme. WordPress version is 3.9.1 So I taking code from here http://codex.wordpress.org/Function_Reference/wp_nav_menu, just change menu and container class / id for better debuging.               <?php                 wp_nav_menu(                     array(                         'theme_location'  => '',                         'menu'            => '',                         'container'       => 'div',                         'container_class' => 'container_class',                         'container_id'    => 'container_id',                         'menu_class'      => 'menu_class',                         'menu_id'         => 'menu_id',                         'echo'            => true,                         'fallback_cb'     => 'wp_page_menu',                         'before'          => '',                         'after'           => '',                         'link_before'     => '',                         'link_after'      => '',                         'items_wrap'      => '
%3$s
',                         'depth'           => 0,                         'walker'          => ''                     )                 );             ?>      But it creates this code:

                 Пример страницы

      Instead of expected this:

                 Пример страницы

      What i do wrong? Thank you. **UPDATED** I already has this code at fuctions.php:               <?php          function bd_setup() {         register_nav_menu( 'primary', __( 'Primary Menu' ) );     }          add_action( 'init', 'bd_setup' );      **SOLVED** After creation Menu in Appearance->Menu and assignation it in Appearance->Menu->Manage Locations I got expected code.


echo is just displaying the word 'array', rather than the array

I'm trying to see the structure of an array, but when I try to `echo` the array, all it says is 'array'. Please can someone explain how I can see the structure of an array?               add_shortcode('book', 'ac_post_meta_shortcode' );       function ac_post_meta_shortcode() {                $mpdata = get_post_meta( 31, 'custom_repeatable', true );            echo $mpdata;       }


How To extend WP_Customize_Control

I'm looking for a way to add a new kind of control to the customize _live preview_ panel. I have seen how to add new sections to the panel using `add_action( 'customize_register'...` The control I want to implement is a different kind of color picker. In a previous post, we see how to extend core classes to add widgets, but what I lack here is a hook that will enable me to bring my object into scope - WP_Customize_Palette_Control. At You can see the beginnings of the code here. This code is in the `functions.php` file of my theme. Thanks for any help. Rob Just updated the code. Now I have `require_once` to bring in the classes. So now I have no PHP errors but my new control HTML does not appear.               <?php          require_once( ABSPATH . WPINC . '/class-wp-customize-setting.php' );     require_once( ABSPATH . WPINC . '/class-wp-customize-section.php' );     require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' );          class WP_Customize_Palette_Control extends WP_Customize_Image_Control {               public $type    = 'palette';             public $removed = '';             public $context;                  public function enqueue() {                     //wp_enqueue_script( 'wp-plupload' );             }                  public function to_json() {                     parent::to_json();                          $this->json['removed'] = $this->removed;                          if ( $this->context )                             $this->json['context'] = $this->context;             }                  public function render_content() {                     ?>                                                  <?php echo esc_html( $this->label ); ?>
                                     <?php _e( 'Upload' ); ?>                                     <?php _e( 'Remove' ); ?>
                                          <?php             }     }          //new WP_Customize_Palette_Control();               //add_action('customize_controls_init', 'WP_Customize_Palette_Control');          // add an option to the customize panel          function sci_customize_controls_init($wp_customize) {         $wp_customize->add_section( 'themename_color_scheme', array(             'title'          => __( 'Color Scheme', 'themename' ),             'priority'       => 35,         ) );              $wp_customize->add_setting( 'themename_theme_options[color_scheme]', array(         'default'        => 'some-default-value',         'type'           => 'option',         'capability'     => 'edit_theme_options',     ) );               $wp_customize->add_control( 'themename_color_scheme', array(         'label'      => __( 'Color Scheme', 'themename' ),         'section'    => 'themename_color_scheme',         'settings'   => 'themename_theme_options[color_scheme]',         'type'       => 'palette',         'choices'    => array(             'value1' => 'Choice 1',             'value2' => 'Choice 2',             'value3' => 'Choice 3',             ),     ) );          }          add_action( 'customize_register', 'sci_customize_controls_init' );


static front page ONLY for certain themes?

A theme I am developing depends on there being a static front page. However, there seems to only be one global option to change if front page is static. So when I go to preview the theme, it won't work because the front-page option is off. But I don't want to change the front-page option because the live site will be affected. Is there a way to change that setting only when certain themes are being viewed?


How do I use wp_query for WordPress search?

I would like to create a custom search form to search posts based on the values of about 4 custom fields. I tried using wp_query to achieve this but so far my biggest problem is that the I don't get any results when searching for data in custom fields - even for data that I am sure exists. Also, I can't figure out how to remove the normal WordPress "keyword" search box and use just my four combo boxes. Here is the code from my search.php file: http://pastie.org/private/jhgsmaolvjyswyhsfphlfa   and here's the code from my searchform.php: pastie.org/private/o3hrtqajh8hbkiht1nyoba   Here is an image of the form layout: http://i.stack.imgur.com/N8ncg.png Thanks.


Wordpress Plugin Look & Feel

Is there a list of the ID's and Classes I can give HTML elements in the admin panel in order to closely mimic the wordpress look and feel?


Is there any good way to use SVN for uploads directory?

We just got our servers set up with SVN which works great. Wordpress upgrades and plugin installations are managed manually, which all goes through SVN as well, but I can't work out a good way to version control upload directories. The best solution I can think of is to periodically go into the folders, look through the images to make sure they are legitimate (no self-unpacking shell scripts, etc) and commit them... either that or svn:ignore the entire folder. Is there a better way to do this? All the discussion I can find on Google has to do with using SVN for Wordpress installs, not dynamically managed assets.


Specify a Page as the parent to the CPT Archive

I have an "About Us" page on my site with some child pages. I have created a "History" custom post type, where the rewrite slug is 'history'. I use archive-cpt_history.php as the template file for that CPT. Everything works exactly as its configured, I can go to website.com/history/ to see my CPT loop in all its glory. The issue is, I need this history CPT to be a child of About Us. How can I rewrite the slug to be /about-us/history so that it works with the archive / landing page? I can do this:               'rewrite' => array( 'slug' => '/about-us/history', 'with_front' => false ),      But that only works with the single posts, not the archive / landing page. Any help would be greatly appreciated. Also, in case this is relevant, once I have solved this issue single- cpt_history.php will simply use " header( 'Location: ' . site_url('') ); " to redirect users back home. There is never any permalink to the individual History post. The design just doesn't work like that. The History landing page will always show all posts in the CPT.


Posts limit on homepage (genesis framework)

in home.php               // NOT working     query_posts('show_posts=3');          // NOT working     add_action( 'pre_get_posts',  'set_posts_per_page'  );     function set_posts_per_page( $query ) {              $query->set( 'posts_per_page', 3 );              return $query;          }          genesis();      I searched a lot, almost always they say the 2nd solution. But i does not work for me, maybe because its genesis. Or is this outdated? I don't want to use the custom grid stuff i just want to limit the posts on one page (the homepage in this example) solution thx to @Milo: its just working in functions.php and there i need a additional if is_home               /** reduce number of posts on homepage **/     add_action( 'pre_get_posts',  'set_posts_per_page'  );     function set_posts_per_page( $query ) {              if ( is_home() )             $query->set( 'posts_per_page', 3 );              return $query;     }


How to make WP_Query not to show irrelevant posts?

I'm using the following `WP_Query` arguments array:               $args = array(  'post_type' => POST_TYPE,                                 'tax_query' => array(                                     'taxonomy' => TAX,                                     'field' => 'slug',                                     'terms' => TERM                                 ),                                 'posts_per_page' => 2                             );      The problem is this query displays all the posts from `POST_TYPE` which have a `TAX` (any `TAX`) assigned to them but it's not limiting it to the `TERM` (particularly one term) taxonomy!   I just want the posts from the specific `TERM` taxonomy and nothing more!


Make assigning post to a specific category equivalent to assigning it to all categories

_Allow me to explain with an example, for the sake of clarity. Please take the time to **read it all to get a good idea** of what I am exactly after._ On my WordPress site categories are used as **Editions** and there are 4 of them — Category (slug):   * US (main)   * UK (uk)   * India (in)   * International (intl) The permalink structure is `/%category%/%year%/%monthnum%/%day%/%postname%/`. With this permalink structure in place, a post assigned to more than 1 category will be accessible via any of the category slugs in the permalink. For example, if a post is assigned to US and UK categories, it'll be accessible via both of these URLs (no redirection):               http://example.com/main/2013/11/01/sample-post/     http://example.com/uk/2013/11/01/sample-post/      **Points of note:**   1. The permalink will still only include the slug of the category with the lowest ID.   2. If you try using the slug of a category that the post is not assigned to, it'll redirect back to the permalink. For instance, these two (note `intl` and `in`):              http://example.com/intl/2013/11/01/sample-post/     http://example.com/in/2013/11/01/sample-post/      Will redirect back to the permalink, i.e.              http://example.com/main/2013/11/01/sample-post/      **The problem:** For those posts that I want to be shown in all Editions (categories in my case), I can check all categories when publishing the post. But that'd cause problems later on when I add more editions, i.e. the old posts won't be shown under the new Editions/categories. So I use this custom function to suit my needs:               add_filter('pre_get_posts','better_editions_archive');     function better_editions_archive( $query ) {         if ( $query->is_tax( 'category' ) && $query->is_main_query() ) {             $query->set( 'post_type', array( 'post' ) );             $query->set( 'tax_query',                 array(                     'relation' => 'OR',                     array(                         'taxonomy' => 'category',                         'field' => 'slug',                         'terms' => 'intl',                         'operator' => 'IN'                     )                 )             );         }         return $query;     }          /*      * Based on:      * http://wordpress.stackexchange.com/a/90573/10691      */      With that function in place, when I want a post to be displayed in all Editions (categories), I can simply assign the post to _International (intl)_ category and voila! The problem is, now the post is only accessible via **its** permalink i.e. `http://example.com/intl/2013/11/01/sample-post/`. But I want it to be accessible (with no redirection) via all the category slugs, i.e.               http://example.com/main/2013/11/01/sample-post/     http://example.com/uk/2013/11/01/sample-post/     http://example.com/in/2013/11/01/sample-post/      * * * _**Reason:** In each Edition (category) archive, I want all the posts' links to start with that specific category's slug i.e. if the archive URL is `http://example.com/uk/`, I made sure that all post URLs'd look like this:_               http://example.com/uk/2013/11/01/sample-post-1/     http://example.com/uk/2013/11/01/sample-post-2/     http://example.com/uk/2013/11/01/sample-post-3/      _I used`str_replace()` for this, just so it's clear._ * * * Now, the question is, when a post is assigned to _International (intl)_ category, how can I make sure that it's accessible, without any redirection whatsoever, via all category slugs, **as if the post were assigned to all the categories**? Precisely, how do I make assigning a post to a specific category equivalent to assigning it to all categories?


How to allow Category Title to use <b> tags?

I'd like to be able to use               <b></b>      within my Category Title in Wordpress but the admin strips them out. I realise I can make the whole title bold using css but I only want it to apply to certain words. Is there a way of enabling this? Thanks for any help in advance.


How to show recents topics below the forum's title (Wordpress + bbPress plugin)?

I'm not very familiar with the bbPress plugin. I would like to list two or three recent topics below the title of the forum (as well as the number of their replies): ![enter image description here](http://i.stack.imgur.com/RXZYB.png) This is **loop-bbp_forums.php** :               <?php          /**      * Forums Loop      *      * @package bbPress      * @subpackage Theme      */          ?>          <?php if ( bbp_has_forums() ) : ?>

                     <?php _e( 'Forum', 'bbpress' ); ?>	                     <?php _e( 'Topics', 'bbpress' ); ?>	                     <?php _e( 'Replies', 'bbpress' ); ?>	                     <?php _e( 'Freshness', 'bbpress' ); ?>

 <?php // @todo - Moderation links ?>

                      <?php while ( bbp_forums() ) : bbp_the_forum(); ?>                          <tr id="bbp-forum-<?php bbp_forum_id(); ?>" <?php bbp_forum_class(); ?>>                                                           <a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>" title="<?php bbp_forum_title(); ?>"><?php bbp_forum_title(); ?>                                  <?php bbp_list_forums(); ?>
<?php the_content(); ?>
                         	                              <?php bbp_forum_topic_count(); ?>	                              <?php bbp_forum_reply_count(); ?>	                                                                <?php bbp_forum_freshness_link(); ?>
                                      <?php bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'size' => 14 ) ); ?>

                      <?php endwhile; ?>
          <?php endif; ?>


How to create a custom nested loop in bbPress (Wordpress + bbPress plugin)

This is how you do it for Wordpress posts:                  $my_query = new WP_Query( "cat=3" );        if ( $my_query->have_posts() ) {             while ( $my_query->have_posts() ) {                 $my_query->the_post();                the_content();            }        }        wp_reset_postdata();      I would like to know how to do that in bbPress (say, listing topics).


How to replace standart comment count with Disqus?

in my blog comments show 0, and not real numbers of comment count. Now this is my code: `<?php comments_number('0 Comment', '1 Comment', '% Comments'); ?>` How to fix that?


How to hide woocommerce theme support notice

I have Woocommerce installed in a Wordpress Network, and a demo network website has theme Twenty Fourteen activated. I see the notice: > Your theme does not declare WooCommerce support – if you encounter layout > issues please read our integration guide or choose a WooCommerce theme :) > > Theme Integration Guide | Hide this notice. I have already created a woocommerce.php file in the Twenty Fourteen theme, and uploaded it, but this notice remains. I want new network users to not have to see this notice when a woocommerce.php file has already been uploaded to the active theme's folder. How do I do this? Is the "hide notice" variable controlled by the presence of woocommerce.php? Is it a cookie generated by clicking on "hide notice" link? Is it a setting saved in wp_options? **Update:** I removed all site cookies, and the Woocommerce notice did not reappear. In wp_options, there is an entry:   * option name = woocommerce_theme_support_check   * option value = twentyfourteen   * autoload = yes Deleting this option does not make the Woocommerce notice reappear. It reappeared in the database after refreshing the Themes page in the Wordpress site, which had Twenty Fourteen as the active theme. I wonder if I just run an SQL script when a new network site is created, to generate an option for each theme, like the twentyfourteen entry above?


How to trigger 404 for custom query var?

How can you trigger a 404 when using custom query vars? I've got re-write rules written for a custom query var, but if you were to request a URL for the query var that should technically be a 404 it returns a normal WP page, but no content, because nothing technically exists for the URL.


Doing action based on input from options menu

This is my first time writing plugin. I have managed to get options menu with the html form:               <?php     add_action('admin_menu', 'menu');     function menu(){         add_options_page("poster","poster",'manage_options',"poster",'option_page_html');     }     function option_page_html(){         ?>
             <form action="wp-content/plugins/poster/post-video.php" method="post">

Paste video url

                 <input type="text" size="100" name="url" />
                 <input type="submit" value="Post"/>             </form>
         <?php     }     ?>      I want to make a script which `insert_post` from the url I paste in the `input` field. It's not autoblogger, I just want to make it easier to embed some related videos which I now do manually. The problem is in the `form action="wp-content/plugins/poster/post-video.php"` part. It seems that wordpress search for that file only in `wp-admin` folder so it becomes `http://example.com/wp-admin/wp-content/plugins/poster/post-video.php` when I try to post, with error 404. I have tried `form action="<?php echo __DIR__."/post-video.php"?>"`, but when I post it goes to `http://example.com/var/www/wordpress/wp- content/plugins/poster/post-video.php"` How to get the right path for the `post-video.php` script inside plugin folder? Or is there some other method, built-in function?


Wordpress User Profile Upload - If page is saved file reset

I have various different extra profile fields which I have set in functions.php however with the upload one if a user uploads an image and saves the form the image is set, however if they go back and edit another field it sets the image field to null. Here is the code I have in my functions.php file. Any help would be really appreciated.                    <?php          add_action( 'show_user_profile', 'extra_user_profile_fields' );     add_action( 'edit_user_profile', 'extra_user_profile_fields' );          function extra_user_profile_fields( $user ) {           $r = get_user_meta( $user->ID, 'picture', true );         ?>
<?php _e("Public Profile - Gallery", "blank"); ?>

             Picture	             <input type="file" name="picture" value="" />                      <?php //print_r($r);                      if (!isset($r['error'])) {                         $r = $r['url'];                         echo "";                     } else {                         $r = $r['error'];                         echo $r;                     }                 ?>

                     <?php     }          add_action( 'personal_options_update', 'save_extra_user_profile_fields' );     add_action( 'edit_user_profile_update', 'save_extra_user_profile_fields' );          function save_extra_user_profile_fields( $user_id ) {          if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }          $_POST['action'] = 'wp_handle_upload';     $r = wp_handle_upload( $_FILES['picture'] );     update_user_meta( $user_id, 'picture', $r, get_user_meta( $user_id, 'picture', true ) );          }          }          add_action('user_edit_form_tag', 'make_form_accept_uploads');     function make_form_accept_uploads() {         echo ' enctype="multipart/form-data"';     }


Super post cleaner, could this be category specific?

I've used this plugin on many sites, and it works fine. It stops duplicate posts from being created, but the site I'm working on now is a pinterest clone, and it won't work with repins. The plugin is no longer supported, is why I'm here asking. Could this be made to work on only one category? I have one category that works as the blog, the rest of the categories are for the pinterest side of the site                function superPostCleaner(){              global $wpdb;              $prefix = $wpdb->prefix;                        $wpdb->query("DELETE a.*                   FROM ".$prefix."posts AS a                   INNER JOIN (SELECT Greater1.post_title, Titles.ID, Greater1.MinID FROM (SELECT post_title, MIN(ID) AS 'MinID', MAX(ID) AS 'MaxID' FROM ".$prefix."posts WHERE post_type = 'post' AND post_status = 'publish'                   GROUP BY post_title HAVING COUNT(post_title)>1) AS Greater1                   LEFT JOIN (SELECT post_title, ID FROM ".$prefix."posts) AS Titles                   ON Greater1.post_title = Titles.post_title WHERE ID > MinID) AS b ON a.ID = b.ID WHERE a.ID = b.ID");          }          add_action('publish_post', 'superPostCleaner');


WooCommerce Product Search Error

I wanted to display product category,in product catalog on my WooCommerce site.I asked another question earlier to make this code working.I added this code on my content-product.php file.                   <?php        $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );        $parents = get_the_terms($term->parent, get_query_var('taxonomy') );             echo "
";        echo "In"." "." ";        foreach( $parents as $parent ) {        echo ''.$parent->name.'';         }       echo "
";       ?>      Everything is working perfectly on product catalog,but whenever i do a search i am getting this error " Invalid argument supplied for foreach()" . I am not that good with programming,i managed make the code working for product catalogs but it is not working with search.Please if anyone can help me,it will be greatly appreciated.


Recommended Post Structure for DB Storage

I'm trying to write a plugin that would help my local little league manage their league, and though I've read the New Table vs Post Meta question, it's still a bit unclear and I'm hoping someone here might be able to help. I have the CPT's (Teams, Players and Matches) as well as the taxonomies (seasons, divisions and positions) created, but my main concern is historical data and querying that data. Is the best way to store player statistics and things of that nature in a separate database table? Is there a scenario anyone could envision where storing that in post_meta would be superior?


user-new.php less detailed after WP3.1; how to revert?

I updated WP to 3.1, and one issue my organization (which uses WP in Network Mode) is having is the Add New User page in wp-admin is now much less detailed -- before it was more like profile.php, with the ability to set username, password and much more. Now, it's only username, password and role. Any idea how to revert this back? Our organization generally creates accounts for people instead of vice-versa? Thanks!


wp_verify_nonce doesn't return true on server when it matches the nonce

$.ajax({         type: "POST",         dataType: "text",         url: ajaxurl,         data: {                 action: "more_news",                 nonce: nonce,                 offset: offset         },         success : function(data, textStatus, jqXHR){             console.log( nonce );             console.log( data );             console.log( textStatus );         }     });      Checking for this AJAX request nonce locally works perfectly. As seen below, my console prints my nonce, "Awesome", and then "success".               9a91a5fdca     Awesome     success      When on my server, my console prints my nonce TWICE (thus proving to me they're exactly the same), then success.               e2ca4eca80     e2ca4eca80     success      I'm… confused… to say the least. How is this possible? and how do I solve it?               add_action( 'wp_ajax_more_news', 'more_news' );     add_action( 'wp_ajax_nopriv_more_news', 'more_news' );          function more_news(){         if ( !wp_verify_nonce($_POST['nonce'], 'more_news_nonce') ){             exit($_POST['nonce']);         }         echo 'Awesome';         die();     }


How to upload multiple images on frontend to ACF gallery using update_field

I'm trying to save images submitted on a frontend form in a way that they are accessible via the ACF backend. In how to upload an image on ACF with update_field on wordpress, someone provided a solution for a single image upload (and consequently a single ACF image field). I thought it should be pretty easy extending this to a multi image upload (and a ACF gallery field), but I get an error I can't track down: `Cannot redeclare wp_crop_image() in /../travel/wp-admin/includes/image.php on line 25` **in functions.php**               function RemapFilesArray($name, $type, $tmp_name, $error, $size)     {         return array(             'name' => $name,             'type' => $type,             'tmp_name' => $tmp_name,             'error' => $error,             'size' => $size,         );     }          function my_update_attachment($f,$pid,$t='',$c='') {       wp_update_attachment_metadata( $pid, $f );       if( !empty( $f['name'] )) { //New upload         require_once( ABSPATH . 'wp-admin/includes/file.php' );         include( ABSPATH . 'wp-admin/includes/image.php' );              $override['test_form'] = false;         $file = wp_handle_upload( $f, $override );              if ( isset( $file['error'] )) {           return new WP_Error( 'upload_error', $file['error'] );         }              $file_type = wp_check_filetype($f['name'], array(           'jpg|jpeg' => 'image/jpeg',           'gif' => 'image/gif',           'png' => 'image/png',         ));         if ($file_type['type']) {           $name_parts = pathinfo( $file['file'] );           $name = $f['name'];           $type = $file['type'];           $title = $t ? $t : $name;           $content = $c;                $attachment = array(             'post_title' => $title,             'post_type' => 'attachment',             'post_content' => $content,             'post_parent' => $pid,             'post_mime_type' => $type,             'guid' => $file['url'],           );                     foreach( get_intermediate_image_sizes() as $s ) {             $sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => true );             $sizes[$s]['width'] = get_option( "{$s}_size_w" ); // For default sizes set in options             $sizes[$s]['height'] = get_option( "{$s}_size_h" ); // For default sizes set in options             $sizes[$s]['crop'] = get_option( "{$s}_crop" ); // For default sizes set in options           }                $sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes );                foreach( $sizes as $size => $size_data ) {             $resized = image_make_intermediate_size( $file['file'], $size_data['width'], $size_data['height'], $size_data['crop'] );             if ( $resized )               $metadata['sizes'][$size] = $resized;           }                $attach_id = wp_insert_attachment( $attachment, $file['file'] /*, $pid - for post_thumbnails*/);                if ( !is_wp_error( $attach_id )) {             $attach_meta = wp_generate_attachment_metadata( $attach_id, $file['file'] );             wp_update_attachment_metadata( $attach_id, $attach_meta );           }             return array(       'pid' =>$pid,       'url' =>$file['url'],       'file'=>$file,       'attach_id'=>$attach_id        );         }       }     }      **on my form.php:**               <input type="file" name="upload_attachments[]">     <input type="file" name="upload_attachments[]">      **in process-form.php**               if ($_FILES['upload_attachment']){           $files = array_map('RemapFilesArray',      $_FILES['upload_attachment']['name'],      $_FILES['upload_attachment']['type'],      $_FILES['upload_attachment']['tmp_name'],      $_FILES['upload_attachment']['error'],      $_FILES['upload_attachment']['size']     );          $gallery=array();          foreach ($files as $file){ //loop through each file         $att = my_update_attachment($file,$site_id);         array_push($gallery,$att['attach_id']);     }     update_field('field_1231242',$gallery,$site_id);          }      I appreciate your help and ideas!


Disable title link in the backend for non-admins

I need to make posts not editable by non-admins in the backend, is there a way to disable the link in the title of the posts when they view the list of post published? Thanks!


Pushing stored procedure to a multisite database in WordPress

I am given a WordPress multisite and need to extract information from the site. I have written a stored procedure that recursively builds a tree relationship for posts of a certain kind. Now I am wondering how to push the stored procedure to the databases of all the sites.(Since this is a multisite configuration, each site(subdomain in this case) has a separate database.) Please help me in this regard. WordPress version: 3.5.1 Multisite config type: subdomains               //code needs refinement          DELIMITER //     CREATE PROCEDURE getPath(IN post_id INT, IN return_path TEXT)          BEGIN           DECLARE done INT DEFAULT 0;      DECLARE a INT;      DECLARE b TEXT;      DECLARE cur1 CURSOR FOR (SELECT * FROM TempTable112);           DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;      DROP TABLE IF EXISTS TempTable112;           SET max_sp_recursion_depth := 10;           CREATE TEMPORARY TABLE TempTable112 AS SELECT id,post_title FROM wp_101_posts WHERE post_parent = post_id and post_status='publish';           SET @s = CONCAT('SELECT * INTO OUTFILE ',"'", CONCAT('Sample',FLOOR(1000+RAND()*9999)),'.txt',"'",' FROM TempTable112');     PREPARE stmt2 FROM @s;     EXECUTE stmt2;     DEALLOCATE PREPARE stmt2;              OPEN cur1;          read_loop: LOOP         FETCH cur1 INTO a,b;         IF done = 1 THEN           LEAVE read_loop;         END IF;              SET return_path = CONCAT('/',return_path,b);          CALL getPath(a, return_path);       END LOOP;       CLOSE cur1;     END //          DELIMITER ;


Filter all queries with a specific taxonomy

Is there any way to filter all post queries and add a specific taxonomy? Case in point, I have a taxonomy object of "Region" with terms like "Global", "Americas", "Europe", etc. (Users designate their region in their user profile through custom fields which is stored as a usermeta value and added the user cache object.) The idea being that as the signed-in user navigates the site, they'd only see content designated within their region. Obviously I could write a custom query per page to include their region, but I was wondering if there was a way to tap into the query object and add the taxonomy requirement regardless of what the query was for (e.g, post, custom post type, archive page, etc.). Any help would be much appreciated! Thanks.


Help with wordpress custom query and advanced custom fields plugin

first of all sorry for my bad english. Let me explain what I`m trying to do: I have a column inside a SQL table with a string using the following format: yy-mm-dd The thing is, it doesn`t use a dateformat type. So, I have my query, where I need to capture all fields with the following specification: value <= '{$thisyear}-{$thismonth}-{$last_day}' any way that I can do that withoung having to change the field format? As long as the tables are generated by the plugin. Any help will be really appreciated, thank you guys!


Allowing style tag in TinyMCE editor

In cases i want to add individual styles for an element its easy i just add inline styles inside p tags, because _wp_add_global_attributes has style attribute.... but when i want to add tag itslef to target/select multiple elements TinyMCE editor removes it entirely... so I got inside core and found filter tiny_mce_before_init but i don't know how to add style tag to allowed tags array!!!!!!!


Add comment meta

I need to add my custom meta to the new comments. Here is what I've done :               /************************************************************************/     /*  Add meta to comments     /************************************************************************/     // Save field     add_action ('comment_post', 'add_meta_settings', 1);          function add_meta_settings($comment_id) {         add_comment_meta($comment_id, 'comment_section', $_POST['comment_section'], true);     }      This work when I create a new comment. But if I post a comment using the "Reply" (to another comment) link, the meta is not saved... After further investigation : On the same page, I have 3 comment threads. Each comment has a meta that tells in which tread they have to be displayed in. At the end of each thread, I have a form to post a comment in this specific thread and it adds the right meta. The problem is when I click the “Reply” link, it adds a form under the comment, but not the good form. It adds the first form that appears in the page, event if I reply a comment from the third thread. So the meta that is added with my new comment is not the good one… Is there a way to tell WordPress which form to use when I click the “Reply” link ? Could you help me ? Thanks !


Mechanism to send to users of secured WordPress install new notifications by SMS or email?

I have a family website, private, requires a WordPress account, in WordPress. Some of my family members would like to get the option for notifications of new posts by email or text message. Email seems easy enough, there are plugins and services for that. But I'm concerned about text messages because we are geographically spread out, and I would like the option to queue the messages so that they are sent to users only within hours they choose. External services or services based off RSS are not a great fit because the RSS feeds are not public and I'd like to keep it that way. Is there a plugin suited to these specific requirements?


Is there a way to hide WordPress behind a web visible directory?

Is there a way to hide WordPress behind a web visible directory for extra security using a symlink?


Splitting WordPress theme CSS into multiple files, good or bad?

I'm developing a WordPress theme framework. I want organize CSS for each section into separate files for the following reasons.   1. Developers can easily deregister styles by parent theme and load their own styles.   2. Easy to maintain.   3. I can load only the required styles based on the options selected by the user. Disadvantages Extra http requests => more load on the server. This disadvantage can be taken care by combining all the CSS files before they are served to the user using plugins like wp-minify. But, will this combining process out weigh the above advantages.


Filter my home page posts by category or by tag

Would like to filter my home page posts by category **OR** by tag. i.e. only posts that are in category "X" or have tag "B" appear on the home page. Have used code below successfully to filter (include/exclude) just by category               function exclude_category($query) {     if ( $query->is_home ) {     $query->set('cat', '3');     }     return $query;     }     add_filter('pre_get_posts', 'exclude_category');      then tried to add the tag filter by replacing `$query->set('cat', '3');` with `$query->set(('cat', '3')||(is_tag('urgent'));` no good - did not work. Can this be done ? How ? Any ideas, help or advice much appreciated