Wordpress 3.1 problem, getting 404

Today morning I updated my wordpress, everything was fine, but suddenly I came to know that if I click on any post which is not having custom taxonomies selected in it, are giving me 404 pages. I thought this is due to some plugins, so I deactivated all the plugins, and then I checked, everything was working, then I activated one by one plugin and came to know the actual plugin due to which I was getting 404 is **GD Custom Posts And Taxonomies Tools plugin** , which I was using for creating custom Taxonomies. But my other posts were working without 404, so i dig my head more into my wordpress, and came to know that my url structure is not supporting wordpress 3.1 In my permalinks structure, I am using custom taxonomies, which was working fine till wordpress 3.0.5, My permalink structure is this `/%postname%/%location%/%mba_courses%/` where location and mba_courses are my custom taxonomies, To make this work I am using this code:               add_filter('post_link', 'location_permalink', 10, 3);     add_filter('post_type_link', 'location_permalink', 10, 3);     function location_permalink($permalink, $post_id, $leavename) {         if (strpos($permalink, '%location%') === FALSE) return $permalink;                  // Get post             $post = get_post($post_id);             if (!$post) return $permalink;                  // Get taxonomy terms             $terms = wp_get_object_terms($post->ID, 'location');                 if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;             else $taxonomy_slug = 'location';              return str_replace('%location%', $taxonomy_slug, $permalink);     }          add_filter('post_link', 'mba_courses_permalink', 10, 3);     add_filter('post_type_link', 'mba_courses_permalink', 10, 3);          function mba_courses_permalink($permalink, $post_id, $leavename) {         if (strpos($permalink, '%mba_courses%') === FALSE) return $permalink;                  // Get post             $post = get_post($post_id);             if (!$post) return $permalink;                  // Get taxonomy terms             $terms = wp_get_object_terms($post->ID, 'mba_courses');              if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;             else $taxonomy_slug = 'mba_courses';              return str_replace('%mba_courses%', $taxonomy_slug, $permalink);     }      How can I make this work in 3.1 or is their any feature in 3.1 where I can have custom taxonomies on my permalink?


Getting Poster Image (Thumb) of Video Embedded through JW Player in Feed

I am trying to add the poster image of YouTube video I embedded through JW Player in the post in the RSS Feed. Till now I found these: **1. This Code is working when used separately, it is getting the URL of the Thumbnail URL from database`wp_postmeta` table** Code:               $post_d = '6108';     $allmiles = $wpdb->get_var( $wpdb->prepare(          "             SELECT meta_value              FROM $wpdb->postmeta              WHERE post_id = %d              AND meta_key = %s             ",                 $post_d, 'jwplayermodule_thumbnail'              )      );     echo "$allmiles";      **2. Then I am now trying to add this in the feed for each posts, I tried this way:-** Combined Code:               function rss_post_thumbnail($content) {         global $post;         $no1 = '1';         $no2 = '1';         if($no1 == $no2) {             $post_d = get_post_meta($post->ID, 'jwplayermodule_fb_headers_id', true);     $allmiles = $wpdb->get_var( $wpdb->prepare(          "             SELECT meta_value              FROM $wpdb->postmeta              WHERE post_id = %d              AND meta_key = %s             ",                 $post_d, 'jwplayermodule_thumbnail'              )      );                  $content = "<img src='$allmiles'>" . get_the_excerpt();         }         return $content;     }     add_filter('the_excerpt_rss', 'rss_post_thumbnail');     add_filter('the_content_feed', 'rss_post_thumbnail');      But this is not working, what is the problem?


Repeatable field within repeatable group of fields

Compounding on Saving metabox repeatable fields ... I've created a metabox with a series of fields that are repeatable. However, within those fields, I'd like to create another field named Choices and make that repeatable within each grouping. I was able to setup the additional field and repeat it, but have no idea how to save the value of the new repeatable field. The new field that I was trying to create is within the commented portions of the code below as well as my attempts at saving it               function poll_potential_results() {         $options = array (             'Option 1' => 'option1',             'Option 2' => 'option2',         );         return $options;     }          add_action('admin_init', 'poll_add_metaboxes', 1);     function poll_add_metaboxes() {         add_meta_box( 'Dicey', 'Questions and Options', 'poll_metabox', 'quizzes', 'normal', 'default');     }          function poll_metabox() {         global $post;         $repeat_fields = get_post_meta($post->ID, 'repeat_fields', true);         $options = poll_potential_results();         wp_nonce_field( 'poll_metabox_nonce', 'poll_metabox_nonce' );         ?>

              <?php if ( $repeat_fields ) : foreach ( $repeat_fields as $field ) { ?>

                 <input type="text" class="widefat" name="name[]" value="<?php if($field['name'] != '') echo esc_attr( $field['name'] ); ?>" />

                                                        <input type="text" class="widefat" name="url[]" value="<?php if ($field['url'] != '') echo esc_attr( $field['url'] ); else echo 'http://'; ?>" />	                                      <select name="select[]">                     <?php foreach ( $options as $label => $value ) : ?>                     <option value="<?php echo $value; ?>"<?php selected( $field['select'], $value ); ?>><?php echo $label; ?></option>                     <?php endforeach; ?>                     </select>                 	                 Remove

              <?php } else : ?>

                 <input type="text" class="widefat" name="name[]" />

                                                        <input type="text" class="widefat" name="url[]" value="http://" />	                                      <select name="select[]">                     <?php foreach ( $options as $label => $value ) : ?>                     <option value="<?php echo $value; ?>"><?php echo $label; ?></option>                     <?php endforeach; ?>                     </select>                 	                 Remove

              <?php endif; ?>

                 <input type="text" class="widefat" name="name[]" />

                                                   <input type="text" class="widefat" name="url[]" value="http://" />	                                      <select name="select[]">                     <?php foreach ( $options as $label => $value ) : ?>                     <option value="<?php echo $value; ?>"><?php echo $label; ?></option>                     <?php endforeach; ?>                     </select>                 	                 Remove

Add another
     <?php }          add_action('save_post', 'poll_metabox_save');     function poll_metabox_save($post_id) {         if ( ! isset( $_POST['poll_metabox_nonce'] ) || ! wp_verify_nonce( $_POST['poll_metabox_nonce'], 'poll_metabox_nonce' ) ) return;         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;         if (!current_user_can('edit_post', $post_id)) return;              $old = get_post_meta($post_id, 'repeat_fields', true);         $new = array();         //$newchoice = $new[$j];         //$newchoice = $new;         //              $options = poll_potential_results();         $names = $_POST['name'];         //$choices = $_POST['choice'];         $selects = $_POST['select'];         $urls = $_POST['url'];              $count = count( $names );         //$countchoices = count($choices);              for ( $i = 0; $i < $count; $i++ ) {             if ( $names[$i] != '' ) {                 $new[$i]['name'] = stripslashes( strip_tags( $names[$i] ) );                      //for ( $j = 0; $j < $countchoices; $j++) {                 //  if ( $choices[$j] != '') {                 //      $newchoice[$j]['choice'] = stripslashes(strip_tags($choices[$j]));                 //  }                 //}                      if ( in_array( $selects[$i], $options ) ) $new[$i]['select'] = $selects[$i];                 else $new[$i]['select'] = '';                 if ( $urls[$i] == 'http://' ) $new[$i]['url'] = '';                 else $new[$i]['url'] = stripslashes( $urls[$i] );             }         }         //if (!empty($newchoice)) {         //  update_post_meta($post_id,'repeat_fields',$newchoice);         //}              if ( !empty( $new ) && $new != $old ) update_post_meta( $post_id, 'repeat_fields', $new );         elseif ( empty($new) && $old ) delete_post_meta( $post_id, 'repeat_fields', $old );     }


cant output grayscaled ive created using add_image_size

I am trying to create a gray scaled image of the image i upload. I have been able to upload the image and create the gray scaled version by using this code:               add_action('after_setup_theme','bw_images_size');     function bw_images_size() {         $crop = get_option('thumbnail_crop')==1 ? true : false;         add_image_size('thumbnail-bw', '', '', $crop);     }          add_filter('wp_generate_attachment_metadata','bw_images_filter');     function bw_images_filter($meta) {         $file = wp_upload_dir();         $file = $file['basedir'] . '/' . $meta['file'];              list($orig_w, $orig_h, $orig_type) = @getimagesize($file);              $image = wp_load_image($file);         imagefilter($image, IMG_FILTER_GRAYSCALE);                   //imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR);         switch ($orig_type) {             case IMAGETYPE_GIF:                 $file = str_replace(".gif", "-bw.gif", $file);                 imagegif( $image, $file );                 break;             case IMAGETYPE_PNG:                 $file = str_replace(".png", "-bw.png", $file);                 imagepng( $image, $file );                 break;             case IMAGETYPE_JPEG:                 $file = str_replace(".jpg", "-bw.jpg", $file);                 imagejpeg( $image, $file );                 break;         }              return $meta;     }      my issue is when i try and output the image in the template I just get a duplicate of the coloured version. I out the images like this:               <?php                         if ( has_post_thumbnail() ) {                         ?>
                                 <?php the_post_thumbnail(); ?>

                                 <?php the_post_thumbnail('thumbnail-bw'); ?>
                         <?php                         }                       ?>      Any ideas why my I can't output my black and white image? Thanks in advance.


How to validate custom fields in custom post type?

I wrote a plugin that creates a custom post type with custom fields. To prevent users from entering incorrect information, how can I validate the data? I assumed that the save_post hook function would process field validation, but I can't seem to find a straight forward way that displays errors back to the user. Is there a built-in wordpress function/feature for this? What is the general technique for accomplishing custom field validation?


Permalinks not working on MU network with domain mapping

I'm using a theme with custom taxonomies. I want to use corresponding archives. If I try the template out on one network it works, and on another the permalink will take me to 404. The only difference between the two networks that I know of is that the one that doesn't has domain mapping, courtesy of this plugin. Ideas for how to fix it? (Just for the sake of it, here is how I generate the archive links: )               <?php foreach( get_terms('region') as $region ): ?>         <a href="<?php echo get_term_link($region); ?>"><?php echo $region->name; ?>     <?php endforeach; ?>


Loops running into each other

I have 3 loops on one page, each pulling a different CPT into a portfolio like layout. Live: http://iassc.baltimoredrew.com/providers/ Gist: https://gist.github.com/3503334 However the tags for the second and third sections are inheriting the ones from the loop before it. Also when I click on one of the tags to filter it, it filters all 3 loops. JS issue? In fact, could it all be JS related? I know there are probably better ways to do this instead of multiple Custom Post Types & Loops. But it's kinda in there now. I'm hesitant to start all over.


how to organize my categories or should I do custom post types for some?

I have main pages calling the Main parent and putting recent posts on those pages. What I am having the most trouble with is the Magazine. I can not seem to just get Spring 2012 to show with it's cover story, features, and departments separate from the Magazine and Fall 2012. I am thinking I need to reorganize or do this differently any ideas? You can see what I have so far at http://justawebbie.com My categories so far:   * News      * Category 1     * Category 2   * Information       * category 1   * Magazine      * Fall 2012     * Spring 2012     * Cover Story     * Features     * Departments


Single page problem when permalink type changed

I have a custom post type which i create and works perfect without any problem, its a team page to show some members in a company, also i created a single-team page to show more details about each member. The problem is when i use Default Permalinks works without any problem, but when use Post name permalink a got 404 error page not found. i hope i didn't miss anything to make this work.


Creating a filter to modify links ending in .pdf

I'm trying to create a filter that checks for links that are to PDFs, and append the `href` attribute with something like `/form?file=[path to pdf]`. For example, starting with: `<a href="http://www.example.com/wp- content/uploads/08/12/example.pdf">`. The filter would output: `<a href="/form?file=http://www.example.com/wp- content/uploads/08/12/example.pdf">` One last thing, at least some of these PDFs are going to be linked to using Advanced Custom Field's File field (`the_field("file")`). I'm not sure if that makes a difference. I've never worked with WordPress filters, so all help is greatly appreciated. Thanks!


Displaying wp menus by name without using theme locations

I used wp menus in the past but always registering a location and then using:               <?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>      To display a menu on that location on my theme I would first create a menu, and then assign it to that location. Well now what I would like to do is to create all the menus I want using some standard name like my-menu-1, my-menu-2, my-menu-x. And then I want to display those menus on my theme but without using any location, just printing them using code identifying them by name. **How could I do that?**


Getting meta content from get_next_post & get_previous_post

Is it possible to retrieve meta content for the `get_next_post()` and `get_previous_post()`? I'm currently using the following method, but not having much luck:               <?php $prev_post = get_previous_post(); ?>     <?php $prev_post->post_title(); ?> /* Returns content */     <?php echo get_post_meta( $prev_post->ID, 'meta_box1', true); ?> /* Doesn't return content */      Should I be forming the call differently?


Remove Comments section from certain category posts

I'm trying to simply disable my comments section from one of my categories from showing up on my posts. How do I do this? Whats the code and where do I insert the code from a general standpoint? Thanks


How to list "invisible" Auto Drafts?

I noticed that when starting to create a new post, and only attach images and then when leavning the post for some reason, it won't show up in the list post view. However when you look in the Media Library you'll see that the image is attached to "Auto Draft" and that the post really exists. Now, I find this useful, and would like to be able to list these Auto Drafts in the post view, but I don't really know what I need to do to list them.. Ideas?


Remove Posts Quick Edit link for specific user role? WP 3.3

I am using Wordpress 3.3.2 with the following plugin: - http://wordpress.org/extend/plugins/advanced-access-manager/ The plugin works perfectly but the author said there is currently no way to achieve this from the plugin, So I am wondering if there is either another plugin or any code modifications I can make to achieve them.   1. I created a custom user role Called "Member"   2. I applied certain permissions so the user can only sees options to make posts in the backend.   3. When making a post, the user does not see the option to edit the post "slug", enable comments, apply password to post, or to make the post private.   4. The problem comes when viewing the posts lists via the backend admin, the user has the option to "Quick Edit" which allows them to change the "slug", apply password, make post private, and choose the checkbox to "allow comments". When Viewing the lists of posts from the backend, I only want the user to be able to see the "Edit" and "View" link that appears when you hover over a post. I do not want the "Quick Edit" link to appear. Thank you in advance!


jQuery UI AutoComplete & wp_enqueue_script

I looked at the included scripts in WordPress (`wp_enqueue_script`) and didnt find what I should include to use jQuery UI Autocomplete I am using it in the admin area. Should I just include jQuery UI from Google CDN? I think it will conflict with WordPress's jQuery UI? It appears to work tho.


How to restrict user to see his comments only and admin can see everyone comments?

i was trying to achieve this how can i restrict user to see his comments only along with admin replies and admin can see everyone comments? Any suggestion with code would be helpful as i am new to wordpress.


How to load more custom type posts through AJAX & LOAD MORE POSTS button

Guys I am a little stuck here. Unable to load posts from a custom post type through AJAX. Normally I have had been using this script http://goo.gl/lwfM5 It seems so that $wp_query is not getting the post-type identification. What should I do? Summarised question will be "How to implement a LOAD MORE button through AJAX for the posts of a Custom Post Type?" The PHP File               <?php                     /**       * Initialization. Add our script if needed on this page.       */      function pbd_alp_init() {         global $wp_query;              // Add code to index pages.         if( !is_singular() ) {               // Queue JS and CSS             wp_enqueue_script(                 'pbd-alp-load-posts',                 plugin_dir_url( __FILE__ ) . 'js/load-posts.js',                 array('jquery'),                 '1.0',                 true             );                  wp_enqueue_style(                 'pbd-alp-style',                 plugin_dir_url( __FILE__ ) . 'css/style.css',                 false,                 '1.0',                 'all'             );                            // What page are we on? And what is the pages limit?             $max = $wp_query->max_num_pages;             $paged = ( get_query_var('paged') > 1 ) ? get_query_var('paged') : 1;                  // Add some parameters for the JS.             wp_localize_script(                 'pbd-alp-load-posts',                 'pbd_alp',                 array(                     'startPage' => $paged,                     'maxPages' => $max,                     'nextLink' => next_posts($max, false)                 )             );         }      }      add_action('template_redirect', 'pbd_alp_init');           ?>      The js file               jQuery(document).ready(function($) {              // The number of the next page to load (/page/x/).         var pageNum = parseInt(pbd_alp.startPage) + 1;              // The maximum number of pages the current query can return.         var max = parseInt(pbd_alp.maxPages);              // The link of the next page of posts.         var nextLink = pbd_alp.nextLink;              /**          * Replace the traditional navigation with our own,          * but only if there is at least one page of new posts to load.          */         if(pageNum <= max) {             // Insert the "More Posts" link.             $('#content')                 .append('

')                 .append('
Load More Posts
');                  // Remove the traditional navigation.             $('.navigation').remove();         }                   /**          * Load new posts when the link is clicked.          */         $('#pbd-alp-load-posts a').click(function() {                  // Are there more posts to load?             if(pageNum <= max) {                      // Show that we're working.                 $(this).text('Loading posts...');                      $('.pbd-alp-placeholder-'+ pageNum).load(nextLink + ' .post',                     function() {                         // Update page number and nextLink.                         pageNum++;                         nextLink = nextLink.replace(/\/page\/[0-9]?/, '/page/'+ pageNum);                              // Add a new placeholder, for when user clicks again.                         $('#pbd-alp-load-posts')                             .before('

')                              // Update the button message.                         if(pageNum <= max) {                             $('#pbd-alp-load-posts a').text('Load More Posts');                         } else {                             $('#pbd-alp-load-posts a').text('No more posts to load.');                         }                     }                 );             } else {                 $('#pbd-alp-load-posts a').append('.');             }                     return false;         });     });      I think $WP_QUERY is not getting to identify the post type. Looking forward. Update here is my custom post type named as aa_portfolio this file below is the template file where I want the posts to be loaded by ajax               <?php // get_header(); ?>

Filter:

All
                              <?php                             // Get the taxonomy                             $terms = get_terms('filter', $args);                                  // set a count to the amount of categories in our taxonomy                             $count = count($terms);                                   // set a count value to 0                             $i=0;                                  // test if the count has any categories                             if ($count > 0) {                                      // break each of the categories into individual elements                                 foreach ($terms as $term) {                                          // increase the count by 1                                     $i++;                                          // rewrite the output for each category                                     $term_list .= '
slug .'">' . $term->name . '
';                                          // if count is equal to i then output blank                                     if ($count != $i)                                     {                                         $term_list .= '';                                     }                                     else                                      {                                         $term_list .= '';                                     }                                 }                                      // print out each of the categories in our new format                                 echo $term_list;                             }                         ?>

                              <?php                              // Set the page to be pagination                             $paged = get_query_var('paged') ? get_query_var('paged') : 1;                                  // Query Out Database                             $aa_portQuery = new WP_Query(array( 'post_type' => 'aa_portfolio', 'posts_per_page' =>'9', 'paged' => $paged ) );                          ?>                              <?php                             // Begin The Loop                             if ($aa_portQuery->have_posts()) : while ($aa_portQuery->have_posts()) : $aa_portQuery->the_post();                          ?>                              <?php                              // Get The Taxonomy 'Filter' Categories                             $terms = get_the_terms( get_the_ID(), 'filter' );                          ?>                              <?php                          $large_image =  wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'fullsize', false, '' );                          $large_image = $large_image[0];                          ?>                                      <?php                                     //Apply a data-id for unique indentity,                                      //and loop through the taxonomy and assign the terms to the aa_portfolio item to a data-type,                                     // which will be referenced when writing our Quicksand Script                                 ?>                                 <li data-id="id-<?php echo $count; ?>" data-type="<?php foreach ($terms as $term) { echo strtolower(preg_replace('/\s+/', '-', $term->name)). ' '; } ?>">                                              <?php                                              // Check if wordpress supports featured images, and if so output the thumbnail                                             if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) :                                          ?>                                                  <?php // Output the featured image ?>                                             <a rel="prettyPhoto[gallery]" href="<?php echo $large_image ?>"><?php the_post_thumbnail('aa_portfolio_img'); ?>                                                                                <?php endif; ?>                                               <?php // Output the title of each aa_portfolio item ?>
<a href="<?php the_permalink(); ?>"><?php echo get_the_title(); ?>

                                   <?php $count++; // Increase the count by 1 ?>                                <?php endwhile; endif; // END the Wordpress Loop ?>                         <?php wp_reset_query(); // Reset the Query Loop?>
                                               <?php                           /**                         Pagination                     **/                              $big = 999999999;                         echo paginate_links(array(                             'base' => str_replace($big, '%#%', get_pagenum_link($big)),                             'format' => '?paged=%#%',                             'current' => max(1, get_query_var('paged')),                             'total' => $aa_portQuery->max_num_pages,                                 'prev_text' => __('Previous'),         'next_text' => __('Next'),                         ));                      ?>
          <?php // get_footer(); ?>      This is how I created the Custom Post Type               <?php          // function: post_type BEGIN     function aa_post_type()     {         // Create The Labels (Output) For The Post Type         $labels =          array(             // The plural form of the name of your post type.             'name' => __( 'Portfolio'),                   // The singular form of the name of your post type.             'singular_name' => __('Portfolio'),                  // The rewrite of the post type             'rewrite' =>                  array(                     // prepends our post type with this slug                     'slug' => __( 'portfolio' )                  ),                  // The menu item for adding a new post.             'add_new' => _x('Add Item', 'portfolio'),                   // The header shown when editing a post.             'edit_item' => __('Edit Portfolio Item'),                  // Shown in the favourites menu in the admin header.             'new_item' => __('New Portfolio Item'),                   // Shown alongside the permalink on the edit post screen.             'view_item' => __('View Portfolio'),                  // Button text for the search box on the edit posts screen.             'search_items' => __('Search Portfolio'),                   // Text to display when no posts are found through search in the admin.             'not_found' =>  __('No Portfolio Items Found'),                  // Text to display when no posts are in the trash.             'not_found_in_trash' => __('No Portfolio Items Found In Trash'),                  // Used as a label for a parent post on the edit posts screen. Only useful for hierarchical post types.             'parent_item_colon' => ''          );              // Set Up The Arguements         $args =          array(             // Pass The Array Of Labels             'labels' => $labels,                   // Display The Post Type To Admin             'public' => true,                   // Allow Post Type To Be Queried              'publicly_queryable' => true,                   // Build a UI for the Post Type             'show_ui' => true,                   // Use String for Query Post Type             'query_var' => true,                   // Rewrite the slug             'rewrite' => true,                   // Set type to construct arguements             'capability_type' => 'post',                   // Disable Hierachical - No Parent             'hierarchical' => false,                   // Set Menu Position for where it displays in the navigation bar             'menu_position' => null,                   // Allow the portfolio to support a Title, Editor, Thumbnail             'supports' =>                  array(                     'title',                     'editor',                     'thumbnail'                 )          );              // Register The Post Type         register_post_type(__( 'aa_portfolio' ),$args);               } // function: post_type END               // function: portfolio_messages BEGIN     function aa_portfolio_messages($messages)     {         $messages[__( 'aa_portfolio' )] =              array(                 // Unused. Messages start at index 1                 0 => '',                      // Change the message once updated                 1 => sprintf(__('Portfolio Updated. View Portfolio'), esc_url(get_permalink($post_ID))),                      // Change the message if custom field has been updated                 2 => __('Custom Field Updated.'),                      // Change the message if custom field has been deleted                 3 => __('Custom Field Deleted.'),                      // Change the message once portfolio been updated                 4 => __('Portfolio Updated.'),                      // Change the message during revisions                 5 => isset($_GET['revision']) ? sprintf( __('Portfolio Restored To Revision From %s'), wp_post_revision_title((int)$_GET['revision'],false)) : false,                      // Change the message once published                 6 => sprintf(__('Portfolio Published. View Portfolio'), esc_url(get_permalink($post_ID))),                      // Change the message when saved                 7 => __('Portfolio Saved.'),                      // Change the message when submitted item                 8 => sprintf(__('Portfolio Submitted. Preview Portfolio'), esc_url( add_query_arg('preview','true',get_permalink($post_ID)))),                      // Change the message when a scheduled preview has been made                 9 => sprintf(__('Portfolio Scheduled For: %1$s. Preview Portfolio'),date_i18n( __( 'M j, Y @ G:i' ),strtotime($post->post_date)), esc_url(get_permalink($post_ID))),                      // Change the message when draft has been made                 10 => sprintf(__('Portfolio Draft Updated. Preview Portfolio'), esc_url( add_query_arg('preview','true',get_permalink($post_ID)))),             );         return $messages;             } // function: portfolio_messages END          // function: portfolio_filter BEGIN     function aa_portfolio_filter()     {         // Register the Taxonomy         register_taxonomy(__( "filter" ),               // Assign the taxonomy to be part of the portfolio post type         array(__( "aa_portfolio" )),               // Apply the settings for the taxonomy         array(             "hierarchical" => true,              "label" => __( "Filter" ),              "singular_label" => __( "Filter" ),              "rewrite" => array(                     'slug' => 'filter',                      'hierarchical' => true                     )             )         );      } // function: portfolio_filter END               add_action('init', 'aa_post_type');     add_action( 'init', 'aa_portfolio_filter', 0 );     add_filter('post_updated_messages', 'aa_portfolio_messages');                    ?>


Custom subscription abandonment

I'm using a subscription service through a small third-party company. I've asked them to consider sending emails to users that drop-off from the subscription but they don't want to implement such a solution for me. My site currently sends each user's email and name to them via a form using the POST method, then they securely take the payment details a bit like PayPal. Customers are then redirected to my site once the subscription is confirmed. What I'd like to know is if there is a way to collect the user's email and name in my Wordpress set-up before the POST form details are sent to the third-party company. Then I guess I could set them up as a user with role 'none' and if I don't get a subscription confirmation from that user within say 1 hour, an HTML email is sent out to them? If I do get a subscription confirmation from them, then they are given a user role and the email isn't sent out to them. Does that seem feasible? Really appreciate any help.


WordPress Network - Bug - is this happening to everyone?

I just installed my WordPress Network. I also have the 'Multisite User Management' plugin network activated. This is my structure:               domain.com (the first installation)     sd1.domain.com     sd2.domain.com      I created a user in the Admin interface, and then deleted it from sd2. I go to sd1.domain.com and log in with this user. Then I change my URL in the browser address bar with sd2.domain.com. I notice that I am logged in sd2.domain.com, which shouldn't be possible. Are you getting this as well? I thought that if you don't have a user assigned to a sub-blog, you shouldn't be able to login to that site. CLARIFICATION (later edit): I was expecting the following behavior: - I have a user that is assigned to domain.com and sd1.domain.com (but not sd2.domain.com) - I use the credentials of that user to log in on sd1.domain.com - If I change the URL in the browser address bar to sd2.domain.com, I thought I would get to sd2.domain.com, but not be logged in, because the user does not belong to sd2.domain.com (this can be seen in admin, under Users). I'm actually looking for a way of not letting a user be logged into a subdomain blog which he doesn't belong to. And to show the content of that subdomain blog to only logged in users. Thank you, HT


looking for a multi-user hello-world plugin

i am jumping neck deep into wordpress. I have set up a muilt-site environment. I am not looking for a hello-world/tutorial on creating a plugin in a muilt- site environment. Can i just follow this http://codex.wordpress.org/Writing_a_Plugin or is the multi-site env different enough that i need something different. thanks for any help


When to use custom DB tables or add_option?

I've got a pretty straight forward question. When does it become too much data to use add_option, update_option, etc, and instead use a custom DB table? For example, if a plugin stores thousands and thousands of characters of data using add_option, etc, is there a maximum it can handle before it starts to create problems? A plugin of mine used to create its own DB table, but it created a lot of issues in which some users setups wouldn't work (especially on Microsoft based hosting servers), and many more users felt the need to contact me and advise me on using add_option instead. I followed their advise, and now the plugin uses these functions. However, I've come a long way in my coding abilities since then and in-turn have started redesigning the plugin. It now has much, much more data to be stored using add_option. Even up to over 10000+ characters worth, and I'm beginning to wonder if it will cause any problems.


Help in using SEO Plugins: SEO Ultimate And Yoast SEO Plugin

_I've deleted my previous question as it was migrated from Prowebmaster to WordPress section, and hence it was deep down somewhere._ I'm in a quandary about using SEO Plugin for my WordPress site. Here's the thing: I was a happy camper with the Yoast SEO Plugin but because I couldn't edit Meta Description in bulk, I reached out for help in this forum. One of the nicest guy recommended me to use SEO Ultimate Plugin. To me, this plugin works very well. Plugin is excellent. Plus, more importantly, I can edit Meta Description without sweating bullets. Now, Yoast SEO Plugin is configured such that it strips category URLs, modifies archive pages with the /date extension and so on. Also it strips away a lot of unnecessary codes from the WordPress core structure -- the WP version, Rel Next, Prev links, etc. SEO Ultimate, on the other hand, will be used primarily to edit Meta Description. However, Yoast SEO Plugin, by default, shows up Title and Meta Description. So I have two MD and I can't switch off Yoast SEO Plugin -- no tick box to switch off the MD. I need your advice. What do I do? I want to kill Yoast SEO Plugin's MD but I don't know how. I want to keep using SEO Ultimate but -- damn! -- I can't do it because of this issue. Any help is highly appreciated.


add_theme_support( 'admin-bar' ) causes fatal error

I am trying to learn more on Theme Development so I've created my own and everything worked fine except when I added `functions.php` and tried to update it with something simple as:               <?php      add_theme_support('admin-bar', array('menus'));     ?>      I get `Server 500 ERROR` and I cannot access any part of Wordpress, not even Dashboard. But then as soon as I delete `functions.php` and refresh page my Wordpress is back again and working smooth. What is so mysterious about `functions.php`???? Thank you so much.


Is it possible to add an item the Post Publish panel?

In the Admin area when you edit a post, I'd like to add a custom item to the Publish panel in the top right corner. Is it possible to access this through the Wordpress API? If so, what functions do I need to look at? Any examples would be much appreciated.


WP Admin pass url parameter to submit/post function

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


Javascript notification banners not showing

i’m having problems debugging a problem that i think a theme is causing…i’ve managed to narrow it down to a problem with the theme by deactivating the theme and the bugs not there – hence I’ve narrowed it down. Anyway, any JS banners that would normally appear don’t seem to be functioning. It’s hard to explain. Here’s the expected behaviour when exporting a user using a plugin – http://db.tt/XXPvZSIz When using it with the default Wordpress theme it works fine, however with the my theme it doesn’t show. When you click export there is no yellow box letting you know how many users have been exported. The action is completed, i'm just not notified. Any ideas on where to start refining by bug fixing skills?


Is it possible to make custom columns in the user.php file to be sortable based off meta values?

I've googled around and not seen any answer that really works so far so I thought I would check and see what others say. I'm working on a plugin that adds three different columns filled with meta data for each user and I would like to know if it's possible to sort by them. I've seen examples of it working on posts but not really on users.php. Any suggestions or examples? Thanks!


Don't display taxonomy if empty

I'm using the following code to display my custom post taxonomies:               function display_post_taxonomies( $content ) {          if( is_single() ) {          $args = array( 'public' => true, '_builtin' => false );              $output = 'objects';                 $operator = 'and';               $taxonomies = get_taxonomies( $args, $output, $operator );              if( $taxonomies ) {                  $content .= '
';                      foreach( $taxonomies as $taxonomy ) {                            $args = array(                                 'orderby'               => 'name',                                 'echo'                  => false,                                 'taxonomy'              => $taxonomy->name,                                 'title_li'              => '' . __( $taxonomy->labels->name, 'your-themes-text-domain' ) . '',                                 'show_option_none'      => __( 'No ' . $taxonomy->labels->name, 'your-themes-text-domain' )                             );                 $content .= '
' . wp_list_categories( $args ) . '
';                          }                        $content .= '
';                }     }        return $content;     }          add_filter( 'the_content', 'display_post_taxonomies' );      This works fine, except there are some cases where I don't have anything in my custom taxonomy. In those cases, I don't want there to be anything displayed at all, i.e., No taxonomy title or default 'no terms' message. I can get rid of the 'no terms' message by simply setting `show_option_none` to `false`, but that leaves the name of the taxonomy there. What I really need is an `if` statement similar to               if($taxonomy => 'objects'){         //$args & &content arrays     }      but that doesn't work. Help much appreciated.


Add internal page to admin menu

i want to put an internal wordpress page (for example Contact page) to the admin panel, in order to dont have to go though Pages->All Pages, is it possible? with the above code it seems that it can only retrieve some pages, not all of them. In many pages i get bool(false) and the template page is for sure correct. in one page i get this object(WP_Post)#823 (28) { ["ID"]=> int(13) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2013-11-06 09:31:01" ["post_date_gmt"]=> string(19) "2013-11-06 09:31:01" ["post_content"]=> string(0) "" ["post_title"]=> string(4) "Home" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(4) "home" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2013-11-06 10:40:37" ["post_modified_gmt"]=> string(19) "2013-11-06 10:40:37" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(37) "http:// localhost/medetail/?page_id=13" ["menu_order"]=> int(0) ["post_type"]=> string(4) "page" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" ["meta_id"]=> string(2) "11" ["post_id"]=> string(2) "13" ["meta_key"]=> string(17) "_wp_page_template" ["meta_value"]=> string(13) "page-home.php" } also i noticed in this one that the http:// localhost/medetail/?page_id=13 is not correct


Wordpress installation self deleted in server restart. SQL Tables gone too!

I have or had in this case, two wordpress sites running on a Ubuntu 12.04 server edition which were installed over the weekend. After installation both sites were performing as expected, no problems. The mysql tables were populated and life was good. This morning after a server restart, the mysql tables are gone and when entering the url to go to the sites wordpress is presenting the initial install page with the following appended in the url ... wp-admin/install.php. My file permissions are as follows: ![File permissions for the WP installation](http://i.stack.imgur.com/3zbbR.png) For both sites, there is a dedicated user for the purposes of the database installation and credentials to keep information separate. Everything else is separate too like the installation directories and apache config files. Has anyone experienced this before? Are there any other thoughts on what the problem is? Thank you for the help.


Trying to get file name

I have a custom meta box to store pdf files. For this input, I'm using type="media" to acess wordpress media library. Now I can't get the file name. Here is my entire loop:
             <?php             $args_artigos = array('post_type' => 'artigo','posts_per_page' => -1);             $artigos_posts = new WP_Query($args_artigos);                  if($artigos_posts->have_posts()) :                 while($artigos_posts->have_posts()) :                 $artigos_posts->the_post();             ?>
             <a href="<?php the_permalink(); ?>" class="artigos-titulo"><?php the_title() ?>             <?php echo esc_html( get_post_meta( get_the_ID(), 'autor', true ) ); ?>             <?php $filename = basename ( get_attached_file( get_the_ID() ) ); echo $filename; ?>
                  <?php endwhile; else: ?>                Oops, there are no posts.             <?php endif; ?>
      But it's return no data.


How much should this hosting cost?

I have a client with a wordpress site that gets the following traffic.   1. 6.2-6.4 Million page views per month   2. Around 3 TB of Transfer per month   3. Most of the users are logged in, so the static caching options are not that effective. About 80% of the traffic is direct to the DB. We have about 20 plugins, but nothing too crazy. Woth out knowing much more, How much do you think they should be paying per month for managed hosting? Not build your own, support your own server setups, but a support desk that you can call 24-7 and someone who updates your LAMP stack, etc. I would not hold anyone to the amount, I just wanted to know what this group of experts would think was reasonable for 24 Hour managed / supported hosting for something of this size? I just want to make sure that I am not way off base when I say our current cost is reasonable.


By registering always make uppercase the first letter of the login

When a New User to register on my site ... I would like that in your login, the first letter always be capitalized. ( uppercase letter ) Forcibly. Does anyone have any idea how to do this?


why does this text overlaps in the sidebar?

I've been trying, without success, to remove to sliding of the text: "ggplot+background+grid+colour" From the left sidebar here Any suggestions on how to do this?


Basic Theme for a Static Corporate Website?

_( **Moderator's note:** Was originally titled "Wordpress for a static corporate website?")_ I am looking for a WordPress solution that will give me:   * a static website, with menu and a few pages,   * does not look like a blog, looks like a corporate website   * a very basic look and feel: white background, almost only text,   * easy to setup and maintain   * SEO An example of my target is:   * rachatdecredit.net It is using WordPress, but I cannot find out which theme; perhaps it's a custom-made theme. Anyway, I cannot find a theme that gives a similar result. Would you have a recommendation?


Explode() expects a string

I currently am getting this error:               Warning: explode() expects parameter 2 to be string, object given in D:\...\portfolio.php on line 12      Here is my portofolio.php:               <?php          $current = get_the_category();          $current_id= $current[0] ->cat_ID;          $categs_list = get_category_parents($current_id);         $pieces = explode("/", $categs_list);  //this is line 12.         $category_name = strtolower($pieces[0]);         $categs = get_cat_id($category_name);         ?>      Any Ideas? PHP is not my forte.


Add a span tag around image

I want to be able to add a `<span></span>` around every image that gets posted. How will I be able to do this?


Is there any W3C compatible Share & Follow plugin?

I'm trying to build a fully W3C compatible blog. But I couldn't find a fully W3C compatible plugin. I want a simple plugin that provides share, tweet and like icons, sociable style. I don't want my readers to click a button to show share buttons, only buttons i want the plugin to provide. Any suggestions?


Post rating using Custom Field

I'm writing new theme for my blog. And I want to make some kind of post rating using custom fields. There are two fields: 'good-post' and 'bad-post'. And after each post I placed two buttons. Yep, 'Good post' and 'Bad post'. On buttons I placed onclick event that calls this AJAX function:               function ajaxIncGoodPost(tempUrl)  {         var postID = $("good-post").attr("rel");              jQuery.ajax({         type: "POST",         url : tempUrl+"/rating.php",         data: "opinion=good&postID="+postID,         success: function(msg){         alert( "Спасибо за вашу хорошую оценку!" );             }         });     }      It calls this function in `rating.php`:               $postID = $_REQUEST['postID'];           if ( $_REQUEST['opinion'] == 'good' ) {         $good_post = get_post_meta($postID, 'good-post');              function inc_good_post() {             $good_post++;             update_post_meta($postID, 'good-post', $good_post);          }     }      So every click on this button calls function that increments `'good-post'` value and stores it in the field. But here comes the problem. After click on the button success messege of AJAX function pops up, but value of custom field doesn't changes. I thought this happens because there is no such fields in my old posts, but according to Wordpress Codex `upadate_post_meta()` checks if such field exists and if not calls `add_post_meta()` which creates field. But this doesn't heepen either. At this point I can't find any mistake. If you have any guesses about this problem please share it!


Order by menu_order and title?

We can order pages by title. Also we can sort them by menu_order. **Is it possible, to order pages by menu_order and title at the same time?**


Wordpress insert NOW() in TIMESTAMP column returns all zeros

I want to insert a TIMESTAMP into my column's TIMESTAMP column, but I always get all zeros. Here is my insert:               $now = 'NOW()';          // insert the date into the db      $wpdb->insert(          'wp_date',          array(             'name' => $name,             'date' => $now             ),          array(              '%s',             '%s'         )      ); // end insert


How to get my post title to work with an apostrophe ('s)?

When saving a post with the title `Jule's Gormet`, it gets formatted as `Jule's Gormet`. If I save it again, it becomes `Jule&#039;s Gormet`. Following this pattern, it keeps escaping the ampersand and getting worse. **More info**   * WordPress version: 3.3.2   * Theme: http://themetrust.com's Reveal (heavily modified)   * DB is UTF-8   * settings>reading has encoding set to UTF-8   * values are being stored in the database as `Jule&amp;amp;#039;s` (etc..) I've disabled all plugins and the problem persists.   I've gone through `functions.php` pretty well, and didn't find anything suspicious. I followed the troubleshooting guide in the brasofilo's comment - but to no effect. Any ideas? **Added this code per tommix**               function get_post_title($title) {          wp_mail('zlysobey@gmail.com','the title',$title); return $title;      } add_filter ('title_save_pre','get_post_title');        **Which Yielded these results:**   * Jule\'s Gormet - 1st ~~attempt~~ save   * Jule's Gormet - 2nd ~~attempt~~ save   * Jule's Gormet - 3rd ~~attempt~~ save   * Jule&#039;s Gormet - 4th ~~attempt~~ save It actually sent 2 emails per save operation - maybe it means something? idk. **On the Trail!** so, I bit the bullet and started in on a fresh install - using all the edited theme code. After liberally deleting stuff from the `functions.php`, I found the issue is somehow related to Bainternet's Tax-meta-class I'm using to add a field to one of my custom taxonomies. Removing the following code fixes the issue. (though I'd like to figure out how to fix it while retaining my added taxonomy field.               // CUSTOM TAXONOMY FIELDS     require_once("Tax-meta-class/Tax-meta-class.php");     $config = array(        'id' => 'focus_creative_services',        'title' => 'creative services',        'pages' => array('focus'),        'context' => 'normal',        'fields' => array(),        'local_images' => false,        'use_with_theme' => true     );     $creative_services_meta = new Tax_Meta_Class($config);     $creative_services_meta->addTextarea('textarea_field_id',array('name'=> 'Creative Services '));     $creative_services_meta->Finish();      I dropped a note to @Bainternet on his websites FAQ. Hopefully he'll sort me out.


Comment Author Name In Reply Form

I have enabled comment replies in my blog. Lets say there is a comment Nick has written... when I'm gonna reply, I want to display a message "Replying to Nick" in the reply's form header. Anyone knows how? Thanks!


How to truncate titles in Recent Posts widget?

I read the thread here about this... http://wordpress.org/support/topic/truncate-titles-in-recent-posts- widget?replies=8 but the suggested solution didn't work, because I wasn't sure what to do with the code. Can anyone give me the full code using the code from the pastebin link, and here: http://wordpress.org/support/topic/post-title-char-count?replies=5 Shortening the titles to 25 characters please? I'm really not good at PHP. It may be easier to make a plugin since the code is already there, so anyone can choose how many characters to limit the titles to? Thanks so much!


Wordpress add_action the_post hook

Now i face a problem, that i want to add a hook into the the_post. Then i use `print_r($post);` here display the my `print_r` content and again display the default content. because i am here in the_loop.so again the content was display.               add_action( 'the_content',  'custom_post' );            function custom_post() {         global $post, $wp_query;         $post_id = $post->ID;         print_r($post);       }      Here i need how to overwrite the default content of the the_post and display my own content. This is possible in a way, that i use the_title and the_content hook but here the function was call two times then its problem. so plz help me.


Multisite with Different Domains

This question is similar to Multisite with entirely different domains? which was not answered. I am re-asking. I want to host multiple domains using WP multisite, which is installed and working normally in "multiple subdomains" mode. This creates multiple WP sites like               site1.domain.com     site2.domain.com      I want to use               www.domain1.com     www.domain2.com      I've tried the Wordpress MU domain mapping plugin but I'm not satisfied with its behavior. This plugin seems to simply redirect the user, ie. the user enters               www.domain1.com      and the browser is sent to               site1.domain.com      I don't want the user to know they aren't on domain1.com. I also tried setting up VirtualHosts in Apache:               <VirtualHost *:80>        ServerName site1.domain.com        ServerAlias domain1.com        ServerAlias www.domain1.com     </VirtualHost>      But this also seems to produce a redirect to               site1.domain.com      in the users's browser.


How to get wp_get_archives to work on multisite

I am using multisite and have a news-archive on blog(3) and would like to use wp_get_archives for showing in sidebar, but it doesn´t show anything. Does it work on multisite? If not is it any others solution? Have tried different conditions.   Right now my code in the sidebar looks like this and the result is nothing.

Newsarchive

           <?php wp_get_archives('type=monthly&limit=15&show_post_count=true'); ?>


Send data using GET method not work correctly

Im using WP 3.5.2 and WPMU. I develop one page http://baohiem.info/chon-mat- gui-vang. This page uses global $wpdb to query table _blogs.(_blogs was customized, added some fields.) When submit form, I use GET method, but, when log in, i have data ($_REQUEST; $_GET) but not log in, there're no data. Why? I don't understand what happen. Can anyone help me? Thank you.               <?php      get_header(); ?>                   <form action="" method="get">             <input id="searchfield-cmgv" type="text" name="hoten" placeholder="Họ và tên tư vấn viên...." size="35" value="<?=$_REQUEST['hoten']?>"/>             <!-- location-->             <select name="location">                 <option value="">-------- Tỉnh/TP --------</option>                 <option value="Hà Nội" <?php if($_REQUEST['location']=='Hà Nội') echo 'selected';?> >Hà Nội</option>                 <option value="TP Hồ Chí Minh" <?php if($_REQUEST['location']=='TP Hồ Chí Minh') echo 'selected';?> >TP Hồ Chí Minh</option>                 <!-- <option value="Huế" <?php if($_REQUEST['location']=='Huế') echo 'selected';?> >Huế</option>-->                 <option value="Đà Nẵng" <?php if($_REQUEST['location']=='Đà Nẵng') echo 'selected';?> >Đà Nẵng</option>                 <option value="Hải Phòng" <?php if($_REQUEST['location']=='Hải Phòng') echo 'selected';?> >Hải Phòng</option>                 <option value="Đồng Nai" <?php if($_REQUEST['location']=='Đồng Nai') echo 'selected';?> >Đồng Nai</option>                 <!-- <option value="Đồng Tháp">Đồng Tháp</option>                 <option value="Gia Lai">Gia Lai</option> -->                 <option value="Hà Giang" <?php if($_REQUEST['location']=='Hà Giang') echo 'selected';?> >Hà Giang</option>                 <!-- <option value="Hà Nam">Hà Nam</option>                 <option value="Hà Tĩnh">Hà Tĩnh</option> -->                 <option value="Hải Dương" <?php if($_REQUEST['location']=='Hải Dương') echo 'selected';?> >Hải Dương</option>                 <option value="Nghệ An" <?php if($_REQUEST['location']=='Nghệ An') echo 'selected';?> >Nghệ An</option>                 <option value="Thái Nguyên" <?php if($_REQUEST['location']=='Thái Nguyên') echo 'selected';?> >Thái Nguyên</option>                 <option value="Yên Bái" <?php if($_REQUEST['location']=='Yên Bái') echo 'selected';?> >Yên Bái</option>                 </select>            <select name="company">                <option value="">-------- Công ty --------</option>                <option value="Prudential" <?php if($_REQUEST['company']=='Prudential') echo 'selected';?> >Prudential</option>                <option value="Manulife" <?php if($_REQUEST['company']=='Manulife') echo 'selected';?> >Manulife</option>                <option value="AIA" <?php if($_REQUEST['company']=='AIA') echo 'selected';?> >AIA</option>                <option value="Dai-ichi Life" <?php if($_REQUEST['company']=='Dai-ichi Life') echo 'selected';?> >Dai-ichi Life</option>                <option value="ACE Life" <?php if($_REQUEST['company']=='ACE Life') echo 'selected';?> >ACE Life</option>                <option value="Bảo Việt" <?php if($_REQUEST['company']=='Bảo Việt') echo 'selected';?> >Bảo Việt</option>                <option value="Hanwha Life" <?php if($_REQUEST['company']=='Hanwha Life') echo 'selected';?> >Hanwha Life</option>                <option value="Generali" <?php if($_REQUEST['company']=='Generali') echo 'selected';?> >Generali</option>                <option value="Chưa có" <?php if($_REQUEST['company']=='Chưa có') echo 'selected';?> >Chưa có</option>            </select>             <input type="hidden" value="true" name="confirm" />            <input id="searchbutton" value="Tìm kiếm" type="submit">         </form>                 <?php            global $wpdb;                  // lấy thông tin công ty, họ tên, location             $company = $_GET['company'];             $hoten = $_GET['hoten'];             $location = $_GET['location'];              if(!$company && !$hoten && !$location){                      // string query                 $strquery = '                                         SELECT bh_blogs.blog_id                                         FROM bh_blogs                                         WHERE bh_blogs.blog_id >1                                         AND bh_blogs.deleted =0                                         ORDER BY bh_blogs.voted DESC                         ';                      // get result                 $res = $wpdb->query($strquery);                      // display result                 //                 //         } else {            //var_dump($location); var_dump($company); var_dump($hoten);             $strquery = '                 SELECT bh_blogs.blog_id                 FROM bh_blogs                 WHERE bh_blogs.blog_id > 1 AND bh_blogs.deleted =0 ';                  if($hoten!='') $strquery .= ' AND bh_blogs.site_name LIKE "%'.$hoten.'%" ';             if($company!='') $strquery .= ' AND bh_blogs.company="'.$company.'" ';             if($location!='') $strquery .= ' AND bh_blogs.location="'.$location.'" ';                  $strquery .= ' ORDER BY bh_blogs.voted DESC ';                  //display result             //             //         }            get_footer();       ?> the url: http://baohiem.info/chon-mat-gui- vang/?hoten=&location=Hải+Phòng&company=Prudential not work. I can't Get['location'],Get['hoten'],Get['company'] * * * Resolved: I use the plugin Better WP Security and it filters my URL. To enable passing parameters like: example.com?src=SomeSource&page=1..... Log in to you ACP. Better WP Security/System Tweak and uncheck the option "Filter Suspicious Query Strings". Note: attention with your parameters is safe for your site :) Merry Christmas.


Include Custom Posts Type in Year/Month/Date Archive

I am looking for solution where I able to get all custom post types in year, month and date archive list. So it can be filters by anything either year, month or date. I am looking for function something like below which I am using to include CPT for authors               function custom_post_author_archive($query) {         if ($query->is_author)             $query->set( 'post_type', array('wp_plugin_review', 'png_gallery', 'post', 'news') );         remove_action( 'pre_get_posts', 'custom_post_author_archive' );     }     add_action('pre_get_posts', 'custom_post_author_archive');


How to build an advanced search form by post type?

I'm trying to build an advanced search form by post type. For example... I have custom Post Type : Locatie Taxonomy : locatii I have categories in PostType : Categories: -Orase - Arad - Alba.... -Tip - Puncte de livrare - Gaze Medicale  I want to get all post in that categories.. For example i select Arad and Gaze Medicate... and shoud apear me all the Medical Point for city arad.               <form method="get" name="searchform" action="<?php bloginfo('url'); ?>/">          <fieldset>     <legend>Centre de distributie:</legend>     <form>

         Selecteaza oras :	         <select name="locatie">     <option value="alba">Alba</option>     <option value="arad">Arad</option>     <option value="arges">Arges</option>     <option value="bacau">Bacau</option>     </select>

Limiteaza cautarile

         <input name="produs" value="1" type="checkbox">	         Punct de livrare	         <input name="produs" value="1" type="checkbox">	         Parteneri logistica	         <input name="produs" value="1" type="checkbox">	         Agenti

         <input name="produs" value="1" type="checkbox">	         Gaze Medicale	         <input name="produs" value="1" type="checkbox">	         Propan	         <input name="produs" value="1" type="checkbox">	         Refrigerenti

     <input class="art-button" type="submit" name="search" value="<?php _e('Search'); ?>" />
          </fieldset>     </form>


Custom post type permalink sends to 404.php

Hi I have created a custom post type and custom taxonomy.The custom post type page is named page-portfolio.php.I have create a loop in it in witch I am trying to link to each posts single page.For that I have created a template single-portfolio.php but for some reason when I click the permalinks I get sent to the 404.php page.Here is my entire structure code:               //custom post type and taxonomy declaration     <?php          add_action('init' , 'portfolio_manager');          function portfolio_manager(){         $args = array(                 'label' => 'Portfolio Manager',                 'singular_label' => 'Portfolio Manager',                 'public' => true,                 'show_ui' => true,                 'capability_type' => 'post',                 'hierarchical' => false,                 'supports' => array('title' , 'editor' , 'thumbnail'),                 'rewrite' => array(                     'slug' => 'portfolio',                     'with_front' =>false                 )         );         register_post_type('portfolio' , $args);     }          add_action('init' , 'portfolio_taxonomy');          function portfolio_taxonomy(){         register_taxonomy("portfolio-type",                            array("portfolio"),                           array("hierarchical" => true,                                      "label" => "Portfolio Types",                                     "singular_label" => "Portfolip Type",                                      "rewrite" => true,                                      "slug" => 'portfolio-type'                                     )                          );     }     ?>     //page-portfolio.php loop     $portfolio = new WP_Query(array(                             'post_type'=>'portfolio',                             'posts_per_page'=>'-1'                         ));                         while($portfolio->have_posts()): $portfolio->the_post();                          global $post;                      ?>                      <li class ="item" data-type="<?php echo str_replace(" " , "" , strip_tags(get_the_term_list($post->ID, 'portfolio-type' , '' , '' , ''))); ?>" data-id="id-<?php the_ID(); ?>">                                 <a href="<?php the_permalink(); ?>">Details                           <?php                             endif                           ?>
                           <?php                          endwhile;                      ?>             If single-portfolio.php is not the page template I should be creating for this page then what is the corect template? If single-portfolio.php is the corect template then what am I doing wrong here.Why is the permalink not sending me to single.portfolio.php?


uploading problem of wordpress theme

I have found a free theme for wordpress. But the problem is , when I try to upload it in my wordpress site, the site says that style.css is not found. But in the zip file it is available. Where is the problem and how it activate this theme? http://www.question2answer.org/qa/36095/update-minimalist-supports-responsive- mobile-tablet-supported?show=36184


Latest post showing up as main title of page on blog page

* * * My latest blog post is showing up as the title of my blog page. I have my page set to static for the home page and have all the titles of the templates displaying at the top except the blog post. I tried to use the conditional tag "is_home" but I kept getting errors. Any help is appreciated! Here is my code at the bottom of the front-page.php               <?php if (is_front_page()) { ?>

Teaching kids how to eat and enjoy healthy foods through cooking cooking and experimental learning

Since 1995

             <?php the_field('for_educators_image') ?>

            <?php } else if() { ?>

<?php echo get_the_title(); ?>

       <?php } ?>


Permalink Rewrite to include Custom Taxonomy Term

I've created a custom taxonomy for posts using               register_taxonomy(          'discipline',          array('post'), /* if you change the name of register_post_type( 'custom_type', then you have to change this */         array(             'hierarchical' => true,     /* if this is true it acts like categories */                          'labels' => array(                 'name' => __( 'Disciplines' ), /* name of the custom taxonomy */                 'singular_name' => __( 'Discipline' ), /* single taxonomy name */                 'search_items' =>  __( 'Search Disciplines' ), /* search title for taxomony */                 'all_items' => __( 'All Disciplines' ), /* all title for taxonomies */                 'parent_item' => __( 'Parent Discipline' ), /* parent title for taxonomy */                 'parent_item_colon' => __( 'Parent Discipline:' ), /* parent taxonomy title */                 'edit_item' => __( 'Edit Discipline' ), /* edit custom taxonomy title */                 'update_item' => __( 'Update Discipline' ), /* update title for taxonomy */                 'add_new_item' => __( 'Add New Discipline' ), /* add new title for taxonomy */                 'new_item_name' => __( 'New Discipline Name' ) /* name title for taxonomy */             ),             'rewrite' => array(                 'slug' => 'discipline',                 'with_front' => false             ),             'show_ui' => true,             'query_var' => true,         )     );      If I use just %postname% in the permalinks page, I get URLs like: whatever.com/discipline/name-of-post I want to get the URL to read whatever.com/parent-term-name/name-of-post I've removed the discipline part using the "Remove Taxonomy Base Slug" plugin but can't figure out how to get the term name included AND have permalinks to other parts of the site unaffected.


TinyMCE errors after 3.7.1 to 3.9.1 upgrade

After updating from 3.7.1 to 3.9.1 I am seeing issues with the editor within WordPress. In the environment that I have not upgraded, I am able to add content blocks and edit the block type flawlessly. I have disabled all plugins and still see the issue. In 3.9.1, I see this error on page load:               Deprecated TinyMCE API call: <target>.onInit.add(..)      After clicking +Add Content Block:               TypeError: r is undefined (/wp-includes/js/tinymce/wp-tinymce.php?c=1&ver=4021-20140423)      After selecting the block type:               TypeError: tinyMCE.get(...) is null      I assume the issue is derived from this:               tinymce.create('tinymce.plugins.editor_toolkit', {         init : function(ed, url) {             var VK = {                 DELETE: 46, BACKSPACE: 8, ENTER: 13, TAB: 9, SPACEBAR: 32, UP: 38, DOWN: 40, LEFT: 37, RIGHT: 39,                 modifierPressed: function (e) {                     return e.shiftKey || e.ctrlKey || e.altKey;                 }             };             function scrollToThisNode(node, padding) {                 vp = ed.dom.getViewPort( ed.getWin() )                 y = ed.dom.getPos(node).y;                 if (y < vp.y || y + padding > vp.y + vp.h) {                     ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + padding);                 }             }             ed.onInit.add(function(ed) {                 ed.dom.addClass(ed.getBody(), 'editor-toolkit');                      // Last-ditch effort to structure content                 $('#post').submit(function(){                     $( ed.getBody() ).children('p').each(function(){                         $(this).replaceWith('

' + $(this).html() + '

');                     });                     return true;                 });                  });


Auto-crop width, not height

I need images to be auto-cropped if they are too wide only. Basically like this: ![Crop-visualization](http://i.stack.imgur.com/bb0Qm.png) I'm using it for a fullscreen slider, where too wide images gets stretched. Cropping obviously is the best of two evils.


admin ajax php success returns 0

I have looked over many posts on here and other websites and nothing I do seems to work. What I am doing is, I have a custom template file and inside that file I have a div that I want to populate using jquery ajax. The problem is that the response is always 0. **Note:** I have used this code before in a plugin and not a template file and it worked the way it was supposed to. This makes me wonder if the add_action code isn't working right.               <script type="text/javascript">     jQuery(document).ready(function() {     jQuery.ajax({         type : "post",         dataType : "html",         url : "<?php echo site_url(); ?>/wp-admin/admin-ajax.php",         data : {action : "tw_pages_results", 'page':0, 'itemsperpage':<?php echo $item_per_page; ?>, nonce: "<?php echo $tw_pages_nonce; ?>"},         success: function(response) {             jQuery("#results").html(response);             jQuery("#1-page").addClass('active');         }     });     });     </script>      tw_page.php This is just the beginning part of the function in the file loaded by the ajax.               add_action("wp_ajax_tw_pages_results", "tw_pages_results");     add_action("wp_ajax_nopriv_tw_pages_results", "tw_pages_results");          function tw_pages_results() {         if ( !wp_verify_nonce( $_POST['nonce'], "tw_pages_nonce")) {           exit("No naughty business please");         }         tw_pages_results.php


Multiple areas of dynamic content in a page

I am new in Wordpress and what I really can't find how to do is the following: I have a new Page created from the CMS. This pages have different modules with text. Take for example this template http://www.templatemonster.com/demo/40000.html There are three modules in the row with an icon, a heading and text. And below other four. How is possible so user be able to edit from wordpress each one of these modules separately?


Setting a static home page and blog page without using the settings

This may seem like a stupid question, and it probably isn't possible, but is it possible for me to set a static home page (using `front-page.php`) and a blog page (using `home.php`, I think) in my theme, **and** have the blog page appear on a separate slug WITHOUT changing the page settings in my Wordpress installation, under `Settings > Reading`? So http://www.mysite.com/blog/ will show my blog (`home.php`), and http://www.mysite.com/ will show my home page (`front-page.php`)? **EDIT** I should point out, as I didn't point it out so explicitly earlier, I would like to avoid creating the pages in Wordpress, if I can. Although @eyedarts does answer the question, it doesn't give completely what I need. Although that may well have been my fault for not explaining that.


Disable trash for post type

I would like to have a custom post type which has 'Activate' and 'Deactivate' rather than 'Publish' and 'Move to Trash'. Once a post is deactivated, the user can go and delete it permanently. This functionality is required due to the nature of the custom post type. Is it possible to disable the emptying of trash (by default 30 days) for this particular custom post type, so that the 'deactivated' posts will remain there and not be cleaned up?


Select full Image Size on widget "Genesis - Featured Posts"

I'm writing a child theme for Genesis and trying to figure out to get the full image sizes on **"Genesis - Featured Posts"** widget. The widget has a check box **"Show Featured Image"** and "Image Size" options of following values.               thumbnail (150x150)      featured-image(150x100)      The options have thumbnail sizes and I'm trying to get the full size of image. Trying to write some code in functions.php of child theme which would give an option to select "full featured image". The codes which listed second option for "Show Featured Image" on the widget is (genesis/lib/widgets/featured-post-widget.php line: 314 - 318)               <?php     $sizes = genesis_get_additional_image_sizes();         foreach( (array) $sizes as $name => $size )             echo '<option value="'.esc_attr( $name ).'" '.selected( $name, $instance['image_size'], FALSE ).'>'.esc_html( $name ).' ( '.$size['width'].'x'.$size['height'].' )</option>';     ?>      I'm not sure if there is a way to have hook or filter for this .. If there is a way to select 'full featured image size' on the widget I'd be great.


defining child page permalink

I have written a page whose slug is `mypage`. I have set it as a child of `mymainpage`. However, I want that its permalink is `www.example.org/mypage` in place of `www.example.org/mymainpage/mypage`. Is it possible?


Nice RSS Feed URLs for each custom post type

By default WP seems to display all posts of all types in the main RSS feed. You have to add a post_type query variable to show post of a certain type... So how can I turn this: `http://site.com/feed/?post_type=book` into `http://site.com/feed/books/` ? And if possible rewrite `http://site.com/feed/` to `http://site.com/feed/blog/`, which should display only normal posts...


How can I disable the update notice for non-administrators?

As I already told, I'm setting up a Blog for a friend. Next to not being him an administrator but an editor that can make changes to theme options) I have an additional question. I don't want him to worry about updates as well nor do I want him bothering me, but the problem is, editors do see a slightly changed variant of the update nag. Is there a way to disable those for non-admins? It's just the case that we normally do know about Wordpress updates even before they get packaged and released.


get custom post archieve by month

I want to make a custom post archieve template where I will display only the custom post by month.. I added this in archieve-news_letter.php               $args = array( 'post_type' => 'news_letter', 'posts_per_page' => 10 );     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();          /* Include the post format-specific template for the content. If you want to                      * this in a child theme then include a file called called content-___.php                      * (where ___ is the post format) and that will be used instead.                      */                     get_template_part( 'newletter', get_post_format() );      where `news_letter` is my custom post...by this I am getting all post without any sorting of month, means I am getting all month post in December link. to make archieve link I used this:
<?php wp_get_archives(array('type' => 'monthly','order'=>'ASC')); ?>
      any help would be appreciate.. Thanks for your time and sharing knowledge... :)


Activate theme via plugin script?

I have a plugin that installs a folder of themes and other plugins into the WP site during plugin activation. I would like to place script into the plugin which will activate one of the themes that the plugin installs. Can someone post a quick example of script that registers and activates a known theme via a plugin's activation script?


Sort column on meta key and meta value

In the WordPress backend I'd like to sort a custom post type column on a meta key and meta value. The meta key is called 'status'. I've got three different meta value's for the 'status' key. How can I sort them alphabetically? This is my code:               // Register the column     function status_column_register( $columns ) {         $columns['status'] = __( 'status', 'bf_rapportage' );              return $columns;     }     add_filter( 'manage_edit-bf_rapportage_columns', 'status_column_register' );          // Display the column content     function status_column_display( $column_name, $post_id ) {         if ( 'status' != $column_name )             return;              $status = get_post_meta($post_id, 'status', true);         if ( !$status )             $status = '<em>' . __( 'undefined', 'bf_rapportage' ) . '</em>';              echo $status;     }     add_action( 'manage_posts_custom_column', 'status_column_display', 10, 2 );          // Register the column as sortable     function status_column_register_sortable( $columns ) {         $columns['status'] = 'status';              return $columns;     }     add_filter( 'manage_edit-bf_rapportage_sortable_columns', 'status_column_register_sortable' );          function status_column_orderby( $vars ) {         if ( isset( $vars['orderby'] ) && 'status' == $vars['orderby'] ) {             $vars = array_merge( $vars, array(                 'meta_key' => 'status',                 'orderby' => 'meta_value_num'             ) );         }              return $vars;     }     add_filter( 'request', 'status_column_orderby' );


Display Product category in archive product page

I want to display the category products in the store page ie archive- product.php. But early it was working, when i add new category it was not display the category product and the url is going correct but it goes to home page of that site. Can u pls help me whats is the solution.


Choose to show or not show title on a template?

I want to show the page title in some pages but on others I don't. I'm wondering how to do it. I thought about using differente content templates one with title and one without. But I'm wondering if it's possible to do it in some other way, like for example including a checkbox in the page to toggle the title. How can I choose not to show the title in some particular pages?


Fix issue with displaced braces( )

I have a problem with the output and placement of braces `()`. When braces occur in code, it is displayed wrongly in the output. Can any one solve this problem ?               <?php echo "I am (developer)"; ?>      Here developer is enclosed with braces, the output of the above code is as follow > (I am (developer rather than > I am (developer) How This problem occure **EDIT** I have install polylang plugin to change RTL TO LTR .But after deleting plugin still face problem. This is effecting my whole site. I've made a lot functionality in my site and the effect is everywhere where I have brace() like post title,post content etc


Issue with images which have no sizes available

I noticed that, in older images uploads of mine, the sizes aren't properly available. The original files shows up but there aren't sizes linked to the image, and full size displays : "Full Size (0 x 0)". As I said, this is only happening with images I uploaded before, all the recent ones are fine. Here is a screenshot, it might help. ![No sizes available :\(](http://i.stack.imgur.com/bu6YY.png) Thanks for your ideas and help.


check_admin_referer always false when I use on add_action('load-'* hook

I have try to add hook on load my plugin page. But every time i save my config, it always return "Are you sure want to ..." message. Is there something i missed? Here's my code:               <?php          class myClassPlugin {              public $menu_slug;              function __construct() {             $config = $this->get_setting();             $this->menu_slug = 'my_menu_slug';                  if (is_admin()) {                 $hook = 'toplevel_page_' . $this->menu_slug;                 add_action('load-' . $hook, array(&$this, 'save_settings'));                 add_action('admin_menu', array(&$this, 'create_menu'));                  }         }              function get_setting() {             $config = get_option('my_options_config', array('set_a' => '','set_b' => ''));             return $config;         }                   function create_menu() {             $hook = add_menu_page('MyMenu', 'My Menu', 'edit_others_posts', $this->menu_slug, array(&$this, 'setting'));         }              function setting() {             $config = $this->get_setting(); ?>             <form name="my_form" action="" method="post">                       <?php wp_nonce_field('my_nonce_name', 'my_nonce_name');                   submit_button();                 ?>             </form>         </div>         <?php             // $this->save_setting();     }          function save_settings() {         if (isset($_POST['my_nonce_name'])) {             check_admin_referer('my_nonce_name');             $options = array('set_a' => $_POST['set_a'], 'set_b' => $_POST['set_b']);                  update_option('my_options_config', $options);         }     }          }          new myClassPlugin();


Build query from the url given

I have an ajax request coming with parameter called `"next_page_url" => "URL_FOR_THE_NEXT_SET_OF_POSTS"` Now I need to build a `WP_Query` arguments using that url to respond to that AJAX request with next set of posts. How do I do that?


Creating additional page with own URL for each custom post

I have a specific issue here. I have website using custom post types, and I need to create a specific functionality for these custom post types. From each custom post type the user should be able to "buy" the product the custom post represents. So my idea is to create programatically additional "page" which would be like %url%/my-custom-post/order/ . And I am looking for the way how to do it.. Adding some rewrite rule..? Searching did not give me a result (maybe I was searching wrong, I am not so sure what exactly to search for..) Thank you for pointing me .. :)