title: Image upload and other options in the same plugin settings form?

text:
I write a wordpress plugin. My plugin has two options. One is an image upload mechanism and the other is a checkbox. My code is below:               <?php     /*     Plugin Name: Plugin Name     Plugin URI:     Description: Description     Version: 0.0.1     Author: Author Name     Author URI:     License: GPL3+     */          add_action( 'admin_menu', 'pluginname_menu' );          function pluginname_menu()         {         add_options_page( 'PluginName Options', 'pluginname', 'manage_options', 'pluginname_options_page', 'pluginname_options_page' );         }          add_action( 'admin_init', 'pluginname_admin_init' );          function pluginname_admin_init()         {         register_setting( 'pluginname_options', 'pluginname-settings' );         add_settings_section( 'section', 'Section', 'pluginname_section_callback', 'pluginname_options-section' );         $options_array = get_option('pluginname-settings');         add_settings_field( 'upload_image', 'Upload image', 'image_upload_callback', 'pluginname_options-section', 'section');         add_settings_field( 'use_image', 'Use image', 'use_image_callback', 'pluginname_options-section', 'section', array(         'name' => 'pluginname-settings[use_image]',         'value' => isset($options_array['use_image']) ? $options_array['use_image'] : '')         );              }          function pluginname_validate($input)         {         $options_array = get_option('pluginname-settings');         $output = array_merge($options_array, $input);         return $output;         }          function pluginname_section_callback()         {         echo 'Feel free to change parameters below.';         }          function upload_image_callback()         {         echo "Filename:<input type='file' name='file' value='image' />";         }          function use_image_callback( $args )         {         $name = esc_attr( $args['name'] );         $value = esc_attr( $args['value'] );         echo "<input type='checkbox' name='$name' value='$value'>";         }          function pluginname_options_page()         {         $uploadedfile = isset($_FILES['file']) ? $_FILES['file'] : '';         if ($uploadedfile['error'] == '0')             {             $upload_overrides = array( 'test_form' => false );             $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );             $options_array = get_option('pluginname-settings');             $options_array['upload_image'] = $movefile['url'];             update_option('pluginname-settings', $options_array);         }              echo "
";         echo "
Options
";         echo "<form action='options.php' method='POST' enctype='multipart/form-data'>";         settings_fields( 'pluginname_options' );         do_settings_sections( 'pluginname_options-section' );          submit_button('Update', 'primary',  'submit-form', false);         echo "</form>";         echo "
";     }     ?>      I have difficulty using both options in the same form. If I remove `action='options.php'`, then the checkbox value is not being saved (validation function is not called). If I remove `enctype='multipart/form-data'`, I can not upload. Leaving everything in place renders the options page completely unusable. Please, help.


title: How to remove trailing </li> tags from wp_nav_menu walker

text:
I have used theme twenty thirteen a my base theme and Have tried used code from http://stackoverflow.com/questions/12159486/wordpress-change-header- navigation-list-items-to-div when I try to validate the page I get an error with invalid trailing `</li>` tags I am trying to create this result from the walker class

text

Text>

      But always end up with trailing `</li>` tags can anyone help with this problem I tried this first               class Description_Walker extends Walker_Nav_Menu     {         function start_el(&$output, $item, $depth, $args)         {             $classes = empty($item->classes) ? array () : (array) $item->classes;             $class_names = join(' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );             !empty ( $class_names ) and $class_names = ' class="'. esc_attr( $class_names ) . '"';             $output .= "
ID' $class_names>";             $attributes  = '';             !empty( $item->attr_title ) and $attributes .= ' title="'  . esc_attr( $item->attr_title ) .'"';             !empty( $item->target ) and $attributes .= ' target="' . esc_attr( $item->target     ) .'"';             !empty( $item->xfn ) and $attributes .= ' rel="'    . esc_attr( $item->xfn        ) .'"';             !empty( $item->url ) and $attributes .= ' href="'   . esc_attr( $item->url        ) .'"';             $title = apply_filters( 'the_title', $item->title, $item->ID );             $item_output = $args->before             . ""             . $args->link_before             . $title             . '
'             . $args->link_after             . $args->after;             $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }     }      and put this in the header               wp_nav_menu(         array (             'menu' => 'main-menu',             'container' => 'div', // parent container              'container_id' => 'my_nav', //parent container ID             'depth' => 1,             'items_wrap' => '%3$s', // removes ul         'walker' => new Description_Walker // custom walker to replace li with div         )     );      I have tried modifying this code but I all ways get trailing `</li>` tags do you think you could point me in the right direction been work on this problem for over a week others seem to have the same problem and I have tried what has been suggested but to no avail. by the way this code was provided by RCV


title: upgrade v. 2.8.5 to latest version of wordpress

text: Is it possible to upgrade WordPress version 2.8.5 to 3.9.2? I am trying to upgrade but the WordPress give me the link to download the latest version of WordPress. If it is possible, how am I going to upgrade my version 2.8.5 to 3.9.5?   Thanks in advance.


title: Optimizing Query used for a Shortcode

text:
So, I have this shortcode that produces a list of all published multisite and their pages. The network in question has about 50 sites in it. The problem is that loading the page I put the shortcode on takes an extra couple of seconds to load. So performance blows. Wondering what I can do to optimize this. Thoughts?               <?php     class Multisite_Shortcode{              /** Multisite parameters         * network_id'  = $wpdb->siteid,         * site_order'  = 'blog_id ', // blog_id, site_id, domain, path, registered, last_updated, public, archived, mature, spam, deleted, lang_id         * site_sort'   = 'ASC', // ASC or DESC         * public'      = null,         * archived'    = null,         * mature'      = null,         * spam'        = null,         * deleted'     = null,         * limit'       = 100,         * offset'      = 0,              ** pages parameters         * depth'       = 0,         * child_of'    = 0,         * exclude'     = '',         * sort_column' = 'menu_order, post_title',         * sort_order'  = 'ASC', // ASC or DESC         * link_before' = '',         * link_after'  = '',         */              /**         * Shortcode initialization         * @return void         */         function __construct() {             add_shortcode( 'blog_pages', array(&$this, 'shortcode_blog_pages') );         }              function shortcode_blog_pages( $atts ) {             global $wpdb;             $args = shortcode_atts( array(                 // blog parameters                 'network_id' => $wpdb->siteid,                 'site_order' => 'blog_id ', // blog_id, site_id, domain, path, registered, last_updated, public, archived, mature, spam, deleted, lang_id                 'site_sort'  => 'ASC',                 'public'     => null,                 'archived'   => null,                 'mature'     => null,                 'spam'       => null,                 'deleted'    => null,                 'limit'      => 100,                 'offset'     => 0,                      // pages parameters                 'depth'         => 0,                 'child_of'      => 0,                 'exclude'       => '',                 'sort_column'   => 'menu_order, post_title',                 'sort_order'    => 'ASC',                 'link_before'   => '',                 'link_after'    => '',             ), $atts );                  $html = '';                  if ( wp_is_large_network() )                 return $html;                  $query = "SELECT * FROM $wpdb->blogs WHERE 1=1 ";                  if ( isset( $args['network_id'] ) && ( is_array( $args['network_id'] ) || is_numeric( $args['network_id'] ) ) ) {                 $network_ids = implode( ',', wp_parse_id_list( $args['network_id'] ) );                 $query .= "AND site_id IN ($network_ids) ";             }                  if ( isset( $args['public'] ) )                 $query .= $wpdb->prepare( "AND public = %d ", $args['public'] );                  if ( isset( $args['archived'] ) )                 $query .= $wpdb->prepare( "AND archived = %d ", $args['archived'] );                  if ( isset( $args['mature'] ) )                 $query .= $wpdb->prepare( "AND mature = %d ", $args['mature'] );                  if ( isset( $args['spam'] ) )                 $query .= $wpdb->prepare( "AND spam = %d ", $args['spam'] );                  if ( isset( $args['deleted'] ) )                 $query .= $wpdb->prepare( "AND deleted = %d ", $args['deleted'] );                  $query .= " ORDER BY {$args['site_order']} {$args['site_sort']} ";                  if ( isset( $args['limit'] ) && $args['limit'] ) {                 if ( isset( $args['offset'] ) && $args['offset'] )                     $query .= $wpdb->prepare( "LIMIT %d , %d ", $args['offset'], $args['limit'] );                 else                     $query .= $wpdb->prepare( "LIMIT %d ", $args['limit'] );             }                  $site_results = $wpdb->get_results( $query, ARRAY_A );                  $html = '';                  // Add other parameter to the list pages             $args['echo'] = false;             $args['title_li'] = '';             $args['walker'] = '';                  foreach( $site_results as $blog ) {                 switch_to_blog( $blog['blog_id'] );                 $list_pages = @wp_list_pages( $args );                 restore_current_blog();                      $details = get_blog_details( array( 'blog_id' => $blog['blog_id'] ) );                 $title = "siteurl}'>{$details->blogname}";                      $html .= "
blog_id}' class='site-pages'>
$title

$list_pages

";             }                  return $html;         }     }          new Multisite_Shortcode();     ?>


title: How to debug register_setting callback function

text: I am using the following code:               register_setting(             'myplugin_options', //setting group name             'myplugin_options', //option name that will be stored in the database             'myplugin_validate_options'//optional callback function     );          function myplugin_validate_options($input) {         //how can i print $input to the screen or view the output of this function for debugging purpsoses?          }      I just need to know how we can debug our validation callback functions. From what I see they can not be output to the screen so it makes writing correct code inside of them difficult. Thanks.


title: Help with Post Meta

text:
This snippet pulls in post "industry" for the current post               $post_meta = get_post_meta( $post->ID );       This code pulls in all the logos for the "brands"               <?php query_posts( 'post_type=brands&orderby=title&order=ASC&posts_per_page=-1' );                           $i = 0;                 if ( have_posts() ) while ( have_posts() ) : the_post(); ?>                     <li id="feature<?php echo $i; ?>"><a href="<?php the_permalink(); ?>" rel="<?php echo $i; ?>"><image src="<?php echo get_post_meta( $post->ID, 'brand_logo_sm', true ); ?>" />
                 <?php $i++; endwhile; wp_reset_query(); ?>      I need some help limiting the the above code to ONLY display the brands that match the "$post_meta" If have tried:               <?php query_posts( 'post_meta=brand_industry&orderby=title&order=ASC&posts_per_page=-1' );      With not lock. Any tips? Thx! Function where I declare the meta:               $brand_meta = array(         'brand_email' => 'Email',         'brand_url' => 'Website',         'brand_stores' => 'Global Store Locator ID',         'brand_gallery' => 'Gallery ID',         'brand_products' => 'Products',         'brand_industry' => 'Industry'     );      Answer to comment below: This code, outputs all the logos.               <?php query_posts( 'post_type=brands&orderby=title&order=ASC&posts_per_page=-1' );                           $i = 0;                 if ( have_posts() ) while ( have_posts() ) : the_post(); ?>                     <li id="feature<?php echo $i; ?>"><a href="<?php the_permalink(); ?>" rel="<?php echo $i; ?>"><image src="<?php echo get_post_meta( $post->ID, 'brand_logo_sm', true ); ?>" />
                 <?php $i++; endwhile; wp_reset_query(); ?>      I only want it to display the logos if the "industry" gets outputted using this code:               <?php $post_meta = get_post_meta( $post->ID ); ?>      is equal to X Thant make sense?


title: Applying class to links around self hosted images embedded to posts/pages

text: So I need to add a class to links around the images for lightbox purposes. But only to images from the upload directory, not to external ones. I've found this solution by @TommiForsström here:               function add_colorbox_class_to_image_links($html, $attachment_id, $attachment) {     $linkptrn = "/<a[^>]*>/";     $found = preg_match($linkptrn, $html, $a_elem);          // If no link, do nothing     if($found <= 0) return $html;          $a_elem = $a_elem[0];          // Check to see if the link is to an uploaded image     $is_attachment_link = strstr($a_elem, "wp-content/uploads/");          // If link is to external resource, do nothing     if($is_attachment_link === FALSE) return $html;          if(strstr($a_elem, "class=\"") !== FALSE){ // If link already has class defined inject it to attribute         $a_elem_new = str_replace("class=\"", "class=\"colorbox ", $a_elem);         $html = str_replace($a_elem, $a_elem_new, $html);     }else{ // If no class defined, just add class attribute         $html = str_replace("<a ", "<a class=\"colorbox\" ", $html);     }          return $html;     }          add_filter('image_send_to_editor', 'add_colorbox_class_to_image_links', 10, 3);      Looks like it's exactly what I need, except it doesn't work. I've tried it on a clean WP thirty thirteen install as well. Any thoughts? Thanks!


title: Check for correct username on custom login form

text: I have used Jeff Star's tutorial for creating my own custom login form http://digwp.com/2010/12/login-register-password-code/. It works great, but I have one problem. On the reset password form, if someone enters their username incorrectly (so that it doesn't verify), they get kicked to the default wp- login.php?action=lostpassword with the error message. Is there a way to redirect to my own error page? Thanks!


title: 2014 Theme Mobile Menu

text: Any suggestions on making 2014 Theme Mobile Menu have drop down vertical sub- navigation - instead of displaying all subnavs horizontally images show before, and looking to achieve ![before](http://i.stack.imgur.com/fXMZW.png) ![looking to achieve](http://i.stack.imgur.com/C9P7J.png)


title: Displaying Custom Taxonomy Children in Dropdown

text: I have a question I hope you can help me with. I have a custom taxonomy called locations and on the first level I have the areas (Asia, Europe, etc) and under each area I have countries (England, South Africa). What I would like to do it display a dropdown menu of all the children of that particular parent similar to what was done here, http://wordpress.org/support/topic/terms-of- custom-taxonomy-in-a-dropdown-menu . However, I want the dropdown to only display the children of the parent page I am currently on, not all the terms. So if I am on North America I want it to show the United States and Mexico and if I am on the Europe parent page I want it to show England. Does that make sense? Nick


title: Why is `add_meta_box` not working?

text: I'm trying to add some meta fields to a WPSC product using the following code:               /**      * data callback      */     function abc_callback($object, $box)     {         echo 'callback executed!';     }          /**      * add custom fields      */     function abc_load_post($post_id)     {         add_meta_box('abc_post_id', 'abc', 'abc_callback', 'post', 'normal', 'default', array());     }     add_action('load-post.php', 'abc_load_post', 10, 2);     add_action('load-post-new.php', 'abc_load_post', 10, 2);      The `abc_load_post` function gets called fine but nothing actually appears on the product editing page (i.e. `/wp-admin/post.php`) Can someone explain what I'm doing wrong?


title: What plugins to use for a travel site?

text: I am developing travel website where users can search and book their travel deal. It goes like this:   1. Providers are creating their travel deals (same as some blogger create blog in WordPress);   2. Users book wanted travel deals;   3. Providers, who have their account where they can see if users book their deal, are notified by the email and sms about just booked (sold) deal. Site is going to be developed using WordPress. Is there any plugin or module that I can use to accomplish this, or at least something similar to reconfigure and not to take this process from scratch?


title: plugin-list-category-post custom fields

text: I'm using list category posts and would like to display several custom fields, but not all together. I have used a template to display the list in a table, and have custom fields for country, county and town that I would like to display in individual cells. These are the only custom fields I will be using, so I can hard code the names in the template is necessary. Thanks.


I am using 'featured image' fields in my post and the images are sized and compressed already but whenever I upload an image that has some text, I keep noticing the image reduced in quality (specifically, the text in the image). Is wordpress compressing my images? if so, how to prevent it?


title: Modify Admin Bar Link

text: Starting on `line 474` of `/wp-includes/admin-bar.php` there is a function that is declared as the following: `function wp_admin_bar_new_content_menu( $wp_admin_bar )` What it does it generates the `\+ New` menu item along with any custom post types that a user has `edit_posts` capability for. The actual top-menu item, `\+ New` defaults to `posts` since it is the first called in the array (I believe that's how it works). I'd like to actually change that first `\+ New` link to something else. In our setup, we need to give users `edit_posts` capability to manage Advanced Custom Fields Options pages, but are not giving them access to posts themselves (which we just had to hide from the menu system). A bit funky, but it's more of a usability concern for us. Aside from all the jumble I said above, can you modify an existing menu link based on the ID of the item itself (which is `new-content` in this case) or would I need to destroy and rebuild the menu itself? I'm just looking to change that `href` attribute to `#`. Thanks!


title: Using www and without www url both for same site

text: Site URL is `lgagro.com.sg`; currently, if browsed without `www.`, it redirects to `www.lgagor.com.sg`. I want to access it with and without `www` i.e. when I browse it by `http://lgagro.com.sg` it should work and if I open it using `www.lgagro.com.sg` it should also work without re-writing the URL. I have `.htaccess` file in root folder which is as such:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]      The site URL is set to `http://www.lgagro.com.sg`, I also tried with `http://lgagro.com.sg` I have another site `http://shashwatinternational.com/` which works in desired way. I don't have any other setting in shashwat. None of the site are multisite. Any suggestion will be helpful.


title: Add a custom field to post

text: I want add a column to my table wp_posts with name "address". So EVERY post have address like field. But i don't know how i can manage the save from Add Post(admin)... I have looked into hooks, but i found only: **manage_posts_columns** that is for manage the colomuns on list posts, and **edit_form_after_editor** where i can show a input field into add page(but what name i need for save it into db ?) Anyone can help me to know how i can show a new field into add post(maybe i can with edit_form_after_editor) and then manage the save to database(how i can take the value from my custom input field ?) Thanks You.


title: Removing the main link to Jetpack from the menu

text: I need to remove the link to the Jetpack settings, but not the links to Omnisearch and Site Stats from the admin menu for everyone not having an administrator role: ![enter image description here](http://i.stack.imgur.com/5mMAM.png) For this, I came up with this code:               function remove_posts_menu() {         if (!current_user_can('administrator')) {             remove_submenu_page('admin.php?page=jetpack', 'admin.php?page=jetpack');         }     }     add_action('admin_init', 'remove_posts_menu');      (Reference for the `remove_submenu_page()` function) However, this doesn't work. I did check that the function is called and so by adding `remove_submenu_page('tools.php', 'tools.php');` - when this is added to the function, just after the removal of the Jetpack settings link, the Tools link is removed, but the Broken Link Checker link (of a plugin I installed) is still visible. What's the correct way to remove the Jetpack link?


title: Empty Date Returned on my function

text:
I am using this function to display the date and title of my latest posts on my dashboard. However for some of the posts the date is not being displayed at all - I have a feeling this might be the posts which I subsequently hit the "update" button but i am not sure.. any ideas why this happens?               function wps_recent_posts_dw() {     ?>
          <?php               global $post;               $args = array( 'numberposts' => 10, 'post_type' => 'any' );               $myposts = get_posts( $args );                     foreach( $myposts as $post ) :  setup_postdata($post); ?>
 (<? the_date('j M, Y @ G:i'); ?>) <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
               <?php endforeach; ?>
     <?php     }          function add_wps_recent_posts_dw() {            wp_add_dashboard_widget( 'wps_recent_posts_dw', __( 'Recent Posts' ), 'wps_recent_posts_dw' );     }     add_action('wp_dashboard_setup', 'add_wps_recent_posts_dw' );


title: Why can I not view image attachment pages?

text: I have a problem with images. I can see my uploaded images, as previously, through the media library. I can access each image by clicking on "edit". But if I then click on "View Attachment Page", I am taken to the "404! We couldn't find the page!" message. This applies to all images in the library. At the same, images in some posts (but not all) are behaving differently from before. It used to be possible for readers to click them and see them full size, whereas now that click simply relads the posts in question. I have experimented with deactivating plugins, but have not found a solution for this. Does anyone know what might cause this, and what might have triggered it?


title: Which plugin will let me decide what users have access to on their side bar in wp-admin?

text: I want to customize the editor role so that they only have access to 'pages, posts, comments, profiles'.


title: Display WordPress Parent Categories Only?

text:
I have the following code on a custom wordpress page:                   <?php          $cat_array = array();         $args=array(           'post_type' => 'post',           'post_status' => 'publish',           'posts_per_page' => 10,           'caller_get_posts'=> 1           );         $my_query = null;         $my_query = new WP_Query($args);         if( $my_query->have_posts() ) {           while ($my_query->have_posts()) : $my_query->the_post();             $cat_args=array('orderby' => 'none');             $cats = wp_get_post_terms( $post->ID , 'category', $cat_args);             foreach($cats as $cat) {               $cat_array[$cat->term_id] = $cat->term_id;             }           endwhile;         }         if ($cat_array) {           foreach($cat_array as $cat) {             $category = get_term_by('ID',$cat, 'category');             echo 'name ) . '" ' . '>' . $category->name.''.'
';           }         }         wp_reset_query();     ?>      It lists the categories in order of most recently updated category first. How do I adjust the code to get parent categories only? # Example: Basically, I would just like to display the top level category. For example: Category - Subcategory - Sub Subcategory - Sub Sub Subcategory Just Category.


title: wp_title() handling of author page

text:
Why doesn't wp_title() display the author's name on an author archive as it does for a category or date archive? How can I hack this functionality? header.php calls:               <title><?php wp_title ( '|', true,'right' ); ?></title>      Here is my author.php:               <?php get_header(); ?>     <?php            $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));         get_userdata(intval($author));         function validate_gravatar($email) {         // Craft a potential url and test its headers         $hash = md5($email);         $uri = 'http://www.gravatar.com/avatar/' . $hash . '?d=404';         $headers = @get_headers($uri);         if (!preg_match("|200|", $headers[0])) {             $has_valid_avatar = FALSE;         } else {             $has_valid_avatar = TRUE;         }         return $has_valid_avatar;     }     $user_email = $curauth->user_email;     $has_avatar = validate_gravatar($user_email);     ?>
About <?php echo $curauth->display_name; ?>

<?php if($has_avatar) {echo get_avatar($curauth->ID, 70);} ?>
       <?php if ($curauth->user_description) : ?>
<?php echo $curauth->user_description; ?>
        <?php endif;         if ($curauth->user_url) : ?>
<a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?>
        <?php endif; ?>        <?php if (!$curauth->user_description && !$curauth->user_url) : ?>
A riddle wrapped in a mystery inside an enigma...
        <?php endif; ?>

Contact

       <?php echo do_shortcode( '[contact-form 1 "Contact Author"]' ); ?>

       <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>       <?php _e('Author Archive'); ?>       <a href="javascript: void(0);" id="mode"<?php if ($_COOKIE['mode'] == 'grid') echo ' class="flip"'; ?>>

          <?php get_template_part('loop'); ?>     <?php get_template_part('pagination'); ?>     <?php get_footer(); ?>


title: Commenting system for WordPress

text: Hi I am thinking of changing from the default WordPress commenting system to Disqus or LiveFyre. What are the biggest advantages of such a change, and maybe possible pitfalls I should look out for. Thanks.


title: Add a specific category at a specific place to the menu that uses wp_list_pages

text: I have a main menu where I display pages. All the pages have associated sub- pages, however in the menu some of them are displayed by themselves without sub-pages and some are displayed with a submenu as a list of all sub-pages. The pages in the menu are sorted according to the menu order specified for them. (Please see my code below). Now, I would like to add some categories at a specific place in the menu and not sure how to better do it. Is it possible to do it using wp_list_pages? What I like about my code is that whenever a subpage is added for a parent page that programmed to display all subpages, the newly added subpage will automatically appear in the site's menu. As opposite to using Appearance->Menu functionality where a user will need to add a newly created subpage to the menu before it will appear on the site. I might be easily over complicating it(!) and the only way to do it is via Appearance->Menu functionality. I would really appreciate any help and tips! Here is the code that I use to display pages, some with all the sub-pages and some only at the top level.               //main nav: use wp_list_pages to display cirtain parent pages without any and with all child pages (a tree with parent)     $parents = array(5,7,17,61,19,25);     $children = array();     foreach($parents as $parent) {       $child_pages = get_pages( "child_of=$parent" );       if($child_pages){         foreach($child_pages as $child_page){           $children[] = $child_page->ID;         }       }     }     //add all the pages that need to be included without children     $parents = array_merge( (array)$parents, (array)array(31,23) );     //merge $parents and $children     $menu_pages = array_merge( (array)$parents, (array)$children );     $menu_pages_str = implode(",", $menu_pages);      ?>           <ul class="menu wrap">       <?php wp_list_pages( "sort_column=menu_order&title_li=&include=$menu_pages_str" ); ?>     </ul>


title: How to tell if all posts are only in one category?

text: I have a `category.php` page which redirects users to a certain template page if the article in the output is in a category. However, I am seeing that if I have say 10 articles,and only one is in the special category, then it redirects. Is there a way to modify my code to only say "if all of the posts are only in this special category then show the template"?               else if (in_category('ontario-ohs-reform-alerts')) {    include(TEMPLATEPATH . '/ontario-ohs-reform-alerts.php'); }


title: Metabox nonce PHP notice

text: I've been getting a notice when I try to add a new post in two different taxonomies, in one i use a custom meta box and in the other not, however the notice appears for both when trying to add a new item, i see this: Notice: Undefined index: product_noncename in /Applications/MAMP/htdocs/site/wordpress/wp-content/themes/theme/functions.php on line 259 hidden just a little below the top black strip in WP Admin **Line 259 is:**               if ( !wp_verify_nonce( $_POST['product_noncename'], plugin_basename(__FILE__) )) {      **which is part of this:**               // Save the Metabox Data     function wpt_save_product_meta($post_id, $post) {         // verify this came from the our screen and with proper authorization,         // because save_post can be triggered at other times         if ( !wp_verify_nonce( $_POST['product_noncename'], plugin_basename(__FILE__) )) {         return $post->ID;         }         // Is the user allowed to edit the post or page?         if ( !current_user_can( 'edit_post', $post->ID ))             return $post->ID;         // OK, we're authenticated: we need to find and save the data         // We'll put it into an array to make it easier to loop though.         $product_meta['_location'] = $_POST['_location'];         $product_meta['_asiaLoc'] = $_POST['_asiaLoc'];         $product_meta['_europeLoc'] = $_POST['_europeLoc'];         $product_meta['_isbn'] = $_POST['_isbn'];         $product_meta['_orderform'] = $_POST['_orderform'];          // Add values of $events_meta as custom fields         foreach ($product_meta as $key => $value) { // Cycle through the $events_meta array!             if( $post->post_type == 'revision' ) return; // Don't store custom data twice             $value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)             if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value                 update_post_meta($post->ID, $key, $value);             } else { // If the custom field doesn't have a value                 add_post_meta($post->ID, $key, $value);             }             if(!$value) delete_post_meta($post->ID, $key); // Delete if blank         }     }     add_action('save_post', 'wpt_save_product_meta', 1, 2); // save the custom fields


title: How to Make a Custom Grid View

text: I'd like to make a grid view that can be used to list items with a thumbnail, a primary description heading, a subheading, and possibly pricing details. This will not necessarily be for eCommerce as initially there will be no shopping cart. Similar to a post, clicking on the item should take you to a full "post" for that item with more information. For an idea what I'm thinking, take a look here: http://www.powerzoneequipment.com/inventory_search.asp?category=engines So here's my questions:   1) Does something like this already exist?   2) What are the requirements to build something like this? Should it be a plugin combined with a custom theme that supports this? Or could this be done with a custom theme and a custom post type? I realize that what I'm asking might be functionality more typically found in something like Drupal. However, I'm curious how difficult it would be to get this type of display in Wordpress.


title: Using Jquery submit with ajax request

text:
When the user clicks the 'submit' button on my form, I would like 'this will be echoed back' to be displayed within an alert. The only JS console error I get: `Failed to load resource http://nikkomsgchannel/e?0017005e002b00560036004400190026002d0025002c005300…240020003700620024005b004a005500790053002c0045002b003600300026002f005d004c` The only code I've changed is the Jquery, before this I was using a hyperlink & `click`event in Jquery, which was working. My code: PHP file               function add_my_css_and_my_js_files(){         wp_enqueue_script( "ajax-test", plugin_dir_url( __FILE__ ) . '/ajax-test.js', array( 'jquery' ) );         wp_localize_script( 'ajax-test', 'the_ajax_script', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );       }     add_action('wp_enqueue_scripts', "add_my_css_and_my_js_files");           function text_ajax_process_request() {                 if ( isset( $_POST["post_var"] ) ) {             $response = $_POST["post_var"];             echo $response;             die();         }     }     add_action('wp_ajax_test_response', 'text_ajax_process_request');          function include_jQuery() {         if (!is_admin()) {             wp_enqueue_script('jquery');         }     }     add_action('init', 'include_jQuery');          add_action( 'init', 'register_shortcodes' );     function register_shortcodes() {         add_shortcode( 'displaycalcs', 'mp_calcs_display' );     }         function mp_calcs_display() {                      $output = <<<HTML                 <form action="" method="post" name="formsubmit" id="formsubmit"   >         Number of welds: <input type="number" name="numberofwelds" id="numberofwelds"  >      Number of construction welds: <input type="number" name="numberofconwelds" id="numberofconwelds"  >        Total one: <input type="text" name="totalone" id="totalone" disabled>

        Total two: <input type="text" name="totaltwo" id="totaltwo" disabled>

        Total three: <input type="text" name="totalthree" id="totalthree" disabled>

        <input type="submit"  value="Calculate" id="submit" name="submit" >

     </form>       HTML;     return $output;     }       **ajax-test.js**               jQuery(document).ready( function($) {         $("#submit").submit( function() {             var data = {                 action: 'test_response',                                  post_var: 'this will be echoed back'             };                     $.post(the_ajax_script.ajaxurl, data, function(response) {                 alert(response);             });             return false;         });     });


title: gravity forms user registration hide form after completed

text: I use gravity forms and addon "user registration" and i want to hide the registration form after the user is login. I guess i must use conditionnals for this job but know how to proceed exactly. Thank you R


title: get_permalink is getting old rewrite rule

text: I had some rewrite rules in my functions.php file. I decided that I didn't need them, and removed all rewrite rules and then flushed them. However for some reason when I use get_permalink() the url is wrong. It's still getting the old rule. I already cleared the cache and also tried accessing from a incognito window. The .haccess file in the root has the same basic WP rewrite.               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      Any ideas why I am still getting the old url? I also went to each post and saved it again, hoping that would reset the url back. UPDATE: I checked the database and under the options table I have an option called rewrite_rules, which has the old rules there. I removed them, but they are added back again after I go to permalinks->save. Update 2: I also tried clearing all transients. Did not help. I also tried completely removing the functions.php from the server and then uploading it again. Just to make sure it was loading a fresh file.


title: Theme layout for home page

text: I'd like to create a theme with this layout http://i49.tinypic.com/2z6w7z5.jpg for the homepage. At the moment I am working off an already existing html website I am a confused about what the white and green/blue part of the layout should be named, i.e. what file name it should have. Thus far I have the bottom footer and the light blue background set up, but am at a lost for what the body file should be (to get it centred with the white background). Thank you in advance for any help.


title: Is it possible to remove WYSIWYG for a certain Custom Post Type?

text: I dont want to use the WYSIWYG at the top of my Custom Post Type. I want to use a custom field textarea that i can place at bottom of my list of custom fields instead. Is this possible?


title: How to show subcategories using loop?

text: i am using `wp_list_categories('child_of=54&title_li=')` method to display all the subcategories, but it is showing only one, how can i use it with loop to show all the subcategories properly.


title: Stop wordpress from adding html tags but not remove my own tags?

text:
I've been trying to make wordpress stop adding html tags to my content but leave my own html tags alone? Tried `remove_filter( 'the_content', 'wpautop' );` and installed PS Disable Auto Formatting but the problem is that it removes my own html tags aswell? I've tried to get_the_content() and the_content() but the same problem occurs there... The way I wan't this to work is to let me add html tags and leave these alone, not removing them. Like this:
Some text here

some more text  fat


title: Shortcodes Not Working on Custom Theme

text: I am editing my mate's site which is a custom theme that his agency must have created: http://www.meddingshughes.com/ I'm using real3d flipbook to (try) display some important portfolio content. This plugin uses shortcode and for some reason, when I insert this into the page, it doesn't work when I update the portfolio page. Have attempting disabling plugins etc but TNA... Any ideas how a relatively minor-skilled tech can sort this? Thanks!


title: WP_Query using meta_query with relation OR and orderby meta_value doesn't work

text: I've been bashing against a bug for a few hours now, and can't seem to find my error. Could there be a bug with the relation type 'OR' in WordPress?               $evenements = new WP_Query(array(         'post_type'     => 'evenements',         'orderby'       => 'meta_value',         'meta_key'      => 'startDate',         'order'         => 'ASC',         'meta_query'    => array(             'relation'  => 'OR',             array(                 'key'       => 'startDate',                 'value'     => date('Ymd'),                 'compare'   => '>=',             ),             array(                 'key'       => 'endDate',                 'value'     => date('Ymd'),                 'compare'   => '>=',             ),         ),     ));      What is weird is that if I put relation to 'AND', it works as intended. If both statements are true, the post will show up. If I put relation to 'OR', all posts will show up, and for some reason even the order will not work properly. Even changing 'order' from 'ASC' to 'DESC' won't change the order the results come in. To understand the query, here's the detail of what exactly I'm trying to do: I want to show events that are in progress or in the future. The two metas are the date at which the event starts (startDate) and the date when the event ends (endDate). So if the start date is higher or equal (to get if an event is happenning today) to today or the end date is higher or equal to today, show the post. The second part (with the end date) is made so an event in progress will be shown, and I cant remove the first part (with the start date) because if the event only lasts a day, the client will only enter the startDate meta. I discarded the bug coming from plugins since I disabled all plugins and the bug was still there. Here is what I get if `echo $evenements->request`.               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts     INNER JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id     INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id)     INNER JOIN wp_postmeta AS mt2 ON (wp_posts.ID = mt2.post_id)     JOIN wp_icl_translations t       ON wp_posts.ID = t.element_id AND t.element_type = 'post_evenements'     JOIN wp_icl_languages l ON t.language_code=l.code AND l.active=1     WHERE 1=1     AND wp_posts.post_type = 'evenements'     AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')     AND (      wp_postmeta.meta_key = 'startDate'      OR ( mt1.meta_key = 'startDate' AND CAST(mt1.meta_value AS CHAR) >= '20140305' )      OR ( mt2.meta_key = 'endDate' AND CAST(mt2.meta_value AS CHAR) >= '20140305' )     )     AND t.language_code='fr'     GROUP BY wp_posts.ID     ORDER BY wp_postmeta.meta_value ASC     LIMIT 0, 10


title: File and directory permissions

text: I installed latest WordPress 3.5 in my CentOS server. When I tried accessing `http://example.com/wp-includes/`, I received a listing of the directory: ( **Index of wp-includes** ). I added the following code at the top of `.htaccess` file, and it fixed the issue:               Options -Indexes     IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*      ## My problem When I try accessing PHP files in `wp-includes` and `wp-content` using a web- browser (for example: `http://example.com/wp-includes/class-smtp.php`), it shows a blank screen. I think it should show "Permission denied" or something like this. Am I correct? How can I achieve this? I'm concerned if my website is vulnerable to attacks. I am already aware of the Hardening WordPress article. Here are my directory and file permissions:   * `wp-admin`: 755   * `wp-content`: 755   * `wp-includes`: 755   * Files have permission 644


title: Alphabetize all but one category

text: I have my categories set to sort alphabetically:               <?php if (is_category()) {           $posts = query_posts($query_string . '&orderby=title&order=asc');        }      ?>      I want to exclude one category so that it sorts by date. I tried this but it made all the cats come up blank:               <?php if (is_category()) {          $posts = query_posts($query_string . '&orderby=title&order=asc&exclude=15');         }     ?>      Any ideas?


title: Hierarchical Custom Post Types

text: I would like to have the following taxonomy structure:               site.com/courses/course-name/pathway/pathway-name      The domain is such that any particular course can be completed by taking a number of different pathways - different module structures. The following URLS would work as such:               site.com/courses      shows a list of courses               site.com/courses/course-name      will follow a template e.g. single-course.php, showing title, content and a list of the pathways associated to this course.               site.com/courses/course-name/pathways/      will follow a template e.g. archive-pathway.php, showing course-name and a list of pathways (not be used so much but will still need to work)               site.com/courses/course-name/pathways/pathway-name      will follow a template, e.g. single-pathway.php, showing the course-name title, the pathway-name title and content for this pathway. The files here may be incorrect whereby I should be using taxonomy-{}.php or otherwise as appropriate, instead of single-{}.php. My question: is it possible to set up the above hierarchy within WordPress? If so, please provide some code to `register_taxonomy` or `register_post_type` as appropriate to help me get started. I cannot find how to do this elsewhere but am pretty sure this is how courses in the TutsPlus network use WordPress.


title: I need to have two 1-5 star rating fields, only editable by admins. Which plugin should I use?

text: I need the following: two different 1-5 star rating fields, for one of my custom content types. The ratigs will be stablished by the admin, so I dont need a real voting system. The fields are more like indicators than polls. I tried gd-star ratings but its aimed at community voting and rating systems which is not at all what I want. I know this would be uite easy to code, but if there is a plugin for this I would like to know. Thank you guys!


title: How can I disable widget from being visible on some pages?

text: I have two widgets in my sidebar, a jQuery vertical menu and an image handler. I need to disable the jQuery widget on my contact page (or hide it or something like this), so that it wont be shown. How can I do this please?


title: Is it ok to not a have child theme and just create a theme from scratch?

text: I would like to know if creating a Wordpress theme from scratch is good? because I know the template tags in wordpress and other tags ... ...but Will I get any future problems in here when it comes to updating to another version? Im curious because I rather create one from scratch rather than creating a child theme because I cant modify the single/index/page.php files to create a modified custom loop.


title: Conditional Facebook Share and Like links

text: I am using Simple Facebook Connect, and have enabled "Recommend" and "Send" links. Unfortunately they are appearing in too many places. Can I limit their appearance using `is_category('catttttt')` style conditionals? Happy to switch to a different Facebook Connect plugin in order to gain this finegrained feature.


title: Multiple loops with / without sticky posts and different post limits

text: I am having trouble with multiple loops and sticky posts in wordpress. The first loop I just want all the sticky posts.               <?php query_posts(array('post__in'=>get_option('sticky_posts'), 'cat' => '-15,-17, -5, -2')) ?>     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>             <?php $do_not_duplicate = $post->ID; ?>          <a href="<?php the_permalink(); ?>"><?php the_title(); ?>          <?php endwhile; endif; ?>      In the second loop I want to get the all of the posts that are NOT sticky (so the sticky posts don't show). Currently all but the latest sticky post still show in the loop below. Also the posts_per_page is including the posts in the first loop which I do not want. No matter how many sticky posts I add I want the number of posts that are NOT sticky to be consistent.               <?php query_posts($query_string . '&cat=-15,-17, -5, -2&post_type=post&posts_per_page=9'); ?>     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>          <?php if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>     <?php the_first_category(); ?>     <a" href="<?php the_permalink(); ?>"><?php the_title(); ?>     <?php the_excerpt(); ?>          <?php endwhile; ?>          <?php next_posts_link('Older →') ?>          <?php endif; ?>      Can anyone help or point me in the right direction?


title: Post custom permalink results in 404 for archive page

text: I have set the following custom permalink structure (for my blog):               /news/%postname%      When I browse to `/news` I was expecting for the `archive.php` template to be served up, unfortunately, I'm presented with a 404. My rewrite is working properly since I can view all posts such as `/news/my- post-title`. How can I make it so that my "archive.php" is served up when browsing to `/news`, currently I have to create a dummy News page which is of course what I don't want. Any help would be much appreciated. **UPDATE:** I have set my Category Base and Tag Base permalinks as follows:               news/categorized     news/tagged      Browsing to `/news/categorized/test` triggers the `category.php` template and browsing to `/news/tagged/test` brings me to the `tag.php` template. I still have no luck in triggering the `archive.php`.


title: How to Build a Movie Library in WordPress 3.x

text: To help me learn WordPress development, I'd like to go "beyond the blog" and build a personal movie library -- similar to IMDb but on a much smaller scale. I need help understanding how to approach the project in WordPress and what I need to learn. Here are the types of things I'd like to do on the site:   * When you visit an actor's page, the actor's films are retrieved from the database and displayed. You can sort the movies by year, title, rating, etc. You can also click on the movie title to go to that movie's page.   * When you visit a movie's page, the actors in the movie are retrieved from the database and displayed along with information like a movie summary, my rating, and whether I own the DVD.   * On the homepage, you can perform a search for movies. For instance, if I'm in the mood for an '80s comedy, I can search for movies in the Comedy genre released between 1980-1989 and that I own on DVD. I can already write all of the PHP and MySQL that's needed, but I don't understand where the code actually goes in WordPress. For example...   * Would this application require building a plug-in, or just adding code to my theme?   * Would each actor's page be treated as a "page" or would it be treated as a post?   * For the actor pages, where would the query go that retrieves the list of movies?   * When the search form is submitted, where is the script located that would process the search request? -- I'm just looking for a push in the right direction regarding how WordPress would handle an application like this. Thanks in advance!


title: Multiple relationship for multiple tax_query in WP_Query

text: I want to use the WP_Query class to filter some of my posts. The problem I facing now is handling the taxonomy query. Normally, the wp_query only handle one relationship for tax_query (either AND or OR), but what I need is mixed use of theses relationship on the tax_query, how can achieve it?   eg               'tax_query' => array(             'relation' => 'AND',             array(                 'taxonomy' => 'taxonomy1',                 'field' => 'slug',                 'terms' => array( $term)             ),             array(                 'taxonomy' => 'taxonomy3',                 'field' => 'slug',                 'terms' => 'terms' => array( $term3),                 'operator' => 'IN',             )            // below i want to use OR relationship            'relation' => 'OR',           array(                 'taxonomy' => 'taxonomy4',                 'field' => 'slug',                 'terms' => array( $term4)             ),             array(                 'taxonomy' => 'taxonomy2',                 'field' => 'slug',                 'terms' => 'terms' => array( $term2),                 'operator' => 'IN',             )         )        I know the code above is not working, do I need to use wp_query filter to do it? Any idea?


title: how to add # before tags?

text: Like Lifehacker and several other sites, would like to know how to add # before tags displayed on the site. for e.g. instead of a tag like "abc", how about "#abc". - is there a way to automatically add # across all the tags present in the system?


title: Hide certain widgets from specific user roles in admin

text: I'm looking for a way to hide certain widgets from specific user types in the admin, `Appearance > Widgets` page? For instance, admins can see all widgets, but authors can only see a select few? I noticed there was a Code Canyon plugin, but it requires a framework with it also which I am not using.


title: How to Show Category List With Corresponding Links?

text: i want to do a research in Category List Area. I'll Explain Here... Now I have 4 Categories Like 1,2,3,4. First of all it needs to show in the category pages Horizontally.Next is, While Clicking on Any Category it will show the articles from only that category in this thumbnail format, this also should be in a format that allows for 40 or 50 potential articles to be shown this way.


title: Does WordPress Allow Blank/Empty Comment Submissions In WordPress?

text: I've got a great Comment Form and Threaded Comments setup by using the native WordPress functions: `comment_form` and `wp_list_comments`. However, I'm trying to also create a custom Contest Comment template for certain posts. I call `comments_template('/contest-comments.php', true);` conditionally based on whether a certain custom field exists or not. It works great. I'm trying to make it look along the lines of http://2010.sf.wordcamp.org/attendees/ I only want to show the person's name wrapped in a link and their avatar. Therefore, I want my comment form to only show the Name, Email, and URL fields. The text area should be hidden. For the Comment Form, I am passing an empty value for the `comment_field` key in the `$args` array I'm passing into `comment_form`. This makes the comment form look okay, but when someone submits a comment, they get a warning from WordPress saying that their message was blank. Any solutions on how to solve this? Thanks!


title: Getting a stack trace when an error occurs?

text: I was told to "get a stack trace" when an error occurs in my WordPress installation. How do I do this? _This is meant to be an easy place to refer others to. Please list plugins, configuration settings, PHP modules... that can do this. Consider that the user might be on a shared host, might want to log to a file instead of the browser, ..._


title: Transient RSS feeds in wp_options not removed automatically?

text: I just noticed 55.000 entries(!) in my wp_options table. I had not been there for a while. So I ran:               delete from `wp_options` where `option_name` like '_transient_timeout_rss%'     delete from `wp_options` where `option_name` like '_transient_rss_%'      And... it is now back to 645 entries... How can I have these older RSS entries removed automatically since transient seems to be eternal. Could It be that on my webhost cron is not working?


title: How to get a post content from another wordpress blog/site?

text: I have a situation where i need to display posts from a specific category from another wordpress site into my wordpress site. Both are my sites and i thought of creating a page specially for this in site A and calling them through iframe in site B. I thought another way of fetching them feed.. But i dont know how to fetch feed contents from other wordpress and how to create a feed for a specific category.


title: Editing theme files and access to the Code pages only to super-admin?

text: When I deal with Multisite installation.Some themes like mystique and aparatus provide the widget areas with in the theme-settings page to enter Advertising codes in the form of HTML or java script .But I want the 'Ad code Boxes' to access only by super admin(Me on my Multisite) and not by Normal admins .Can I make that boxes available only to me?


title: Check in function on custom page

text: I have a website about places and attractions in my country. Each place/attraction is a different custom post. On this page, i would like to add a button with the value "Check In" and if clicked by a registered user i would like to save a value in db with the: user id, post id and 1 if the button was pressed. On the user page, i would like to show where he check in and how many times. I have allready the user page, the places pages, etc. I only need to add this feature. It's doable? If yes, can someone help me? LE: I don't expect that someone will just give me the code. Just point me in right direction - how to add for a custom post a custom entry in the db.


title: Is there an easy way to make a meta box have the tabs like the Categories meta box has?

text: My question is pretty much summed up in the title. I'm dropping a meta box in the New Post / Edit Post admin page, and I want to be able to set it up with tabs like the Categories meta box has. I assume there's an easy way to hook into this, but I can't remember how. Does anybody know?


title: How to make a relationship between books and authors?

text: I have a book category, but now I would like each book could be concatenated with the author profile page. And the tab for the author to show, in addition to text, the list of books he has written.   How can I do it?


title: meta_query fails to compare on values containing apostrophes

text: I have WP Query and I am simply comparing by the meta value by = My value contains town names, and seems to work great for the majority of names. However some names contain apostrophes... **Madonna dell'olmo** And the meta values with apostrophes fail to work.    This is my query...               $dealerResults = new WP_Query(array(         'posts_per_page' => -1,         'post_type'     => 'dealer',         'meta_query'    => array(             array(                    'key' => 'dealer_country',                    'value' => $ajaxCounty,                    'compare' => '='             ),             array(                    'key' => 'dealer_location',                    'value' => $ajaxTown,                    'compare' => '='             )         )           ));         I am passing the from a option value through some jquery function and ajax.               foreach($value as $town){         echo "<option class=\"$county_class\" value=\"$town\">$town</option>";     }      -               dealerResults = function () {         var county = $('#dealer-county').val(),             town = $('#dealer-town').val(),             wp_nonce = '<?php echo wp_create_nonce("dealer_search");?>';         if(county != 0 && town != 0){             $.ajax({                 type: 'POST',                 url: '<?php echo admin_url('admin-ajax.php'); ?>?r='+Math.random(),                 data: { varCounty : county, varTown : town, action: 'dealer_search', nonce: wp_nonce },                 success: function(data){                     $(".dealer-wrapper").remove();                     $("#dealer-results").append(data);                       }             });         }     }      -               $ajaxCounty = $_POST['varCounty'];     $ajaxTown = $_POST['varTown'];            My question is how can I get the query to work for my meta values which contain apostrophes?    Thanks in advance


title: Restrict individual category combinations

text: While assigning multiple categories to a post, I need to restrict the category choices on a post depending on what other categories have already been assigned to the particular post. For example, lets say we have categories A, B and C.   For any post, we want to restrict having both categories B and C. So posts may have the following assignments:   * A, B, C   * A, B   * A, C  **No post** should have B **and** C. How can I achieve this?


title: How to update all post at once?

text: Is there a way to update all post at once? The issue is, when i migrated content from another CMS, some of the permalinks are working fine and some of them are not, when i updated the posts all links are working fine. I have tried some methods to perform this requirement, but it doesn't helped.


title: How Authentication in wordpress works? wp_authenticate_username_password()

text: function wp_authenticate_username_password($user, $username, $password) {     if ( is_a($user, 'WP_User') ) { return $user; }          if ( empty($username) || empty($password) ) {         $error = new WP_Error();              if ( empty($username) )             $error->add('empty_username', __('ERROR: The username field is empty.'));              if ( empty($password) )             $error->add('empty_password', __('ERROR: The password field is empty.'));              return $error;     }          $userdata = get_user_by('login', $username);          if ( !$userdata )         return new WP_Error('invalid_username', sprintf(__('ERROR: Invalid username. Lost your password?'), wp_lostpassword_url()));          if ( is_multisite() ) {         // Is user marked as spam?         if ( 1 == $userdata->spam)             return new WP_Error('invalid_username', __('ERROR: Your account has been marked as a spammer.'));              // Is a user's blog marked as spam?         if ( !is_super_admin( $userdata->ID ) && isset($userdata->primary_blog) ) {             $details = get_blog_details( $userdata->primary_blog );             if ( is_object( $details ) && $details->spam == 1 )                 return new WP_Error('blog_suspended', __('Site Suspended.'));         }     }          $userdata = apply_filters('wp_authenticate_user', $userdata, $password);     if ( is_wp_error($userdata) )         return $userdata;          if ( !wp_check_password($password, $userdata->user_pass, $userdata->ID) )         return new WP_Error( 'incorrect_password', sprintf( __( 'ERROR: The password you entered for the username %1$s is incorrect. Lost your password?' ),         $username, wp_lostpassword_url() ) );          $user =  new WP_User($userdata->ID);     return $user;     }      This is the code i found in wordpress. but i surfed inside but i cannot able to find where the username or password is retrieved for the database. i just want to know what query is used by wordpress to retrieve the password and username.


title: Remove first separator in wp_nav_menu

text:
I am using following code to get my menu. My problem is Span is not getting added and I want to remove the first separator.
     <?php $menuParameters = array(         'container'       => false,         'echo'            => false,         'items_wrap'      => '%3$s',         'depth'           => 0,         'before'           => ' | '     ); ?>     <?php echo strip_tags(wp_nav_menu( $menuParameters ), '' ); ?>
      The output I got is:
         |  Fashion Insider         |  Leasing


title: Wordpress Feed Creator Name Tag Full Name Instead Of First Name

text: I am parsing a Wordpress feed in my iOS application. I don't know much about Wordpress and its customisation. The feed shows the author name as below:               <dc:creator>andy</dc:creator>      while i want it to show the full name of the author in the feed like:               <dc:creator>andy rubin</dc:creator>      Can anybody point out where I can go to do that. Thanks!


title: Custom Field as Custom Taxonomy?

text: I have a custom taxonomy, "Country". I am using WP User Frontend to let users post to the site. Most data is saved as custom fields, so I have a custom field "cf_country". I want to be able to set that custom field to the taxonomy for existing and all future posts. I found a converter plugin, but its a one time thing. I want this to happen automatically. Is there any way to do this? Thanks! **Possible Solution** `function save_taxonomy_data( $post_id ) {               // verify this came from our screen and with proper authorization.     if ( ! wp_verify_nonce( $_POST['_wpnonce'], 'wpuf-add-post' ) )          return;          // OK, we're authenticated: we need to find and save the data     if ( isset( $_POST['cf_country'] ) ) {          wp_set_object_terms( $post_id, $_POST['cf_country'], 'country' );     }     }     add_action('wpuf_add_post_after_insert', 'save_taxonomy_data');     function edit_taxonomy_data( $post_id ) {          // verify this came from our screen and with proper authorization.     if ( ! wp_verify_nonce( $_POST['_wpnonce'], 'wpuf-edit-post' ) )          return;          // OK, we're authenticated: we need to find and save the data     if ( isset( $_POST['cf_country'] ) ) {          wp_set_object_terms( $post_id, $_POST['cf_country'], 'country' );     }     }     add_action('save_post', 'edit_taxonomy_data');`


title: How do I disable the "by author" hyperlink on posts?

text: I'm trying to disable the "author" hyperlink when making a post, but having no success. How can I do it? ![enter image description here](http://i.stack.imgur.com/Pm41m.jpg)


title: WP_Query issues with argument posts_per_page

text:
I have a query that displays the names of donors as well as a dedication. It displays using a date meta query.               $args = array(        'post_type' => 'donors',        'order_by' => 'id',        'order' => 'DESC',        'posts_per_page' => -1,        'date_query' => array(          array(            'after' => $from,            'before' => $to          ),          'inclusive' => true,        ),        'meta_query' => array(          array(            'key' => 'type',            'value' => 'donor',            'compare' => '='          )        )      );      I would like for this to display in an unlimited manner, but for some reason it only displays 252 items when it should display 378. Is there an exhaust limit for how many queries I can do? **EDIT** Here is my complete code of my custom query               $colors = array('#00274E', '#a33038', '#6391B5');     $separators = array();     $sepcount = 0;     $sepindex = 0;          $args = array(             'post_type' => 'arcf_donors',             'order_by' => 'id',             'order' => 'DESC',             'posts_per_page' => -1,             'is_paged' => true,             'paged' => $paged,             'meta_query' => array(                     array(                       'key' => 'type',                       'value' => 'donor',                       'compare' => '='                     )             )     );          $subquery = new WP_Query($args);          $separators = array(             'http://.s3.amazonaws.com/wp-content/uploads/445_4387134.jpg',             'http://.s3.amazonaws.com/wp-content/uploads/564_3765091.jpg',             'http://.s3.amazonaws.com/wp-content/uploads/829_4027101.jpg',             'http://.s3.amazonaws.com/wp-content/uploads/988_4172711.jpg',             'http://.s3.amazonaws.com/wp-content/uploads/987_4120232.jpg',             'http://.s3.amazonaws.com/wp-content/uploads/127_3764954.jpg',             'http://.s3.amazonaws.com/wp-content/uploads/440_4241356resized.jpg',             'http://.s3.amazonaws.com/wp-content/uploads/127_3764954.jpg',             'http://.s3.amazonaws.com/wp-content/uploads/311_2996427.jpg',             'http://.s3.amazonaws.com/wp-content/uploads/445_4387134.jpg'     );          <?php if ( $subquery->have_posts() ):             while ( $subquery->have_posts() ): $subquery->the_post();                     $color = $colors[mt_rand(0,2)]; $sepcount++; ?>                     <?php if ($sepcount == 5): ?>                             <?php $sepindex++; ?>                             <?php if ($sepindex > 9) $sepindex = 0;?>                                  <div id="post-290" class="<?php print $sepindex; ?> post-size-1x1 project type-project status-publish format-link hentry post-single has_thumb about about experiments experiments portfolio portfolio services services team team post" data-post-size="1x1">                                     <div class="inner-image-placeholder" id="post-290-in" style="background-image: url('<?php echo $separators[$sepindex]; ?>');">

                     <?php $sepcount = 0; ?>                        <?php else: ?>                          <div id="post" class=" post-size-<?php the_field('brick_size'); ?> project type-project status-publish format-standard hentry has_thumb portfolio portfolio post" data-post-size="<?php the_field('brick_size'); ?>" style="background-color:<?php echo $color; ?>">

                           <?php                           echo '
';                           echo the_title();                           echo '
';                           if ($show == 'dedication'):                             if (get_field('brick_message') != '' ||  get_field('block_message') != ''):                               echo '

';                               if (get_field('brick_size') == '1x1'):                                 echo '
'. the_field('brick_message') .'
';                               else:                                 echo '
'. the_field('block_message') .'
';                               endif;                               echo '

';                             endif;                           endif;                           ?>
                                                  <?php if (get_field('brick_message') != '' ||  get_field('block_message') != ''): ?>

                               <?php                               if ($show == 'name'):                                 if (get_field('brick_size') == '1x1'):                                   echo '
'. the_field('brick_message') .'
';                                 else:                                   echo '
'. the_field('block_message') .'
';                                 endif;                               else:                                 echo the_title();                               endif;                               ?>

                         <?php endif; ?>

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


title: get_option() vs get_theme_mod(): Why is one slower?

text: I've been using `get_theme_mod()` for some time in various projects of mine. I decided to take advantage of the Theme Customization API in WordPress v3.4 once it was available as I felt it was an indispensable tool for my clients to use. After some time, I began to notice that my sites were feeling a little more sluggish than usual, and the Customizer in particular took quite a long time to load. Through plenty of trial and error during my investigation, I decided to try switching out the `type` when registering my settings (i.e. `$wp_customize->add_setting()`) from `theme_mod` to `option`. Once I did this and swapped out all of my `get_theme_mod()` calls to `get_option()`, I noticed a **very significant** increase in speed using the latter setup as opposed to the former on the frontend and especially in the Customizer on the backend. I've been looking through the WordPress core in an effort to try and figure out an answer for why this is, but can't seem to discern what the particular hangup is in this scenario. Any insights that the community might have with regards to `get_option()` performing significantly faster than `get_theme_mod()` would be greatly appreciated.


title: What happens when wp_cron is deactivated in Wordpress?

text: In a Wordpress 3.5.1 the apache log generates the following error related to wp-cron.php: > [18/Jun/2013:10:53:21 +0200] "POST /wp- > cron.php?doing_wp_cron=1371545601.7393701076507568359375 HTTP/1.0" 200 211 > "-" "WordPress/3.5.1; http://www.foo.com" [18/Jun/2013:10:54:36 +0200] "POST > /wp-cron.php?doing_wp_cron=1371545676.3652250766754150390625 HTTP/1.0" 200 > 211 "-" "WordPress/3.5.1; http://www.foo.com" [18/Jun/2013:10:56:44 +0200] > "POST /wp-cron.php?doing_wp_cron=1371545804.4974770545959472656250 HTTP/1.0" > 200 211 "-" "WordPress/3.5.1; http://www.foo.com" > > ... More than 700 petitions per hour like this are made and I do not have any Cron plugin. I think if I insert the following code in wp-config.php it will desactivate this cron:               define('DISABLE_WP_CRON', true);      I would like to confirm this and ask about what possible pernicious secondary effects this could have.


title: Problem updating from 3.6 to 3.7

text: I am trying to update wordpress from 3.6 to 3.7 using the updater in the admin backend. This is something that has always worked fine in the past on the server my site is on but for some reason when I click the "Update Now" button (which should run the script in `wp-admin/update-core.php` the page hangs for a minute or two before going to a blank admin page (i.e. the wp-admin menu bars and header bar are there but there is no content in the body of the page). Any idea what's causing this? I've tried deactivating some plugins but woocommerce must be kept on for as long as possible in case of an order going through - in any case I doubt it would cause this failure. **Edit:** as a site note, my site runs on a VPS running Ubuntu 12.10 on Nginx with php 5.4.6. I also have a few other wordpress sites on the same server on different vhost. They are much simpler and use completely different themes and only a couple of simple plugins. The update still fails on them in the same way suggesting a server issue rather than an issue with themes or plugins. As mentioned I will check logs but at work currently where ftp and ssh ports are blocked which makes it tricky. **Edit 2** : Having reviewed the log an entry is recorded when I run the upload and it fails: > 2013/10/29 23:20:48 [error] 9384#0: *5318248 upstream timed out (110: > Connection timed out) while reading upstream, client: 81.107.86.251, server: > www.sergedenimes.com, request: "POST /wp-admin/update-core.php?action=do- > core-upgrade HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", > host: "sergedenimes.com", referrer: "http://sergedenimes.com/wp- > admin/update-core.php" I have tried restarting both php-fpm and Nginx to no avail. It looks like it could be a server config problem but the rest of the site works flawlessly (including updating plugins). The issue is not specific to just this site. On my VPS I have 3 other WordPress sites running on separate vhosts that all share the same update problem. Any idea what the cause could be and how to solve?


title: Sending the reset password link programatically

text: I have this manually created page:               $user_login = sanitize_text_field( $_GET['user_login'] );          if ( username_exists( $user_login ) ||  email_exists($user_login) ) { ?>     <!--Everything has been validated, proceed ....-->          <!DOCTYPE HTML>     <html lang="en-US">     <head>         <meta charset="UTF-8">         <title></title>         <script type="text/javascript">             function submit()             {                 var f = document.getElementById('lostpasswordform');                 f.onclick = function () { };                 document.lostpasswordform.submit();             }         </script>     </head>     <body onload="submit()">              <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">                  <input type="hidden" name="user_login" id="user_login" class="input" value="<?php echo ($user_login); ?>" />              <?php do_action('lost_password'); ?>              </form>          </body>     </html>          <?php         echo "SUCCESS";         exit();     } else {         echo "Entered Username or Email was incorrect, please try again!";     }      ... everything seems right but it doesn't work when called from an app, but if I manually visit `domain.com/forgot-password?user_login=username` it does send the reset pass email fine.


title: Using Gravity Forms how to show drop down next to checkbox?

text: Something like this:                    [ ] checkbox-1 <drop down 1>     [ ] checkbox-2 <drop down 2>     [x] checkbox-3     [x] checkbox-4 <drop down 3>      Can this be done?


title: Pagination Issue: Custom Post Type In Index

text:
I'm using a template, which uses Custom Post Type 'movies'. When I try to change the page I got 404 Not Found :( This is my index.php
     <?php     $temp = $wp_query;     $page = get_query_var('page');     $page = (!empty($page) ? $page : 1);     $wp_query= null;     $wp_query = new WP_Query();     $wp_query->query('post_type=movies'.'&posts_per_page=6&paged=$page');     ?>     <?php while (have_posts()) : the_post(); ?>           <div class="box " id="post-<?php the_ID(); ?>">

<a href="<?php the_permalink() ?>" rel="bookmark" title="Ver <?php the_title(); ?>"><?php echo get_post_meta($post->ID, 'wtf_ryear', true); ?>

     <?php     if ( has_post_thumbnail() ) { ?>         <a href="<?php the_permalink() ?>"><img class="boximg" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=270&w=180&zc=1" alt=""/>     <?php } else { ?>         <a href="<?php the_permalink() ?>"><img class="boximg" src="<?php bloginfo('template_directory'); ?>/images/dummy.png" alt="" />     <?php } ?>

          <?php if(++$counter % 4 == 0) : ?>

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

     <?php getpagenavi(); ?>     <?php $wp_query = null; $wp_query = $temp;?>
      And this is my Post Type:               function post_type_movies() {     register_post_type(     'movies',      array( 'public' => true,             'publicly_queryable' => true,             'has_archive' => true,              'hierarchical' => false,             'menu_icon' => get_stylesheet_directory_uri() . '/images/movie.png',             'labels'=>array(                 'name' => _x('Movies', 'post type general name'),                 'singular_name' => _x('Movie', 'post type singular name'),                 'add_new' => _x('Add New', 'Movies'),                 'add_new_item' => __('Add New Movie'),                 'edit_item' => __('Edit Movie'),                 'new_item' => __('New Movie'),                 'view_item' => __('View Movie'),                 'search_items' => __('Search Movies'),                 'not_found' =>  __('No Movies found'),                 'not_found_in_trash' => __('No Movie found in Trash'),                  'parent_item_colon' => ''                 ),                                        'show_ui' => true,             'menu_position'=>5,             'query_var' => true,             'rewrite' => TRUE,             'rewrite' => array( 'slug' => 'pelicula', 'with_front' => FALSE,),             'register_meta_box_cb' => 'mytheme_add_box',             'supports' => array(                 'title',                 'thumbnail',                 'comments',                 'editor'                 )             )      );     }      add_action('init', 'post_type_movies');      Check it out at http://ddlpremium.com/peliculeros Thanks in advance.


title: How to get all children and grandchildren of a hierarchical custom post type?

text: I need to get all sub-posts of a specific (root) parent id.               get_posts( array( 'numberposts' => -1, 'post_status' => 'publish', 'post_type' => 'microsite', 'post_parent' => $root_parent_id, 'suppress_filters' => false ) );      WP-Codex: get_post() function has the post_parent but no child_of parameter. The advantage of the function get_pages() in combination with the child_of paramenter is "... Note that the child_of parameter will also fetch "grandchildren" of the given ID, not just direct descendants."*


title: Why does is_user_logged_in() return false after I change user password on the front end?

text: I've written a custom front-end change password page. At the top of the page I have this snippet of code:               <?php if ( !is_user_logged_in() ) { auth_redirect(); } ?>         After the request is processed and the user's password is changed the page draws, but the next page view triggers `is_user_logged_in()` to return false and it sends the user to the login page... After looking at the code for `is_user_logged_in()` I'm guessing that something gets invalidated in the user's cookie, but I have no idea what. Any pointers?


title: $wp_customize customizer_preview_init not firing inside javascript

text: I'm trying hook the customizer_preview_init action in order to trigger live preview of the changes I'm making in the customizer. However, my first test is failing. I'm just trying to get an alert to fire inside the .js Any ideas what I'm doing wrong?               //Add customizer.php to admin:     if ( is_admin() ) :     require_once( GENESIS_ADMIN_DIR . '/customizer.php' );      customizer.php:               function mytheme_customizer_live_preview()     {         wp_enqueue_script(                 'mytheme-themecustomizer',  //Give the script an ID                 get_template_directory_uri().'/framework/admin/customizer.js',//Point to file                 array( 'customize-preview' ),   //Define dependencies                 '', //Define a version (optional)                 true //Put script in footer?         );     }     add_action( 'customize_preview_init', 'mytheme_customizer_live_preview' );      customizer.js               alert('customizer.js loaded!');           ( function( $ ) {              alert('Customizer!');         //Do Stuff          } )( jQuery );      **Update** : It appears that my enqueue is failing. The customizer.js file is nowhere to be found in the dev tools resource panel. I've verified that the footer.php does in fact have a wp_footer() call as expected. This is Genesis theme, perhaps some filter affecting the enqueue?


title: Different Product Templates for Woocommerce

text:
I'm trying to make two different templates for two different product pages. I've done some digging around and written a conditional that should wrap the page if that particular product is within the Category. I've named the new category "shop" and created a new singles product page called single-product-shop.php. I've then wrote some dummy content in there to test whether the page template has loaded, My single-products.php page now contains the following code.               <?php     /**      * The Template for displaying all single products.      *      * Override this template by copying it to yourtheme/woocommerce/single-product.php      *      * @author      WooThemes      * @package     WooCommerce/Templates      * @version     1.6.4      */          get_header('shop'); ?>

<?php the_title(); ?>

<?php the_breadcrumb(); ?>

<a href="<?php echo home_url(); ?>">

                          <?php while ( have_posts() ) : the_post(); ?>                              <?php                               if (is_product_category('shop')) {                          woocommerce_get_template_part( 'content', 'single-product-shop' );                          } else {                          woocommerce_get_template_part( 'content', 'single-product' );                         }                               ?>                           <?php endwhile; // end of the loop. ?>

      However Although I believe I'm close to achieving my desired result - It doesn't seem to load the correct template. Could this be due to me having the particular product in several categories. So would A way round this be to create two versions of the product and only have the category shop ticked? Thanks for any help guys


title: Outputting results from select box option in options panel

text: I'm trying to figure out how to get the results from a select box option and apply them to my theme. When I use a text input or color picker it works fine. But when I use a select box, nothing is changing. Here's the option:               $options['color_scheme'] = array(             'name' => __('Color Scheme', 'text-domain'),             'desc' => __('Select a color scheme.', 'text-domain'),             'id' => 'color_scheme',             'std' => 'blue',             'type' => 'select',             'class' => 'mini',             'options' => array('blue', 'yellow'));      This code below is where I'm trying to output certain option based on the selection:               if ( of_get_option('color_scheme') == "blue") {                     $output .= "#header {background:#000066;}\n";                 }         else if ( of_get_option('color_scheme') == "yellow") {                     $output .= "#header {background:#FFFF66;}\n";                 }          if ($output <> '') {                 $output = "<!-- Custom Styling -->\n<style type=\"text/css\">\n" . $output . "</style>\n";                 echo $output;             }


title: Using Iris Colorpicker on TinyMCE shortcodes page

text: I'm actually working on a small shortcodes plugin. On plugin main file I register TinyMCE button and link core js about button:               add_filter("mce_external_plugins", "shortcodes_tinymce_plugin");     add_filter("mce_buttons", "register_shortcodes_button");          function register_shortcodes_button($buttons) {         array_push($buttons, "separator", "shortcodes");         return $buttons;     }          function shortcodes_tinymce_plugin($plugin_array) {         $plugin_array['shortcodes'] = PLUGINDIR_URI . 'tiny_mce_script.js';         return $plugin_array;     }      Which contains this code:               (function() {             tinymce.create('tinymce.plugins.shortcodes', {              init : function(ed, url) {                                ed.addButton('shortcodes', {                   title : 'Utilizer shortcodes',                   image : url.replace('/js','')+'/img/shortcodes.png',                   cmd : 'shortcodes',                 pluginurl : ajaxurl                             });                  ed.addCommand('shortcodes', function() {                 ed.windowManager.open({                     file : url.replace('/js','')+'../../tinymce_shortcode.php',                     width : 510 + parseInt(ed.getLang('button.delta_width', 0)),                     height : 415 + parseInt(ed.getLang('button.delta_height', 0)),                     inline : 1                 }, {                     plugin_url : url                 });             });              }           });           tinymce.PluginManager.add('shortcodes', tinymce.plugins.shortcodes);      }     )();      When you click the button modal page loads this file tinymce_shortcode.php which contains this content on top of document:               <?php           require_once("../../../../wp-load.php");           if ( !current_user_can('publish_posts') ) exit();          wp_register_script( 'shortcodes',   PLUGINDIR_URI . "shortcodes.js", false, "1.0", true );        wp_register_script( 'tiny-mce-popup',   PLUGINDIR_URI . "tiny_mce_popup.js", false, "1.0", true );             wp_enqueue_script(          array(              'iris',              'json2',              'jquery',              'jquery-ui-core',              'jquery-ui-sortable',             'jquery-ui-tabs',             'jquery-ui-slider',             'jquery-ui-datepicker',             'jquery-ui-autocomplete',             'tiny-mce-popup',             'shortcodes',             'media-upload',              'thickbox',         )       ); ?>      Then on bottom right before body gets closed I execute this code:               <?php do_action('admin_print_scripts'); ?>     <?php do_action('admin_print_footer_scripts'); ?>      All of javascript libraries are loaded like jquery, jquery-ui, media-upload, thickbox, jso2 etc. Only iris the color picker ones do not get loaded. Any help is really appreciated.


title: Change author of custom post to meta key

text: i have custom post type with custom meta key called "`show_program_editors`" , and when "admin" add new post in it, i need to save post author as `show_program_editors` value,not save to admin. how can do that.


title: How to get a Google maps SQL->XML->map marker tutorial to work in WordPress

text: I have been trying to figure out what is wrong with my code for a couple days now, and I can't seem to crack it. I am trying to follow this tutorial I tried all three of the suggested methods to output the XML from my sql server, and I could only get it to work using echo. The issue I am having is I keep getting the error > "TypeError: xml is null" This happens at `var markers = xml.documentElement.getElementsByTagName("marker");` in the code posted below. I have no idea how to continue. Please let me know if there are any questions I can aswer for you all. Here is the webpage where the code is trying to run Here is the code: (Header section (edited to pertinent code))               <?php                      <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />                       `      (phpsqlajax_genxml3.php)               <?php     require("phpsqlajax_dbinfo.php");          function parseToXML($htmlStr)      {      $xmlStr=str_replace('<','<',$htmlStr);      $xmlStr=str_replace('>','>',$xmlStr);      $xmlStr=str_replace('"','"',$xmlStr);      $xmlStr=str_replace("'",''',$xmlStr);      $xmlStr=str_replace("&",'&',$xmlStr);      return $xmlStr;      }           // Opens a connection to a mySQL server     $connection=mysql_connect (localhost, $username, $password);     if (!$connection) {       die('Not connected : ' . mysql_error());     }          // Set the active mySQL database     $db_selected = mysql_select_db($database, $connection);     if (!$db_selected) {       die ('Can\'t use db : ' . mysql_error());     }          // Select all the rows in the markers table     $query = "SELECT * FROM Markers WHERE 1";     $result = mysql_query($query);     if (!$result) {       die('Invalid query: ' . mysql_error());     }          header("Content-type: text/xml");          // Start XML file, echo parent node     echo '<markers>';          // Iterate through the rows, printing XML nodes for each     while ($row = @mysql_fetch_assoc($result)){       // ADD TO XML DOCUMENT NODE       echo '<marker ';       echo 'name="' . parseToXML($row['name']) . '" ';       echo 'type="' . $row['type'] . '" ';       echo 'description="' . parseToXML($row['description']) . '" ';       echo 'lat="' . $row['lat'] . '" ';       echo 'lng="' . $row['lng'] . '" ';       echo 'rank="' . $row['rank'] . '" ';            echo '/>';     }          // End XML file     echo '</markers>';          ?>     `


title: How to remove buttons from tinyMCE in wp_editor added via AJAX

text:
I've created a plugin with a custom post type that uses the standard editor. Also on the page, I've got a button that causes a jQuery dialog to pop up that also contains the tinyMCE editor created with `wp_editor`. I would like to modify the list of buttons on the toolbar, but only for the SECOND editor (the one in the dialog box). Here's what I've got right now:               class MyPlugin {         function MyPlugin() {             // AJAX action that instantiates the second editor             add_action( 'wp_ajax_show_my_editor', array( &$this, 'show_my_editor' );                  // enqueue the javascript that displays the editor in a dialog             add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );                  /**              * Things I've tried to get the buttons I don't want to go away              */             // filter buttons directly             add_filter( 'mce_buttons', array( &$this, 'mce_buttons' ), 10, 2 );             // filter tinyMCE settings pre-init             add_filter( 'tiny_mce_before_init', array( &$this, 'tiny_mce_before_init' ), 10, 2 );         }              /**          * Enqueues the javascript/css that displays the editor in a dialog          */         function admin_enqueue_scripts() {             wp_enqueue_script( 'editor_dialog_js', plugins_url( 'js/editor_dialog.js', __FILE__ ), array( 'jquery', 'jquery-ui-dialog' ), false, true );             wp_enqueue_style( 'jquery_ui_smoothness', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/themes/smoothness/jquery-ui.css' );         }              /**          * Instantiates a wp_editor instance via AJAX call          */         function show_my_editor() {             wp_editor( '', 'myeditor', array(                 'media_buttons' => false,                 'textarea_rows' => 5,                 'teeny'         => false,                 'quicktags'     => true,                 'tinymce'       => array(                     'skin'                    => 'wp_theme',                     'plugins'                 => 'wordpress, wplink',                     // setting buttons here should work, but doesn't                     'theme_advanced_buttons1' => 'bold,italic',                     'theme_advanced_buttons2' => '',                     'theme_advanced_buttons3' => ''                 )             ));             exit;         }              /**          * Supposed to filter out buttons I don't want          * Possibly redundant since 'theme_advanced_buttons1' is set above          */         function mce_buttons( $buttons, $editor ) {             // filter out buttons ONLY for the editor loaded via AJAX             if ( 'myeditor' == $editor ) {                 $buttons = array_diff( $buttons, array( 'strikethrough' /* ...other buttons */ ) );             }             return $buttons;         }              /**          * Supposed to filter out buttons I don't want          * Possibly redundant since 'theme_advanced_buttons1' is set above          */         function tiny_mce_before_init( $settings, $editor ) {             // filter out buttons ONLY for the editor loaded via AJAX             if ( 'myeditor' == $editor ) {                 $settings[ 'theme_advanced_buttons1' ] = 'bold,italic';             }             return $settings;         }     } // end MyPlugin class      And my `editor_dialog.js` file looks like this:               jQuery( document ).ready( function( $ ) {         $( '#show_editor_dialog_button' ).click( function() {             $.get( ajaxurl, { action: 'show_my_editor' } )             .success( function( editor ) {                 $( '

' ).html( editor )                 .dialog({                     modal: true,                     buttons: { 'OK': function() { $( this ).dialog( 'close' ); } },                     width: 500                 });                 tinymce.execCommand( 'mceAddControl', true, 'myeditor' );                 quicktags( { id: 'myeditor' } );             });         });     });      Here's what I've found out:   1. If I remove the `if ( 'myeditor' == $editor )` conditional then the buttons are filtered out for ALL of my editors, not just the AJAX one as I desire   2. If I use `print_r( $buttons )` or `print_r( $settings[ 'theme_advanced_buttons1` ] )` in either of my filters I can see that my filters are running, that they only run when the AJAX editor is being loaded, and that the buttons I want filtered out appear to be filtered out   3. Trying all combinations of these filters and also setting the `theme_advanced_buttons1` parameter in the AJAX callback function does NOT seem to work So, in short, I'm flummoxed and haven't been able to think of anything else to try. It looks like I've set the appropriate filters, but then why does the toolbar on my AJAX editor still have ALL of the standard WP tinyMCE toolbar buttons?


title: Problem with custom page template and permalink

text: I created custom page template for news               template_news.php      with name               template name: news      and i created a page and configured for that page also i set permalink to               /news/%postname%      also i set news page for blog posts page now WP don't use template_news.php for news page but use index.php !! How i can fix this?


title: How to bring registration field to index page?

text: I am using wordpress and buddypress for my site and my registration works perfectly on www.mysite.com/register, i need to bring the registration fields to the home page(index.php). My register page contains 6 about fields, i tried to bring this, but i couldn't do so and i am stuck with this, could anyone know the solution.


title: Notting but the latest post content keeps on being loaded

text:
Im loading post into a content area via ajax but the latest post is the only one that loads, any one encounter this and manage to fixed it, if so please enlighten me.
              <?php $args = array('posts_per_page' => 1); query_posts($args);?>     <?php while ( have_posts() ): the_post(); ?>

                 <?php the_title(); ?>
             <?php the_post_thumbnail(array(150, 150, true)); ?>             <?php the_content(); ?>

                <?php endwhile; ?>            <?php wp_reset_query(); ?>
      its not my ajax script because I get the same result every time, and yes single.php is present but im not using it in anyway. The javascript               var $mainContent = jQuery(".content"),                 siteUrl = "http://" + top.location.host.toString(),                 url = '';               jQuery(document).delegate("a[href^='"+siteUrl+"']:not([href*=/wp-admin/]):not([href*=/wp-login.php]):not([href$=/feed/])", "click", function() {             location.hash = this.pathname;             return false;         });                            jQuery(window).bind('hashchange',  function(){                 url = window.location.hash.substring(1);                       if (!url) {                     return;                 }                       url = url + " #inner";                       $mainContent.slideUp('slow').load(url, function() {                     $mainContent.slideDown('slow');                 });             });                   jQuery(window).trigger('hashchange');      The links to load for ajax

                                  <?php while (have_posts()): the_post(); ?>
<a href="<?php the_permalink();?>"><?php the_post_thumbnail(array(150, 150, true));?>
                                  <?php endwhile; ?>
                              Left                         Right


title: Using front-page.php need new blog page

text: I'm using front-page.php to generate a static frontpage for a Web site I'm working on. I can't seem to get Wordpress to display the blog posts on any other page. I tried creating a custom template to display blog posts, but it doesn't display any posts. Also, when I try to set the front-page as a static frontpage manually in the reading settings, it doesn't appear as an option. Help?