How to add 10 different css class to posts

How I can assign a different css class to each post of the 10 posts of each blog page? Like this :
..
..     .     .     .
     --     Second page     --
..
..     ..      So on ! Thank You a lot for the help.


How to hide, and not to remove the attributes metabox?

I need to **hide** , and not to remove the attributes meta box in the backend. The following code is removing the metabox:               function hide_meta_box_attributes() {     remove_meta_box('pageparentdiv', 'post', 'normal'); }      add_filter('add_meta_boxes', 'hide_meta_boxes_attributes');      The problem is, that I am running hierarchical posts, which means I need to have the possibility to have posts and subposts which is enabled by this metabox. When I am removing the metabox, the functionality is not working anymore. But for my authors, I need to hide these attributes metabox. Anybody has a clue how to get a solution on this?


Determining Author post count

This is more of an efficiency question as the following code does do what I want.               $user_name = get_the_authour;     $query = new WP_Query('author_name=JustinH');             $author_post_count = $query->post_count;                  if ($author_post_count >= jwh_option('post_count_set') {                 $post_status = 'publish';             }else{                 $post_status = 'pending';             }      That query pulls back all the user meta and all the data for their posts. Is there a more precise way to get to:               $query->post_count;


Run shortcode before filters

My users post snippets code in comments. I created a shortcode for this :               function post_codigo($atts,$content=""){                  return ''.$content.'';     }          add_shortcode('codigo','post_codigo');        Problem is that html gets filtered before its wrapped into the code tags. I think that if i can get the shortcode run before filters then i can use               function pre_esc_html($content) {       return preg_replace_callback(         '#()(.*?)()#imsu',         create_function(           '$i',           'return $i[1].esc_html($i[2]).$i[3];'         ),         $content       );     }          add_filter(       'the_content',       'pre_esc_html',       9     );      that i found around here. What you think? UPDATED: Ok now i changed my shortcode to:                function post_codigo($atts,$content=""){                      return ''.esc_html($content).'';         }              add_shortcode('codigo','post_codigo');      But it still adding breaks and breaking the whole code into several `` tags


Just created a Wordpress Table can't get $wpdb get row to work - need help

I will begin by saying this is unfinished, and I am new to web programming. That being said, I am trying to create a javascript slide show that remembers the last slide a Wordpress (loggedin user) was viewing. I have hand entered one record into a new Wordpress table called wp_slideshow. The columns in that table are user and last_slide. The current data is one record, user = admin, last_slide = 3. I just want to get the current userid that is logged in from wordpress and then get the last_slide number. Once I get it I need to integrate the last slide into my javascript code and begin displaying the last slide. Any suggestions on why my current code (just for getting one record from my wp_slideshow table does not work? Here is my code:                   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

                      <?php the_content(); ?>                 <?php edit_post_link('Edit.', '
', '
');?>                      <?php global $current_user;?>                 <?php get_currentuserinfo();?>                 <?php $user_id = $current_user->ID;?>                      <?php global $wpdb;?>                 <?php                  $thenbr = $wpdb->get_row( $wpdb->slideshow( "SELECT * FROM $wpdb->slideshow WHERE user = "admin"" ) );                 echo $thenbr->last_slide;                  ?>

                  <FORM NAME="joe">             <INPUT TYPE="text" WIDTH="300" NAME="burns" VALUE="Text For Picture One">             </FORM>                   Back                   Next
         <?php endwhile; endif; ?>


How to display TinyMCE HTML view?

I'm displaying TinyMCE in my plugin's settings using wp_tiny_mce():               <?php wp_tiny_mce( false , array("editor_selector" => "a_nice_textarea"));?>          <textarea class="a_nice_textarea" id="a_nice_textarea" name="a_nice_textarea"></textarea>      Everything works as expected but I want to display the HTML editor ONLY but wp_tiny_mce seems to output only the Visual Editor. I know these are initial settings, but I've been playing with them for some time now without any luck:               // TinyMCE init settings     $initArray = array (         'mode'                              => 'none',         'onpageload'                        => 'switchEditors.edInit',         'width'                             => '100%',         'theme'                             => 'advanced',         'skin'                              => 'wp_theme',         'theme_advanced_buttons1'           => "$mce_buttons",         'theme_advanced_buttons2'           => "$mce_buttons_2",         'theme_advanced_buttons3'           => "$mce_buttons_3",         'theme_advanced_buttons4'           => "$mce_buttons_4",         'language'                          => "$mce_locale",         'spellchecker_languages'            => "$mce_spellchecker_languages",         'theme_advanced_toolbar_location'   => 'top',         'theme_advanced_toolbar_align'      => 'left',         'theme_advanced_statusbar_location' => 'bottom',         'theme_advanced_resizing'           => true,         'theme_advanced_resize_horizontal'  => false,         'dialog_type'                       => 'modal',         'relative_urls'                     => false,         'remove_script_host'                => false,         'convert_urls'                      => false,         'apply_source_formatting'           => false,         'remove_linebreaks'                 => true,         'paste_convert_middot_lists'        => true,         'paste_remove_spans'                => true,         'paste_remove_styles'               => true,         'gecko_spellcheck'                  => true,         'entities'                          => '38,amp,60,lt,62,gt',         'accessibility_focus'               => true,         'tab_focus'                         => ':prev,:next',         'content_css'                       => "$mce_css",         'save_callback'                     => 'switchEditors.saveCallback',         'wpeditimage_disable_captions'      => $no_captions,         'plugins'                           => "$plugins"     );      Here's even a pretty good explanation of the problem and kind of a solution, but the code provided doesn't work for me either (and doesn't do exactly what I want to achieve): http://keighl.com/post/switching-visualhtml-modes-with-tinymce/ Any hints?


Setup page template array in a custom post type

Hi below is a 'case' (in a custom post type) for pulling all categories and displaying them as a drop-down menu. How can I do the same but turn it into a list of checkboxes?                   //tax_select - this lists all of the categories in a drop-down, we want to change to a checkbox     case 'tax_select':     echo '<select name="'.$field['id'].'" id="'.$field['id'].'">             //<option value="">Select One</option>'; // Select One     $terms = get_terms($field['id'], 'get=all');     $selected = wp_get_object_terms($post->ID, $field['id']);     foreach ($terms as $term) {         if (!empty($selected) && !strcmp($term->slug, $selected[0]->slug))             echo '<option value="'.$term->slug.'" selected="selected">'.$term->name.'</option>';         else             echo '<option value="'.$term->slug.'">'.$term->name.'</option>';     }     $taxonomy = get_taxonomy($field['id']);     echo '</select>
Manage '.$taxonomy->label.'';     break;      How I'm saving the data:                   // Save the Data     function save_custom_meta($post_id) {     global $custom_meta_fields;          // verify nonce     if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))         return $post_id;     // check autosave     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)         return $post_id;     // check permissions     if ('page' == $_POST['post_type']) {         if (!current_user_can('edit_page', $post_id))             return $post_id;         } elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;     }          // loop through fields and save the data     foreach ($custom_meta_fields as $field) {                 if($field['type'] == 'tax_select') continue;         $old = get_post_meta($post_id, $field['id'], true);         $new = $_POST[$field['id']];         if ($new && $new != $old) {             update_post_meta($post_id, $field['id'], $new);         } elseif ('' == $new && $old) {             delete_post_meta($post_id, $field['id'], $old);         }     } // end foreach              // save taxonomies     $post = get_post($post_id);     $category = $_POST['category'];     wp_set_object_terms( $post_id, $category, 'category' );     }     add_action('save_post', 'save_custom_meta');


Child and grandchild taxonomy listings - 404

I have the following structure:   * Hotels (custom post type)   * Continents (taxonomy) Working actual links examples leading to single post: _hotels/europe/france/a-hotel_ *hotels/europe/italy/firenze/a-hotel* Problem: getting 404 when trying to access childs and grandchilds listings:   * _hotel/europe_ - **works!**   * _hotel/europe/france_ - **404**   * _hotel/europe/france/paris_ - **404** Not sure if something is missing, should I use a page template for those access points? The code was hard to get working, thanks for examples around here: http://pastebin.com/WYJLYjHM Thanks for any help.


Using Output from one Function and calling it into another

I'm trying to get my head around a fairly simple concept in PHP but I'm pretty green. I have a function..               function pa_insertPage($atts, $content = null) {         // Default output if no pageid given         $output = NULL;         // extract atts and assign to array         extract(shortcode_atts(array("page" => '2404' // Value for Course Descriptions page         ), $atts));         // if a page id is specified, then run query         if (!empty($page)) {             $pageContent = new WP_query();             $pageContent->query(array('page_id' => $page));             while ($pageContent->have_posts()) : $pageContent->the_post();                 // assign the content to $output                 $output = apply_filters( 'the_content', get_the_content() );             endwhile;         }         return $output;     }      And I'd like to use the returned `$output` from this function in another function called `naada_assess()` In my `naada_assess` function I've called `$recClasses = pa_insertPage($output);` but that doesn't seem to do the trick.


add_image_size() to crop images into squares?

So I know about setting custom images with `add_image_size('name',X,Y,Crop?)` which is cool but I need to build something that will crop images, regardless of their size, into squares. Basically, I want to make sure the user's uploaded images will always be squares.


What is best for saving lot of extra detail of user?

In my site i need to store 200 extra data for each user. Now i know about the user meta option. But is it a good way to save 200extra field for each user? Or should i create an extra table in the database to do the work.


Edit Media - Edit Custom Sized Featured Images

When I edit images in the wordpress backend - crop, aspect ratio etc. my featured images don't change. I've tried all combinations of saving (All image sizes, Thumbnail, All sizes except thumbnail). How can I make these changes effect my featured image? This featured image is a custom size using add_image_size() eg. `add_image_size( 'featured', 638, 300, true );`


Plugin could not be deleted due to an error: Could not fully remove the plugin(s) my-plugin/my-plugin.php

Why uninstalling the following (empty) plugin results in error? Here is `my-plugin/my-plugin.php`:               <?php     /*     Plugin Name: My Plugin     */      and `my-plugin/uninstall.php`:               <?php      When I click 'Delete' and then confirm, I get the following error: > Plugin could not be deleted due to an error: Could not fully remove the > plugin(s) my-plugin/my-plugin.php. What's wrong here? * * *               ~/Sites/wordpress/wp-content/plugins/my-plugin $ ls -ll     total 16     -rwxrwxrwx@ 1 me  staff  34 13 Aug 21:43 my-plugin.php     -rwxrwxrwx@ 1 me  staff   6 13 Aug 21:44 uninstall.php


Cannot login to admin panel in multisite install if subdomain is added to hosts file

This is my case.I created a multi-site installation where users can register and be provided with a subdomain. As of this time, the administrator has not yet enable the creation of sub-domains in the apache configuration, so I manually added the newly created subdomains (from my testing) to my hosts file. After registration, it works but it will only access the front end. If I will logged-in, e.g. http://mysubdomain.mymultisiteexample.com/wp-admin, it won't allow me to logged-in to the backend even though the logged-in details are correct? Any clues what is causing this? Is this related to a cookie? Thanks for any ideas..


Updating shortlinks from staging

Many of the shortlinks on pages of our site are links to our staging site. The current live site started life as the staging version, so I imagine that's why, but I don't know how to fix the issue. Does anyone have any tips as to how to achieve this? **Update** Apologies, this is actually the http://wp.me/... shortlinks created and added to the head of pages by Jetpack. I need to know how to clear/update these, to reflect the change of domain (from staging to production). Hope this is now clearer.


Editor capabilities - admin_init

I'm having a little difficulties with roles and capabilities. Editors gets a 'Cheatin uh?'-message when they try to update the custom theme- settings. Can anyone explain why - or maybe even have a solution?               <?php     add_action('admin_menu', 'add_global_custom_options');     function add_global_custom_options() {     add_menu_page('Indstillinger', 'Indstillinger', 'moderate_comments', 'functions','global_custom_options');     }          add_action('admin_init', 'custom_settings_css');     function custom_settings_css() {     wp_enqueue_style('custom-settings-css', get_bloginfo('template_directory') . '/theme-files/css/custom-settings.css');     } ?>          <?php     function global_custom_options()     {?>

Indstillinger
         <form method="post" action="options.php">             <?php wp_nonce_field('update-options') ?>

Settings

BOXIT
                     <textarea name="box1" size="45"><?php echo get_option('box1'); ?></textarea>

<input type="submit" name="Submit" value="Gem indstillinger" />
             <input type="hidden" name="action" value="update" />             <input type="hidden" name="page_options" value="box1" />         </form>
     <?php}?>


How to set up WP Cron in this scenario

I wanted to use Wordpress built in WP Cron to update currency rates daily. I use this function currently,               require_once(WP_PLUGIN_DIR . '/autocurupdate/currencyexchange_class.php');     $cx=new currencyExchange();     $cx->getData();     $currency_sql = "select last_updated from " . $wpdb->prefix."currencies where code = 'PHP'";     $currency_1 = mysql_query($currency_sql);     $currency_2 = mysql_fetch_array($currency_1);     $last_updated = mysql2date(get_option('date_format'), $currency_2['last_updated']);     $current_date = $cx->Date;     $currentdate = mysql2date(get_option('date_format'), $current_date);     if($last_updated !== $currentdate) {     update_currency();     }      How can I run `update_currency()` function daily using WP Cron?


How to highlight most recent posts in a list

I want to be able to highlight the most recent post in a list of recent posts. By highlight I mean bold or style slightly differently from the other posts. This is the code I use now:
Assignments

     <?php         $recentPosts = new WP_Query();         $recentPosts->query('showposts=15&cat=188&order=ASC');     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
     <?php endwhile; ?>
      This simply returns a numbered list. I would like to style differently the most recent post (i.e. the last item on the list). How can this be done?


esc_sql inserting weird chars to DB

I am using esc_sql function for making safer SQL operations but i am mysteriously getting `? and  ` in the DB table how can i avoid them. Edit : Here is my array after esc_sql()                 Array     (         [image_main] => http://market.watchprosite.com/img/watchprosite/market/23/post/market_image.3444923.jpg         [0] => Rolex  (more) \n\n\n         [1] => WG Submariner dial (only)         [2] => 116619         [3] => MINT         [4] =>           [5] =>           [6] =>           [7] =>           [8] => WTB: Want To Buy         [9] => Aug 7, 2013, 7:00 AM         [10] => EUR 1,000&nbsp(in USD)         [11] => EUR  *(estimate)\n         [12] =>           [description] => Looking for a spare dial from a Rolex Submariner 116619 (white gold). Urgently! Plenty of references available as a good buyer and seller and I expect the same from you. Thanks in advance!!!! Carl     )      I am using this function for applying esc_sql for each value.               public static function sanitizeInput($key='',$value=''){             return trim(esc_sql($key));         }      Here is the actual query which is generating :               INSERT INTO tbl_scrubed_data SET                                               keywords='{"brand":"rolex","model":"","WTB":1,"FS":0}',                                              url_to_post='http://market.watchprosite.com/?show=collection.detail&id=163938&brandview=Rolex&mod=&series=+WG*+WG+Submariner+dial+%28only%29&p=Rolex+WG*',                                              description='Looking for a spare dial from a Rolex Submariner 116619 (white gold). Urgently! Plenty of references available as a good buyer and seller and I expect the same from you. Thanks in advance!!!! Carl',                                              date_captured=now(),crawl_id='6',                                              image_main='http://market.watchprosite.com/img/watchprosite/market/23/post/market_image.3444923.jpg',                                              images='["http:\/\/market.watchprosite.com\/img\/watchprosite\/market\/23\/raw\/market_image.3444923.jpg"]',brand='Rolex  (more)',                                              series='WG Submariner dial (only)',model='116619',                                              watch_condition='MINT',box=' ',                                              papers=' ',year=' ',case_size=' ',status='WTB: Want To Buy',listed='Aug 7, 2013, 7:00 AM',                                              asking_price='EUR 1,000&nbsp(in USD)',retail_price='EUR  *(estimate)',payment_info=' ',forum_id='1'      This is working good in phpmyadmin.


How To Remove WordPress Version From The Admin Footer

Is there anyway to remove version number from the right side of WordPress admin footer? I know this code will add some text before the version number, but it will not remove it:               function change_footer_version() {echo 'Anything ';}     add_filter( 'update_footer', 'change_footer_version', 9999);      And the following code will do nothing"               function change_footer_version() {return ' ';}     add_filter( 'update_footer', 'change_footer_version', 9999);      So, is there anyway to remove the entire from the template or anything with functions.php file? Thanks for your time!


Get current user array into hyperlink

I am unsure how to take data from the user array and place some of these values into the following hyperlink. I want to replace the email address, first name and last name with the values from the currently logged in user array.                         <?php     $current_user = wp_get_current_user();     /**      * @example Safe usage: $current_user = wp_get_current_user();      * if ( !($current_user instanceof WP_User) )      *     return;      */     echo 'Username: ' . $current_user->user_login . '
';     echo 'User email: ' . $current_user->user_email . '
';     echo 'User first name: ' . $current_user->user_firstname . '
';     echo 'User last name: ' . $current_user->user_lastname . '
';     echo 'User display name: ' . $current_user->display_name . '
';     echo 'User ID: ' . $current_user->ID . '
';          ?>


Customizing the built-in Media Playlist

I have a simple challenge I can't quite seem to make any progress on: **Get the current track (or video) playing and display a link to a transcript of the song.** This should be a simple task (and the solution might very well be simple). I'm using the default media player for Wordpress. Options I've thought of so far:   1. Hooks. I don't see any I could use, yet there's a million other hooks for everything else. For example, use a filter hook when the current title changes, grab the current title, display the link underneath the title. This would be the preferrable method as I could simply name the transcript files the same.   2. Jquery. Use some sort of change event for the current track element and display a transcript link of the same name. Couldn't get this to work.    3. Custom Media Fields. Add the URL into a custom field for each media element. A more manual process, but I'd be OK with this. But this kind of relies on getting the PHP/Javascript correct which I've had trouble with (see above). Any help is appreciated.


Font Face Doesn't want to work in Wordpress

I do have a font I want to use with my links. Somehow it doesn't work.               @font-face {           font-family: HelveticaNeueLight;           src: local('fonts/HelveticaNeueLight.ttf');        }      My font path is: `wp-content/themes/mytheme/fonts/HelveticaNeueLight.ttf`, and I used it like this-               .jplnav li a {          font-family: HelveticaNeueLight;        }      Browser: Chrome Is there some kind of special code to use?


2nd and 3rd Custom Post Type URL's 404ing

My first CPT saves its URL's exactly as expected. However, I have worked for 2 days on getting my second and third Custom Post Type URL'S to rewrite correctly. They do in fact save as expected in edit.php like this:               www.domain.com/things/postname/      **However it is 404ing when I view the page.** I have used               global $wp_rewrite;          $projects_structure = '/%things%/';     $wp_rewrite->add_rewrite_tag("%things%", '([^/]+)', "things=");     $wp_rewrite->add_permastruct('things', $projects_structure, false);       **Why won't the other CPT URL's rewrite?** For my "food" CPT I am using               'rewrite' => array(         'slug' => 'food',        'with_front' => false,        'feed'=> true,          'pages'=> true      ),       and have also tried               global $wp_rewrite;          $projects_structure = '/food/%food%/';     $wp_rewrite->add_rewrite_tag("%food%", '([^/]+)', "food=");     $wp_rewrite->add_permastruct('food_pt', $projects_structure, false);      Brand new WP install, I have checked my htaccess               # 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      I have manually flush_rewrite_rules(); and my settings->permalink structure is               /%year%/%postname%/      I have read everything that Google can get me and just don't get understand. Any help would be great.


Can't edit images

Two days ago I discovered a huge problem with my Wordpress media editor. I just can't edit any image because it doesn't appear. Wordpress shows only small icon of broken picture... I was looking for the problem and now I'm pretty sure functions.php file causes my problem. I realized when I remove functions.php - problem disappear too. But what is strange - editor doesn't work when functions.php is EMPTY. I tried everything. I turned off all of my plugins, but I can't rid of my functions.php, because It's too important for me. On the other hand the problem with images is really irritating... Thanks in advance.


Get list of years when posts have been published

I want to create a list of posts from a Custom Post Type and add some filters the user can click to filter the list. I added filters for all the categories by using the get_terms() function. Now I want to add filters by year, so I need a way to retrieve a list of all the years in which at least one post has been published... I just need something like:               $years = get_all_years_with_posts();     // returns array( 2011, 2013, 2014 )      I know I can grab all the posts, check their year, and build the list myself, but is not there any other approach?


Best Practise: Linking to WPMU sites from other sites

I'm digging through WPSE, and WP Codex/Core, and I am looking for essentially `wpmu_blog_link( $blog_id )`, which would essentially be `home_url()` with a parameter to pass the `blog_id`. I could easily just do               Link to blog 2      but it seems a little more hard-coded than necessary, and would break between development (localhost) and live. There's always               function blog_home_url( $blog_id ) {         switch_to_blog( $blog_id );         $url = home_url();         restore_current_blog();         return $url;     }          ...          <a href="<?php echo blog_name_url( 2 ) ?>">Link to Blog 2      Just seeing if there is anything built-in.


post edit button on front end

If you are logged-in and switch to the front-end the default Wordpress theme `Twenty Eleven` provides `edit` buttons next to every post. Pressing this button you get to the certain post's back-end post edit page. How to implement this into a custom template?


Remove Posts Without Comments

I would like to have any posts that contain 0 comments be deleted on a regular and ongoing basis. My blog is currently using a combination of a cron job and the following snippet added to functions file to publish a basic post; I need for that post to be removed when no comments are added for that 24 hour day - so the next day, if no comments have been added, post is deleted. //-- Auto_Post Snippet --// add_action('wp_auto_post', 'my_auto_post'); function my_auto_post() { // Create a post object $my_post = array( 'post_title' => 'Click Here to submit a concern.', 'post_content' => '', 'post_status' => 'publish', 'post_author' => 1, 'post_category' => array(8,39) );               // Insert the post object into the database     $post_id = wp_insert_post( $my_post );     wp_publish_post( $post_id );      } //--//


wp_register_script and wp_register_style when shortcode is used

hi so I used a great tutorial off of http://scribu.net/wordpress/optimal- script-loading.html and I am having trouble loading the scripts when a shortcode called lightbox is used here is my code. I am at the page when it is called wanted to check with someone to see if it is properly written.               class fancy{         static $add_script;              static function init() {             add_shortcode('lightbox', array(__CLASS__, 'handle_shortcode'));                  add_action('init', array(__CLASS__, 'register_script'));             add_action('wp_footer', array(__CLASS__, 'print_script'));         }              static function handle_shortcode($atts) {             self::$add_script = true;                  // actual shortcode handling here         }              static function register_script() {         wp_register_script('fancy-wheel', get_stylesheet_directory_uri('/js/jquery.mousewheel-3.0.6.pack.js', __FILE__), array('jquery'), '3.06', true);         wp_register_script('fancybox', get_stylesheet_directory_uri('/js/jquery.fancybox.js', __FILE__), array('jquery'), '1.0', true);         wp_register_script('fancy-buttons', get_stylesheet_directory_uri('/js/jquery.fancybox-buttons.js', __FILE__), array('jquery'), '1.0', true);         wp_register_script('fancy-media', get_stylesheet_directory_uri('/js/jquery.fancybox-media.js', __FILE__), array('jquery'), '1.0', true);         wp_register_script('fancy-thumbs', get_stylesheet_directory_uri('/js/jquery.fancybox-thumbs.js', __FILE__), array('jquery'), '1.0', true);         wp_register_style('fancy-css', get_template_directory_uri('/css/jquery.fancybox.css', __FILE__), array('css'), '1.0', true);          wp_register_style('fancy-buttons', get_template_directory_uri('/css/jquery.fancybox-buttons.css', __FILE__), array('css'), '1.0', true);          wp_register_style('fancy-thumbs', get_template_directory_uri('/css/jquery.fancybox-thumbs.css', __FILE__), array('css'), '1.0', true);           }     static function print_script() {         if ( ! self::$add_script )             return;              wp_print_scripts('fancy-wheel','fancybox','fancy-buttons','fancy-thumbs','fancy-css','fancy-buttons','fancy-thumbs');         }     }          fancy::init();


Wordpress Specified file failed upload test

I am trying to upload a excel file to wordpress, i am getting error: "Specified file failed upload test.", .xls format file cannot be uploaded?? How do get arround it?


How to use checked() function with multiple check box group? How to properly sanitize that checkbox group?

I'm using the theme options page from the underscores (_s) theme to build a theme options page and I have a group of check boxes on it. In the example below I've just included 2 for simplicity. My questions are:   1. What goes in the checked() function below to keep each check box checked when saved? I have to check each value against the value in the DB correct?   2. How do I properly sanitize the group of checkboxes? They seem to save to the DB fine, but I know I'm doing something wrong. Here's each relevant block of code:               // register setting     register_setting(         'options', // Options group         'theme_options', // Database option         'theme_options_validate' // The sanitization callback, see below     );          // add settings field     add_settings_field(         'post_sharing_networks',         'Post Sharing Networks To Show',         'settings_field_post_sharing_networks', // callback below         'theme_options',         'general'     );          // set up the array     // more will be added later. 2 shown here for simplicity     function post_sharing_networks() {              $post_sharing_networks = array(             'twitter' => array(                 'value' => 'twitter',                 'label' => 'Twitter'             ),             'facebook' => array(                 'value' => 'facebook',                 'label' => 'Facebook'             ),         );              return $post_sharing_networks;     }          // callback          function settings_field_post_sharing_networks() {              $options = get_option( 'theme_options' ); // get array of all the theme options              $post_sharing_networks = $options['post_sharing_networks']; // this will get array for just the post sharing networks          // eg         /*         array (size=2)       'twitter' => string '1' (length=1)       'facebook' => string '1' (length=1)     */              // builds the checkbox list form the post_sharing_networks() function         foreach ( post_sharing_networks() as $network ) { ?>                 <label>                  <input type="checkbox" value="1" name="theme_options[post_sharing_networks][<?php echo esc_attr( $network['value'] ); ?>]" <?php checked( /* what goes in here for this to work? */ ); ?> />                      <?php echo $network['value']; ?>             </label>              <?php }     }               // sanitization callback     function theme_options_validate( $input ) {              $output = array();              // how do I properly sanitize the checkbox group?             // it saves the checkboxes to DB fine currently but I think it can be improved         $options = get_option( 'theme_options' );              foreach ( post_sharing_networks() as $network ) {                  if ( isset( $options['post_sharing_networks'] ) )                 $output['post_sharing_networks'] = $input['post_sharing_networks'];              }              return apply_filters( 'theme_options_validate', $output, $input );          }         This is what it looks like when saved into the wp_options table               s:21:"post_sharing_networks";a:2:{s:7:"twitter";s:1:"1";s:8:"facebook";s:1:"1";}


load-* hook for dashboard

I'm trying to add a screen option to the dashboard screen. I have a function like:               my_function() {              ...         add_screen_option()         ...          }      Now, I need to know the correct action hook $hook to use hooking in my function when the dashboard screen is loaded:               add_action( "load-$hook", 'my_function' );      What should $hook be?


Using add_theme_support inside a plugin

I've created a custom post type as a plugin and released it into the repository. One of the core features involves using a featured image. I've added `thumbnail` to `$supports` in `register_post_type()`, so the meta box shows up in the Administration Panel. I'm also hooking into `after_setup_theme` and calling `add_theme_support( 'post-thumbnails' )`, but I don't think it's taking affect. The codex says you have to call it from the theme's functions.php file, but if that's true then it'll only work if the user's theme calls `add_theme_support( 'post-thumbnails' )` (which would cover _all_ post types. If the theme doesn't call it, or only calls it on a specific type, then it won't work. Does anyone see a way around this problem?


Script that gets the first tag of post and query all other posts with the same tag

The script gets the first tag of a post and retrieves in a wordpress loop all other posts with the same tag. I can't seem to get it working:( Any ideeas?               $posttags = get_the_tags();     $count=0;     if ($posttags) {       foreach($posttags as $tag) {         $count++;         if (1 == $count) {           $tag = $tag->name . ' ';         }       }     }     query_posts('tag='.$tag.''&'showposts=-1');          while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
          <? endwhile;      wp_reset_query();       Take care


How to display regular posts & custom post types that fall under a category using just the generic category template?

1) My site has posts, and 2 custom post types (news & essays) 2) They all share normal categories like sports & health (no custom taxanomy involved) 3) Using the generic category.php template, how do I make it so this template handles all categories while displaying all content falling under it regardless of content post type. Or simply, I would like the generic category.php template to handle all category displays but should include custom post types as well. This may be a stupid question but have returned to Wordpress after a long hiatus and am finding the default wordpress themes hard to understand to do this. Just confused and frustrated right now. Please help


How to show link to next posts in single.php

I can't get `get_next_posts_link` to work. shouldn't his code work?               <?php echo  get_next_posts_link(); ?>      Well, I am trying to get next 5 posts, any idea how? EDIT: Accroding to:               <?php next_post_link('<strong>%link</strong>', '%title', TRUE); ?>      Should show me a link to next post in the same category, when I do this nothing is shown. And I do have posts in the category. Thanks!


Update meta values with AJAX

I am working on a voting system in Wordpress. I first made it with `GET` requests but someone told me you should not use `GET` for this, So I started working with AJAX to update custom fields/meta values, after reading this article. I've read a lot of the documentation from jQuery and Wordpress AJAX pages this is with I have now. I think I am on the good way, but there is something missing / or I am doing wrong. The vote function works fine, because I have tested this earlier with the `GET` requests. I have this simple HTML test form:               <form id="vote_form" method="post">         <input type="hidden" id="id" name="id" value="810">         <input type="hidden" id="post_id" name="post_id" value="811">         <input type="submit">     </form>      I have this jQuery file included in my header.php and off course included the jQuery library itself.               jQuery(document).ready(function() {              jQuery( "#vote_form" ).submit( function( event ) {                  event.preventDefault();                  var id = jQuery("#vote_form #id").val();             var post_id = jQuery("#vote_form #post_id").val();             var vote = 'up';                  jQuery.ajax({                 type: "POST",                 url: stn_vote.ajaxurl,                 data: {                      id: id,                      post_id: post_id,                     vote: vote,                      action: 'stn_voting'                  },                  });               });          });      And my vote function hooked into the `wp_ajax` action.                   // Ajax Voting     wp_register_script( 'ajax-vote', get_template_directory_uri() . '/js/ajax-vote.js', array('jquery') );          $nonce = wp_create_nonce("vote_nonce");     $stn_vote_data = array(         'ajaxurl' => admin_url( 'admin-ajax.php'),         'nonce' => $nonce,     );     wp_localize_script( 'ajax-vote', 'stn_vote', $stn_vote_data );          function stn_script_enqueuer() {             wp_enqueue_script( 'jquery' );         wp_enqueue_script( 'ajax-vote' );          }     add_action( 'wp_enqueue_scripts', 'stn_script_enqueuer' );                  // Vote Up             if( isset( $_POST['id'] ) ) {                      //simple Security check                 if ( ! wp_verify_nonce( $_POST['nonce'], 'vote_nonce' ) )                     die ( 'Busted!');                      if( isset( $_POST['post_id'] ) ) {                     $post_id =  $_POST['post_id'];                 }                      if( $_POST['vote'] == 'up' ) {                          $vote_id = $_POST['id'];                     $key = 'vote_up_' . $post_id;                     $vote_up = get_post_meta( $vote_id, $key, true );                     $value = $vote_up + 1;                     $update_vote_up = update_post_meta( $vote_id, 'vote_up_' . $post_id, $value );                          // Update vote count                     $vote_count = get_post_meta( $vote_id, 'vote_count_' . $post_id, true );                     $value = $vote_count + 1;                     $update_vote_count = update_post_meta( $vote_id, 'vote_count_' . $post_id, $value );                          // Update vote percent                     $vote_percent = ( ( $vote_up + 1) / ( $vote_count + 1 ) ) * 100;                     update_post_meta( $vote_id, 'vote_percent_' . $post_id, $vote_percent );                      }                      // Vote Down                 else {                               $vote_id = $_POST['id'];                     $key = 'vote_down_' . $post_id;                     $vote_down = get_post_meta( $vote_id, $key, true );                     $value = $vote_down + 1;                     $update_vote_down = update_post_meta( $vote_id, 'vote_down_' . $post_id, $value );                          // Update vote count                     $vote_count = get_post_meta( $vote_id, 'vote_count_' . $post_id, true );                     $value = $vote_count + 1;                     $update_vote_count = update_post_meta( $vote_id, 'vote_count_' . $post_id, $value );                          // Update vote percent                     $key = 'vote_up_' . $post_id;                     $vote_up = get_post_meta( $vote_id, $key, true );                     $vote_percent = ( $vote_up / ( $vote_count + 1 ) ) * 100;                     update_post_meta( $vote_id, 'vote_percent_' . $post_id, $vote_percent );                      }             }             die();              }         add_action('wp_ajax_stn_voting', 'ajax_stn_voting');         add_action('wp_ajax_nopriv_stn_voting', 'ajax_stn_voting');


Why does `inclusive` not work in this wordpress loop?

It's seemingly simple, I have this loop which should loads posts from, and including the current post.               <?php     $categories = get_the_category();     foreach( $categories as $category ) {       $catID[] = $category->cat_ID;     }      $args = array(         'category__in' = > $catID,         'category__not_in' = > 1,         'posts_per_page' = > 10,         'date_query' = > array(             array(                 'before' = > get_the_date()             ),             'inclusive' = > true,          )     );     $loop = new WP_Query($args);     while ($loop -> have_posts()) {     $loop -> the_post();       get_template_part( 'sidebar-posts-template' );     }     wp_reset_postdata();     ?>      The problem is that it doesn't **include** the current post. Why? Edit: This loop, using a fixed date also does not work and will start loading posts from the 27th, not including the 28th. The `inclusive` date should include posts from the 28th.               $args = array(         'date_query' = > array(             array(                 'after' = > 'January 1st, 2013',                 'before' = > array(                     'year' = > 2013,                     'month' = > 2,                     'day' = > 28,                   ),                 'inclusive' = > true,              ),          ),         'posts_per_page' = > -1, );      Edit 2: This is now the loop I am using.               $args = array(         'category__in' => $catID,         'category__not_in' => 1,         'posts_per_page'=>10,         'date_query' => array(             array(                 'before' => get_the_date(),                 'inclusive' => true,              ),         )     );      Edit 3:               $args = array(         'posts_per_page'=>10,         'date_query' => array(             array(               'before'    => array(              'year'  => 2013,              'month' => 2,              'day'   => 28,                ),               'inclusive' => true              ),          )     );


Changing the order of widgets according to current page?

I would like to change the order of the widgets, for instance: **Front-Page** : Recent Posts Recent Comments **Single Post** : Recent Comments Recent Posts Is it possible to achieve this?


How do i set up multiple portfolios (each with its own defined set of images -) to display on the same page?

I want to have one multi-column portfolio page but within each column or cell is a defined set of images for that particular category (or event) I do not want to rotate through images and see ones from another cell or column it would be like having multiple photo albums accessible on the same page. I think this can be done using categories but I dont seem to be able to assign more than one category to a page and have the portfolio display each category as a separate set of images. Thank you


List custom field values in alphabetical order without repetition

The function below lists the custom fields as in this example:   * Frank Capra   * Alfred Hitchcock   * Woody Allen   * Woody Allen   * Frank Capra   * Pedro Almodóvar   * Pedro Almodóvar I introduce the values in alphabetical order and without repetition. Eg:   * Alfred Hitchcock   * Frank Capra   * Pedro Almodóvar   * Woody Allen * * * This is the code:               <?php     $movie_reviews = get_posts('numberposts=-1&orderby=post_name&order=ASC');     foreach($movie_reviews as $post) : setup_postdata($post);     ?>     <li>     <?php $director = get_post_meta($post->ID, "director", $single = true);     if($director !== '') {     echo $director;     } ?>     </li>     <?php endforeach; ?>     </ul>      Is this possible? Grateful for any help.


Reset form on onclick function

I have a problem. I want to have an reset/clear button in my form, but it won''t work.. http://pastebin.com/jc0yqXiq Line 1-8 is the php for my form on line 94-97                 <form id="myForm" method="post" action="" onSubmit="if(!confirm('Är du säker på att du vill acceptera budet?')){return false;}">        <input type='text' value="1" value='<?php echo $doors ?>' name='doors[<?php echo $auto->ID; ?>]'>        <input type="button" onclick="" value="Neka bud"> - <input type='submit' value='Godkänn bud' />     </form>          <?php     if ( isset( $_POST['doors'] ) ){       // verify nounce prob a good idea         foreach($_POST['doors'] as $item=>$key) {             $id= sanitize_text_field($item);             update_post_meta( $id, 'doors', sanitize_text_field( $key ) );         }       }     ?>      Any suggestions to what the problem might be :)


How to change the default home page for the WordPress Dashboard?

Is it possible to change the Default "Home" admin page when logging into the WordPress Dashboard? I thought about a couple of possibilities...   1. Substitute the content on the Dashboard home page with custom content.   2. Redirect to a different admin page within the WordPress Dashboard upon successful login. If it is possible to do either of the two options, what hooks would you recommend utilizing?


avi mp4 flv video player

I want to uploads videos from admin and show them using any video player. I used a plugin but when i tried uploding a video the message appers that uplod size exceeded. Can anybody suggest me any good video player plugin.


Custom field with Types: get custom field's value label (of type select)

We use the Types plugin to setup different custom products for a client. A certain custom post (product) contains some custom fields which is a drop-down select. When creating a new product of this type, the user may select one option from that list. For example, let say that certain product has a custom field of type select with the following options set :               1 = Option A     2 = Option B     3 = Option C      Now, in a template, I'm trying to display the label for that custom field. The best thing I came up with is by doing :               $value = reset(get_post_custom_values('custom_field', $post->ID));      which would return a string, for example `"1"`, the value of the custom field. Now, this is worthless as I need to display the label (the chosen item from the list, for example `"Option A"`) in that template. How do I find the associated label for that custom field value?


How to use "offset" to paginate get_users?

Is is possible to paginate the get_users function with the "offset" parameter? I have complete my custom query of users for my list and now I need to paginate the results into multiple pages. Here is my sample code:
         <?php              $args = array(             'meta_key' => 'jabber',             'meta_value' => 'User Name',             'meta_compare' => 'LIKE',             'order' => 'ASC',             'count_total' => true,             'fields' => 'all',           );                   $blogusers = get_users($args_1);         foreach ($blogusers as $user) {                  $user_id = $user->ID;              $user = get_userdata($user_id);                    echo '
' . $user->display_name . '
';              }         ?>
      If there's anyone you can give some advice I would appreciate it. Thanks in advanced.


Compare post-IDs within WP_Query? (Less than / Greater than)

Can I use `WP_Query` to only query posts less than (or greater than) a given post ID?               $filtered_query_args = array(         'post_type' => 'projects',         'order' => $prev_next=='next' ? 'DESC' : 'ASC',         'orderby' => 'ID',         // ID <= $post->ID     );      I've been digging around in the codex with no luck. I can of course do this conditionally within the loop, but it would be much cleaner if I could use `WP_Query` directly.


Email entire post contents

We're a small newspaper with our archives put into a localhost WordPress web server in-house. I'm looking for some sort of plugin that might allow the reporters to, say, click a button that would email them the contents of the entire post to themselves (not just a link, as the server is not connected to the rest of the world). Any ideas? TIA


Which theme foundry has clean coded themes, where code is poetry

I'm looking to find a theme foundry (ie. woothemes, elegant themes) that has themes that are very well coded; where "code is poetry". To be more precise, I'm looking for themes coded in "the wordpress way" - similar to how Twenty Ten, Eleven and _s themes are coded. My experience buying and then subsequently modifying themes bought from theme forest was been quite traumatic! The themes look fantastic in the demo (ie. dandelion theme) but then you look at how the theme is coded and it's a tragic mess. Nothing like the elegance and thoughtfulness put into themes like twenty ten or the new starter theme _s. I am a wordpress developer, so I'm often wanting to go into functions.php, style.css or page templates and change and modify things for a client. Having to work around spagetti code and strange coding practices used in many premium themes wastes a lot of time. So, which theme foundry has the very clean code that is the most similar to default wordpress themes? And for this question I'll just assume they are all beautiful, simple and elegant. Knowing if the themes are responsive would be a bonus. Please respond if you have real experience with customizing theme code.


Send email when a new post is published

I'm looking for a method, or plugin, that will allow me to do the following:   1. User can signup to a 'notifications' email list   2. When a new post is published on the site, users on this list are automatically emailed a notification This is for site visitors as opposed to administrators or registered users. Any suggestions much appreciated.


Why are there updates for obsolete WordPress versions?

Today milestone 3.3.3 was completed – five days after version 3.4. I have seen the same with milestone 3.2.2 which was never released. WordPress does not offer any long term support as Matt once explained. See also: Will there be security updates for 3.1 once 3.2 is released? 3.3.3 is a security backport – somewhat understandable – but the backports 3.2.2 were mostly not security related. What is going on here? As an administrator and developer – should I care?


Displaying a list of tags in my archives page

I'm looking to display a list of tags on my archives.php page. Here is the search archives page. I have archives by month               <ul>       <?php wp_get_archives(); ?>       </ul>        Archives by category               <ul>       <?php wp_list_categories(); ?>       </ul>      and now I'm trying to look through the codex for a way to display a list of tag links but none of them do that. I just want them to do exactly what my list of categories is doing. Why can't I find the right template tag for that? Any help is appreciated.


Cannot upload themes. Error: "The uploaded file could not be moved to /var/www/wp-uploads/localhost/2011/10."

The uploaded file could not be moved to /var/www/wp-uploads/localhost/2011/10.      That's the error message I get when I try to upload a wordpress theme. This is my current permission status of my folder.               $ sudo ls -la /var/www/wp-uploads/localhost     total 12     drwxrwxr-- 3 root     www-data 4096 2011-10-27 16:44 .     drwxr-x--- 3 root     www-data 4096 2011-10-27 15:45 ..     drwxrwxr-- 3 www-data www-data 4096 2011-10-27 16:44 2011      Is there a terminal command I can use to allow wordpress to have permission to write things in this folder? I use LAMP and Ubuntu 11.04. Thank you.


Best Wordpress Localization Plugin?

We would like to translate our Wordpress installation into multiple languages. I found the following 3 plugins: ICanLocalize http://wordpress.org/extend/plugins/icanlocalize-translator/ GTS Translation http://wordpress.org/extend/plugins/gts-translation/ Straker http://www.strakersoftware.com/straker/index.cfm?3B36AF5E-65E2-4D8F-8F16-B5B863523FF2 I heard the ICanLocalize is a bit of a mess. Don't know the others. It's not sooo important to have an integration with a translation agency, but really just to have the website up in multiple languages with a reasonable link structure.


Why isn't WMPL correctly redirecting users based on browser language?

Even though I have _'Browser language redirect'_ activated at WMPL's setup screen, users aren't being correctly redirected according to browser language. I currently have three languages selected: **en (default)** , **es** and **pt- br**. Only **es** users are automatically redirected to spanish page. **pt- br** users aren't, no matter what browser I use.


How to exclude Sticky from Recent Post?

Im sorry about my english. I using below code to display recent post in my footer. The problem is, my recent post show sticky post. How to hide or remove sticky post from recent post??
          <?php $recent = new WP_Query("showposts=5"); while($recent->have_posts()) : $recent->the_post();?>

             <?php if (has_post_thumbnail()) { ?>             <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('img100'); ?>             <?php } else { ?>             <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/nophoto.png" />             <?php } ?>

                 <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">                 <?php $tit = the_title('','',FALSE); echo substr($tit, 0, 46); if (strlen($tit) > 46) echo " [...]"; ?>

                 <?php the_time('M jS, Y') ?>

     <?php endwhile; ?>


Advanced Custom Fields: Post Object - Not returning data

I have a custom post type called "Training" with an archive page (archive- training.php). I have another custom post type called "Courses". I am using Advanced Custom Fields: Post Object to link "Courses" posts to "Training" posts via a single select dropdown on the "Training" edit screen (ie. each "Training" post has one related "Courses" post). In the archive-training.php file I have the following loop:                   <?php while (have_posts()) : the_post(); ?>          <div <?php post_class('loop'); ?> id="post-<?php the_ID(); ?>" >

                 <a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__('Permalink to %s', 'purepress'), the_title_attribute('echo=0')); ?>" rel="bookmark">                     <?php the_title(); ?>                     <?php                         $post_object = get_field('post_object');                              if( $post_object ):                                   // override $post                             $post = $post_object;                             setup_postdata( $post );                                   ?>

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

                             <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>                     <?php endif; ?>

               <?php endwhile; // End the loop. Whew.  ?>      But only the "Training" post title is being output - the related "Courses" title/permalink is not. Any help would be much appreciated. Cheers guys.


Conditionally remove comments and post meta in functions.php

I'm new to Wordpress and am coming from the point and click world of Joomla! what was easy there now involves some solid php knowledge to replicate in Wordpress ;) I'm try to conditionally remove post-meta and comments from 3 categories using functions.php I'm using Woothemes Canvas and my own child theme. I can remove post-meta globally by using an empty function:               function woo_post_meta() {}      This works fine but I only want it to work for 3 categories I know I need to somehow use is_category butI'm not sure of the syntax, I tried               if ( is_category(4,5,6) ) {         function woo_post_meta() {}     }      but that doesn't work, i'm not sure how to correctly write a function within a function. Then how do i also remove comments from those categories? or should I make custom content type to do all this?


How to prevent a custom post type from using the archive.php template?

I have the following:               //Jobs     register_post_type( 'jobs',         array(             'labels' => array(                 'name' => __( 'Jobs' ),                 'singular_name' => __( 'Job' )             ),         'public' => true,             'show_ui' => true,         'has_archive' => false,             'hierarchical' => true,             'query_var' => true,             'supports' => array( 'title', 'editor', 'comments', 'trackbacks', 'revisions','author', 'excerpt', 'custom-fields', 'thumbnail', 'page-attribute' ),         'rewrite' => array('slug' => 'jobs', 'with_front' => true),             'taxonomies' => array( 'post_tag', 'category'),             'can_export' => true,         'show_in_nav_menus' => true,         //'capability_type'=>'jobs',         //'capabilities' => array(         //  'read_post' => 'read_jobs'         //),         )     );      I tried this: `'has_archive' => false,` But the Jobs custom post type is still using the `archive.php` template. Any ideas of what is wrong here?


comments are going to spam

Why all wordpress comments are going to spam? I didn't installed any plugins to protect blog from comment and trackback spam. Please help me to find a solution.


Trying to change image funtion from enlarge image to redirect to amazon website

So im making an amazon affiliate website. the theme im using (ebuy) enlarges the image when you click on it. I'd rather just have the image take you strait to amazon. i went poking around in the single-goods.php template and found this:
     <?php     if ( has_post_thumbnail() ) { ?>         <a rel="prettyPhoto" href="<?php get_image_url(); ?> "  title="<?php the_title(); ?>" ><img class="boximg" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&w=200&zc=1" alt=""/>     <?php } else { ?>         <img class="boximg" src="<?php bloginfo('template_directory'); ?>/images/dummy.png" alt="" />     <?php } ?>
      Im new with code but im pretty sure this is telling the site to enlarge the image. how do i go about rewriting this to link them to the product in amazon's website. thanks :)


IF statement in a do_shortcode

Is it possible to do a if statement in a do_shortcode?               <?php          echo do_shortcode("[table width='500'] " .              if ( have_posts() ) :                  while ( have_posts() ) :                      the_post();                      the_content();                  endwhile;              endif; .          "[/table]");      ?>      It gives me an unexpected T_IF. EDIT: And without the IF statement it gives the post outside the shortcode.


Plugin that integrates Google Storage with WordPress?

W3 Total Cache and CDN Sync Tool (w/ WP Super Cache) are two plugins that do a pretty good job of integrating various Content Delivery Networks (CDN's) — including Amazon S3 / CloudFront, CloudFiles, and MaxCDN (among others) — with WordPress. But I am looking for a plugin (free or paid) that integrates Google Storage (not to be confused with Google Drive or others — see pricing) with WordPress, and so far, could find none. Has any come across a plugin that does this, by chance?


get_posts with meta_compare='LIKE' not working

I am using the following code:               $tolettpe = "Sale";//default     if($_REQUEST['tolettype']) $tolettpe = $_REQUEST['tolettype'];     else if($_REQUEST['srch_type']) $tolettpe = $_REQUEST['srch_type'];     $args = array(         'numberposts'  => $latestcount,         'category'     => $catidstr,       'meta_key'     => 'property_type',       'meta_compare' => 'LIKE',       'meta_value'   => $tolettpe.'%'      );     $post_content = get_posts($args);      The value in the database is 'Sale||' and there are no query string variables in the request. But the query returns no results. If I use the exact value and no meta_compare, it works. Any ideas how to make this work?


wp e-commerce - theme problem - why won't it load wpsc-single_product.php?

This is so frustrating! The theme i made myself works fine with wp-e-commerce (getshopped) plugin, but for some reason it won't load wpsc-single_product.php when i view a single product. When i change theme to twenty ten it works fine, so i'm positive that it has SOMETHING to do with my theme - But what? what do i eed to do in order to make my theme more compatible to wp-e-commerce? My own theme is based on the bones responsive framework. I'll appreciate any help, idea, clues - anything. Thanks!


Hide a subdirectory on my website hosting

I have a website www.mcruiseon.com. I have added .htaccess to get all www.mcruiseon.com to redirect to www.mcruiseon.com/wordpress. But the 'wordpress' still shows up on my html link on browser. Can I hide the fact that the website is hosted under a folder wordpress ?


autologin in wordpress when loged in non wp-site

Say I have a non-Wordpress website abc.com that has a Wordpress install at abc.com/news. How can I integrate my non-Wordpress login system at abc.com with the Wordpress installation at abc.com/news so that if a user logs into abc.com and then browses to abc.com/news he is already logged in at abc.com/news?


Post Meta not saving when have empty post

Hi I created a meta box on the post, page and project post types. The meta boxes save their data well on every post type. However I have a slight problem, when I create a new post and just enter a value in the meta box, then click 'save draft', the value in the meta box is not saved. On the pages and project post types the value would save. The behaviour is that if I don't enter anything in the title or the content of a new post, no metadata will be saved, and I also noticed that no permalink is generated, while for the other post types it is generated and the meta data is saved. Is this standard WordPress behaviour or do I have some bug in my code? Functionally wise I don't think it's a big problem, because we will of course always be entering a title and content within the posts, but I'm curious about this behaviour and would like to know if it's coming from my end or not. Thanks.


Yoast Force Rewrite Crashed Site

I just applied force rewrite in WordPress SEO by Yoast plugin and now cannot access my site at all am getting a Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error. message in Chrome and "Content Encoding Error The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression." in Firefox Please HELP!


Include template before a loop

This is my category / archive page i want to include a template before loop but i cant get posts based on category, it showing latest post only on every page. when i removed this line before the loop               <?php include( TEMPLATEPATH . '/includes/tb/hot_posts.tpl.php' ); ?>      it work smoothly, but i need this template before the loop this is code (archive / category )               <div class="Hot_post">          <?php include( TEMPLATEPATH . '/includes/tb/hot_posts.tpl.php' ); ?>          <?php if (have_posts()) : $count = 0; ?>      * * * and this is code from template (includes/tb/hot_posts.tpl.php)                <?php query_posts('meta_key=post_views_count&order=DESC'); ?>       <?php if ( have_posts() ) : while (   have_posts() ) : the_post(); ?>       please guide me


How to add a link(href) so when i click it, it renders (shows all) posts of custom post type (rich_media), from the current category?

I am trying to set up an image menu to show "all posts", "all videos" (custom post type: rich_media). I want to have an individual image for each post type, and by clicking it I want to show all posts in the current category of the chosen post type. All post_types share the common categories taxonomy. I managed to list all regular posts from current category by simply linking to current category, not sure how to do the trick with the custom post.


Guest author's post not display in author template

I am using this filter to display guest author on post, but i want guest author's posts to appear in the `author.php` template also. This is my guest author code (inside `functions.php`).               <?php     add_filter( 'the_author', 'guest_author_name' );     add_filter( 'get_the_author_display_name', 'guest_author_name' );     function guest_author_name( $name ) {         global $post;              $author = get_post_meta( $post->ID, 'guest-author', true );              if ( $author )             $name = $author;         return $name;     }     ?>      ...and here is the author template: http://codex.wordpress.org/Author_Templates#Sample_Template_File


adding a unique page to an existing site

i'm a wp newbie working with an existing site. i've been asked to add a unique page to the site and am having trouble finding out if this is possible. the current site would not change, but there would be a unique page sharing only the navigation menu of the site. not sure what to call it to research how to's any help appreciated. thank you


How can I get_post_meta() in the most efficient way?

I have a custom post type for a real estate site, and the theme displays 9 properties in a grid on the home page. I don't think its written terribly efficiently - I'm getting about 160 queries on the front page, and only about 20 of those queries are from plugins, so the theme needs some improvement. In the first place, it includes a file in the post loop - I'm not a PHP expert, but is including the same file repeatedly in the post loop really the best thing to do? The file that is included simply calls get_post_meta() for about a dozen or so variables for the custom post property listing (eg, number of bedrooms, etc). My first proposal is to move that section of code into the main file so its not "included" over and over. But more importantly, is there a better way to get the post meta than to call get_post_meta() a dozen times for a dozen variables - perhaps with a single query that gets all the meta at once, which I can assign to an array?


Upgrade Wordpress Database from 2.6 to 3.2

I'm trying to migrate an old wordpress site to a new host - the old installation hasn't been updated for a while and is still on 2.6.5 while the new install is 3.2.1 (current). Unfortunately the old front end is currently not working, so I can't use anything there. I'm wondering if there's a tool or way to update the existing 2.6.5 database to be compatible with 3.2.1 so that I can just load all of the existing data into the new system via a SQL query.


Add classes + taxonomy terms to wp_list_pages() output

I'm outputting a list of pages in my custom post type — a kind of tree — using `wp_list_pages()`. All's going well, except now I want to put some classes in the li's for styling. Even that's not going too bad with the help of this guy:               function tsep_page_css_class( $css_class, $page, $depth, $args, $current_page ) {       if ( !isset($args['post_type']) || !is_singular($args['post_type']) )         return $css_class;            global $post;       $current_page  = $post->ID;       $_current_page = $post;       _get_post_ancestors($_current_page);            if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )         $css_class[] = 'current-page-ancestor';       if ( $page->ID == $current_page )         $css_class[] = "current-page-item";         elseif ( $_current_page && $page->ID == $_current_page->post_parent )         $css_class[] = 'current-page-parent';            return $css_class;     }     add_filter( 'page_css_class', 'tsep_page_css_class', 10, 5 );      This basically prints out `current-page-item`, `ancestor` or `parent` in my `<li>`. This part works really well. What I want however, is to print out taxonomy terms from my "content-type" taxonomy in the `<li>` classes too. So, one might look like this: ` I've got a start on it:               $terms = get_the_terms( $post->ID, 'content-type' );                  if ( $terms && ! is_wp_error( $terms ) ) :                       $content_type = array();                      foreach ( $terms as $term ) {                     $content_type[] = $term->name;                 }                      $the_content_type = join( ", ", $the_content_type );                  endif;      But in the end, `$the_content_type` doesn't seem to return anything. How can I get `$the_content_type` to return a value, and how would I put that value in the `$css_class[]` above? Hope some of this made sense! Thanks.


Custom Post Type Archive Template

I have similar problem to this one: Custom Post Type Template - Archive I have a WordPress custom post type called `coupon`. I try to assign the template to it by using `archive-coupon.php`, but it goes directly to `home.php`. I also have a custom taxonomy of this CPT called `tags` with the `rewrite rule => "tag"` so when I go to a URL like this - `http://mysite.com/tag/3d` I want to see a custom template for my Custom Post Type or general for taxonomies. I have also tried `taxonomy.php` template but it still ignores it. What could be the problem? ### Update - I don't know what really happened. But before that I had template called taxonomy-store.php. So, when I renamed it to another name, taxonomy `tag` started using `taxonomy.php` template file. And still `archive-coupon.php` doesn't work.


Wordpress plugin WP-blocks is adding slashes before apostrophe

**Edit: Problem Solved, solution posted at bottom** I'm going crazy trying to figure out why this is happening. This is well known issue, and I've done everything recommended so far. I'm using php version 5.3 and magic quotes are off. This issue only occurs when using the plugin wp_blocks, so I'm assuming there is something in the code that is making this happen. Any ideas? I'm currently sifting through the plugin to see if there is anything that would force this behavior. Of note is that if I insert the html entity ''' and then save and go back into the html (I use ultimate tinyMCE, which has a nice highlighted syntax editor, but this also occured before isntalling that plugin), it will replace all of ''' with apostrophes. **Solution** The plugin used only a wordpress function called wp_kses_stripslashes, which only works on double quotes apparently. I simply further processed the passed data through stripslashes and voila.


Validate an option array

We use the default WordPress `register_setting()` function to validate theme options. This call, for example:               register_setting( 'options-group', 'option1', 'intval' );      Will validate whether or not `$option1` is an integer. What can I use to pass an array of options to validate each member of the array? For example:               $options = array(         'options1' => 4,              // intval         'options2' => '127.0.0.1',    // IP address         'options3' => 'test@test.com' // Email address     );


Best way to enable sorting by 3 criteria on a page of listings

If you go to this site: http://www.ec-ohio.com and click on one of the links in the Directory (left column of homepage) you generate a page with listings, and at the top of each page there's 3 links that let you sort the page content by city, county or product. I want to rebuild the site in WP, but am wondering how to enable that kind of sorting. I was going to enter the listings via custom post types. Any advice greatly appreciated!


Advanced custom fields plugin limit number of fields in the group to 64

I have a problem when creating more than 64 fields in the fields group using plugin "Advanced custom fields". I've already found out that problem is in saving of new fields not in loading from database, because when I put new field directly to database it is loaded and shown in plugin (in the list of fields). I was trying to find source of the problem and found out that fields are send in $_POST["fields"] array. But when they are processed by plugin method the $_POST["fields"] variable has only 64 fields in it (I tried count($_POST["fields"])) even if there is more fields in the form. So I think that this array is cut to size of 64 somewhere in wordpress probably. I tried this                   add_filter( 'postmeta_form_limit' , 'customfield_limit_increase' );         function customfield_limit_increase( $limit ) {             $limit = 100;             return $limit;         }      but it didn't work. Any suggestions please?


WordPress 3.4 Permalinks Redirection Problem

A few years ago this was the permalink structure I had for my blog: /%year%/%category%/%postname%.html I changed these permalinks last year to this: /%category%/%postname%/%post_id%/ A plugin that goes by the name Permalinks Redirect was used, and it worked pretty well to permanently redirect older URLs to newer ones. However, after a recent WordPress update to 3.4.1 version, I noticed the older permalinks are no longer redirecting. The problem is not with the plugin -- I have spent 2 days dabbling with every redirect plugin I could find. After a bit of Googling, I figured out the problem is with WordPress 3.4, and a bug has been already submitted. Link: http://wordpress.org/support/topic/changing-permalinks-not-redirect-the- old-to-the-new#post-2913004 All the older URLs are throwing out 404 errors, which is frustrating. I'd really appreciate if there's a HTACCESS redirect code, or MOD_REWRITE code (the site is using nginx, if that helps) that could be posted here. I have very little knowledge about redirection. Thanks a ton!


Define width of featured image thumbnails, but also make responsive?

So I know how to define thumbnail images with set_post_thumbnail_size and it works, but the issue is that the image isn't responsive when I do that, right? When I define the thumbnail to be 300 x 9999, I'm telling the image to always be 300 pixels wide, but I need that image to expand or constrict with it's responsive container. When viewing my project on a desktop, the image containers are floated up next to each other, and need to be around 300 pixels wide. When you view the site on smaller and mobile widths, the image and it's container can actually expand up to 700 pixels because they are no longer floated next to each other, but are stacked up with no floats. I do have max- width:100%; for images in my css by the way. Is there anything I can do? I was going to use this method: http://mobile.smashingmagazine.com/2012/06/14/responsive-images-with-wordress- featured-images/ but still, aren't we just defining image widths that aren't going to be responsive? Plus, just using is_mobile to detect probably isn't perfectly reliable. If I shrink my site down to 700 pixels, it's not necessarily a mobile device, but I will need a different image served up. Ugh


How can we customize the logo and some text on the welcome screen?

I have found discussions and solutions on hiding or removing the lately introduced **Welcome screen**. But we DO find the screen, as a whole, very useful and an excellent addition. So, what we are looking for is quite different. * * * We just want to **change parts of it on a multisite/subfolders network**. To be exact. The wp logo image (wp-badge.png) on the left, as well as the header next to it (.welcome-panel-content .about-description, .welcome-panel h3) and the text under it included in (.about-text, .about-description, .about-wrap li.wp-person a.web). ![Proposed Welcome Panel](http://dl.dropbox.com/u/70811202/welcome_02.png) I am aware that most of it is hardcoded. Still.... There must be a way. :) PS: 1) We already use a plugin that can add css on the admin screens. But I don't think it would solve anything. 2) If there is a way, please be as specific/descriptive as possible. My coding skills suck. :( ## Update After following brasofilo's instructions I have compiled the code to a mu- plugin. I placed it in our mu-plugins folder, have tested it on our test- multisite and works like a charm. :) I have it uploaded to my dropbox so anyone can benefit. Feel free to Right Click Here, download it and customize it to your needs. I hope it helps others as well. PS: @brasofilo Please let me know whether I have credited it correctly.


How to tell if a user has gone in and created a menu

By default if a user has not created say a footer or a top level menu then WordPress, in the case of the footer, will use default content like pages and so on to "create" a menu. I don't want this to happen. I want to do something like:               if user has not set a menu for footer        display a message telling them they should.     else        display said menu.     end      How would I do this?


Multiple Block Quotes without using HTML

First of all, I have a client that has no HTML knowledge. He wants his all his posts to have a certain format where within the post body, he can add multiple pull quotes with different styles. Note that all the posts would have the same structure. Any suggestions on how to go about this? Custom post style? Custom button on TinyMCE? Anyhelp would be appreciated


Load jquery only for certain pages in the backend

I have a set of custom theme settings in my functions.php file. **In order to arrange some things I want to load jquery ONLY to my functions.php file.** What I read in wordpress is this: If it was needed within the admin, you could use the admin_enqueue_scripts action instead, **however this enqueues it on ALL admin pages, which often leads to plugin/core conflicts** , ultimately breaking the WordPress admin experience. Instead, You should only load it on the individual pages you need it, See the Load scripts only on Plugin pages section for an example of that. This is the wordpress recommended script for enabling jquery only on plugin pages. **Can I adapt this script to enable my script just for the theme options page?**               <?php         add_action( 'admin_init', 'my_plugin_admin_init' );         add_action( 'admin_menu', 'my_plugin_admin_menu' );              function my_plugin_admin_init() {             /* Register our script. */             wp_register_script( 'my-plugin-script', plugins_url('/script.js', __FILE__) );         }              function my_plugin_admin_menu() {             /* Register our plugin page */             $page = add_submenu_page( 'edit.php', // The parent page of this menu                                       __( 'My Plugin', 'myPlugin' ), // The Menu Title                                       __( 'My Plugin', 'myPlugin' ), // The Page title                       'manage_options', // The capability required for access to this item                       'my_plugin-options', // the slug to use for the page in the URL                                       'my_plugin_manage_menu' // The function to call to render the page                                    );                  /* Using registered $page handle to hook script load */             add_action('admin_print_styles-' . $page, 'my_plugin_admin_styles');         }              function my_plugin_admin_styles() {             /*              * It will be called only on your plugin admin page, enqueue our script here              */             wp_enqueue_script( 'my-plugin-script' );         }              function my_plugin_manage_menu() {             /* Output our admin page */         }     ?>      Thank you!


Keeping LaTeX contents in line with non-latex text

I am using LaTex from the JetPack plugin, which is similar but not identical to TeX for maths, for my WordPress blog where I post course work. How do I get the generated formulae to centre on the line so the equals sign lines up with the normal text that I have typed? to see what I mean please check this blog entry. here are a the two offending pieces of LaTeX for the last two equations of the equations:               $latex = \large{\dfrac{1}{62,000}} $      and               \left(\large{\dfrac{10,000}{62,000,000}}\right) 100\% $      thanks for your time :)


How to hide all child pages with post_query?

i have a page template as start page(home.php). i use a 2 columns grid to display all pages on that home.php with title and excerpt. unfortunately also my child pages are shown and i can't figure out how to hide them. I am not trying to make a list menue or something, its more like a gallery of my pages. for now i use "query_posts('post_type=page' .$parent);" with the mentioned result. i tried to use an array as well, but this will give me posts instead of pages (fr reasons i havnt understood yet). What am i missing to hide all child pages and only display the parent pages? Any help? Thanks in advance! Dan


Wordpress Hide Widget If $_Session Is Active?

I was wondering if there is an easy solution to add some php "if" code when my website tries to show the widgets and if it has $_SESSION I set on homepage (based on the source of which they came) not to show one of them?


set custom value on default admin columns based on row values

I added some foreign key to wp_comments db table. Some comments could be indipendent from post. For these comments I've comment_post_ID set to 0. So i need something like:               add_filter("manage_comments_default_column","myplugin_my_filter", 10, 2);          function myplugin_my_filter($default, $comment_ID){          if($default == "response"){              //and if comment with id=$comment_ID isn't related to a post              echo "";          }     }      Does exist some similar hook? ---Edit--- Temporary solved using:               /*     unlink 'response' column and  add a 'response'      substitute column called 'article'     */     add_filter("manage_edit-comments_columns", "myplugin_manage-columns");          /*       if comment has a post related show a link to        that post in 'article' field        else leave 'article' field empty     */     add_filter("manage_comments_custom_column","myplugin_manage-content-columns", 10, 2);      But I hope for a better solution. * * *


Default permalink structure causing Notice: Undefined property: WP_Query::$post

I use the wp for membership site. I use pages for the user log in, manage post, edit profile and etc. When I apply the default permalink structure, I found that the debug mode show this notice on every pages (not post page).               Notice: Undefined property: WP_Query::$post in /var/www/example/wp-includes/query.php on line 2986 Notice: Trying to get property of non-object in /var/www/example/wp-includes/query.php on line 3349       But when I use the post name for the permalink structure, this notice disappeared. Though it seems is not a serious issue (is it?), but I'd to know what causing this warning? Thanks


Sort results by groups of numbers and letters

I have this code:               <?php     $letter=' ';      query_posts( array (  'orderby' => 'title', 'order' => 'ASC' ) );     if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
         <?php          $title=get_the_title();          $initial=strtoupper(substr($title,0,1));         if($initial!=$letter)           {           echo "

$initial :

";           $letter=$initial;           }         echo '
'.$title.'
';         ?>
     <?php endwhile; endif; wp_reset_query(); ?>      I show the results by groups, in this way:               **&**     'title     "othertitle          **1**     1555555555     1666666666          **2**     2111111111     2555555555          **A**     abbbbbbbbb     annnnnnnnn          **B**     blllllllll     bhhhhhhhhh      But I want a group in this way:               **0>9**     1555555555     1666666666     2111111111     2555555555          **A**     abbbbbbbbb     annnnnnnnn          **B**     blllllllll     bhhhhhhhhh          **O**     othertitle          **T**     title      So I'd like to show:   * results grouped in letters (A>Z) in different group (ex: group A, group B, group C,...)   * results grouped in numbers (0>9) in the same group   * delete the first character from the title with the initial apostrophe (') or quote ("). How can I resolve please?


WP Business Directory Manager Plugin Admin Listings?

I'm using the WP Business Directory Manager plugin and I'm having some problems. I've been meaning, as an admin, to add a Listing to my directory, but it shows pended, so i look a round the plugin a found a way to change it in the backoffice but it published every listings. Is there a way to have only the admin that his listings get published by default?   In the `listing.php`:                if ( !$data->listing_id && ( !$listing_cost || current_user_can( 'administrator' ) ) ) {              wp_update_post( array( 'ID' => $listing_id, 'post_status' => wpbdp_get_option( 'new- post-status' ) ) );      }      the setting of the `new-post-status`:               $this->add_setting($s, 'new-post-status', _x('Default new post status', 'admin settings', 'WPBDM'), 'choice', 'pending', '',                            array('choices' => array('publish', 'pending'))                            );      Much appreciated.


Customize Option Framework

I was trying to create a Option Theme Page for my theme and I wasn't able.   Today I found the Option Theme Framework but after some time I really can't understand how to use it.   In particular, I'm able to create a new "field" but I cant'use it.   For example, I would create a field to le the user to change the color of a specific class/tag. Has anyone an idea of how to do that?   I can't find any docs EDIT: I'm able to use the stuff like variables and something else in a normal php page, but I can't use that to change my CSS.


Is this plugin safe to run?

This is an extract of code from a wordpress plugin. Is it safe to run despite the variables not being filtered? Also does the wpdb class filter to prevent any injection?               list($email_id, $user_id, $url, $anchor) = explode(';', base64_decode($_GET['r']), 4);     $wpdb->insert(NEWSLETTER_STATS_TABLE,         array(             'email_id' => $email_id,             'user_id' => $user_id,             'url' => $url,             'anchor' => $anchor         )     );


How can I get an <h2> tag to wrap each ancestor that gets outputted in this condition?

I found this snippet in a different thread and it mostly does what I need, but I'm having trouble wrapping the individual pages this outputs with tags. All I can seem to add is a line break. I don't have a lot of experience with php so unfortunately I wasn't able to customize it to my needs. In the end I just need the firsts and second level page titles to be displayed and they need to be wrapped in individual h2's. Thanks in advance.                   //This is the loop that pulls banner titles     function print_page_parents($reverse = true){         global $post;              //create array of pages (i.e. current, parent, grandparent)         $page = array($post->ID);         $page_ancestors = get_ancestors($post->ID, 'page');         $pages = array_merge($page, $page_ancestors);              if($reverse) {             //reverse array (i.e. grandparent, parent, current)             $pages = array_reverse($pages);         }              for($i=0; $i<count($pages); $i++) {             $ban_titles.= get_the_title($pages[$i]);             if($i != count($pages) - 1){                 $ban_titles.= " <br /> ";             }         }              echo $ban_titles;     }


colorbox not loading in <head>

I can not get colorbox fully loaded. I am trying to add color box to use in my plugin admin. I do not need it for the front end. I can get the css but can not get jquery.colorbox-min.js or the inline script to load in the `<head>`. Here is what I have:               /*--------------------------------------------------------------------*/     /*    admin Stylesheet     /*--------------------------------------------------------------------*/     add_action( 'admin_enqueue_scripts', 'add_wlmm_admin_stylesheets' );          function add_wlmm_admin_stylesheets() {         if (is_admin()) {                  /*              * Includes css for:              *              *  - plugin optins framework              *  - colorbox             */           wp_enqueue_style( 'wlmm-admin-style', WLMM_URL . 'admin/css/wlmm-admin-styles.css' );       }     }               /*--------------------------------------------------------------------*/     /*      load colorbox for admin help images     /*--------------------------------------------------------------------*/          add_action( 'wp_enqueue_scripts', 'wlmm_do_colorbox_js' );     add_action( 'wp_head', 'wlmm_do_colorbox_script' );          function wlmm_do_colorbox_js() {              if (is_admin()) {           wp_enqueue_script( 'colorbox', WLMM_URL . 'admin/scripts/colorbox/jquery.colorbox-min.js', array( 'jquery' ) );       }     }          function wlmm_do_colorbox_script() {          if ( ! defined( 'COLORBOX_WIDTH' ) ) define( 'COLORBOX_WIDTH', '95' );     if ( ! defined( 'COLORBOX_HEIGHT' ) ) define( 'COLORBOX_HEIGHT', '95' );     if ( ! defined( 'COLORBOX_OPACITY' ) ) define( 'COLORBOX_OPACITY', '0.6' );          // Colorbox settings     echo '     <script>       jQuery(document).ready(function () {           jQuery("a.admin").colorbox({ width:'.COLORBOX_WIDTH.', height:'.COLORBOX_HEIGHT.', opacity:'.COLORBOX_OPACITY.' });       });     </script>     ';     }


Show admin help message across custom post type parent and child posts

In my custom plugin, I am using the following code to display an info / help box. This is working great for the main admin edit screen that lists the custom posts, but how can I extend this to show the message at the top of each of the actual child custom posts too.               function my_admin_notice(){     global $pagenow;     if ($_GET['post_type'] == 'my_custom_post_type' ) {      echo '

Help

some help text

';     }     }     add_action('admin_notices', 'my_admin_notice');


Custom rewrite rules for /pastissues/%category%-%postname%.html

I have been researching this for over a week now. I've tried a few tutorials on custom rewrite rules and custom post types, but I'm still not sure which direction I should go in for making this happen. And it absolutely has to happen. This is a large client who needs to retain the same link structure that is coming from a moveable type envrionment: WP ---> http://www.domain.com/pastissues/category/here-is-the-postname.html - works on wordpress MT ---> http://www.domain.com/pastissues/multiple-word-category-orsingle-one- here-is-the-postname.html - works on Moveable Type I've tried: /pastissues/%category%-%postname%.html --> this produces the right looking link, but fails when I request an article if the article has a category that is more than one word. So I probably need to write a custom permalink plugin. I've tried looking through available plugins out there, but custom permalinks won't help me, because I'm a multi-site install.


Adding thumbnails for non-image attachments

I'm working on a site that provides Photoshop resources. I would like to create a page offering brushes for download that displays a thumbnail image and a link to a .zip file for each brush set. I was thinking that I could attach the .zip files for all the brush sets to the page and then display the thumbnails. I was wondering if there might be a way to link a thumbnail image to the attachment and then display all of the thumbnails. My initial thought was to add a custom field for attachments that allowed you to upload a thumbnail. Then, use something like this, but modified to output the thumbnail with a link to the attachment itself [ List Post Attachments - Remove Image Thumbnails ] to display all of the previews. Is there an existing plugin that allows you to upload thumbnails as a custom field to attachments, or can you tell me how to do so myself? (Or, if there's a better way to do this, I am all ears!) Thank you!


Customizing Only a Specific Menu using the "wp_nav_menu_items" Hook?

Thanks to some help on here, I've managed to add a custom search box to my main menu... by adding this to my theme's functions.php               add_filter('wp_nav_menu_items','search_box_function');       function search_box_function ($nav){       return $nav."
<form action='http://example.com/' id='searchform' method='get'><input type='text' name='s' id='s' placeholder='Search'></form>
";     }      However, I've now added another menu to put in the footer, but the search box gets added to this one too. How would I add the search box to the primary menu only? My code for registering the menus is:               register_nav_menus( array(       'primary' => __( 'Primary Navigation', 'twentyten' ),       'secondary'=>__('Secondary Menu', 'twentyten' ),           ) );      ..and the code to display the secondary menu is:               wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'secondary' ) );


Adding Visibility Options

I've searched for plugins but while some do halfway accomplish the task they are normally very complicated. I'd like to add option to the visibility menu when creating a page (and post, but page is more urgent). ![visibility menu wordpress](http://i.stack.imgur.com/ZRqGY.png) These options need to be: _"Only visible to logged user"_ and _"Only visible to guest (i.e. not logged in"_ Does any one know of plugin or and point me in the right direction to write my own? **EDIT:** A use case for this is; only show the registration and login pages to 'guests'. A logged-in user doesn't need to see these pages.


Multiple images with Media Uploader on front-end

I'm trying to implement a **multiple** image upload on a frontend form, using the built-in Wordpress Media Uploader. I managed to have a single image upload, but I can't find out how to have **multiple** image fields. I'm very new to jQuery, unfortunately. Whenever I use multiple `<input>` fields, the `Upload Image` Button only works on the first one. Help is greatly appreciated. This is my working code for the single image upload, which I try to adjust to allow multiple `<input>` fields/ image uploads. **html frontend form**               <label for="upload_image">         <input id="upload_image" type="text" size="36" name="ad_image" value="http://" />          <input id="upload_image_button" class="button" type="button" value="Upload Image" />         <br />Enter a URL or upload an image     </label>      **media-uploader.js**               jQuery(document).ready(function($){              var custom_uploader;              $('#upload_image_button').click(function(e) {                  e.preventDefault();                  //If the uploader object has already been created, reopen the dialog             if (custom_uploader) {                 custom_uploader.open();                 return;             }                  //Extend the wp.media object             custom_uploader = wp.media.frames.file_frame = wp.media({                 title: 'Choose Image',                 button: {                     text: 'Choose Image'                 },                 multiple: false             });                  //When a file is selected, grab the URL and set it as the text field's value             custom_uploader.on('select', function() {                 attachment = custom_uploader.state().get('selection').first().toJSON();                 $('#upload_image').val(attachment.url);             });                  //Open the uploader dialog             custom_uploader.open();              });               });      **in functions.php**               add_action('wp_enqueue_scripts', 'media_uploader_script');     function media_uploader_script() {         if (is_page_template('page-item-submission.php')) {             wp_enqueue_media();             wp_register_script('media-uploader-js', get_template_directory_uri().'/assets/js/media-uploader.js', array('jquery'));             wp_enqueue_script('media-uploader-js');         }     }      Here's a screenshot of what I'm trying to implement (I know that the "Add More" Button is another kind of 'issue').![enter image description here](http://i.stack.imgur.com/kdQ93.png) EDIT: This is how far I got with Steven Jones help: **media-upload.js**               jQuery(document).ready(function($){              var custom_uploader;              $('.upload_image_button').click(function(e) {               var target_input = $(this).attr('id');                  e.preventDefault();                       //If the uploader object has already been created, reopen the dialog             if (custom_uploader) {                 custom_uploader.open();                 return;             }                  //Extend the wp.media object             custom_uploader = wp.media.frames.file_frame = wp.media({                 title: 'Choose Image',                 button: {                     text: 'Choose Image'                 },                 multiple: false             });                  //When a file is selected, grab the URL and set it as the text field's value         custom_uploader.on('select', function() {         attachment = custom_uploader.state().get('selection').first().toJSON();         $('input[name=' + target_input + ']').val(attachment.url);     });                  //Open the uploader dialog             custom_uploader.open();              });               });      **html frontend form**               <input type="text" size="36" name="image_1" value="http://" />      <input id="image_1" class="upload_image_button" type="button" value="Upload Image" />          <input type="text" size="36" name="image_2" value="http://" />      <input id="image_2" class="upload_image_button" type="button" value="Upload Image" />      However, only one of the two field gets populated with input I choose from the media uploader. Example: I click on the second button (image_2) first, an URL gets populated into that field. Afterwards I click on the first button (image_1): the attachment URL now gets populated into the second field, although it must go into the first field... this doesn't make sense.