title: pagenavi with merged wp_query

text:
i need to use wp_query to excute posts from 2 separated keywords using `s=keyword` so i have found this answer & it is very very useful Combining queries with different arguments per post type & i achieved my goal this is my code               <?php add_filter( 'posts_search', '__search_by_title_only', 500, 2 ); ?>     <?php     $first=array(     's'         => 'keyword1',     );     $second=array(     's'         => 'keyword2',     );     $first_query = new WP_Query( $first);     $second_query = new WP_Query( $second);     $result = new WP_Query();     $result->posts = array_merge( $first_query->posts, $second_query->posts );     $result->post_count = count( $result->posts );?>
     <?php remove_filter( 'posts_search', '__search_by_title_only', 500 ); ?>     <?php if ( $result->have_posts() ) : while ( $result->have_posts() ) : $result->the_post();?>     //layout      <?php endwhile; ?>     <?php if ($result->max_num_pages > 1) tie_pagenavi(); ?>     <?php wp_reset_query(); ?>     <?php wp_reset_postdata(); ?>     <?php endif; ?>      but my problem is the pagenavi not worked for me the `<?php if ($result->max_num_pages > 1) tie_pagenavi(); ?>` my theme have a custom pagenavi which authors & categories archive use it my pagenavi code is               <?php     /*     Plugin >> Name: WP-PageNavi     Plugin URI: http://lesterchan.net/portfolio/programming/php/     Description: Adds a more advanced paging navigation to your WordPress blog.     Version: 2.50     Author: Lester 'GaMerZ' Chan     Author URI: http://lesterchan.net     */               /*       Copyright 2009  Lester Chan  (email : lesterchan@gmail.com)          This program is free software; you can redistribute it and/or modify     it under the terms of the GNU General Public License as published by     the Free Software Foundation; either version 2 of the License, or     (at your option) any later version.          This program is distributed in the hope that it will be useful,     but WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     GNU General Public License for more details.          You should have received a copy of the GNU General Public License     along with this program; if not, write to the Free Software     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA     */               ### Function: Page Navigation: Boxed Style Paging     function tie_get_pagenavi($before = '', $after = '') {     global $wpdb, $wp_query;     $pagenavi_options = tie_pagenavi_init();           if (!is_single()) {         $request = $wp_query->request;         $posts_per_page = intval(get_query_var('posts_per_page'));         $paged = intval(get_query_var('paged'));         $numposts = $wp_query->found_posts;         $max_page = $wp_query->max_num_pages;         if(empty($paged) || $paged == 0) {             $paged = 1;         }         $pages_to_show = intval($pagenavi_options['num_pages']);         $larger_page_to_show = intval($pagenavi_options['num_larger_page_numbers']);         $larger_page_multiple = intval($pagenavi_options['larger_page_numbers_multiple']);         $pages_to_show_minus_1 = $pages_to_show - 1;         $half_page_start = floor($pages_to_show_minus_1/2);         $half_page_end = ceil($pages_to_show_minus_1/2);         $start_page = $paged - $half_page_start;         if($start_page <= 0) {             $start_page = 1;         }         $end_page = $paged + $half_page_end;         if(($end_page - $start_page) != $pages_to_show_minus_1) {             $end_page = $start_page + $pages_to_show_minus_1;         }         if($end_page > $max_page) {             $start_page = $max_page - $pages_to_show_minus_1;             $end_page = $max_page;         }         if($start_page <= 0) {             $start_page = 1;         }         $larger_per_page = $larger_page_to_show*$larger_page_multiple;         $larger_start_page_start = (tie_n_round($start_page, 10) + $larger_page_multiple) - $larger_per_page;         $larger_start_page_end = tie_n_round($start_page, 10) + $larger_page_multiple;         $larger_end_page_start = tie_n_round($end_page, 10) + $larger_page_multiple;         $larger_end_page_end = tie_n_round($end_page, 10) + ($larger_per_page);         if($larger_start_page_end - $larger_page_multiple == $start_page) {             $larger_start_page_start = $larger_start_page_start - $larger_page_multiple;             $larger_start_page_end = $larger_start_page_end - $larger_page_multiple;         }         if($larger_start_page_start <= 0) {             $larger_start_page_start = $larger_page_multiple;         }         if($larger_start_page_end > $max_page) {             $larger_start_page_end = $max_page;         }         if($larger_end_page_end > $max_page) {             $larger_end_page_end = $max_page;         }         if($max_page > 1 || intval($pagenavi_options['always_show']) == 1) {             $pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $pagenavi_options['pages_text']);             $pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text);             //echo $before.'
'."\n";                          if(!empty($pages_text)) {                         echo ''.$pages_text.'';                     }                     if ($start_page >= 2 && $pages_to_show < $max_page) {                         $first_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['first_text']);                         echo ''.$first_page_text.'';                         if(!empty($pagenavi_options['dotleft_text'])) {                             echo ''.$pagenavi_options['dotleft_text'].'';                         }                     }                     if($larger_page_to_show > 0 && $larger_start_page_start > 0 && $larger_start_page_end <= $max_page) {                         for($i = $larger_start_page_start; $i < $larger_start_page_end; $i+=$larger_page_multiple) {                             $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);                             echo ''.$page_text.'';                         }                     }                     previous_posts_link($pagenavi_options['prev_text']);                     for($i = $start_page; $i  <= $end_page; $i++) {                                              if($i == $paged) {                             $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['current_text']);                             echo ''.$current_page_text.'';                         } else {                             $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);                             echo ''.$page_text.'';                         }                     }                     next_posts_link($pagenavi_options['next_text'], $max_page);                     if($larger_page_to_show > 0 && $larger_end_page_start < $max_page) {                         for($i = $larger_end_page_start; $i <= $larger_end_page_end; $i+=$larger_page_multiple) {                             $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);                             echo ''.$page_text.'';                         }                     }                     if ($end_page < $max_page) {                         if(!empty($pagenavi_options['dotright_text'])) {                             echo ''.$pagenavi_options['dotright_text'].'';                         }                         $last_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['last_text']);                         echo ''.$last_page_text.'';                     }                  //echo '
'.$after."\n";         }     }     }               ### Function: Round To The Nearest Value     function tie_n_round($num, $tonearest) {     return floor($num/$tonearest)*$tonearest;     }               ### Function: Page Navigation Options     function tie_pagenavi_init() {     $pagenavi_options = array();     $pagenavi_options['pages_text'] = __('page %CURRENT_PAGE% من %TOTAL_PAGES%','tie');     $pagenavi_options['current_text'] = '%PAGE_NUMBER%';     $pagenavi_options['page_text'] = '%PAGE_NUMBER%';     $pagenavi_options['first_text'] = __('« first','tie');     $pagenavi_options['last_text'] = __('last »','tie');     $pagenavi_options['next_text'] = __('next');     $pagenavi_options['prev_text'] = __('prev');     $pagenavi_options['dotright_text'] = __('...','tie');     $pagenavi_options['dotleft_text'] = __('...','tie');               $pagenavi_options['num_pages'] = 8;          $pagenavi_options['always_show'] = 0;     $pagenavi_options['num_larger_page_numbers'] = 0;     $pagenavi_options['larger_page_numbers_multiple'] = 10;          return $pagenavi_options;     }          ?>      **note please : iam using this code in custom template within single page, the function`__search_by_title_only` is in my `functions.php` to search only the titles in this query** **edit when i use`<?php if(function_exists('tie_pagenavi') ) { tie_pagenavi('', '', '', '', 3, false); } ?>` it is show the pagination div `<div class="pagination"></div>` the which available in my categories & authors archives but but in this template the div is empty** any idea!


title: Get the original menu item name string instead of the label

text: I am building a hierarchical menu of custom taxonomies and their related posts using wp_get_nav_menu_items as follow:               if( $locations = get_nav_menu_locations() && isset($locations['secondary']) ):       $menu = wp_get_nav_menu_object( $locations['secondary'] );            $menu_items = wp_get_nav_menu_items( $menu->term_id );            foreach( (array) $menu_items as $key => $menu_item ):         # access to $menu_item -> title;         # access to $menu_item -> ID;         # access to $menu_item -> object_id;         # etc ...       endforeach;     endif;     etc ...      Say I have a menu item called **service** (it is a term of custom taxonomy solutions_category), and from the Appearance -> Menus I changed its label to ' **Our Services** ' through the Navigation Label. In this case **$menu_item->title** returns 'Our Services'. How can I get 'service' instead? Because I need it for a subsequent WP_Query to get all posts that belong to custom category 'service' Thanks P.S. I can post full code if you need.


title: How to get comment id in callback function?

text: I am trying to get the comment ID in the custom callback function that I can use in wp-list_comments. Any help on how to do this? Thanks in advance I am using wp_list_comments as: ` wp_list_comments('avatar_size=60&type=comment&callback=get_the_rating');` Note: I was trying to use arguments earlier but I am not sure if I can use arguments in callback functions.


title: How to set the default avatar of buddypress avatar

text: I need a way to set the default avatar for buddypress's `bp_core_fetch_avatar`. Using the regular `get_avatar` you can just set the `$default` path but I can't find anyway to do it with buddypress's function. For instance, I use this function to get the full size avatar for a post author but adding `default => "mysite.com/default.png"` doesn't pass.               function fod_post_author_avatar() {     global $post;          if ( function_exists('bp_core_fetch_avatar') ) {         echo apply_filters( 'bp_post_author_avatar', bp_core_fetch_avatar( array( 'item_id' => $post->post_author, 'type' => 'full', 'width' => "130px", 'height' => "130px", default => "http://mysite.com/wp-content/themes/123/images/default-avatar.png" ) ) );      } else if ( function_exists('get_avatar') ) {         get_avatar();     }     }


title: Exlude pages from wp_list_pages

text: in a blow I'm working on there is a navigation menu made of pages and subpages. I didn't code it, so I'm not completely sure how it works, but after reading some code it seems that the menu is generated by this line in the navivation.php file.               <?php wp_list_pages('title_li=&depth='.$bpt_navigation_depth.'&sort_column=menu_order'); ?>      Now, I had to manually build another menu. I just created a list and inserted links to the pages I needed, without using any wordpress function. Some of these links are in the other menu too, so I want to remove them from there. I tried doing this:               <?php $args = array(         'depth'        => 0,         'show_date'    => '',         'date_format'  => get_option('date_format'),         'child_of'     => 0,         'exclude'      => '17',         'include'      => '',         'title_li'     => __('Pages'),         'echo'         => 1,         'authors'      => '',         'sort_column'  => 'menu_order, post_title',         'link_before'  => '',         'link_after'   => '',         'walker'       => '',         'post_type'    => 'page',             'post_status'  => 'publish'      ); ?>                       <?php wp_list_pages($args); ?>      But what happens is that it creates a menu with one single element named 'Pages', which contains a submenu with all the other pages and, anyway, it doesn't exclude the page 17.


title: How to convert that page to a wordpress template?

text: Couple of days I am trying to integrate THAT page in wordpress. I converted it to wordpress theme but can't make the images to loads. All I see is the loading circle. I changed the path in javascript that call the ajax file:               $.get('http://localhost/wordpress/wp-content/themes/two/ajax/thumbs.php?album='+album,function(data){       but no result. I changed even the paths in thumbs.php (example from ../thumbs to full path or with blog_info command )...and again-no result. Any ideas what else I have to change? I deactivated all plugins, but the site still doesn't work. I would be very grateful if you help me. p.s.sorry for my english


title: Threaded comments - deleting parent comment leads to orphan comments

text: Got an issue on a site where deleting a comment with replies (where threaded commenting is activated), leads to the child comments being orphaned, causing unexpected behaviour (such as the orphaned comments attaching themselves to the latest comment). I haven't looked into this yet, but before I do, is this a known problem with threaded comments, or a theme specific problem? I'm thinking of hooking into whatever the hook is for deleting comments to not actually delete the comment, but replace it with something like [deleted] - good idea, or not?


title: How to filter Multiple taxonomies with radio buttons

text: ![enter image description here](http://i.stack.imgur.com/Fy2xm.jpg) To The right are the taxonomies, under them are the different terms, based on the radio selection of the terms..... i have to filter and display the car models....... The Live working can be found here, follow the link


title: Using Foundation 5 in WordPress Administration Area

text:
I am attempting to implement Zurb's Foundation 5 in a development to enable me to utilize its functionality to create better page UIs within the wp-admin. However, for some reason Foundation's JS is not working. Here is source from a custom wp-admin page:               <!DOCTYPE html>                              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />     <title>Your Profile ‹ Career Women — WordPress</title>          <meta name="viewport" content="width=device-width,initial-scale=1.0">     <link rel='stylesheet' id='foundation-loader-php-f-foundation-css-css'  href='http://careerwomen.ca/wp-content/plugins/wordpressurize-core/Css/foundation/loader.php?f=foundation.css&ver=1.0.0' type='text/css' media='all' />     <link rel='stylesheet' id='foundation-loader-php-f-normalize-css-css'  href='http://careerwomen.ca/wp-content/plugins/wordpressurize-core/Css/foundation/loader.php?f=normalize.css&ver=1.0.0' type='text/css' media='all' />     <link rel='stylesheet' id='admin-admin-css-css'  href='http://careerwomen.ca/wp-content/plugins/wordpressurize-core/Css/admin/admin.css?ver=1.0.0' type='text/css' media='all' />     <link rel='stylesheet' id='admin-events-css-css'  href='http://careerwomen.ca/wp-content/plugins/wordpressurize-core/Css/admin/events.css?ver=1.0.0' type='text/css' media='all' />     <link rel='stylesheet' id='open-sans-css'  href='//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=3.9.1' type='text/css' media='all' />     <link rel='stylesheet' id='dashicons-css'  href='http://careerwomen.ca/wp-includes/css/dashicons.css?ver=3.9.1' type='text/css' media='all' />     <link rel='stylesheet' id='admin-bar-css'  href='http://careerwomen.ca/wp-includes/css/admin-bar.css?ver=3.9.1' type='text/css' media='all' />     <link rel='stylesheet' id='debug-bar-css'  href='http://careerwomen.ca/wp-content/plugins/debug-bar/css/debug-bar.dev.css?ver=20111209' type='text/css' media='all' />     <link rel='stylesheet' id='wp-admin-css'  href='http://careerwomen.ca/wp-admin/css/wp-admin.css?ver=3.9.1' type='text/css' media='all' />     <link rel='stylesheet' id='buttons-css'  href='http://careerwomen.ca/wp-includes/css/buttons.css?ver=3.9.1' type='text/css' media='all' />          <link rel='stylesheet' id='wp-auth-check-css'  href='http://careerwomen.ca/wp-includes/css/wp-auth-check.css?ver=3.9.1' type='text/css' media='all' />     <link rel='stylesheet' id='mymail-admin-css'  href='http://careerwomen.ca/wp-content/plugins/myMail/assets/css/admin.css?ver=1.6.6.3' type='text/css' media='all' />
     Skip to main content

                 Skip to toolbar

                             Log Out

             +             –             ×

ks4003078.ip-142-4-208.net

#1

PHP

5.3.3

MySQL

5.1.73

Memory Usage

35,273,824 bytes

Please Enable

WP_DEBUG

                     Object Cache

Cache Hits: 406
Cache Misses: 53

Group: options - ( 94.58k )

Group: default - ( 0.03k )

Group: users - ( 0.38k )

Group: userlogins - ( 0.03k )

Group: useremail - ( 0.05k )

Group: userslugs - ( 0.03k )

Group: user_meta - ( 3.58k )

Group: counts - ( 0.16k )

                  Edit User                  Add New
              <form id="your-profile" action="http://careerwomen.ca/wp-admin/user-edit.php" method="post">

Tab 1

Tab 2

Tab 3

Tab 4

Panel 1 content goes here.

Panel 2 content goes here.

Panel 3 content goes here.

Panel 4 content goes here.

                      <input type="submit" name="submit" id="submit" class="button button-primary" value="Update User">
              </form>

             Thank you for creating with WordPress.

             Version 3.9.1

Session expired

Please log in again.             The login page will open in a new window. After logging in you can close it and return to this page.

                     I have removed irrelevant code, such as the wp-admin menu and admin bar. Here is the contents of my load.js file:               jQuery.noConflict();     jQuery(document).foundation();      For some reason the Foundation tabs functionality is not working, which leads me to believe there is a JS conflict. Any help would be appreciated!


title: Remove taxonomy slug when not assigning taxonomy with custom post types

text: I have created a custom post type plugin that when the user assigns the post to a taxonomy (termed 'classification' in the site), it is added to the url slug. So basically it renders: site.com/data/{classification}/{page-title} However, I'm not sure how to remove the taxonomy (classification) from the slug when the user does not select one. My code is below:               function classification_permalink($permalink, $post_id, $leavename) {         if (strpos($permalink, '%classification%') === FALSE) return $permalink;             // Get post             $post = get_post($post_id);             if (!$post) return $permalink;                  // Get taxonomy terms             $terms = wp_get_object_terms($post->ID, 'classification');             if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0]))                 $taxonomy_slug = $terms[0]->slug;             else $taxonomy_slug = 'no-classification';              return str_replace('%classification%', $taxonomy_slug, $permalink);      Obviously the `else $taxonomy_slug = 'no-classification';` is what the slug defaults to when a taxonomy is not chosen. But how would I edit that line so the slug, when no taxonomy is assigned, would revert to the root so it would read: site.com/data/{page-title} ? The full plugin is on my github: https://github.com/tgelles/dr12-post-types


title: Error jQuery(domChunk).live is not a function

text: I'm getting this error in FireFox:               Error: jQuery(domChunk).live is not a function Source File: http://www.bradford.nhs.uk/wp-includes/js/thickbox/thickbox.js?ver=3.1-20110528 Line: 26      This is the function:               //add thickbox to href & area elements that have a class of .thickbox     function tb_init(domChunk){         jQuery(domChunk).live('click', tb_click);     }      Thickbox seems to be a build in WordPress feature but the theme we are using uses prettyPhoto.


title: How do I rebind event after widget save

text: I am writing a widget who's form elements have a click event attached to. I bind it using jQuery. However, after clicking `save`, the bindings gets lost. That is, clicking those elements doesn't trigger the function anymore. I tried using the `on()` jQuery method, as suggested here, but that doesn't help:                   var buttonsHolder=jQuery('#widgets-right .icon_buttons');                     // save the array of big icons, for later reference, and assign them the click event         var  buttons=buttonsHolder.children('input');         buttons.on("click",function(){             openPanel(jQuery(this),jQuery(this).index());         });      I could put my `js` code inside the widget form, as suggested here. That does solve the problem, but I really prefer to keep my `js` code separated. What do I need to do in order to keep the click event of those elements working even after the `save` button is clicked?


title: Way to include posts both with & without certain meta_key in args for wp_query?

text: **EDIT 2** : **Rather than figuring out the real solution I've decided to use a workaround, and am simply setting the default value for book_in_series to '0'.** Thanks to @eddiemoya for all his the time he spent looking at this with me! **EDIT** : I had a different question with required posting the full code for this archive page / query, if you'd like to see that it's here. This query is working great, but doesn't include any posts which don't have the meta_key 'book_in_series' (which determines the sort value). What I'd like to have happen is for the books to be sorted by this value if it exists, otherwise come back unordered. Is that possible?               $args = array(             'post_type' => 'books',             'posts_per_page' => -1,            'nopaging' => true,            'surpress_filters' => true,            'orderby' => 'meta_value',            'meta_key' => 'book_in_series',            'order' => 'ASC',            'post_parent' => $current_series_id,      );           $books = new WP_Query( $args);      It seems like this answer from Rarst comes close, but I'm not sure how to adapt it for my circumstances. Custom query with query_posts doesn't show post without certain meta_key Thanks in advance for your help!


title: How to create a dynamic page based on form data with a plugin?

text: I have a form that users fill out. When they finish, they are redirected to a 3rd party site to set up payment options. After completing the payment process, they are sent back to my site with a variety of $_POST variables. My plugin needs to create a thank you page based on those POST variables. It's a simple little page with a title and a few paragraphs of text. _I do not want these pages to be stored in the database._ They will be unique to each transaction. I attached a function to `init` that parses the $_POST data (after sanitizing, of course.) That function creates two global variables: `$my_title` and `$my_content` I'm not sure how to turn those into a page for the user, though. The payment system will send users to `www.mysite.com/thank-you` So far, I have a filter on `rewrite_rules_array` to add my url:               function my_rewrite_rules( $rewrite_rules) {         $rule = array('thank-you/?$' => 'index.php?formresult=thank-you');         $rewrite_rules = $rule + $rewrite_rules;         return $rewrite_rules     }      I filter `query_vars` to add mine:               function my_insert_qv($vars) {         array_push($vars, 'formresult');         return $vars;     }      Then, I have an action on `template_redirect` where I think the action should be. Maybe this is the wrong path.               function my_template_redirect() {         gloval $wp;         $qvs = $wp->query_vars;         if (array_key_exists( 'laundry', $qvs && $qvs['laundry'] == 'thank-you' ) {             global $wp_query;             $wp_query->set( 'is_404', false );             // ... now what?         }     }      How can I show the user a page that loads the default page template from the active theme and shows my dynamic title and content?


title: rewrite rule to redirect to the most recent date permalink

text: I've got an archive that's displayed using a URL on the form `www.mysite.ex/mycpt` and I need to make a rewrite rule for that URL which redirects to a permalink with the latest date archive, which is on the form `www.mysite.ex/mycpt/2012/01/31`. The archives use the same archive-mycpt.php template, but my guess is that the fact that it is a Custom Post Type does not matter in this case. I can get the most recent post date by using get_posts and extract the `post_date` for the `post_type` and use that info to attach a path to the above mentioned URL. I suppose I could put that in a rewrite rule, but how do I make a rewrite rule that always has up-to-date information on the most recent post date? I think that I might need to make an action hook somewhere to update the rewrite rule when a new post of the `post_type` is made, but I'm not sure which hook to use and how to use it, or if it's a good approach to begin with. Any ideas? edit: Thanks to woony for pointing me in the right direction.


title: Posting from Wordpress to Facebook

text: Is there a plugin that automatically posts your blog post to Facebook? And only to a specific Page (because I'm admin of several).


title: Generated WYSIWYG gallery with individual gallery_page templates

text: I am in the process of making my first theme, and have created the basic pages index.php, front_page.php, single.php and page.php, I also wanted to add a gallery template page. The idea being the gallery page will differ slightly in format as in no sidebar etc, and I would also like to add further gallery pages after that which will exploit different lightbox and image effects. I can see how to style the individual images using Firebug on an existing gallery so that seems fairly basic. What I can see so far is creating a gallery via the WYSIWYG editor in Wordpress on a default page, appears to revert to page.php. I created a gallery.php and selected this in the dropdown box under page attributes, but the gallery failed to appear using this method. Can someone give me the heads up as to what happens when a gallery is created via the WYSIWYG editor, or is there a link that gives a good rundown of the process that is happening? This may not be possible and I suspect the core Wordpress needs some tweaking to achieve what I have in mind, and I have no intention of tweaking as I am just a beginner! I would also sooner avoid a plugin at this stage like Nextgen gallery. Or is there a different better method you can suggest? Thanks, Ant


title: Adding Custom User Profile data based upon Categories

text: Based upon the code found here: How To Add Custom Form Fields To The User Profile Page? How Could I alter this so that users could check one of several boxes based upon categories I have setup in the blog. E.g. If I have categories: Apples Oranges Bananas Id like these to appear in the User Profile area with a checkbox next to each so that a user can select which fruit they like best.


title: How to overload the update() of existings widgets?

text:
Problem: I couldn't overload the update() method of an existing widget. The widget method and the form method work fine but I can't update the value of the new options defined in the form method. Bellow is how I made that: I want to use the default WP widgets from my custom theme and I need to give them the look and feel of my company. I inherited the WP_Widget_Pages class and overloaded the form() (I need to add two options), the update (to manage the new options) and the widget() methods. In my functions.php it look like this :               function load_my_widgets() {     register_widget('WP_MY_Widget_Pages');     }          /* Add our function to the widgets_init hook. */     add_action( 'widgets_init', 'load_my_widgets' );          class WP_MY_Widget_Pages extends WP_Widget_Pages {          function widget( $args, $instance ) {         parent::widget($args, $instance)     }          function update( $new_instance, $old_instance ) {         $first_instance = parent::update($new_instance, $old_instance);         $first_instance['block_type'] = 'my_block_type';         $first_instance['block_color'] = 'my_block_color';              return $first_instance;     }          function form( $instance ) {         //Defaults         $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '', 'block_type' => '', 'block_color' => '' ));         $block_type = esc_attr( $instance['block_type'] );         $block_color = esc_attr( $instance['block_color'] );         parent::form($instance);         ?>
                 <label for="<?php echo $this->get_field_id('block_type'); ?>"><?php _e( 'Block type:' ); ?>                 <select name="<?php echo $this->get_field_name('block_type'); ?>" id="<?php echo $this->get_field_id('block_type'); ?>" class="widefat">                     <?php foreach (get_all_block_type() as $block_label => $block_type): ?>                         <option <?php selected( $block_type , $instance['block_type'] ); ?> value="<?php echo $block_type; ?>"><?php _e($block_label); ?></option>                     <?php endforeach; ?>                 </select>                 <?php echo 'Block type : '.$instance['block_type']; ?>

                 <label for="<?php echo $this->get_field_id('block_color'); ?>"><?php _e( 'Block color:' ); ?>                 <select name="<?php echo $this->get_field_name('block_color'); ?>"                          id="<?php echo $this->get_field_id('block_color'); ?>"                          class="widefat" style="background-color: <?php echo $block_color_value; ?>" >                     <?php foreach (get_all_block_color() as $block_color_label => $block_color_class): ?>                         <option <?php selected( $block_color_label , $instance['block_color'] ); ?> value="<?php echo $block_color_label;?>" style="background-color: <?php echo $block_color_class;?>" > </option>                     <?php endforeach; ?>                 </select>                 <?php echo 'block color : '.$instance['block_color']; ?>
              <?php     }          }      I have cleaned up the widget method for reading purpose. I did not bother you with validation in the update(), I have set a literal value to make it short. When I go to the dashboard/widget page, then display my Page widget, I can set values to the two new attributes. When I save, the output of the new option's value shows nothing (there is nothing too in the database: select option_value from wp_options where option_id='106';) I would really appreciate any hint. Thanks in advance.


title: get_previous_post in same categories

text: I have a post in two categories, 1 and 2. I want to get the previous post in the two categories, 1 **and** 2.               get_previous_post(true);      With that code I'm getting the previous post in category 1 **or** 2. Any idea?


title: Any alternate TinyMCE4 themes / subthemes?

text: TinyMCE4 in WordPress 3.9 has some cool changes, but it seems to have only one "theme" included. Is there any way to make a sub-theme of the theme defined by CSS, and `theme.js` in `wp-includes/js/tinymce/themes/modern` ? Or a way to dequeue and enqueue a custom theme from somewhere else? Where can I find these MCE4 themes, if it's a common pluggable option? I'm also really curious what the `tinymce.ThemeManager.get('modern')` is meant for, since it only gives you the `function(editor) {... }` containing private variables and functions from `theme.js`, but gives you no way to "monkey patch" the reposition or add-toolbar functions, etc. that are within that function.


title: get comments and get posts in loop

text: I need to get posts done by specific users and get also comments done to these posts, so far I can get the posts and comments but can't get how to do it in loop properly, because now I get the same comments displayed for each post no matter to which posts they actually belong to... So here is the code...loop inside another one, I am now quite sure that is the way it should... So the output in my case: list of posts + each posts get ALL the comments which have ever been done... I want to get post + only its comments in a loop (I will put only php)                       <?php $posts = get_recent_posts_by_author_role('tenant');                             foreach($posts as $post) {                                 $title=$post->post_title;                                 $perma_link=get_permalink($post->ID);                                 $img_post=get_the_post_thumbnail($post->ID);                                 $author_name=$post->post_author;                                 $content_post=$post->post_content;                                 $date=$post->post_date;                                 $content_style="comment_text";                                   ?>          <?php $comment=get_comments($post->ID);                                     foreach($comment as $com){                                              $com_author=$com->comment_author;                                         $com_date=$com->comment_date;                                         $com_content=$com->comment_content;                                         global $authordata;                                         $author_roles=$authordata->roles;                                         ?>          <?php  }?>     <?php  }?>


title: Create a widget to display image and Title?

text: I want to Create a Widget with image top and Title at bottom.Please help me to display ![enter image description here](http://i.stack.imgur.com/IEYEG.jpg) like image top and Title at bottom also add link to to the arrow image. i have Created a Widget area and installed "image widget",can display image using "image widget" but the problem is i cannot display the Title at bottom and add links to the Title.


title: Remove Actions/Filters added via Anonymous Functions

text: That's a freaking bad practice I must say. Spent last two hours finding a solution to remove actions and filters added via Anonymous functions. This is the code used on a Parent Theme, and I need to remove it.               /**      * Add custom columns to admin comments grid      *  * Rate that user set.      */     add_filter( 'manage_edit-comments_columns', function( $default ) {         $columns['smr_comment_rate']  = __( 'Rate', 'txtdmn' );              return array_slice( $default, 0, 3, true ) + $columns + array_slice( $default, 2, NULL, true );     });      Got toscho's answer, played with it heavily, but no help. So, is there any other alternative that will remove actions/filters added via anonymous functions? Thanks


title: Obtaining values from objects

text: This code works fine and returns two StdClass Objects for each of my two posts:                       $children = get_pages($args);                  foreach ($children as $cake=>$element) {                 $args = array(                               'post_id' => $ID                               );                 $Comments = get_comments( $args );             };      This is great. I get each comment's properties but I am only interested in the comment date. My desired output is: $CommentDates = (date1, date2, etc) -- Eventually I'd like to get the most recent comment date. My next move is:                       foreach ($Comments as $CommentObject) {                 $CommentDates = $CommentObject->comment_date;             }      This returns only one date and it happens to be the second object's value. However, if I simply echo this foreach, I get both dates. foreach ($Comments as $CommentObject) { echo $CommentObject->comment_date; }


title: Wordpress register_post_type Invalid post type

text: I am creating my own posts in wordpress however I have hit a little problem and im not sure how to fix it. The below register_post_type creates an Invalid post type error.               add_action( 'init', 'create_post_type' );     function create_post_type() {     register_post_type( 'talent',         array(             'labels' => array(                 'name' => __( 'Talent' ),                 'singular_name' => __( 'talent' )             ),         'public' => true,         'has_archive' => true,         )     );     }      it doesn't seem to like the word talent. If I change 'talent' to 'arist' it works. However it needs to be 'talent' for the URL. Ive checked on wordpress and using talent shouldn't cause any conflicts with default wordpress settings.


title: Is it possible to handle two or more shortcodes in a single page?

text: I have a shortcode **[API-Module version="1"]** and another shortcode like **[API-Module version="2"]** If i handle any one at a time in a single page it works perfectly. Yet my requirement needs both had to be visible in front end(UI) when handling two shortcodes. Is there any possibilities to do so ? Constructor to add short-code:               function __construct() {                 add_shortcode('API-Module', array(&$this, 'handle_shortcode'));             }      This part is used in handling short-code:                function handle_shortcode($atts) {       $version_type = $atts['version'];         ob_start();          require_once "/front_end/view/api-list.php";          $output_string=ob_get_contents();          ob_end_clean();          return $output_string;            }


title: Wordpress comment_form() does not display actual comments

text: Maybe I did not understand the role of comment_form(). **After pasting this in my wordpress single.php I get just the form for submitting comments but NOT THE ACTUAL COMMENTS.** Is this a bug, or the comment_form() does not handle listing the comments? Ty!


title: How to achieve representation of streets index with custom taxonomies

text: I need some advise on how to create achieve a representation of streets hierarchy (in this order: Continent > Country > State > City > Street Name) Like this: ![enter image description here](http://i.stack.imgur.com/z9rqN.png) My only guess for now is to do it using custom taxonomies, that are set to be hierarchical. But, I am not too sure about that, and I believe there might be a better approach. Obviously the street level will be a custom post type. I'd appreciate your help, Maor


title: Dropdown list of a custom post type

text: I have a custom post type, Doctors, that I need to create a dropdown nav for. I just want it to populate a select list with all the posts of that CPT and navigate to that post on selection. I'm doing a couple other dropdowns with wp_dropdown_categories, but I guess there's no built in function for listing a post type?


title: Add new button to WP backend menu

text: I can add a new link under the dashboard menu in the backend of WP               function new_link_display() {         echo "Echo html code for the page";     }          function new_link_page() {         if (function_exists('add_submenu_page') )             add_submenu_page('index.php', __('New Like Label'), __('New Link Label'), 'manage_options', 'new-link-display', 'new_link_display');     }     add_action('admin_menu', 'new_link_page');      How do I add a new button below the Settings button. I don't want it with in the Settings menu but a separate button below it.


title: Why my title change the last post title in my loop?

text:
I have a loop on my index page. The problem I'm having is that the HTML generated has a different title from what I wrote in the template part header.php in `<head>` I do know for sure it takes as new value in `<title>` for the current title of my last post (which is seen in my loop). If I had to guess, I'd say there's something generating thid from each article in the loop that can rewrite the `<title>` in the `<head>`, but I can't find out what. EDIT1 : Here is my loop, to be more precise, it's actually the value in `<h3><?php the_title()?></h3>` which is put in the `<head><title></title></head>`               <?php if ( is_home() ) {   query_posts( 'cat=-5' );   } ?>     <?php if (have_posts()) : ?>       <?php while (have_posts()) : the_post(); ?>         <div <?php post_class()?>>
             <a href="<?php the_permalink(); ?>"><?php the_title(); ?>

             Posté le <?php the_date(); ?> dans <?php the_category(', '); ?> par <?php the_author(); ?>.
             <?php the_tags(); ?>

             <?php the_excerpt(); ?>

       <?php endwhile; ?>     <?php else : ?>
         Il n'y a pas de Post à afficher !
     <?php endif; ?>     <?php wp_reset_query(); ?>      And this is my `<head>` :               <head <?php language_attributes(); ?>>         <meta charset="<?php bloginfo('charset'); ?>">         <title><?php the_title(); ?></title>         <link rel="stylesheet" type="text/css" href="http://necolas.github.io/normalize.css/3.0.1/normalize.css">         <link rel="stylesheet" href="<?php echo get_template_directory_uri();?>/css/app.css" type="text/css">         <link rel= "icon" href="<?php echo get_template_directory_uri();?>/favicon.ico" type="image/x-icon " />         <link href='http://fonts.googleapis.com/css?family=Gloria+Hallelujah' rel='stylesheet' type='text/css'>         <?php wp_head(); ?>


title: Extra field in wp_post instead of postmeta

text: Is there any advantage in terms of query performance, if I add an extra fields in `wp_posts` table, instead of using postmeta? I have already searched for these reasons, but without success.


title: Page/post editor with syntax highlighting

text: is there a plugin that replaces/enhances the built-in Page/Post HTML editor so that HTML is syntax-highlighted? What I'm looking for is something like "Power Code Editor" but for editing Pages/Posts. NOTE: Just to be absolutely clear: I am not looking for a plugin that let me post highlighted code snippets, I just want to edit the HTML code of my posts in a nicer editor :) An added bonus would be a formatter function to cleanup the indentation. Is anybody aware of such a plugin? Thanks!


title: How to Dynamically Resize WordPress Image On-The-Fly (custom field/theme option)

text: So - at a client's request, I am in need of being able to resize an image not the standard WordPress way... but from an image pulled-in from a theme option. I can't simply use the custom_header area, as there will be two or three (I also have some options once the image is uploaded to let the user choose how the link should function (page, post, category, no link, external link, etc)). I'm using Options Framework Theme with great success and I can retrieve the image src just fine, it's a matter of if this can somehow be used in combination with the add_image_size() function normally used for post thumbnails. I'd REALLY rather not go the timthumb route and stick with WordPress APIs (I know that's a little contradictory to what I am doing in the first place...). Any help would be greatly appreciated. Thanks!


title: Grab value of excerpt_length

text: I know how to "set" the excerpt length for posts, but if I need to actually grab this integer value for something else, do you have any idea how I can grab/echo out just the value? Thanks!


title: Moving wordpress to an unknown outlet

text: I have some wordpress websites on one server that I want to download. The problem is I don't know what url or what server I am moving it to. The problem is I do want the original to work. Suggestions on what I should do? This Wordpress Codex suggests I already know where I am moving the wordpress... Suggestions on what I should do?


title: Disable the admin bar / probleme with responsive menu

text: I am using a plugin called > Disable WP Admin Bar Removal The goal : Disable the admin bar (back and frontend). I really want to disable this bar for the dashboard but if I want to use the dashboard on my phone or tablet, the left responsive menu disapeared. The button of the responsive menu is in the admin bar, that's the problem. Is there a way to change that ?


title: Multiple Customizers

text: So I'm building quite a lot of convenient customization options into the wp_customizer and while it does offer the ability to organize settings into tabs, it still seems to be getting rather crowded. Ideally I'd love to have multiple customizer menus each dedicated to specific sections so instead of just having Appearance > Customizer for example I'd have Appearance > Customize Structure, Appearance > Customize Fonts, Appearance > Customize Colors.. Each would go to a page very much like the current customizer page but the settings would be dedicated to specific customizations. Is there any way to generate more than one customizer?


title: New theme crashing site

text: I have recently recreated a theme on our site. I took the old theme as a base and started messing around and trying to be more efficient with our code and what it was doing. And it all seemed to work really well. Until I put it live of course. I updated the site prior to the full new theme going live, with wee bits to test the water and it all seemed to be going well. But then I put it all live and it crashed. The only difference, that I can see really, is the difference between using includes to pull in php files with hardcoded values, which I changed to a function call instead. These functions do a lot of "echo"-ing so could it be that? Even though it wasn't affecting performance before.


title: Serve content from centralized location

text: I'm looking for an easy/efficient way to manage & serve content from one master WP site to multiple drones (NOT multisite). On the master site i'll have custom post type "served_content". The drones will have "collection" pages, each will serve multiple different served_content posts. served_content might become disabled from the master site, too. ## Requirements   * Fetch posts **with their metadata**   * Cache this data so we don't slow down page load too much. Ideally instead of requesting everytime, it can just **sync** the "served_content" posts across all my WP installations   * Use mostly native WP functions, or readymade WP plugins   * Being able to publish **and un-publish** (disable from showing) the served-content, right **from the master site**. ## How I want it to work On (one of) my clients i'll have a page that requests specific post IDs from the centralized location, for example:               $posts_to_retrieve = array(1,5,12,23);     get_remote_posts($posts_to_retrieve);      ## What I've been planning on using   * WP XML-RPC api (and specifically wp.getPost method)   * SimpleXML to parse the returned XML The problem is I don't think XML-RPC method is caching the requests What will you recommend to use? Thanks in advance!


title: What page should I use for a contact form?

text: I want to make a theme with an about page and a contact form, Should I make a custom page meant specifically for it? (the blog is ment for mobile and I'm not looking for most flexibility, the page can be all hard coded but the text) And how would such page be created from the WP-Admin?


title: Custom loop of a single category, cannot order by date. What am I missing?

text: I'm going nuts. All I have is a simple loop on the home page of the site (which is a static page), and it should show the most recent (1) post of a certain category. The trouble is no matter what i do, it seems including category parameter makes sorting by date not work. This is the loop I am using:               <?php         $announcements = new WP_Query();         $announcements->query('showposts=1&cat=4');         while ( $announcements->have_posts() ) : $announcements->the_post();     ?>      The oldest post always shows up when using this. I have tried adding `&orderby=date` and `&order=DESC`, but nothing works until I remove the `&cat=4`, at which point things are sorted by date just fine. Am I missing something, or is sorting a single category by date not possible?


title: Organizing and grouping an array by year

text:
looking for some code review. I had an issue where I had to list events by their year. This was sorted by a meta_key ( "show_date" ). It works as intended, though I'm interested to see if there is another way to do this that is more efficient. I've commented out my code to shed light on my though process.               <?php get_header(); ?>          <?php      $args = array(         'post_type' => 'event',         'category_name' => 'past',         'meta_key' => 'show_date',         'order_by' => 'meta_value'     );          $prod_history = new WP_Query( $args );          //set up the arrays to store the years so I can iterate over them easily later     $all_years = array();                         if ( $prod_history->have_posts() ) :     ?>          <?php while( $prod_history->have_posts() ): $prod_history->the_post(); ?>         <?php              $date_str = get_field( 'show_date' );             //seperate the date from format 'MONTH day(int), YYYY, giving us only year                    $show_year = explode(',', $date_str);                  //reassign $show_year to an interger instead of a string             $year_num = intval( $show_year[1] );                     $link = get_permalink();             $title = get_the_title();                    array_push( $all_years, $year_num );                  $dates[] = array(                 $year_num => array (                     'title' => $title,                     'link' => $link                 )             );                  ?>     <?php endwhile; endif; ?>          <?php         $start_year = min( $all_years );         $end_year = max( $all_years );              foreach( range( $end_year, $start_year ) as $year ){             echo "
" . $year . "
";             foreach( $dates as $date ){                 foreach ( $date as $key => $value ) {                     if( $key == $year ) {                         echo '
' . $value['title'] . "
";                     }                 }             }         }     ?>      Was setting up my multidimensional array '$dates' the best way of doing so? Was my four deep foreach statement the most efficient way? Did I overlook a much simpler solution? Just trying to be a better programmer, thanks for the help.


title: website is sending people to wrong address

text: I'm having trouble with my website. I tried to log-in one day and I found myself being pointed to a completely different website/blog. My dashboard link automatically redirects and I have no idea how to fix this. Does anyone else have any clue how to get in touch with the right people or how to go about solving this?


title: Take control of WordPress before functions.php

text: I'm developing **theme** and I want to make page cache of static pages in my WordPress theme (and basically I know how to implement it) The problem is that when making theme - the first time when I " _get any control_ " about what is happening is inside **functions.php** file of theme, and this file is loaded about 1 sec after request starts (before it is loading all wordpress functions stuff, I quess some sql - **but I dont need that all as I'm using page cache** , just want to render saved html - thats what is cache about to dont init functionality of page). So the question is - **Am I able to - from level of theme - take control of WordPress initialization before theme functions.php?** - the best would be as soon as possible after request start **Why?** Getting html from cache takes 0,05s in my case, and time from request start to functions.php is 1s so in sume it gives 1,05s that I could reduce to like 0,1s if I'm able to 'capture' request earlier. I dont want to modify non-theme files like WordPress core files as many people will use this theme, but if there is no other way than maybe but I dont feel it would be good practice?


title: How can I add custom text styles to the visual text editor?

text: By default an author can select from Paragraph, Address, Preformatted, Heading 1, etc.. As an example I'd like the author to have the ability to visually wrap selected text in a tag, without ever seeing the tag. Is TinyMCE Advanced the only/best way to go?


title: need help to Arabic text in WordPress in textarea

text:
I am doing a worpdress theme which is in Arabic language. When I write anything in Arabic. It turn into `u0646u0646u0646`. This appear in custom meta box here my code :-               function wpq_quiz_answers_info() {              global $post;              $question_answers = get_post_meta( $post->ID, '_question_answers', true );              $question_answers = ( $question_answers == '' ) ? array( '', '', '', '', '' ) : json_decode( $question_answers );              $question_correct_answer = trim( get_post_meta( $post->ID, '_question_correct_answer', true ) );              $html = '<input type="hidden" name="question_box_nonce" value="' . wp_create_nonce( basename( __FILE__ ) ) . '" />';              $html .= '
';              $html .= '
الاجابة الصحيحة	<select class="widefat" name="correct_answer" id="correct_answer" >';              for ( $i = 1; $i <= 5; $i++ ) {                  if ( $question_correct_answer == $i ) {                 $html .= '<option value="' . $i . '" selected >الاجابة ' . $i . '</option>';             }             else {                 $html .= '<option value="' . $i . '">الاجابة ' . $i . '</option>';             }              }              $html .= '</select>
';              $index = 1;              foreach ( $question_answers as $question_answer ) {                  $html .= '
الاجابة ' . $index . '	';             $html .= '<textarea class="widefat" name="quiz_answer[]" id="quiz_answer' . $index . '" lang="ar">' . esc_textarea( trim( $question_answer ) ) . '</textarea>
';                  $index++;              }              $html .= '
';              $html .= '
';              echo $html;     }          function wpq_save_quizes( $post_id = false, $post = false ) {              if ( ! wp_verify_nonce( $_POST['question_box_nonce'], basename( __FILE__ ) ) ) {                  return $post_id;              }              if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {                  return $post_id;              }              if ( 'quiz' == $_POST['post_type'] && current_user_can( 'edit_post', $post_id ) ) {                  $question_answers = isset( $_POST['quiz_answer'] ) ? ( $_POST['quiz_answer'] ) : array();                  $filtered_answers = array();                  foreach ( $question_answers as $answer ) {                      array_push( $filtered_answers, sanitize_text_field( trim( $answer ) ) );                  }                  $question_answers = json_encode( $filtered_answers );                  $correct_answer = isset( $_POST['correct_answer'] ) ? sanitize_text_field( $_POST['correct_answer'] ) : "";                  update_post_meta( $post_id, "_question_answers", $question_answers );                  update_post_meta( $post_id, "_question_correct_answer", $correct_answer );                   }         else {                  return $post_id;              }     }      But in editor its work good. Please help to fix this. Thanks


title: How to display thumbnail if post is assigned one otherwise not

text:
I would like to display the most recent post in a block, and if the post is assigned with a thumbnail I would like it to be shown on the left to the post content. This is my code that I have been trying                               <?php query_posts('posts_per_page=1') ?>                 <?php while ( have_posts() ) : the_post(); ?>
                         <?php if ( has_post_thumbnail(); )?>
                             <?php the_post_thumbnail(); ?>

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

<?php the_excerpt(); ?>

Posted on <?php the_time('jS F, Y'); ?>

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

<?php the_excerpt(); ?>

Posted on <?php the_time('jS F, Y'); ?>

                      <?php endwhile; wp_reset_query(); ?>


title: How to create an archive for all posts that do not have a post format?

text: The title says it all. I need working pagination, correct post count etc. Basically a new page for posts but with a filter for post formats. Things I have tried so far: 1) Created a new rewrite rule for **/no-formats/** that gets the id of the page that loads home.php and appends an argument (?no_post_format=true). Then hooked to 'pre_get_posts', checked for that argument and added a tax_query to the main query that excludes all posts with post formats. This did not work because a rewrite rule to the home page causes a redirect to the actual home page. So /no-formats/ becomes /home/ and my argument is lost. Not the actual code but to give you an idea of what I mean:               add_rewrite_rule( 'no-formats/?$', 'index.php?p='. get_option( 'page_for_posts' ) . '&no_post_format=true', 'top' );      2) Created a new page and tried to replicate the behavior of the page that displays posts and added the mentioned tax_query exclude. I just couldn't come up with any way to get an exact duplication of the home page. Maybe have to dig deeper into WP core. Does somebody have any ideas that could push me into the right direction?


title: Pass custom value to custom taxonomy

text: I'm trying to pass a custom field value into a custom taxamony whenever I publish a post. Everything works fine except the meta value part. I can only pass strings. In the codex it says that wp_set_post_terms takes either string or array, tag or category. But can't I echo a meta value?                    function add_author_taxonomy( $post_id ) {          global $wpdb;          if(!wp_is_post_revision($post_ID)) {              wp_set_post_terms( $post_id, echo get_post_meta($post_id, 'user_submit_customauthor', true) , 'author', true );               }          }          add_action('publish_page', 'add_author_taxonomy');          add_action('publish_post', 'add_author_taxonomy');


title: Widget not displaying in WMPU sites

text:
I'm modifying a theme for a WPMU install, and I've hit a wall. In order to display a text widget in a specified area, I'm using:               $args = array(         'before_widget' => '

',         'after_widget' => '

',          'before_title' => '
',         'after_title' => '
'     );          the_widget('WP_Widget_Text', array('text' => "[si-contact-form form='1']"), $args);      The `shortcode` `"[si-contact-form form='1']"` get's put into the widget and pulls in a Fast Secure Contact Form form. It works on the main site, but is not displaying anything on the subdomain sites. Any ideas why? I have checked, and the subdomains have the same form, with the same shortcode. Not sure why, but this widget won't display unless another widget (ie. Search) is set in the back office. It's not a big deal, since I need the search widget in this instance anyways, but any help towards a solution to this would be appreciated.


title: unregister_sidebar() in stand-alone theme not working

text: With this StackOverflow Q&A I can't make the `unregister_sidebar()` work for me. ### Scenario I have developed a theme using a sidebar area, where I've used a Widget. But I don't want the 'Editor' to get access to this Sidebar Widgetized Area in Admin area. So I want to do a tweak in my theme's `functions.php`, where I previously declared `register_sidebar()` somewhere to register the sidebar. I understood that, setting a less priority will trigger the unregister function more earlier, so I tried with:               function site_unregister_sidebar() {              if ( is_admin() && current_user_can('editor') ) {             unregister_sidebar( 'my_custom_widget_area' );         }     }          add_action('widgets_init', 'site_unregister_sidebar', 1);      But nothing is happening.   * What actually I'm doing wrong?   * Is there any other way I can achieve this?


title: Custom metabox for file upload return empty filename

text: I want to attach a file to a post and "do something with it later". The file isn't being pulled over when I publish/update my post, the error I get is an empty filename. If I change the input type to text and submit I can get the text to save/display but trying to upload the file acts as though I haven't supplied the file to the form: form -- function display_file_upload_meta_box($post_id,$post){               wp_nonce_field( basename( __FILE__ ), 'file_upload_meta_box_nonce' );         ?>             <p>                 <?php                     $fileUpload= get_post_meta($object->ID,'file-upload-meta',true);                     if(!$fileUpload)                         $fileUpload = '';                     echo 'file: '.$fileUpload;                 ?>                 <label for="file_upload_meta">Attach a file to this post</label>                 <input type="file" id="file_upload_meta" name="file_upload_meta" class="widefat"/>             </p>         <?php         }      code to upload file --               $new_meta_value = wp_upload_bits($_FILES["file_upload_meta"]['name'], null, file_get_contents($_FILES["file_upload_meta"]['tmp_name']));


title: get_option( 'home' ) not returning value in database

text:
I am using multisite (subfolders) and have several subsites on it. All have been working fine with no problems however one subsite is now not returning the correct value with get_option( 'home' ) for some reason - it was working fine for a while but just recently stopped working... So now this subsite cannot create any new pages and link to the correct media etc and when I view the permalinks settings for this subsite none of the options include the assigned subsite path. So to clarify my problem, I looked at the code in /wp/wp-admin/options- permalink.php and added the following code to line 125:               if ($_GET['debug'] === 'true'){       echo 'current_blog_id: '. get_current_blog_id() .'
';       echo 'blogname: '. get_option( 'blogname' ) .'
';       echo 'siteurl: '. get_option( 'siteurl' ) .'
';       echo 'home: '. get_option( 'home' ) .'
';     }      Everything outputs correctly except that get_option( 'home' ) is returning the wrong value for this subsite - it returns the the domain to my primary multisite. so for example it should return: mymultisitenetwork.com/subsite9/ however it just returns: mymultisitenetwork.com/ All the other values are returned correctly ( get_current_blog_id(), get_option( 'blogname' ), get_option( 'siteurl' ) When I check the other subsites in my network the get_option( 'home' ) returns the correct value for that subsite ( like: mymultisitenetwork.com/subsite2/ ) I checked the options table in the database for this subsite "wp_9_options" and it has the correct value in there "mymultisitenetwork.com/subsite9/" So why when I output echo out get_option( 'home' ) it returns mymultisitenetwork.com/ instead of mymultisitenetwork.com/subsite9/ ?? I even tried clearing the cache before outputting get_option('home') with the following code but that didn't work either - still outputted the wrong data:               $GLOBALS['wp_object_cache']->delete( 'home', 'options' );      Please help to resolve this as this client can no logger create any new pages because of this.. Any help is greatly appreciated - thanks in advance! Note: because I cannot put links in this post I have removed http:// from the dummy links above.


title: How to get all the items of a taxonomy even if it does not have a custom post type?

text:
How do you get get all the items of a taxonomy even if it does not have a custom post type? I tried :               <?php      $termsq = get_terms("competence");      $countq = count($termsq);      if ( $countq > 0 ){          echo "
";          foreach ( $termsq as $termq ) {            echo "
" . $termq->name . "
";               }          echo "
";      }      ?>      but, it just displays the taxonomy that contains a custom post type. I want to get the complete taxonomy, even if it has no custom post type related to it.


title: Resetting post data to previous loop in nested loops

text:
I'm trying to use nested loops with the posts to posts plugin. The loops both work, but the problem arises after the second nested loop ($issue). I want to access the $publication loop again, but the data is still the $issue data. `wp_reset_query()` will reset right back to the main loop in single.php which I don't want. I could use `get_posts()` instead of new WP_Query, but I want to be able to use `get_template_part()`. How can I reset my data back to the publication loop, so that the second 'Publication title' returns the publication, not the issue, title? Here's my code within single.php:               $publication = new WP_Query( array(     'connected_type'  => 'publication_to_post',     'connected_items' => $post->ID,     'fields'          => 'ids',     'posts_per_page'  => 1,     ) );          if ( $publication->have_posts() ) {     while ( $publication->have_posts() ) : $publication->the_post();         echo '
Publication title = '.get_the_title().'
';         $pub_id = get_the_ID();              $issue = new WP_Query( array(             'connected_type'  => 'publication_to_issue',             'connected_items' => $pub_id,             'fields'          => 'ids',             'posts_per_page'  => 1,         ) );              if ( $issue->have_posts() ) {             while ( $issue->have_posts() ) : $issue->the_post();                      // need to be able to use template parts in here                 echo '
Issue title = '.get_the_title().'
';                  endwhile;         }              // This currently returns the issue title, not the publication title         echo '
Publication title = '.get_the_title().'
';          endwhile;     }


title: Get sticky post from category?

text: I have parent category is Game `cat_id=42`. Child categories are : acrade, causual,.... I want show a top game module in mainpage template, it will show 10 sticky post from game category. This my code :               <?php         $args = array(           'cat' => 42,           'posts_per_page' => 10,           'post__in'  => get_option( 'sticky_posts' ),        );        query_posts( $args );     ?>


title: How to find out what handler is registered to a shortcode

text: I would like to be able to programatically find out what handler is registered to a particular shortcode. I want to be able to find this so I can save it, change it, perform a do_shortcode, then change it back to what it was originally. I understand WordPress has a gobal variable $wp_filter for registered filters... Is there and equivalent for shortcodes?


title: Can not add jquery in footer

text: I am trying to load the script in footer but always it shows that it is added in header.               function tabbed_scripts()       {       wp_register_script( 'tabbed-scripts', plugins_url( '/js/jquery.responsiveTabs.min.js', __FILE__ ) );        wp_enqueue_script( 'tabbed-scripts' );        }        add_action( 'wp_enqueue_scripts', 'tabbed_scripts' ); How can I move script to footer?


title: Many POST requests to /xmlrpc.php from GoogleBot taking down server?

text: I have several hosted wordpress blogs, and I've been trying to visit them and they are really slow. I looked at my server logs and I found this               stanfordflipside.com:80 188.138.33.149 - - [17/Aug/2013:17:14:28 -0700] "POST /xmlrpc.php HTTP/1.1" 200 595 "-" "GoogleBot/1.0"     stanfordflipside.com:80 188.138.33.149 - - [17/Aug/2013:17:14:28 -0700] "POST /xmlrpc.php HTTP/1.1" 200 595 "-" "GoogleBot/1.0"     stanfordflipside.com:80 188.138.33.149 - - [17/Aug/2013:17:14:28 -0700] "POST /xmlrpc.php HTTP/1.1" 200 595 "-" "GoogleBot/1.0"     stanfordflipside.com:80 188.138.33.149 - - [17/Aug/2013:17:14:28 -0700] "POST /xmlrpc.php HTTP/1.1" 200 595 "-" "GoogleBot/1.0"     stanfordflipside.com:80 188.138.33.149 - - [17/Aug/2013:17:14:29 -0700] "POST /xmlrpc.php HTTP/1.1" 200 595 "-" "GoogleBot/1.0"     stanfordflipside.com:80 188.138.33.149 - - [17/Aug/2013:17:14:29 -0700] "POST /xmlrpc.php HTTP/1.1" 200 595 "-" "GoogleBot/1.0"     stanfordflipside.com:80 188.138.33.149 - - [17/Aug/2013:17:14:29 -0700] "POST /xmlrpc.php HTTP/1.1" 200 595 "-" "GoogleBot/1.0"     stanfordflipside.com:80 188.138.33.149 - - [17/Aug/2013:17:14:29 -0700] "POST /xmlrpc.php HTTP/1.1" 200 595 "-" "GoogleBot/1.0"     stanfordflipside.com:80 188.138.33.149 - - [17/Aug/2013:17:14:31 -0700] "POST /xmlrpc.php HTTP/1.1" 200 595 "-" "GoogleBot/1.0"     stanfordflipside.com:80 188.138.33.149 - - [17/Aug/2013:17:14:31 -0700] "POST /xmlrpc.php HTTP/1.1" 200 595 "-" "GoogleBot/1.0"     stanfordflipside.com:80 188.138.33.149 - - [17/Aug/2013:17:14:31 -0700] "POST /xmlrpc.php HTTP/1.1" 200 595 "-" "GoogleBot/1.0"      I am getting ~10 hits per second to the file /xmlrpc.php from the GoogleBot to several sites, and this seems to be slowing down the server. I am running               tail -f       on the log file, and can just see these requests continuing. Does anyone know why this might be happening or what you could do to stop it?


title: global variable not accessable inside functions

text: I downloaded and installed a wordpress plugin. Everthing works fine on localhost untill i uploaded the site on live server it wasn't working as intended. When i define a variable as global its value is not accessable inside functions. Courses.php               include 'functions.php';      functions.php               global $PLUGIN_ADDRESS;     echo $PLUGIN_ADDRESS = plugins_url('/', __FILE__);     require 'functions/course.class.php';      course.class.php               class courses     {     public function course_form($course_edit)     {               global $PLUGIN_ADDRESS;               echo $PLUGIN_ADDRESS;      and the result is empty. Im getting this $PLUGIN_ADDRESS value correct when i access my site over localhost using the same code. But on live server it returns empty value. I've also tried using $GLOBALS but still same result. Any help is highly appericiated. Thanks


title: URL displays different page (a loop)?

text: So I've been playing with many themes lately and finally came back to my old one, and I'm in trouble. I have (always had actually) a page called Portfolio. It's address is www.example.com/portfolio. I have a few different pages such as Contact at www.example.com/contact etc. Now, the problem is, when I go to www.example.com/portfolio it displays a loop from my custom post type called portfolio but not the page itself. Even when I open the page using direct link from wp-admin, it still displays wrong content. After I delete any page and I try to access it I get 404 page, but after I delete Portfolio there's still this loop under example.com/portfolio :O I'm pretty sure /portfolio URL has been hardcoded somehow in my database by one of the previous themes (is it even possible?) and now points to something else. How to fix that?


title: WP No Base Permalink only works with logged user (admin)

text: (My apologies for my poor English, I'm french) I just want to have a shorty URL for all page of my WP Site: `www.example.com/wordpress-answers-is-a-good-site` for my posts insteads of `www.example.com/category/wordpress/tips/wordpress-answers-is-a-good-site`. `www.example.com/hardware` for hardware category instead of `www.example.com/category/tech/geek/hardware`. For this issue, I use the plugin named "WP No Base Permalink", who works perfectly... for me. But not for all users. After I activate the plugin, all works fine for me. But for unlogged user and logged as another role as admin (contributor, author...), the rewriting works but the blog displays bad URLs for the category. "Hardware" Menu and Nav links to `www.example.com/category/tech/geek/hardware` and the user have a 404 error (because the good URL is `www.example.com/hardware`). All works good for posts and pages, but not for the category permalink, export for me (admin). My permalink structure is: `/%postname%`. I can't found another plugin to make this rewriting.


title: How to fix 'Call to undefined function do_settings()' error?

text:
I am writing my first plugin and to access/save options I follow codex.wordpress.org/Creating_Options_Pages I basically copied the example from 'See It All Together' in a separate file `mhomepage_admin_menu.php` The main code of the plugin goes like               if ( is_admin() ){ // admin actions         add_action('admin_menu', 'add_plugin_admin_page' );         add_action('admin_init', 'register_mhomepage_settings' );          } else {       // non-admin enqueues, actions, and filters     }          function register_mhomepage_settings() { // whitelist options       register_setting( 'mhomepage_option_group', 'left_right_margin_option' );       register_setting( 'mhomepage_option_group', 'top_margin_option' );       register_setting( 'mhomepage_option_group', 'include_comments_option' );     }            function add_plugin_admin_page($plugin_name) {         add_menu_page( 'mHomePage', 'mHomePage', 'manage_options', 'mhomepage/mhomepage_admin_menu.php', '', '', 6 );          }      and the beginning of `mhomepage_admin_menu.php` looks like

Your Plugin Name
          <form method="post" action="options.php">         <?php settings_fields( 'mhomepage_option_group' ); ?>         <?php do_settings( 'mhomepage_option_group' ); ?>
      I have to questions   * Q1: how to fix the error?   * Q2: what is the correct file name in `<form method="post" action="options.php">`? Is that `mhomepage_admin_menu.php`?


title: loading a custom stylesheet in a function

text:
im having problems loading my custom stylesheet inside `wp-admin` here is my code to load stylesheet inside my theme's `function.php`               add_action('admin_head', 'my_custom_style');          function my_custom_style()      {       echo '<link rel="stylesheet" href="' . get_bloginfo('template_url') . '/css/style.css" media="screen" type="text/css />';       }      and some functions that adds `<div>` on my `admin-header` and `admin-footer`               add_action('admin_head', 'echo_html');     function echo_html(){         echo '
 test superwrap';          }          add_action('wp_footer', 'echo_foo');     function echo_foo(){         echo '
';          }      when i echo below `code` inside my `my_custom_style` function, it works. but when i link the stylesheet, it doesnt load.


title: Am I mixing up the concept of posts pages and categories?

text: I'm planning on having workshops on this layout: ![screenshot](http://i.imgur.com/Qcz3AmF.jpg) I have several workshops: Meditation has 2 or 3, Reikki has 2 and Feng Shui has a couple. So as I read the codex about pages and categories I get a bit confused. Should I create a category called Workshops, put it on the menu, then create a Meditation page, and on that page put the events as posts? And is it possible to showcase the indivdual workshops in the sidebar like I show in the image above? Note that I plan to have a "Recent Articles" on a sidebar below "Workshops", not sure if that will interfere. This may be a basic concept but the more I think about this, the more my head hurts. P.S.: I have 2 workshops repeated in the screenshot, just for the sake of visualization.


title: Admin bar stats widget plugin image broken

text: Using Wordpress Stats on my site. On the admin bar when logged in and viewing the site, the spark image with daily stats is broken. It's not a critical issue, just an annoyance. Any ideas? ![enter image description here](http://i.stack.imgur.com/S1cUb.jpg) Edit: Broken URL: http://www.denveroffthewagon.com/wp- admin/?page=stats&noheader&proxy&chart=admin-bar-hours&height=20&hours=48


title: How does: /index.php?post_type=event&event-date=2011-07-25 work? What if it doesn't work?

text: I have an events cpt with a slug "event" I am using it in several places but I am trying to create a "day" view that shows all the events for a given day. I also have the archive arg set in the CPT creation in functions.php I have been around and around on this one but essentially here is what I am trying to do: domain.com/index.php?post_type=event&event-date=2011-07-25 this brings up a page that lists a whole bunch of crap(random posts), not the events for that day. Also if I change it to event_archive.php?post_type=event&event- date=2011-07-25, I get a Page can't be found error. I am not even worried about custom rewrite rules at this point, I just want it to work.


title: How should one implement add_settings_error on custom menu pages?

text: The Professional WordPress Plugin Development book explains in detail how to properly use the Settings API, and it also demonstrates how to add Menus and Submenus, but unfortunately it doesn't provide any joined-up examples of this. Whilst I've managed to get most of it working, I can't figure out how to properly implement add_settings_error on custom Menu pages. Here is my code:               function settings_main_validate( $input ) {     $valid['text_string'] = preg_replace( '/[^a-zA-Z]/', '', $input['text_string'] );          if ( $valid['text_string'] != $input['text_string'] ) {         //add_setting_error: $title, $id, $error_message, $class         add_settings_error( 'fields_main_input', 'texterror', 'Incorrect value entered!', 'error' );     }             return $valid;     }                        The validation above will work great on setting rendered using `add_options_page`, but will not display the settings errors on pages rendered with `add_menu_page`.


title: Add htmlentities and/or shortcode into data-attributes

text:
I realize this is crazy but, I built up a filtered gallery with quicksand and it pulls in a larger image, title and description when you click the smaller image it shows the data-img in a larger form. Below is the code that is currently working...               <img src="<?php echo $large_image ?>" data-img="<?php echo $large_image ?>"      data-title="<?php echo get_the_title(); ?>"       data-description="<?php the_content();?>" alt="" class="superbox-img" />      My client came back and asked if they could change the larger images that is begin pulled from the data-img attribute from static images to galleries... So I installed the Advanced Custom Fields plugin and added a WYSIWYG editor, for a shortcode field, in the portfolio posts (custom page type). Which I would like to import a royal slider(http://dimsemenov.com/plugins/royal-slider/) short code into. I've since changed the code from above to the following...               <img src="<?php echo $large_image ?>"      data-img="<?php htmlentities(the_field('portfolio_galleries')); ?>"      data-title="<?php echo get_the_title(); ?>"      data-description="<?php the_content();?>" alt="" class="superbox-img" />      Which is throwing an error and spitting out the following HTML...               <img src="http://localhost:8888/BVH/wp-content/uploads/2013/03/St-Francis-Assisi-Interior-6-.jpg"      data-img="

          test1
test1

          test2
test2

     test3
test3

"           data-title="Doane" data-description="
testing1234
"      alt="" class="superbox-img" />      Maybe I'm going about this the wrong way but the initial gallery worked great and I'm wondering how to go about accomplishing this problem any help would be great as I know this is probably a lost cause the way I'm currently trying to accomplish this. :-/ Thanks in advanced. UPDATE:               data-img="<div id="new-royalslider-6"      class="royalSlider new-royalslider-6 rsMinW rs-simple-vertical"       style="width:100%; height:500;"><div      class="rsContent"> <a      class="rsImg" href="localhost:8888/BVH/wp-content/uploads/2013/03/…; <div`


title: User redirect to destination URL after login

text: Scenario: if user not login, user redirect to customize login page and redirect again to destination page after login. I don't use a function or plugin. This code to restriction page:               if (!is_user_logged_in()){ wp_redirect( get_option('home') . '?redirect_to=' . esc_url($_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]) );     }      successfully to user login but in login page the URL change to ?page=login and can't get URL redirect to destination page. How to make it? Anyone could help, please?


title: Automatically remove trashed pages from nav menu

text: As it is now, when a page that is in the nav menu is trashed, it still stays in the menu until manually remove via the nav menu editor. Is it possible to have trashed pages removed automatically? Thanks


title: Change header.php after ajax call

text: Is possible change class to body_class() after ajax call to load posts/pages? I would say no, but I have not used much with wordpress ajax, so I ask the question.


title: Is it good idea to combine Options FrameWork with Hybrid Core Framework

text: (This is my first time posting here, so would appreciate if anyone could let me know the best way to post questions). Until now, I had been using TwentyEleven Theme and adding "Options Framework - http://wptheming.com/options-framework-theme/". It works great and I wish to continue using it. However I found a better base theme Hybrid Core (http://themehybrid.com/hybrid-core), through which I could better management my development. I wanted suggestions if its good to combine "Options Framework" & "Hybrid Core" for theme development considering Hybrid already has its own way of adding meta boxes to the Theme Options page.


title: Defining hooks within (php)classes?

text: I have been trying to write a reusable modular options class and I am stuck at this specific point. How do i define hooks within php classes? ## Try 1 :               class super_options {          // ..........................                 function render_options_page ()            {                 //....................                          $this->top_page_hook();                 //....................             }                // ..........................                  function top_page_hook() {                  do_action( array( &$this, 'top_page_hook') );             }          }      and when hooking to the above, add_action( array( &$plugs, 'top_page_hook' ), 'stuff_for_top_hook' ); This doesn't work. ## Try 2 :   * Replacing the `$this->top_page_hook();`, with `do_action( 'top_page_hook' );`   * Calling `add_action( 'top_page_hook', 'stuff_for_top_hook' );`   * Works, but the class loses its reusability. So how do i take care of this? Please share your wisdom. Thanks.


title: How to do a WP_User_Query in Wordpress 3.0.1?

text: How do I query a list of authors / users in Wordpress 3.0.1? I'd upgrade but my theme doesn't support WP 3.2.1


title: For what queries is conditional tags informative?

text: I think it's great to use conditional tags but if the query is slightly advanced it won't give information about the original query. For example; is_category('apple') _might_ give a false response if "banana" AND "apple" has been queried. This is because is_category() compares against one single category and doesn't bother about the rest. I need a way to know when I can expect that conditional tags won't give complete information about the original query. Can someone explain the limits of wordpress conditional tags?


title: Blog & Portfolio setup

text: Like so many others on the web, I've been trying to get a blog and a portfolio to play nicely together within the same website. Here is what I would like the urls to look like and some things that I have tried. **Desired Permalink Structure:**               reggi.com/portfolio     reggi.com/portfolio/$post_year/$post_title     reggi.com/portfolio/category/$category     reggi.com/portfolio/tag/$tag     reggi.com/blog     reggi.com/blog/$post_id/$post_title     reggi.com/blog/category/$category     reggi.com/blog/tag/$tag      **Here are some things i've tried:**   * Two wordpress installs Cons: Very large (doup of wp core files), multiple logins, separate themes   * Two wordpress installs using symbolic links on wp core files (to minimize size) Cons: multiple logins, separate themes   * Wordpress multisite Cons: force root, can't use `blog`,   * One wordpress with `/%category%/` in permalink Cons: slow, categories & tags leave out `blog` & `portfolio` in permalink (ex `reggi.com/cat/$category`) **Question:** Is there something that i've missed is there any other way to have two blogs on one site?


title: Setting up a gallery with images and a zip download

text: I am putting together a little gallery/portfolio for a friend's work and I am struggling to work out where a plugin starts and theme begins. I'm trying to achieve a simple grid of images which link to a detailed view. Inside the detailed view it is just the image, a little description and then a zip download button. How can I do this with WordPress?


title: Empty folder being created by Wordpress, breaks site

text: I have a page on my site at mysite.com/publish. This page leads to a members area where they can add/edit posts from the front end. For some reason, randomly as far as I can tell, Wordpress keeps adding an empty folder to the same folder that Wordpress is in. For instance, my WP install is in a sub- directory called wordpress-2013 which is inside my main public directory. Inside that main directory an empty directory called "Publish" keeps being created so when someone tries to visit mysite.com/publish an error is given because of that folder. I'm not sure where to even start figuring out what might be wrong. Anyone have any ideas? I found a couple threads on here from about 4 years ago that either didn't have answers or did not apply to the current WP version. Thanks in advance.


title: Wordpress Taxonomy Menu

text:
I have got the following simple code.
<?php            echo '
All
';                  if ( $count > 0 ) {                      foreach ( $mylinks as $mylink ) {             echo '
'.'slug .'" >';             echo $mylink->name;             echo "";             echo "
";             }         }        ?>      The above basically returns the following:

         All

         Education

      What I want is to have the taxonomy terms, (i.e. say taxonomy Education to link to an independent page: http://website.com/education and on that page have all the custom post types with the taxonomy 'education' displayed on the page. PS: Displaying the taxonomy terms is not a problem, the problem is linking the displayed taxonomy terms (in the code above) to an independent page (http://website.com/independent_page). This must happen all dynamically. Is it possible? Please share your suggestions or links to tutorials. One more question. What is the exact custom taxonomy URL? Is it http://website.com/taxonomy/education ?


title: Can't seem to get wp_localize_script to work

text: This is my code:               wp_enqueue_script('ms_ajax_localized');          wp_localize_script( 'ms_ajax_localized', 'MS_Ajax', array(         'ajaxurl'       => admin_url( 'admin-ajax.php' ),         'nextNonce'     => wp_create_nonce( 'myajax-next-nonce' ))     );      I popped it into my `functions.php` Bashing my head against the wall. I've used wp_localize_script before and I'm just blind to what is wrong this time. When I load the page I can't find the script tag in the source anywhere...


title: Show content if parent page has children

text: Using this piece of code you can show content depending if it's a child-page or not:               <?php     global $post;          if ( is_page() && $post->post_parent ) : ?>     This is a child-page.          <?php else : ?>     This is a parent-page.          <?php endif; ?>      But I would like to add one more statement, so that I could have different content if it's a parent-page that has a child, or a parent-page that hasn't. Would something like this below work? If yes, what would "XXX" be?               <?php     global $post;          if ( is_page() && $post->post_parent ) : ?>     This is a child-page.          <?php elseif ( is_page() && XXX ) : ?>     This is a parent-page (with one or more children)          <?php else : ?>     This is a parent page without children.          <?php endif; ?>      Thanks in advance!


title: w3 total cache and sitemap.xml

text: I have been installing lately w3 total cache on my wordpress site and today webmaster tools has been mailing an error by sitemap.xml crawling. `Sitemap ist HTML`. Is anybody experienced this issue with w3 total cache? If yes what would be the workaround?


title: Single post comment template not working

text: I cant get the comments template to show up in my single-events.php This is my code               <?php while ( have_posts() ) : the_post(); ?>        <?php get_template_part( 'content', 'events' ); ?>     <?php comments_template( '', true ); ?>     <?php endwhile; // end of the loop. ?>      If I put the comments template in my events template (events.php), it will show up but it doesnt work on the single posts. Any ideas anyone?


title: Get posts with tag all post types

text: I'm trying to get all posts that have a specific tag, regardless of what type of post that is. I've tried every solution I've found (here on SO and further), but nothing works: I always only get the normal 'post' type from my wp_query. I've tried this:               $query_args = array(             'tag' => $tag,             'post_type' => array('post', 'praktijk', 'expert', 'download', 'product', 'event')         );              $query = new WP_Query( $query_args );      And I would think that would work. Replacing the array of post_types with the string 'any' also doesn't work. Does anybody know what I'm doing wrong?


title: Woocommerce: assign an "author" to a product

text: I'm developing my first theme for woocommerce. I need to be able to have "authors" (really "designers") assigned to woocommerce products. Is that feasible? I was thinking of using the wordpress built-in "author" user, but the interface of a product editing does not provide the "author" box, unlike a "post" editing interface.


title: date issue with category post retrival

text: I am trying to retrieve all posts from an rss feed from a category, and I have working code that does this. However, on one category I will only get all posts until a certain date. Any post prior to this date will not show up. I have debugged this by posting a new article and set it as close to the last retrieved post as possible. The glitch seems to happen passing from one day into another at 00:00 (12AM). Does anyone know of such an issue.               add_filter('option_posts_per_rss', 'override_posts_per_rss');     function override_posts_per_rss($value){             if(isset($_GET['posts_per_rss']))             return intval($_GET['posts_per_rss']);         else             return $value;     }      this is the code that I am using. It works fine for all of my other categories except for one where I hit this date barrier. I have tried any code from this post: Individual rss feed entry length for categories? and all give the same output hitting this date barrier. Any help is appreciated!


title: Main menu highlighting on subpage which is not in submenu but in hierarchy

text: I have my menu made of images. Therefore I use `divs` and with `.current-menu- item` I use CSS to change the image. This works if I'm directly on this main page. If I'm on a subpage I cannot use this trick anymore. The reason is that the submenu is build like the following: Each page has set a parent. The submenu is generated with               wp_page_menu(array(         'child_of' => SUBMENU_ROOT     ));      whereas SUBMENU_ROOT is the fetched top most parent. So I have the parent ID which should be highlighted in the main menu. How can I achieve a highlighting of the main menu when I'm on a subpage? Or is the only way to use the normal menu dialog?


title: Problem embedding a page on facebook

text: When I put the link to this page: http://www.likeforisrael.info/ In facebook, I get the embed code to show a link to this page: http://likeforisrael.info/NVnlO/ And idea why this happens?!


title: How to enqueue scripts depending on post formats?

text: So I'm trying to enqueue scripts used for some post formats like video and audio and I could find a way to check what post formats are going to be shown on the page. I tried print_r on some global variables but they doesn't seems to have post_format in the post details, I tried $posts and $wp_query and also tried print_r on $GLOBALS. I also tried adding an action for video and audio post formats but the action runs too late for queuing scripts. have anyone done something like this before ? and thanks in advance.


title: Need to download uploaded binary file

text: I have uploaded a binary .war file which is nothing but a .zip file with Java web application extension. When I hit the URL for this file, I see junk characters in browsers. URL: http://www.javaquizmaker.com/QuizGenerator.war Need a way by which I can make the users download this file. By the way, I uploaded using FTP and the Add new media feature of WordPress gave me an error about File upload not supported due to security reasons. Pls. advise.


title: How to get the role id from the role name?

text: I need to retrieve the id of a role by giving it roles name. For example:               if( current_user_can('editor') ) {      //here I want to retrieve the id of editor.     }      How can I do that?


title: Website in one language, but admin backend in English

text: > **Possible Duplicate:**   >  Localization: I want the backend: english and frontend in defined language I have installed WordPress in Greek language, because I need the greek frontend translation. But I dont like the Greek admin backend. Is there anyway to change only the backend language leaving the frontend untouched?


title: Can someone please tell me what is wrong with my plugin?

text:
Two days back a made a plugin that allows me to insert toggle box in to the post with the shortcode `[toggle Title="My title"]toggle test[/toggle]` I also posted my plugin on WordPress.org plugins > http://wordpress.org/extend/plugins/toggle-box/. **The Problem** I made the whole plugin on sand box that I have made on my local machine using XAMPP then after a while I installed the plugin on an other WordPress blog where it was installed OK CSS and JS were loading in to the page but toggle was not working !!!! (the style and JS were appearing in the head and the heading was also appearing but it was not toggling when I clicked it.) then I tried to use the plugins on some other blogs but encountered the same problem. then I set up another WordPress sandbox on my machine and used the plugin there and it was not working there so I realized there is some thing wrong with my code which I was unable to find. So can some one please identify and provide the solution for the problem thanks **Code of my plugin** /toggle box.php               <?php     /**      * Plugin Name: Toggle box      * Plugin URI: http://wordpress.org/extend/plugins/toggle-box/      * Description: This is an awesome custom plugin which adds toggle box funtionality in to your theme themes.      * Author: phantom.omaga      * Author URI: http://profiles.wordpress.org/users/phantom.omaga/      * Version: 0.1.0     **/          //*************************** Toggle Boxes Short Code ***************************//          function togglebox($atts, $content = null) {         extract(shortcode_atts(array(             'title'      => '',         ), $atts));              $out .= '
' .$title. '
';         $out .= '

';         $out .= do_shortcode($content);         $out .= '

';             return $out;     }          add_shortcode('toggle', 'togglebox');               //*************************** Get Plugin URL  ***************************//          function get_pluginurl() {     // WP < 2.6     if ( !function_exists('plugins_url') )         return get_option('siteurl') . '/wp-content/plugins/' . plugin_basename(dirname(__FILE__));         return plugins_url(plugin_basename(dirname(__FILE__)));     }     //*************************** Calls Toggle Box css and js***************************//          function add_togglebox () {     ?>         <link type="text/css" href="<?php echo plugins_url('toggle-box'); ?>/toggle-box.css" rel="stylesheet" />                   <?php }     add_action('wp_head', 'add_togglebox');     ?>      /toggle-box.css               /*************************** Shortcodes: Toggle Box ***************************/          h3.toggle {     background-repeat: no-repeat;     background-position: -27px -23px;     font-size: 16px;     padding: 0 0 20px 23px;     cursor: pointer;     }     h3.toggle a {     text-decoration: none;     display: block;     }     h3.toggle-active {     background-position: -6px -50px;     }     .toggle-box {     clear:both;     margin: 0 0 10px 0;     overflow: hidden;     }     h3.toggle {     background-image: url(images/sprite.png);     }      /toggle-box.js               /*************************** Toggle Content ***************************/          jQuery(document).ready(function(){     jQuery(".toggle-box").hide();           jQuery(".toggle").toggle(function(){         jQuery(this).addClass("toggle-active");         }, function () {         jQuery(this).removeClass("toggle-active");     });          jQuery(".toggle").click(function(){         jQuery(this).next(".toggle-box").slideToggle();     });     });      /images/sprite.png    While using firebug I found that the problem is with my jQuery > jQuery is not defined > > [Break On This Error] jQuery(document).ready(function(){ and I have defined it OK I think so can some one tell me what I should do to make it right.