Add custom image sizes to media uploader

I want to add custom image sizes to the media uploader: ![media uploader](http://i.stack.imgur.com/y9LXW.png) In order to do this, I use the following code (comments are there for convenience):               // this function adds the custom image sizes to the media uploader     function my_insert_custom_image_sizes( $sizes ) {         // get the custom image sizes         global $_wp_additional_image_sizes;         // if there are none, just return the built-in sizes         if ( empty( $_wp_additional_image_sizes ) )             return $sizes;              // add all the custom sizes to the built-in sizes         foreach ( $_wp_additional_image_sizes as $id => $data ) {             // take the size ID (e.g., 'my-name'), replace hyphens with spaces,             // and capitalise the first letter of each word             if ( !isset($sizes[$id]) )                 $sizes[$id] = ucfirst( str_replace( '-', ' ', $id ) );         }              return $sizes;     }          // define the init function next, which sets up all the necessary stuff     function custom_image_setup () {         add_theme_support( 'post-thumbnails' );         add_image_size( 'my-size1', 250, 250 );         add_image_size( 'my-size2', 350, 350 );         add_image_size( 'my-size3', 450, 450 );         add_filter( 'image_size_names_choose', 'my_insert_custom_image_sizes' );     }          // attach that init function to the 'after_setup_theme' hook     // so it runs on each page load once your theme's been loaded     add_action( 'after_setup_theme', 'custom_image_setup' );      This code works fine. Beside one issue: When uploading an image, if it is smaller than the dimensions of the smallest custom image size, then this error appears: `Invalid argument supplied for foreach()`. I presume the problem comes from the `my_insert_custom_image_sizes` function. So basically, when no custom image is made, the error appears. How can I fix this? I have a feeling the problem is something simple that I overlooked but I'm lost... If you want to replicate this error, just paste the above code in functions and upload an image that is **smaller** than 250x250 in pixels. **UPDATE** : After some further research, it appears that the error is related to the foreach in my JPEG compression function:               // Set JPEG compression quality     add_filter('jpeg_quality', create_function('$quality', 'return 100;'));     add_action('added_post_meta', 'ad_update_jpeg_quality', 10, 4);          function ad_update_jpeg_quality($meta_id, $attach_id, $meta_key, $attach_meta) {              if ($meta_key == '_wp_attachment_metadata') {                  $post = get_post($attach_id);                  if ($post->post_mime_type == 'image/jpeg') {                      $pathinfo = pathinfo($attach_meta['file']);                 $uploads = wp_upload_dir();                 $dir = $uploads['basedir'] . '/' . $pathinfo['dirname'];                      foreach ($attach_meta['sizes'] as $size => $value) {                          $image = $dir . '/' . $value['file'];                     $resource = imagecreatefromjpeg($image);                          if ($size == 'large') {                         // set the jpeg quality for 'large' size                         imagejpeg($resource, $image, 35);                     } elseif ($size == 'medium') {                         // set the jpeg quality for the 'medium' size                         imagejpeg($resource, $image, 35);                     } elseif ($size == 'small') {                         // set the jpeg quality for the 'small' size                         imagejpeg($resource, $image, 40);                     } else {                         // set the jpeg quality for the rest of sizes                         imagejpeg($resource, $image, 90);                     }                          imagedestroy($resource);                 }             }         }     }      Any ideas what is wrong with it?


audio streaming plugin but with no save option?

I need to publish a audio file that I want to make available to   * listen and   * not to download any idea how to do it? Is there any free WP plugin for that? Something where user cannot save the audo using any webbrowser plugin like DownloadHelper etc.


display posts from specific category on a page , in thematic child theme?

i have a blog page template , i need to make it display posts from specific category called news this is the template , i use thematic framework child theme               <?php     /**     * Template Name: Blog     *     * This template allows you to display the latest posts on any page of the site.     *     */              // calling the header.php         get_header();              // action hook for placing content above #container         thematic_abovecontainer();          ?>
     <?php thematic_abovecontent(); ?>
     <?php     $wp_query = new WP_Query();     $wp_query->query( array( 'posts_per_page' => get_option( 'posts_per_page' ), 'paged' => $paged ) );     $more = 0;     ?>          <?php                       // create the navigation above the content                  thematic_navigation_above();                       // calling the widget area 'index-top'                  get_sidebar('index-top');                       // action hook for placing content above the index loop                  thematic_above_indexloop();                       // action hook creating the index loop                  thematic_indexloop();                       // action hook for placing content below the index loop                  thematic_below_indexloop();                       // calling the widget area 'index-bottom'                  get_sidebar('index-bottom');                       // create the navigation below the content                  thematic_navigation_below();                       ?>
     <?php thematic_belowcontent(); ?>
          <?php              // action hook for placing content below #container         thematic_belowcontainer();              // calling the standard sidebar         /*thematic_sidebar();*/              // calling footer.php         get_footer();          ?>


How to add custom menu item on plugin activation?

When my plugin is activated, I would like to add a new menu item. Here is my code:               class My_Plugin {       function __construct() {         register_activation_hook(__FILE__, array($this, 'install'));       }            function install() {         add_action('admin_menu', array($this, 'add_menu_item'));       }            public function add_menu_item() {         add_menu_page(...);       }     }          $my_plugin = new My_Plugin();      Unfortunately, it doesn't work. I notice that `install` is called, but `add_menu_item` isn't. What would be the proper way to do this?


Drag-and-drop "Panels"-style visual layout editor?

I'm a combination Drupal and WordPress developer and have recently started playing with Drupal's Panels module -- which allows you to create flexible layouts and drop content blocks (The Drupal equivalent of widgets) in place on either a per-layout or per-content item basis. I'm now working on a WordPress project that would really benefit from this kind of functionality — **is there a visual layout editor for WordPress that even slightly resembles Panels?** By "visual layout editor", I mean something that can have text and/or widgets added on an ad-hoc basis to regions created by either dragging column widths or click-and-dragging selections (Similar to Adobe InDesign). **Edit:** It's a year later, so I've created a wiki answer below. The original question has been updated to reflect this.


Post Submission from frontend with custom field isn't working

I'm working with submitting posts from fronted which has some custom fields. I used shortcode API to use the form in any page/post. The code should be found bellow. But after submitting the form, nothing happened and the form returns. I need your kind help.               <?php     //Shortcode API     function apl_video(){     global $current_user;     get_currentuserinfo();     if (!isset($_POST['submit'])) {          ?>     <form name="new_post" method="post" action="">

Video Title	<input id="post_title" tabindex="1" type="text" name="post_title"/>

Video Width	<input id="vid_wid" tabindex="2" type="text" name="vid_wid"/>

Video Height	<input id="vid_hei" tabindex="3" type="text" name="vid_hei"/>

Autoplay	<select tabindex="4" name="vid_ply" id="vid_ply">             <option value="Yes">Yes</option>             <option value="No">No</option>             </select>

Skin	<select tabindex="5" name="vid_ski" id="vid_ski">             <option value="player1">Player 1</option>             <option value="player2">Player 2</option>             </select>

               Youtube Video Link	               <input id="vid_you" tabindex="6" type="text" name="vid_you"/>

               MP4 Video Link	               <input id="vid_mp4" tabindex="7" type="text" name="vid_mp4"/>

               OGG Video Link	               <input id="vid_hei" tabindex="8" type="text" name="vid_ogg"/>

               WEBM Video Link	               <input id="vid_hei" tabindex="9" type="text" name="vid_web"/>

               Poster Image Link	               <input id="vid_hei" tabindex="10" type="text" name="vid_pst"/>

                       	                      <?php wp_nonce_field( 'new-post' ); ?>                      <input type="submit" value="Generate" name="submit"/>

                    </form>          <?php }          else {         $title      =   esc_attr($_POST['post_title']);         $vid_wid    =   esc_attr($_POST['vid_wid']);         $vid_hei    =   esc_attr($_POST['vid_hei']);         $vid_ply    =   esc_attr($_POST['vid_ply']);         $vid_ski    =   esc_attr($_POST['vid_ski']);         $vid_you    =   esc_attr($_POST['vid_you']);         $vid_mp4    =   esc_attr($_POST['vid_mp4']);         $vid_web    =   esc_attr($_POST['vid_web']);         $vid_ogg    =   esc_attr($_POST['vid_ogg']);         $vid_pst    =   esc_attr($_POST['vid_pst']);                   global $user_ID;              $new_post = array(                 'post_title'    => $title,                 'post_status'   => 'publish',                 'post_type'     => 'video',                 'post_date'     => date('Y-m-d H:i:s'),                 'post_author'   => $user_ID,         );              //save the new post         $pid    =   wp_insert_post($new_post);              // Do the wp_insert_post action to insert it         do_action('wp_insert_post', 'wp_insert_post');               add_post_meta($pid, 'vid_wid', $vid_pst, true);         add_post_meta($pid, 'vid_hei', $vid_hei, true);         add_post_meta($pid, 'vid_ply', $vid_ply, true);         add_post_meta($pid, 'vid_ski', $vid_ski, true);         add_post_meta($pid, 'vid_you', $vid_you, true);         add_post_meta($pid, 'vid_ogg', $vid_ogg, true);         add_post_meta($pid, 'vid_web', $vid_web, true);         add_post_meta($pid, 'vid_mp4', $vid_mp4, true);         add_post_meta($pid, 'vid_pst', $vid_pst, true);                        //Result         echo 'Done';                            }     }               add_shortcode( 'wpvideogen', 'apl_video' );


br tags on backend not showing up on frontend

I was really searching here for a solution for this but I couldn't find anything. **Problem:** br and/or br / tags which I put into my content on the backend were just not showing up on the frontend. No matter what I did - enter+shift in the visual or insert the tags manually in the html editor - I tried several things but nothing worked. Interesting fact: on the page I am working have already been a few br's which are working without any problems, so I looked through the code if there was something but I still couldn't find anything. I found an **acceptable solution** for this: Simple Breaks. This plugin gives me the possibility to insert br tags by writing the shortcode "[br]". I'm kinda fine with that. Still I truely want to ask you if you have similiar problems or if there is any solution to this! It is known that WP has it's problems with br's and p's so I guess the users just have to go with it. Greetings from germany and pls don't be too hard on my bad english :) **More information:**   * I already unchecked "WordPress should correct invalidly nested XHTML automatically" in Admin > Settings > Writing. (thanks to PoseLab)   * I installed TinyMCE Advanced and checked "Stop removing the  and   tags when saving and show them in the HTML editor"


Is it possible to save more than one image to an option?

The following code allows you to upload multiple images but only one is saved to the option. Can multiple images be saved to the option as an array or would I have to create separate controls?               $wp_customize->add_section("slider",array(         'title'=>"Slider",         'description'=>"Choose the images for the slider",         'priority'=>'36'     ));          //images     $wp_customize->add_setting("slider[images]",array(         'default'=>"",         'type'=>"option"     ));     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize,"slider[images]",array(         'label'=>__("Images","adaptive-framework"),         'section'=>"slider",         'settings'=>"slider[images]"     )));


Wp eCommerce meta information search

Out of the box, WP eCommerce does not support Meta search. This is a big problem if you are selling books online and need clients to be able to search by the most important Meta tag, Author! Can someone please tell me how I could go about including the meta information search or is there a better plugin that does not cost an arm and a leg to search for meta information too? Many thanks


Customizing Users in Admin Area

I know how to customize the users in the admin area of WordPress. I have done it many times. However, I would like to customize the user a bit differently as explained below. I would like to add a new labe and a new textbox associated with that label. Lets call them "Label 1" and "Textbox 1". I like to add those under the "Username" field set and before the "Role" field set. In other words, I like the admin area for the user to look like this after the customization"               Username: <TEXTBOX FOR USER NAME>     Label 1: <TEXTBOX 1>     Role: <DROPDOWN LIST FOR ROLES>      All examples I found describe adding the new fields at the bottom of the User page. How can I add them to the middle? Thanks.


get_the_author_meta

I am just wondering if `get_the_author_meta()` returns value after unserializing in case it is stored in database as a serialized array? Until today, on my script, this has been returning data in form of an array after unserializing it and array functions on returned data were working fine. But today array functions stopped working because it's no more returning unserialized array. It returns `a:1:{i:0;s:11:"test";}` which is making my script break... It was working fine... How is it possible?


selected menu item

The template I'm working on for a client has the following pages:   * Home : a custom static page that displays the content of a certain WP page, and the latest sticky posts. This is the front-page.php file.   * About us: a WP page   * Services : a WP page   * Events : a list of WP posts, in the Events category   * Blog : a list of WP in the Blog category I'd like to highlight the current section in the main menu in CSS, but the only idea I have is to make a big list of PHP conditionals depending on the current case. For example if we are seeing the Events category, then we must be in the Events section, and so on. Is there a more straightforward way of accomplishing this?


wp_head() - list hooked actions with priorities?

I'd like to add something to `wp_head()` but I'm aiming precise location (like after style.css but before rtl.css and before my other custom script). I'm wondering if it's possible to list everything that is attached to `wp_head()` in execution/display order anyhow? I know that I can pass priority/order parameter to `add_action` but I need to know what number will that be.               add_action( 'wp_head', 'my_function', 10 );      It all starts with `10` but somehow rtl.css seems to be always after style.css. Is it `11` maybe? How do I find that out?


Removing meta boxes: remove-meta_box() or unset()?

I've seen two ways to remove meta boxes: remove_meta_box() and unset().               function TEST_remove_dashboard_widgets(){         remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );     }     add_action('wp_dashboard_setup', 'bmc_remove_dashboard_widgets');      vs.               function TEST_remove_dashboard_widgets() {         global $wp_meta_boxes;         unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);     }     add_action('wp_dashboard_setup', 'bmc_remove_dashboard_widgets');      remove_meta_box seems better since it's clearly intended just for that, but I've also seen the unset formulation in several places. Why would I use one vs. the other?


Enable comments for post when comments meta box removed

I've hit the issue described in '11: "Enable comments for post with comments meta box removed" and I'd like to ask for your help to adapt the mentioned there code to the current wordpress version. I have a custom post type that must have comments enabled and _contributors_ must not be able to disable comments. I've enabled comments in Settings->Discussion and removed the `commentstatusdiv` meta box with `remove_meta_box()`. After that I've figured out that comments is unset when the meta box is disabled. I am looking for the way to enforce the comments now.


Display random posts, but omit the post it is on?

I am trying to have a section under a single post where it displays completely random posts. I got everything working, but every once in a while one of the random posts that get displayed is the actual post that it is on (the single). Here is my code:               <?php     $args = array( 'numberposts' => 3, 'orderby' => 'rand' );     $rand_posts = get_posts( $args );     foreach( $rand_posts as $post ) : ?>     <?php endforeach; ?>      Is there anyway to not have it ever display the post it is on? Thank you.


How to add HTML / Form to an Admin Bar Menu

I'd like to add a custom form to the admin bar in Wordpress. is there a way to accomplish this? So far all of the documentation seems to only allow the addition of simple text links.


Local version of jquery not working right

Developing a theme for someone else, nornally on sites I'd maintain I'd use google CDN to load jquery like so:               //don't use (deregister) WP's jQuery version     wp_deregister_script( 'jquery' );          //Use jQuery from Google Code     wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js');     wp_enqueue_script('jquery'););      But after deleting that WordPress's local version breaks my site, it's loading the same version just from wp-includes, jquery 1.11.1. When I use google CDN it's all fine. When I use the local version it just throws up errors in my JS like 'Uncaught TypeError: undefined is not a function' on the first line of my main.js file. Totally perplexed as to what would cause this issue.


how to remove filter from wordpress shortcode output

Twitter URL plugin add the filter to the_content. This filter messing up the output of my plugin shortcode output. So I wish to remove this filter only for my shortcode output.               add_filter('the_content', 'twitter_url');      I know this can be removed using below filter               remove_filter('the_content', 'twitter_url');      But, How to apply this filter only to my shortcode output. My shortcode               add_shortcode('xxx', 'func_xxx');      Shortcode callback function               function func_xxx(){           return 'xxx';     }      So please guide me to do this!


Is it possible to enqueue a raw CSS string directly from within a template file?

I was wondering if it's possible to enqueue raw CSS as a string directly from within a template file? I'm writing a custom template for a page and need to add some style rules for it. What I want to do is write the styles out as a string var in PHP then use the enqueue_style function to load these styles, rather than me having to add them in to 'style.css' or some other external style-sheet. I assumed that so long as I enqueue my styles before calling the 'get_header' function, and if I hook in to the 'wp_head' or 'wp_enqueue_styles' actions, that this would work but it doesn't appear to and I'm not sure if 'wp_enqueue_style' can take a raw CSS string. Anyone got any advice please? Kind regards, Chris


Get Original Dimension Featured Image on the homepage

I'm trying to integrate a custom slider using a 3rdParty jQuery plugin onto the homepage. I'm almost there. I need the original featured images and not the cropped ones.               <?php if (is_home()): ?>     <?php     $featured_posts = new WP_Query(array(         'post_type' => 'post',         'showposts' => 5,         'tag' => 'featured'     ));     ?>
     <?php while($featured_posts->have_posts()): $featured_posts->the_post(); ?>         <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'featured-image'); ?>                                 <a href='<?php the_permalink(); ?>'>             <img src="<?php echo $image[0]; ?>" style="width:940px;height:500px" />              <?php endwhile; ?>
     <?php endif ?>                      The problem here is that all the images are of 516x340 dimension. How I get the original dimensioned image ?


Client cant see the Updated dynamic content

I have came across an issue... whenever I upload new content to the site.. and i send the link to the client.. He can not view the changes instead what he see is the previously updated content. Looks like there is some caching issue.. but i have never seen dynamic content being cached. Even I have to clear my cache on Safari to view the dynamic changes.. I am using a theme Village . Not sure if that is the theme issue.. Is there any solution to this which i may try rather than waiting for the Theme developer to respond? I use the following code to make sure that the updated content is loaded everytime the page load. `<?php header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); header('Cache- Control: no-store, no-cache, must-revalidate'); header('Cache-Control: pre- check=0, post-check=0, max-age=0'); header ('Pragma: no-cache'); ?>` But will it Re-load everything including Js and css files?? If that is the case, then i shouldn't be using this technique? Thanks, Nasir


Place a cookie when a specific page has been viewed?

I'm trying to direct new site visitors to a custom registration page **for the their first visit only**. The registration collects detailed information relating to an upcoming event, it is **not** designed to register the visitor as a user of the WordPress installation. The registration page contains a Gravity form which when submitted redirects to a thank you page. I would like to know the correct way to **place a cookie in WordPress only when the visitor lands on the thank you page**. Thanks in advance. NB: I should also say that I've added the following to the functions.php file:               /* SET NEW USER COOKIE */     function set_newuser_cookie() {         if (!isset($_COOKIE['newtcpa_visitor'])) {             setcookie('newtcpa_visitor', 1, time()+3600*24*100, COOKIEPATH, COOKIE_DOMAIN, false);         }     }     add_action( 'init', 'set_newuser_cookie');      I'm unsure about COOKIEPATH & COOKIE_DOMAIN. I've tried the following settings, but I'm not having much luck at isolating the WP template/page:               setcookie('newtcpa_visitor', 1, time()+3600*24*100, '/', '.mydomain.com', false);      and               setcookie('newtcpa_visitor', 1, time()+3600*24*100, '/', '.mydomain.com/thank-you/', false);      _Apologies for the multiple edits... first post on WordPress Answers_


variable value disappears in a second loop

i can't manage to "see" the value of `$originalArticle` in `echo '/'.$originalArticle.'== &'.$sameArticle;` : i tried with "global" before, but it does not work... The output is for example : > /== &48 Any help?               <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                          <?php $originalArticle = the_ID(); //this works ?>
…

…
                     <?php                      $cats = get_the_category();                     $cat_obj = array_shift($cats);                     $cat_id = (int) $cat_obj->cat_ID;                          $second_query = new WP_Query( 'cat='.$cat_id.'&posts_per_page=2' );                     while ( $second_query->have_posts() ) : $second_query->the_post();                              $sameArticle = get_the_ID();                              /* HERE */ echo '/'.$originalArticle.'== &'.$sameArticle; //output : /== &48                              if ( $originalArticle == $sameArticle )                         {                         } else {                             //...      Thanks for your help


how to add user registration and signup in wordpress and create members only page?

i'm trying to add a user login system in my wordpress as like regular php sites. when a user logged in then , i wanna show the specific page content otherwise no. Is there any process to add nice registration and login system in wordpress and no back end access also ? thanks


Check if action hook exists before adding actions to it

I am trying to add a `rel=next` and `rel=prev` link tags to the head element of `image.php` template file. I have Wordpress SEO installed and I like to hook to this plugin `wpseo_head` action hook to achieve that. What I would like to do is to check if the `wpseo_head` action hook exists before I attach my action to it, and if not like in the case of the plugin is not installed or deactivated, I would use `wp_head` instead. I have tried `has_action('wpseo_head')` function, but the problem with that is if there are no functions attached to this hook it will return `false` even if the plugin is installed activated.               if (has_action('wpseo_head')) {         add_action('wpseo_head', 'ad_add_link_tag_image_head');     } else {         add_action('wp_head', 'ad_add_link_tag_image_head');     }      What is the way to check for actions that may not exist in Wordpress? Thanks.


Why does this search.php not work?

This search.php shows all the results from a said search however, doesn't include the title, The Search Results For...... and search query amount; or even the no searches found and prints the searchform.               <?php get_header(); ?>     <?php if ( have_posts() ) : ?>
<?php printf( __( 'Search Results for: %s', 'nothing' ), '' . get_search_query() . '' ); ?>

           <?php if (have_posts()) : while (have_posts()) : the_post(); ?>               <?php      $featured = get_post_meta($post->ID,'_thumbnail_id',true);      $attachments = get_children( 'post_type=attachment&orderby=menu_order&exclude='.$featured.'&post_mime_type=image&post_parent='.$post->ID );      $vimeo = get_post_meta($post->ID, 'rw_post-vimeo',true);?>
               <time datetime="<?php the_time('Y-m-d')?>"><?php the_time('F jS, Y') ?></time>              <?php  get_template_part( 'includes/inc-image' ); ?>     <?php endif; ?>                         <?php  get_template_part( 'includes/inc-detail' ); ?>     <?php endwhile; endif; ?>
     <?php wp_pagenavi(); ?>

                                   <?php else : ?>
<?php _e( 'Nothing Found', 'nothing' ); ?>

<?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentyten' ); ?>
     <?php get_search_form(); ?>     <?php endif; ?>          <?php get_footer(); ?>      Interesting though the posts in their li tag appear witin the opening
      So i assume its a statement issue but cannot figure it out :( Any ideas?


Garbled HTML pulled for page description "caption id=attachment..."

Whenever someone links to my wordpress blog, whether it's on Facebook, ScoopIt, or whatever, instead of a description, it automatically pulls information from the image: ![Example of this happening on ScoopIt](http://i.stack.imgur.com/bg65C.png) How do I get this to stop happening? I'd prefer the meta description or something, not some garbled HTML.


wp_insert_post at same time as saving post results in 502 Bad Gateway

I'm currently trying to create/update one post while also saving the current post that I'm on. It's all happening here:               add_action('save_post', 'wysiwyg_save_meta');     function wysiwyg_save_meta(){         global $post;         $editor_id = WYSIWYG_EDITOR_ID;         $meta_key = WYSIWYG_META_KEY;              if(isset($_REQUEST[$editor_id])) {             update_post_meta($post->ID, WYSIWYG_META_KEY, $_REQUEST[$editor_id]);                  $thankYouPost = get_thank_you_post($post->ID);                  $postArgs = array(                 'post_content'   => $_REQUEST[$editor_id],                  'post_name'      => 'thank-you',                 'post_title'     => "Thank You",                 'post_status'    => $post->post_status,                 'post_type'      => 'landing_page',                 'post_parent'    => $post->ID,             );                  if ($thankYouPost->ID) {                 $postArgs['ID'] = $thankYouPost->ID;             }             wp_reset_postdata();             wp_reset_query();             wp_insert_post($postArgs);             wp_reset_postdata();             wp_reset_query();         }     }      Now, this works and saves both pages, but it doesn't seem like it's actually working. The page just sits and tries to load and eventually I get back a 502 Bad Gateway error. However, manually refreshing the page shows me that the action was successful. What could be causing this? Any more information I will be happy to provide. Thank you for your time.


syntax error unexpected '}' at 364 line

I am getting this error on my website and am not able to access admin dashboard. The error occurs when I am a new theme on my website. Can you please help me to find this error. > Parse error: syntax error, unexpected '}' in /home/content/html/wp- > content/themes/imag-mag/functions.php on line 364


Conditional check to see if a bootstrap.css is included in a theme

I am creating a shortcode plugin for Bootstrap framework that will go along with my theme. However since this would be released to the plugin, if a users's theme already has Bootstrap.css included, is there a way for me to check this from a plugin?


Large Unwanted Space at the Bottom of Blog Posts

I'm a bit stumped as the why there is such a large space at the bottom of the blog posts. I've tried removing the "more" tag, I've inspected the element multiple times, but just cant seem to get rid of it. Any suggestions? http://gregtaylordesignstudio.com/sayyes/?page_id=10


Single Product Navigation within Category for WooCommerce

I'm working on a website for a client who would like to have product navigation on each single product page. The navigation will go through each product within the category and when it reaches the last product it will return to a product overview page. I've tried a number of different approaches, but the only approach that has kind of worked thus far is using the wordpress post navigation:
<?php previous_post_link('%link','prev'); ?>

<?php next_post_link( '%link','next'); ?>      but this cycles through all products, not just category specific. I've also tried setting the prev/next post link like this, trying to remain within the category:
<?php previous_post_link('%link','prev', TRUE); ?>

<?php next_post_link( '%link','next', TRUE); ?>
      but as it turns out, the post category is not being set because Woocommerce handles the category as a product category and not a post category. To try to work around this, I came up with this function:               function save_product_cat(){     global $post;         $terms = get_the_terms( $post->ID, 'product_cat' );         wp_set_post_categories( $post->ID, $terms );         wp_set_object_terms( $post->ID, $terms->slug, 'category');      }          add_action('save_post', 'save_product_cat');      I'm trying to hook into when a post is saved so that I can grab the product category and set it as the category. When I test to see what the product category/ies are I'm still getting an empty array. Any ideas as to why my category isn't getting saved? Or a better way to go about single product navigation within product category?


Override plugin with functions.php

add_action('wp_head','add_gpp_gallery');     function add_gpp_gallery() {         if( ( is_single() || is_page() ) && ( !is_page_template('page-blog.php') ) ){             remove_shortcode('gallery', 'gallery_shortcode');             add_shortcode('gallery', 'gpp_gallery_shortcode');         }     }      Hi All, I pulled the above function out of the plugin's core functions file, and I was hoping to change it to only replace the WP default gallery on my custom post type. So I changed the if statement above to:               if (is_single() && is_post_type('post_type'){      So I changed it and put it into my functions.php - but I'm getting an error that stating that I can't redeclare add_gpp_gallery How would I override the plugin's functions without touching the plugin code? thanks **EDIT** I tried:               remove_action( 'wp_head', 'add_gpp_gallery' );     add_action('wp_head','jason_add_gpp_gallery');     function jason_add_gpp_gallery() {         if ( is_single() && is_post_type('listings') ){             remove_shortcode('gallery', 'gallery_shortcode');             add_shortcode('gallery', 'gpp_gallery_shortcode');         }     }      and I get a fatal error - > Fatal error: Call to undefined function is_post_type() in > /home/hostspro/public_html/movemaine.com/wp- > content/themes/movemaine/functions.php on line 269 **EDIT #2** I had cross wired my functions, and was forgetting to change out the is_post_type. The following code is working and thanks for the help               remove_action( 'wp_head', 'add_gpp_gallery' );     add_action('wp_head','jason_add_gpp_gallery');     function jason_add_gpp_gallery() {         if ( is_single() && 'listings' == get_post_type() ) {             remove_shortcode('gallery', 'gallery_shortcode');             add_shortcode('gallery', 'gpp_gallery_shortcode');         }     }


How to put a Worpdpress theme in spanish (having the po file)?

I am building a Wordpress blog system in Spanish and I'd like to have the default theme also translated to "es_ES". I am already running this Wordpress installation in Spanish. What I'd like to know is how to do the same with the default theme (twenty-eleven). This site allows us to download the po file with the translation: http://translate.wordpress.org/projects/wp/3.2.x/twentyeleven/es/default But I don't know what to do next. Thanks.


How to include the latest post of a specific category on a matching page

I have a number of pages, and on each I would like to display the latest post from the category which matches that page. So I have page 1, 2 and 3, and on page 1, I'd like the latest post from category A. 2 -> B, 3 -> C, and so on. I have been trying to code this myself, but I can't find a solid enough CMS resistant way of linking the page to the post category. Thus if someone changes the page, I'd lose the post. I have found the plugin, http://wordpress.org/extend/plugins/list-category- posts/ which seems to do what I want, however adding a shortcode to my page, just displays the shortcode and doesn't do anything. I assume this is because it supports WP 3.1.4 and I'm running 3.2.1. Can I code this functionality myself, or will I need to create a link table in the database? I'd rather use the WP framework, but if I can't crack this, I'll just write a script to do it in plain old php and just include it, which I don't want to do.


Display only the latest post from multiple categories

I have a jQuery slider at the top of my index.php, which works fine. The only problem is that I would like to use query_posts to only display the latest post from five different categories, and always show one from each. So when a new post is created in, lets say the category interview, this will be displayed. But the interview post which was posted one day earlier will then not be displayed, but the latest post from the four other categories are still there. I think this is a bit complicated, no?


wp_footer hook running twice

I have created a widget that have to run some code using the wp_footer hook as well. But if you extend the WP_Widget, the wp_footer runs twice! Has someone already past for the same issue? Here is an example:               /*     Plugin Name: Test     Description: Test Plugin by Romulo De Lazzari     Version: 1.0     Author: Romulo De Lazzari     */          new Test();          class Test extends WP_Widget{              public function __construct(){                  parent::__construct('test-widget', 'Test Widget');                        add_action('widgets_init', array($this, 'register_my_widget'));             add_action('wp_footer', array($this, 'do_something'));         }              public function register_my_widget(){             return register_widget("Test");         }              public function do_something(){             echo "
Hello! This is a test!
";         }              public function widget($args, $instance) {              }              public function form($instance){              }              public function update($new_instance, $old_instance){              }          }      The method do_something() is running twice here, if I take off the "Widget part" it runs well. Could someone help me? Thanks in advance, Romulo


How do i create a loop that list and divide posts into months?

I was wondering if there was any way to make a custom loop that divides posts into months. I would use it on the Archive page to list all posts within a given category with a title that indicated what month it was posted. Like this: ## January: post1 post2 post3 ## February: post4 post5 post6 Any help would be appreciated. Thanks!


Recent Posts slider, using WP_Query(), loads duplicate sliders

I have written a small piece of code for Wordpress that will show the most recent top 4 posts in a slider (the Filament Group Responsive Carousel). It works, displaying the posts and sliding them etc, but there are 4 sliders, each with the 4 posts in them. I must have positioned some of the code with `WP_Query()` wrong. Here is my code:
         <?php             $topNews = new WP_Query();             $topNews->query('showposts=4');              while ($topNews->have_posts()) : $topNews->the_post(); ?>                 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                                              <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.                             the_post_thumbnail('full');                     } ?>
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'android_and_tea' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?>

             <?php endwhile; ?>
      So my question is, what code do I need to reposition/change/add/remove to get it to display one slider with the 4 most recent posts, instead of 4 sliders with the 4 most recent posts?


How can I sort my loop based on meta data, using a form?

I've created a custom post type called 'properties' with custom meta boxes of 'price' and 'rooms'. I have a custom loop-property-archive.php to display the properties. What I would love to have is a method to sort the properties based on the meta data from those two meta boxes. Ideally I would have a drop-down called 'sort by', with the options of 'price asc.', 'price desc.', 'rooms asc.', and 'rooms desc.'. When the user selects an option the page is re-sorted. I can currently query by custom taxonomies, which creates a URL like: mysite.com/?post_type=properties&area=high-ridge&university=birmingham. I need to be able to filter that page or any other combination of area and university. Therefore building individual templates with custom queries is out of the question. I tested out appending meta_key=_price&orderby=meta_value to the URL but that doesn't work. Any ideas why? I'm open to server or client side suggestions. Server may be better because if there is pagination involved I think that would be handled better. Obviously client side has the advantage of no page refreshes though. Thanks!


How to Sort posts by Vote Count?

Does anyone know how to automatically sort posts by Vote Count? I am using a plugin called WP Voting where a visitor can vote on a post. The plugin keeps track of how many votes each post has. The author offered some code that would sort them posts in the main blog page and it works, but it unfortunately broke the Category view. The code is below and it is dropped into the `functions.php`               <?php      /**      * SORTS THE POSTS BY VOTE COUNT      */     add_filter('posts_orderby', 'edit_posts_orderby');     add_filter('posts_join_paged','edit_posts_join_paged');              function edit_posts_join_paged($join_paged_statement) {         global $wpdb;         $join_paged_statement = "LEFT JOIN ".$wpdb->prefix."wpv_voting ON ".$wpdb-                >prefix."wpv_voting.post_id = $wpdb->posts.ID";         return $join_paged_statement;     }          function edit_posts_orderby($orderby_statement) {         global $wpdb;          $orderby_statement = "(".$wpdb->prefix."wpv_voting.vote_count) DESC";         return $orderby_statement;     }      ?>


error with WP custom form

I have set up a custom form in my locally hosted WP and I made a page where user goes after successfully done with the form but I got two issues : 1- the form validation code appears on the interface how can I hide it 2- there's no data sent to my DB and I've been directed to a blank page when I run the php file that does the data storage process I land on the page that show the user the success of the forum filling here is my html code+ form validation code(WP side) :               <?php     function validateForm()     {     /* Validating name field */     var x=document.forms["myForm"]["name"].value;     if (x==null || x=="")     {     alert("Name must be filled out");     return false;     }     /* Validating email field */     var x=document.forms["myForm"]["telephone"].value;          if (x==null || x=="")     {     alert("telephone must be filled out");     return false;     }     }      ?>          <form action="C:\xampp\htdocs\wordpress\process.php" method="post" name="myForm">     Name <input id="name" type="text" name="name" />     Telephone <input id="telephone" type="text" name="telephone" />     Fax <input id="fax" type="text" name="fax" />     Web address <input id="webaddress" type="text" name="webaddress" />     State <input id="state" type="text" name="state" />     Address <input id="address" type="text" name="address" />     <input type="submit" value="Submit" /></form>                    <script type="text/javascript">// <![CDATA[     /* JS validation code here */     ...     ...     // ]]></script>      and this is the php for the Data storage function:               <?php      //establish connection     $con = mysqli_connect("localhost","xxx","xxx","android_app");      //on connection failure, throw an error     if(!$con) {       die('Could not connect: '.mysql_error());      }      ?>          <?php      //get the form elements and store them in variables     $name=$_POST["Name"];      $telephone=$_POST["Telephone"];      $fax=$_POST["Fax"];      $webaddress=$_POST["Webaddress"];      $state=$_POST["State"];      $address=$_POST["Address"];      ?>          <?php      $sql="INSERT INTO `android_app`.`islamic_organisation` ( `Name` , `Telephone` , `Fax` , `WebAddress` , `state` , `Address`) VALUES ( '$name','$telephone', '$fax', '$webaddress' , '$state', '$address')";          mysqli_query($con,$sql);      ?>          <?php     //Redirects to the specified page     header("Location: http://localhost/wordpress/?page_id=857");      ?>      I hope somebody can give some help thanks


How to direct user to actual 404 page when a check is false in single.php?

Can someone tell me how to direct a user to the main 404 file instead of having to print an error message saying "file not found" in single.php? For example:               <?php          if (!$myVar) {       // go to 404.php and return an official file not found header     } else {       // show the following HTML     }          ?>


Where and how does WordPress store and use its plugin and hook information?

When WordPress installs a plugin, where does it keep the fact of a hook/plugins existence? For example, wp-includes/plugin.php I can see `do_action`, but I'm not familiar enough to know how WP loads its plugins. Does it have the hook name in the database along with the new plugged in hook name? I looked in wp_options, but did not anything.


Plugin developement and SVN

I'm going to develop a plugin for WordPress. My environnement is all set up with a local wordpress installation and Aptana Studio. I also have my own subversion server. I have now to determine how I'm going to use subversion. I see mainly two possibilities :   * Register my plugin at WordPress.org and use from the very beginning of my development the repository provided. Problem : to register, I need to give a link to my plugin, which doesn't exist yet.   * or, develop my plugin with my own repository on my own svn server. When the plugin is ready (or at least a working beta version), register it at WordPress.org. Problem : I would have two repositories : mine and the one provided by WordPress.org. How am I going to deal with these ? Another question : no matter where the repository is (on my own server or on WordPress servers), where should I check it out ?   * Into my local wordpress installation, in the plugin folder : this means if I want to test it with several wordpress versions, I would have multiple check-ins. Advantage is that I can put the whole wordpress site into Aptana and take advantage of the autocompletion.   * Into another folder and symlink to this folder from my difference local wordpress installations. Disadvantage : I don't have autocompletion in Aptana.   * Or is there a better solutions ? Thanks for your help


Remove Default Blogroll Links via Plugin script

I have a plugin that I use on all my new sites to set up site defaults (deletes the "hello world" post, the "about" page, the "Mr WordPress" comment, etc...) I'd like to add a routine that removes all the default links under "Blogroll". I'm not sure what function to call. Any ideas?


Take Variables Set in Functions.php and Echo Them Inside My Custom Post Template

I have the following function set up in my functions.php file to allow my custom post type "Slideshow" to work.               add_action( 'the_post', 'paginate_slide' );          function paginate_slide( $post ) {              global $pages, $multipage, $numpages;              if( is_single() && get_post_type() == 'lom_slideshow' ) {         $prefix = "slide{$i}";         $multipage = 1;         $id = get_the_ID();         $custom = array();         $pages = array();         $i = 1;              foreach( get_post_custom_keys() as $key )             if ( false !== strpos( $key, 'slide' ) )                 $custom[$key] = get_post_meta( $id, $key, true);              while( isset( $custom["slide{$i}-title"] ) ) {              $hide = $custom["slide{$i}-hide"];         $slidetype = $custom["slide{$i}-slidetype"];              if( 'on' == $hide ) {         $i++;         continue;                             }                  $page = '';             $title = $custom["slide{$i}-title"];             $image = $custom["slide{$i}-image"];             $desc = $custom["slide{$i}-desc"];             $embed = $custom["slide{$i}-embed"];             if(isset($image))             $imgdisplay = "";             else             $imgdisplay = '';              if( 'Video' == $slidetype )                   $page = "

{$title}

{$embed}

";         else             $page = "

{$title}

{$imgdisplay}

{$desc}
";             $pages[] = $page;             $i++;         }         $numpages = count( $pages );         }     }      This part displays the output:               $page = "

{$title}

{$embed}

";      It displays there where `the_content` is called in my template. Rather than putting the pieces together there in my functions.php I'd like to be able to call each piece directly in my Custom Post template exactly where I want it. For example, by putting `<?php echo $desc; ?>` in my template file where I want the Description to display and `<?php echo $title; ?>` where I want the Title to display. I've tried a couple different ways but can't get anything to display. **Without starting over from scratch or redesigning my whole template how can I make these variable more modular (able to be placed at will within my template)?**


Button not working?

In my code `add_post_meta` is ignoring the button around it and is executing anyway. Why is this so? I've tried the following:               <input type="submit" value="Test" id="submit">         $thisid = wp_insert_post ( $post, true);         if(!isset($_POST['submit'])){             if ( is_wp_error($thisid) ) {                 return get_error_codes();                 echo "not ok";             }else{                      wp_insert_post($thisid);                 add_post_meta( $thisid, 'field_123123eee12312', $column2);                 echo "ok";             }         }      Added the two echo's and the echo `ok` is showing. No idea why this is so. Also a request, can anyone add a tag for `add_post_meta` it seems get/update are there but not add.


Lots of attachments is causing slow load

I have a wordpress site with 400k unattached images. When I try to view any single attachment page it loads quite slow. Is there anyway to improve performance?


Remove p tags in wordpress posts

WORDPRESS VERSION: 3.8.1 PHP version: 5.3 I have a trouble with wordpress posts. How can I remove the auto P tags added? This is my final html code:

     Livelli Vip

Invalid Displayed Gallery

      There is another trouble, wordpress add slashes (magic_quotes_gpc on my server is Off):
      I tried to put this code in functions.php or single.php and even comment these lines in wp-includes/default-filters.php but is not working:               remove_filter( 'the_content', 'wptexturize'        );     remove_filter( 'the_content', 'convert_smilies'    );     remove_filter( 'the_content', 'convert_chars'      );     remove_filter( 'the_content', 'wpautop'            );     remove_filter( 'the_content', 'shortcode_unautop'  );     remove_filter( 'the_content', 'prepend_attachment' );      What can i do?


Importing users to Buddypress with custom fields

Here's the setup:   * The client uses a proprietary custom-coded PHP CMS and is wanting to move to WordPress with BuddyPress.   * The old, custom CMS has a roster functionality, which I'm using BuddyPress custom fields to replace.   * The custom fields are basic contact info (Phone, Fax) and company info (Text field). What is the best way to import these? It seems my two options are:   1. Create a pretty large SQL query that reformats this data between databases (I'm about 3 hours into doing it this way so far)   2. Export it into some sort of JSON format and use the Ning importer. If the best option is using the Ning importer, know where I can get an example Ning user list CSV so I may format the user data accordingly? If the best option is using a big MySQL query, what are some things I should look at in terms of row values WordPress expects? Many thanks!


Let both the admin and post author update comment meta

I have a function which lets the post author set the "best comment". I want the admins to also be able to set the "best comment". Who can this be best achieved?               // Set Best comment for post     function select_best_comment($best_comment_id, $best_comment_parent_question) {         // Prevent Non Logged In Users from making updates         if ( !is_user_logged_in() ) { return new WP_Error('not_logged_in_post', 'sorry cant do this'); }              $post_data = get_post($best_comment_parent_question);         $current_user = wp_get_current_user();          // Make sure the post author is selecting the best comment             if ($current_user->ID == $post_data->post_author) {                      include (TEMPLATEPATH . '/translations.php');                         global $wpdb;                 $get_comments = "SELECT * FROM " . $wpdb->prefix . "comments WHERE comment_post_ID ='". $best_comment_parent_post . "'" ;                 $best_post_comments = $wpdb->get_results($get_comments);                      $best_comment = get_comment($best_comment_id);                      foreach($best_post_comments as $comment) :                     setup_postdata($comment);                     update_comment_meta($comment->comment_ID, 'best_comment', 'no');                 endforeach;                      $currentPointNumber = intval(get_user_meta($best_comment->user_id, 'points', true));                      $newPointNumber = $currentPointNumber + 2;                        $best_comment_user = get_userdata($best_comment->user_id);                      update_comment_meta($best_comment_id, 'best_comment', 'yes');                      // Add 2 Points for being Selected as Best comment                 $has_been_best_comment = get_comment_meta($best_comment_id, 'has_been_best_comment_before', true);                 if ($has_been_best_comment == 'no' || $has_been_best_comment == '') {                     update_user_meta($best_comment->user_id, 'points', $newPointNumber);                     update_comment_meta($best_comment_id, 'has_been_best_comment_before', 'yes');                 }                      setcookie("best_comment_selected_".$best_comment_parent_post,"yes", time()+10);                 $post_data = get_post($best_comment_parent_post);                 wp_redirect($post_data->guid);               }         }


Pagination difficulty using custom query in genesis-based custom theme

I am creating a genesis child theme. I have a category called 'faculty' with about 60 posts in it. I am modifying the category template file so that it displays this category in a customized fashion. The desired result is that the faculty appear in random order, they do not appear more than once they appear in groups of four per page Here is the relevant code from my page (category-faculty.php):               remove_action('genesis_loop', 'genesis_do_loop');     add_action('genesis_loop', 'hdo_faculty_loop');          function hdo_faculty_loop() {       global $paged;       $args = array(         'category_name' => 'faculty',         'posts_per_page' => 4,         'orderby' => 'rand',         'paged' => $paged       );       genesis_custom_loop(  $args );          }          genesis();      What I am getting is <>:   * 4 faculty per page [yay!] random order [yay!]    * previous and next navigation at the bottom of the page [yay!]    * only 6 pages (24 faculty)instead of the expected 15 [boo!]    * duplicate faculty in the set of 24 [boo!]    * a "next" loop on the sixth page that navigates to a 404


Using WP rather than .htaccess to redirect pages/posts

I run a site with over 100 specific redirects in the htaccess for legacy html files that were subsequently brought into WP. There are also rules for pages within a date range to redirect to the home page, and all sorts of other nasties. Given that WP handles redirects and permalinks internally, and without using a plugin, what would be the best way to programatically redirect these links and keep my .htaccess file clean?


Add title to image post

I can't add the title on a featured image in the recent posts. try this but only get the alt               <?php                $default_attr = array(         'src'   => $src,         'class' => "attachment-$size",         'alt'   => trim(strip_tags( $attachment->post_excerpt )),         'title' => trim(strip_tags( $attachment->post_title )),     );     $pages = wp_get_recent_posts();      ?>
         <?php foreach ($pages as $page): ?>
                 <?php echo get_the_post_thumbnail($page["ID"],'',$default_attr); ?>
         <?php endforeach; ?>
      **EDIT OUTPUT FIXED:**

      Any idea? **SOLUTION** This work for me               <?php $pages = wp_get_recent_posts(); ?>
         <?php foreach ($pages as $page): ?>             <?php             $attachment_id = get_post_thumbnail_id( $page->ID );             $attachment = get_post( $attachment_id );                  $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );             ?>
                 <?php echo get_the_post_thumbnail($page["ID"],'', array( 'title' => esc_attr($page["post_title"]), 'data-thumb' => $url)); ?>
                 <?php echo esc_attr($page["post_title"]) ?>
         <?php endforeach; ?>


Double thumbnails?

is it possible to use the thumbnail mechanic twice? I find the thumbnail API really useful for allowing users to place in there own graphics, so that I can control size and position easily. All they have to do is remember to click featured image. I would like two such mechanisms on my page, any idea how I could do this? Preferably hand coding.


Unable to upload/install any WordPress themes

I have a version 3 installation of wordpress on my hosting package that I installed myself Everything else so far seems ok such as posting etc, but I'm unable to install any new themes I have tried to install a theme from clicking one of the "featured" themes, and have tried to upload a ZIP from the wordpress themes website, but each time it just hangs on "Unpacking" or "downloading" and nothing ever happens, I don't get any errors I've noticed that under `/wp-content/uploads` I can see a zip I select for upload, its filesize seems ok Any ideas?


query_posts ->using meta_compare / where meta value is smaller or greater or equals

I am using `query_posts( $args )` to filter the Loop. I want to filter posts based on their `meta_value` "vote", sometimes smaller than, sometimes equals and so on.... I definitly want to use the `query_posts()` function and pass my filter through `$args`! I don't want to use `add_filter('posts_where', 'filter_where');` and then add an `AND` statement to the query. I want to use the given functionality of WordPress to filter posts with `meta_key`, `meta_value` and `meta_compare` like this:               $args = array( 'meta_key'=>'vote', 'meta_compare'=>'>=', 'meta_value'=>5, 'posts_per_page'=>100 ) )          query_posts( $args );      The result of this is:               SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND wp_postmeta.meta_key = 'vote' AND wp_postmeta.meta_value >= '5' GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 100      The problem of that is:               wp_postmeta.meta_value >= '5'       It should be:               wp_postmeta.meta_value >= 5      Then it would work fine. I don't understand why WordPress adds quotes. I'm using the predefined parameter from WordPress (`<`, `>`, `<=`, `>=`) and it's obvious that this will only work with numbers and not strings which would need to be in quotes. The documentation says: > Returns posts with custom field key of 'miles' with a custom field value > that is LESS THAN OR EQUAL TO 22 > > `query_posts('meta_key=miles&meta_compare=<=&meta_value=22');`


pre get posts changing the query

i need to change the posts in taxonomy.php page. I have a meta_key which i want to compare to meta value. But currently my code is not returning anything. I am sure i am missing something. Please let me know what i am doing wrong!               add_action('pre_get_posts', 'add_event_date_criteria');     function add_event_date_criteria(&$query)     {         // We only want to filter on "public" pages         // You can add other selections, like here:         //  - Only on a term page for our custom taxonomy         if (!is_admin() &&             is_tax('event-tag') || is_tax('event-category')) {             $query->set('meta_key', 'start_time');             $query->set('meta_compare', '>=');             $query->set('meta_value', time());             $query->set('meta_key', 'start_time');             $query->set('orderby', 'meta_value_num');             $query->set('order', 'ASC');         }          }


Suggestions for creative use of post format feature, or themes that use them well

I'm looking for themes or examples of sites that use the post format feature in an interesting way. I suppose adding special styling for each post format would be a good start. But if anyone knows of it being used in a cool or creative ways by a premium or free theme feel free to chime in.


What action should I hook into when adding roles and capabilities?

I'm going to be using add_role() and $role->add_cap() to set up a new custom role and attach a new capability to existing roles. I'm wondering where the best place to do this is? Obviously I can do it straight inside functions.php and be done with it. But is this the best practice? Do I only need to do this on admin_init? or should I do it on init? I'm not entirely sure what the best practices are around using init action hooks rather than just dropping a direct function call inside functions.php. thanks for your input!


Passing parameters to a custom page template using clean urls

I am now passing parameters to a custom template in the following format               www.example.com/?pageid=12&rid=24&title=this-is-the-title      I have created two tables . So I need to fetch data and display them on those pages. I would like it to be using clean URL format like:               www.example.com/pageid/12/rid/24/title/this-is-the-title      Can anyone tell how this can be achieved? Thanks


Why do I get a WAMP homepage when clicking on specific website's URL on LocalHost?

Using WAMPSERVER for windows 7, smartgit and Safe Search Replace I have pulled a wordpress code from my git, downloaded a database and inserted into my localhost's phpmyadmin. My home page works but when I click on one of the links I get the WAMP homepage. What am I doing wrong? I have tried the following in WP-Config to use the localhost URL instead of the one saved to the database but it didn't work:               define('WP_HOME','http://127.0.0.1/website');      define('WP_SITEURL','http://127.0.0.1/website');


Non-Latin Characters in permalinks

I was opened this idea 7 months ago:   http://wordpress.org/extend/ideas/topic/non-latin-characters-need-love   Still i couldnt find a solution for it. **Simply what i want?**   Want to use "şŞ İı Ğğ Üü Öö çÇ" turkish characters in permalinks / slugs.


What exactly is ReAuth?

Searching for " **WordPress Reauth** " and the like all result in folks who are having problems with `ReAuth=1`. What exactly is ReAuth?


Displaying Child Categories in carousel

Basically I am making a carousel using carouFredSel that displays post. I have that part working fine but instead of showing an endless list of posts from a certain category I want it to just show posts from a child category on each "slide". So basically the carousel is pulling a query of all children of a category, the posts shown in the carousel are only the post of one child category at a time (i.e. on load 3 posts are show from "Child A" when you hit next it loads the 4 posts of "Child B") This company is doing it well and uses both CarouFredSel and Wordpress: HERE Here is the documentation I changed the code from:HERE Here is my code I am trying to work:
         <?php             $args = array(                 'type'                     => 'post',                 'child_of'                 => 0,                 'parent'                   => 'location',                 'orderby'                  => 'name',                 'order'                    => 'ASC',                 'hide_empty'               => 1,                 'hierarchical'             => 1,                 'taxonomy'                 => 'category',                 'pad_counts'               => false );             $carouselPosts = new WP_Query($args);             ?>             <?php while ($carouselPosts->have_posts()) : $carouselPosts->the_post(); ?>

<?php get_the_category( $id ) ?>

                      <div id="<?php get_the_category( $id ) ?>">

                             <?php the_post_thumbnail( $size, $attr ); ?>

                      prev                 next
         <?php endwhile; ?>


Postmeta not saving

I'm created a postmeta box but it doesn't appear to be saving anything to the DB. I'm check in wp_postmeta and there is nothing there relevant to this metabox. I believe it is something wrong with the nonce due to the `die` error been displayed. question: What is causing my metabox not to save to the database therefore not allowing me to output the results. here is my code that creates/saves the metabox.               <?php     // Add the Meta Box       function ge_add_subtitle_meta_box() {           add_meta_box(               'excerpt_meta_box', // $id               'Excerpt Meta Box', // $title                'ge_show_subtitle_meta_box', // $callback               'page', // $page               'normal', // $context               'high'); // $priority       }            //hook the function to add meta boxes     add_action('add_meta_boxes', 'ge_add_subtitle_meta_box');            // Field Array       $prefix = 'getextra';       $custom_meta_fields = array(           array(             'label' => 'Subtitle',             'desc'  => 'Insert a small description of the page underneath this title.',               'id'    => $prefix.'subtitle',               'type'  => 'textarea'              )     );            // The Callback       function ge_show_subtitle_meta_box() {       //make array globalscope and call $post to acces global array     global $custom_meta_fields, $post;       // Use nonce for verification       echo '<input type="hidden" name="subtitle_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';                // Begin the field table and loop           echo '
';           foreach ($custom_meta_fields as $field) {               // get value of this field if it exists for this post               $meta = get_post_meta($post->ID, $field['id'], true);               // begin a table row with               echo '
                      '.$field['label'].'	                      ';                       switch($field['type']) {                           // case items will go here                           // text       case 'text':           echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
'.$field['desc'].'';       break;       // textarea       case 'textarea':           echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
'.$field['desc'].'';       break;      // checkbox       case 'checkbox':           echo '<input type="checkbox" name="'.$field['id'].'" id="'.$field['id'].'" ',$meta ? ' checked="checked"' : '','/>              '.$field['desc'].'';       break;      // select       case 'select':           echo '<select name="'.$field['id'].'" id="'.$field['id'].'">';           foreach ($field['options'] as $option) {               echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option['label'].'</option>';           }           echo '</select>
'.$field['desc'].'';       break;                       } //end switch               echo '
';           } // end foreach           echo '
'; // end table       }            // Save the Data       function getextra_save_subtitle_meta($post_id) {           global $custom_meta_fields;                // verify nonce           if (!wp_verify_nonce($_POST['subtitle_meta_box_nonce'], basename(__FILE__))) {             return $post_id; } else { die( 'failed to verify nonce' ); }              // 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) {               $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       }       //hook into save the post     add_action('save_post', 'ge_save_subtitle_meta');         ?>


fetch_feed returning rss feeds on same server as empty

I'm trying to use fetch_feed to pull a feed that is hosted on the same server (but uses a different domain name). So, my site is, for example, bullfrogs.com and I'm trying to pull an RSS feed of events from tadpoles.com, which is hosted on the same server but not in the same WP install and using a different domain name. It doesn't work. It says there are "no items" in the feed. Now, I can use the exact same fetch_feed function to pull any other validated RSS feed (such as from, say, CNN or Gawker) from an external server into bullfrogs.com. I can also use the same code block on another site of mine on a completely different web host/server, turtles.com, and it will pull the RSS from tadpoles.com with no problems. The RSS feed from tadpoles.com validates with the W3C RSS validator tool. Assume I don't know much about the server, and that I don't manage it and need to ask a sys admin to help me if the issue is anything that can't be fixed from the WordPress dashboard. He has already reported that he doesn't see anything in the debug stuff or site logs aside from a 500 error on the rss feed. How do I ask about other possibilities, and what things should I be looking for? The code is from this site and looks like this:                   <?php if(function_exists('fetch_feed')) {              include_once(ABSPATH . WPINC . '/feed.php');               // include the     required file         $feed = fetch_feed('http://tadpoles.com/feed'); // specify the source feed              $limit = $feed->get_item_quantity(7); // specify number of items         $items = $feed->get_items(0, $limit); // create an array of items              }     if ($limit == 0) echo '
The feed is either empty or unavailable.
';     else foreach ($items as $item) : ?>
         <a href="<?php echo $item->get_permalink(); ?>"            title="<?php echo $item->get_date('j F Y @ g:i a'); ?>">             <?php echo $item->get_title(); ?>

         <?php echo substr($item->get_description(), 0, 200); ?>          [...]
          <?php endforeach; ?>      Thanks in advance.


Wordpress Automatic Update to 3.9.1 breaks Permalinks

Yesterday, WordPress 3.9.1 Maintenance Release May 8, 2014 updated my version from the latest and all of the sudden, my inside pages were broke - no one could reach anything except the home page. I went to permalinks, re-saved the custom permalinks to %postname% as they were. Unfortunately, this impacted visibility for some hours. How can I allow this auto-updater to fix security issues, but prevent this permalink break from happening in the future?


Loading shortcode stylesheet only when shortcode is in text widget

I would like to load shortcode stylesheet only when it will be put in text widget. Please help somebody.


Session Cookie security questions

I am a .NET developer but I also administer all of our corporate websites, which are all Wordpress. I inherited the sites from someone who is no longer at my company. My company recently spent a bunch of money on a security audit by consultants and they found the following issues regarding login/cookie and how they work in Wordpress. -User session cookies are not secure -session validation is not destroyed and is still active when a user logs out -session cookie includes the username in it Is there any way do fix these issues?


Change User Role based on Point System Issue

Trying to change user role based on points. This is working seems fine till it keep increasing points. The problem happens when if we decrease points it is not changing role back to below stage. Means if I have 600 points for administrator role and if user earn and role changed to administrator. After than if points goes down to 500 due to some type of negative system it should change role back to below administrator respecting to the point value in condition but this is not happening. Once role set to upper it is never going down even if point decrease.               global $wpdb;     $pref = self::qa_prefix();     $u = new WP_User($u_id);          $user_point = $wpdb->get_row("SELECT userid, points FROM {$pref}userpoints WHERE userid = {$u_id}");          if(!is_super_admin()) {                  if($user_point->points >= 600) {             $u->set_role('administrator');         } elseif($user_point->points >= 150 && $user_point->points < 600) {             $u->set_role('editor');                         } elseif($user_point->points >= 100 && $user_point->points < 150) {             $u->set_role('contributor');                         } else {             $u->set_role('subscriber');         }          }      Any suggestion or idea please.... :)


WP e-Commerce plugin is breaking drop down menus functionality

After installing WP e-Commerce plugin primary theme menu functionality got broken. Here is theme with installed WP e-Commerce plugin: http://www.interactstaging.net/clients/tozzi/ and here clean theme install which custom theme is based on: http://interactstaging.net/fusiontheme/ Any clue what can be wrong? PS. I have adjusted CSS to get sub menus to work, but still have no clue why WP e-Commerce is breaking them. PS2. Looks like CSS trick doesn't work on IE10 :\


How to customize reset_url or $reset_url

I'm trying to change the confirmation link with key and username sent by wordpress when a user forget his password. The link looks like:               /wp-login.php?action=rp&key=VZUyDIiJxJz&login=user_name      And I want to change it this way:               /new-password/?action=rp&key=VZUyDIiJxJz&login=user_name      But I don't know what filter I must use to change it. Thank you in advance for your help and time. Found a solution, putting this code in my theme functions.php. Maybe there's a best solution out there... I think change all the message is not a good way:               function reset_password_message( $message, $key ) {          if ( strpos($_POST['user_login'], '@') ) {         $user_data = get_user_by('email', trim($_POST['user_login']));     } else {         $login = trim($_POST['user_login']);         $user_data = get_user_by('login', $login);     }          $user_login = $user_data->user_login;          $msg = __('The password for the following account has been requested to be reset:'). "\r\n\r\n";     $msg .= network_site_url() . "\r\n\r\n";     $msg .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";     $msg .= __('If this message was sent in error, please ignore this email.') . "\r\n\r\n";     $msg .= __('To reset your password, visit the following address:');     $msg .= '<' . network_site_url("new-password/?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";          return $msg;          }          add_filter('retrieve_password_message', reset_password_message, null, 2);


Wordpress metaboxes - textfield suggestion automatically populated

**[Long story short]** Is there any Wordpress plugin/function that would allow the creation/integration of a metabox's textfield that automatically populates a dropdown menu (in the admin area, while in the article creation screen) where to pick the desired value withouth having to write it down by hand every time? And if so, is there anything like that? **[A little bit of information]** I'm taking care of an infected Wordpress site by doing a fresh new installation and configuring it from scratch. The owner used "Verve metaboxes" in order to manage 3 custom fields (coutry, town, and address): he states that - while creating a new article - he could click on the country textfield and pick from a populated dropdown menu the correct value. He then proceded to say that once   he selected a county and clicked on the "town" textfield, he would get a list of the towns of THAT and ONLY country. The same goes for the street (once selected the town, he would get only results for that town only). Verve Metaboxes is now discontinued due to vulnerabilities and I cannot (nor want) to use it - I've then spent a few hours trying to find an alternative and/or a tutorial that would allow me to duplicate this feature but I couldn't find any. So I wonder, is there anything like that or the owner of that website is merely delusional/trying to ask for new features without any clue? Thanks in advance


BP Multi Network & Members Directory

With bp-multi-network it appears members are shared across all networks. Example - networks based on location. newyork.mydomain.com, losangeles.mydomain.com, vancouver.mydomain.com At present a member of any network is listed in any other network's members directory if they are active in the other network. So each Members Directory lists all members of the entire installation who have accessed that network. So if a "New York" member becomes active on the "Los Angeles" network they are listed in the Los Angeles Members Directory and vice-versa Now what if I also wanted a members list of just those members who joined in New York and a members list of just those members who joined in Los Angeles and a members list of just those members who joined in Vancouver etc etc. A viable solution is perhaps if I had 1) a required registration field (Your Location) drop down with the locations and then 2) a page on each network listing the members who have listed this location in the required field registration form I understand this involves interacting with WP_Query about which I have not got the faintest clue. If there is anyone out there who can attempt this or even point me in the right direction I'd be thrilled.


How to hide certain plugins from other admins?

I'm running a WP site for a client (who has an admin account) and I'd like to hide certain plugins that I've installed. Is there a way to hide certain plugins (not all) from the list for specific users? I'm not interested in user _roles_ , rather hiding certain plugins from specific user _names_. Thanks!


if is_home(), change class of menu-item-225 of wp_nav_menu

Thanks for taking the time to check this out. I know it's outdated, but I'm using Wordpress 3.2.1. I have a Custom Home Page - where I created a Page for it and titled it as my Home Page with the custom URL. I was hoping someone on here will know how to target the Custom page (whether by PHP, Javascript, etc), so that if it's on the home page, I can change the `menu-item-225` to have a class of `current_page_item`. On my header.php, I have the following code.               if (is_home()) {             wp_nav_menu(array('depth'=>0,'menu_class' => 'mainNavigation','container_id' => 'navwrap','menu'=>'Main Menu','link_before'=>'','link_after'=>''));                                }             else {                 wp_nav_menu(array('depth'=>0,'menu_class' => 'mainNavigation','container_id' => 'navwrap','menu'=>'Main Menu','link_before'=>'','link_after'=>''));                                }


Adding Contact Form 7 to my anti-spam rules in .htaccess

I have the following rules set in my `.htaccess` file to block spam. It works by not allowing anyone to login, register, or make a comment unless the conditions are met. It works, but I would like to add **Contact Form 7** _(version 3.2)_ in there somehow.               RewriteCond %{HTTP_COOKIE} !^PHPSESSID=\w+ [OR]     RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?example\.com/ [NC,OR]     RewriteCond %{HTTP_USER_AGENT} ^$     RewriteRule ^wp-(comments-post|login|register)\.php http://example\.com [R=301,L,NS]      I've tried using `wp-contact-form-7.php` and `submit.php`. I've also tried using the uri `/contact-us/` where the contact form is located and none work.


New image size version only for the Featured Image file

I'm worried about too many files created when adding a new image size. All uploaded files will generate the new size, **I need a specific image size only for the file set as Fetured image, is there some way to do this?**. The _thumbnail_ , _medium_ , etc are ok, but there is no need to create the new size for every file. I think this should work right after setting the Featured Image.


How can I include active content in a custom post type?

Related to my How do I create a custom post type for a training CMS in WordPress? question, if I have a custom page type created for the presentation of training content, how could I include active content, such as a multiple choice test in some of these training pages? would very much prefer that the training page (i.e. my custom post type) is aware of the test, and acts as a micro-LMS, handling navigation back and forth between questions etc. It would break my cold, hard heart to simply plug the test into an iframe, so what else can I do?


Cannot use 'CSS' in post title

**Issue?**   Whenever I use the term 'CSS' in a post title, the rest of the title (after the term 'CSS'), is inserted at the top of the single post page. **What steps will reproduce the problem?**   1. Create a new post.   2. Type 'CSS' somewhere in the post title.   3. Preview/publish the post. **What is the expected output? What do you see instead?**   I expect to see the page title appear as normal, which it does. However, at the top of the page, above the opening body tag, everything in the title after the term 'CSS' is inserted. **What version of the product are you using?**   WordPress 3.3    Here is a link to illustrate the issue: http://joshnh.com/2001/12/test-css- title/


How do I create a custom post type for a training CMS in WordPress?

I need to create a custom post type based on the existing 'Page' type, for a WordPress based training CMS. I have no problem simply creating a new post type, but I would like to offer some kind of templating in these training pages for the inclusion of standard, repeated content such as instructions, as well as the possible inclusion of simple multiple choice tests in each page type. How can I go about this? What areas of the Codex should I be studying?


How could I create a 'private comments' section on a custom post type?

Related to my How do I create a custom post type for a training CMS in WordPress? question, I would like to know how I can create a private comments section for a custom post type (or any post type for that matter, if possible), where these comments are only visible to their author. I am working on a training CMS and students should be able to make private study notes on the training content pages as they work through them.


Custom Post Type Template Based on Page Slug?

I have a hierarchical custom post type (missions) setup. I want to create a few child pages for it (discuss, petition, educate), but I want each of those child pages to display a different template. There does not appear to be a way to use a selected template, like on a normal page, so I thought maybe I could just have the child custom post type pages display content based on their slug. So the permalinks would appear as:               /mission/mission-01/      - /mission/mission-01/discuss/      - /mission/mission-01/petition/      - /mission/mission-01/educate/          /mission/mission-02/      - /mission/mission-02/discuss/      - /mission/mission-02/petition/      - /mission/mission-02/educate/      Since they are children, and the Discuss pages could all use the same slug, maybe a function that gives all pages with slug /discuss/ the page-discuss- template.php from my theme directory. Thanks for any help!


How should I add links to other pages/posts from my post?

I'm wondering how should I link to other posts from one of my posts. Ideally I would use a function like get_permalink() but php is not available in post content, so how can I link to other pages ensuring the links won't break if I change the post/pages slugs?


The Loop isn't working

I can't get the loop to work as it's supposed to, without using the not-so- recommended:               <?php query_posts('post_type=post&post_status=publish&paged='. get_query_var('paged')); ?>      I'm using a custom page template named "template-blog.php" with this content: http://pastebin.com/raw.php?i=9W3akEcX And here's the "content.php" file: http://pastebin.com/raw.php?i=EH6xhzLQ Using that loop, I get only one post, which is actually a page to which I've assigned the "template-blog.php" template, in the form of a post - only the title, since I haven't added any content to it when I created it the dashboard. Is there anything wrong with my code above? Thanks.


Why is my Blog Page ID == First Post ID?

It is possible that I'm doing something wrong. Currently I'm using `index.php` as the main blog page. I have a page setup for the Blog and set it up in my Settings. When I try to get the Blog Page ID though it always shows the first posts ID instead. I'm not running any additional queries anywhere besides the normal Loop. Why is my code showing the Post ID versus the Page ID? **Index.php Code:**               <?php get_header(); ?>          <?php get_sidebar(); ?>          <?php         echo $post->ID;  // First Post ID         echo get_queried_object_id(); // First Post ID     ?>
     <?php if(have_posts()) : ?>                     <?php while(have_posts()) : the_post(); ?>                         <div <?php post_class('blog-entry') ?> id="post-<?php the_ID(); ?>">
                                 <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">                                     <?php the_title(); ?>
                                                              by Company <?php the_time('F jS, Y') ?> /                                  <a href="<?php the_permalink(); ?>/#comments">Share Comment
                                 <?php the_excerpt(); ?>

                                                                      <a href="<?php the_permalink(); ?>" title="Read More">Continue Reading »

                     <?php endwhile; ?>
                         <?php previous_posts_link('« Previous Page'); ?>                         <?php next_posts_link('Next Page »'); ?>
                 <?php endif; ?>
     <?php get_footer(); ?>


How to use is_multisite() in a must-use-plugin?

I want this code to be executed in a plugin in the _mu-plugins_ folder. When executing in _functions.php_ everything works fine, but when I try it as a plugin in _mu-plugins_ this creates a blank page.               if (( is_multisite() && !current_user_can('manage_network') ) || ( !is_multisite() && !current_user_can('create_users')))  {       add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );       add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );       add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );     }


Posting via HTTP requests?

Is there any way to do auto blogging on WordPress? What I want to do is to submit a new blogging entry through a HTTP request rather than through the WordPress UI. I know that I can do it using email, but I don't want to go through any mail server.


Formatting Standard Post Format

I'm looking to display an image for all the "standard" post formats on my site. I have done some research on how to add quote, video, photo, etc and have been able to implement these images into the site but when it comes to the "standard" post type I get nothing! I have done all the necessary steps in the functions.php file:               add_theme_support( 'post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', 'audio' ) );       And my code to display the images is as follows:
          <?php if(has_post_format('video')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/video.png" alt="Video" />         <?php } ?>          <?php if(has_post_format('image')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/photo.png" alt="Photo" />         <?php } ?>          <?php if(has_post_format('standard')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/text.png" alt="Text" />         <?php } ?>          <?php if(has_post_format('audio')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/audio.png" alt="audio" />         <?php } ?>          <?php if(has_post_format('aside')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/aside.png" alt="aside" />         <?php } ?>          <?php if(has_post_format('gallery')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/gallery.png" alt="gallery" />         <?php } ?>          <?php if(has_post_format('link')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/link.png" alt="link" />         <?php } ?>          <?php if(has_post_format('quote')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/quote.png" alt="quote" />         <?php } ?>          <?php if(has_post_format('status')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/status.png" alt="status" />         <?php } ?>          <?php if(has_post_format('false')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/standard.png" alt="standard" />         <?php } ?>          <?php if(has_post_format('chat')) { ?>         <img src="<?php bloginfo('template_url'); ?>/post-icons/chat.png" alt="chat" />         <?php } ?>      Can anyone help me out on how to get the standard post images to display?


How Do I Allow Comment Moderation for Other User's Posts?

I want to setup a user account that only has access to moderate comments - for all posts - but doesn't have access to edit any posts. When I give the user the moderate comments privilege (using an old role manager plugin), it doesn't let them moderate comments on other articles. Is there a plugin that does this, or something I'm doing wrong?


Attaching taxonomy data to post with wp_insert_post

I am implementing (trying) a front end posting system which shows taxonomy data in several dropdown select fields, each of the dropdowns is named by using the "name" $arg in wp_dropdown_categories.               <?php wp_dropdown_categories('taxonomy=location&hide_empty=0&orderby=name&order=asc&name=location') ?>        as you can see taxonomy is "location" and select name is "location". I then add the variables for each of the taxonomy select dropdowns like so along with post_title, post_content etc:               $title      = trim($_POST['wpuf_post_title']);     $content    = trim($_POST['wpuf_post_content']);     $tags       = wpuf_clean_tags($_POST['wpuf_post_tags']);     $customcategory      = trim($_POST['customcategory']);     $cat        = trim($_POST['cat']);     $location        = trim($_POST['location']);     $sale_rental        = trim($_POST['sale_rental']);     $price        = trim($_POST['price']);      and finally i add the extra info into an array ready to be sent by wp_insert_post, im quite stuck on whether i am doing the right thing by adding tax_input into the array like below as this is what i seem to be understanding from codex that i need to do.               'tax-input'    => array( $location,      $sale_rental,      $price      ),      so that it all ends up looking like this:               $my_post = array(                 'post_title'    => $title,                 'post_content'  => $content,                 'post_status'   => $post_status,                 'post_author'   => $userdata->ID,                 'post_category'    =>    array($_POST['cat']),                 'post_type' => $customcategory,                 'tags_input'    => $tags,                 'tax_input'    => array( $location,                                          $sale_rental,                                          $price                 ),         );          $post_id = wp_insert_post($my_post);      however when i submitted the new post, all the standard post data (and also my custom post type) goes in ok, but the taxonomies do not, im obviously doing something wrong, but what?


Plugin directory "Last Updated" not changed after initial commit?

I released the first version of my Rewrite analyzer plugin with a commit on 2010-05-12. The WordPress.org plugin directory however still displays 2010-11-27 as the "Last Updated" date - this is the date when the plugin directory was created in the repository. The Developer FAQ states: > Last updated time   >  Time of last check in to the appropriate directory (trunk/ or the stable > tag directory) **after a version number change**. Most developers commit their first version right after their plugin directory gets created, so you won't notice the difference. But I have seen the same discrepancy in other plugins that were committed more than one day after the directory was created. I committed both the `trunk/` and `tags/1.0/` directories in one go (with a local copy and then a commit), but the other plugin with this problem did it like most people do: a commit of `trunk/` and then a remote copy to `tags/1.0/`. Otto recently said: > The only time the readme gets parsed and the entry gets rebuilt is when the > version of the plugin changes. However, for people using tags, this > generally happens after they make the new tag and update the Stable Tag. The readme file got parsed, so I don't know what else I could have done to make it update correctly?


Difference between after_setup_theme and init action hooks?

What is the difference between the `after_setup_theme` and `init` action hooks? It seems they are both called right before any page in WordPress is loaded (even admin pages).


Is there a faster way to git-svn clone a wordpress plugin from the subversion repository?

When cloning a SVN repo with git-svn it searches laboriously through every revision for changes that are relevant (at least as I understand it). Is there anyway to make this process quicker? I found this link: http://stackoverflow.com/questions/747075/how-to-git-svn- clone-the-last-n-revisions-from-a-subversion-repository that suggests it is possible to limit the number of revisions, just need to figure out how far back to go and how to find that number


Twenty Eleven unregister all default sidebars?

I need to unregister all the default sidebars in the Twenty Eleven theme so I can add custom left and right sidebars via the functions.php file in a child theme. This function below is for Twenty Ten; but I don't know where to find the correct strings for the widget areas for Twenty Eleven, which are called Main, Showcase and Footer Areas one, Two and Three.               function remove_some_widgets(){              // Unregister some of the TwentyTen sidebars              unregister_sidebar( 'first-footer-widget-area' );         unregister_sidebar( 'second-footer-widget-area' );         unregister_sidebar( 'third-footer-widget-area' );         unregister_sidebar( 'fourth-footer-widget-area' );     }     add_action( 'widgets_init', 'remove_some_widgets', 11 );


Stop wordpress automatically escaping $_POST data

I have a custom front end form which creates a custom post type post and have just discovered WordPress automatically escapes $_POST data in the same way that Magic Quotes does. I have Magic Quotes disabled and have created a test form that I run on the same domain. When run on it's own, no data is escaped. However when I run it as a page template for a WordPress page the raw $_POST data is escaped, i.e. using print_r($_POST) so before there has been any processing done. I have also tried this with multiple themes and the same result. Anyone know where / how to shut this off? Is there a filter I can suppress for this form? Cheers.


How can I include a setting that has a variable number of values in a settings page using register_setting?

I have one option on a settings page that can have between 1 and 5 values. I have a basic understanding on how to set up single value settings using the Settings API, but how do I go about generating the markup etc. for the setting with a variable number of values?


js error on post editing page

I'm getting a Javascript error on the wp-admin/post.php page which prevents me from adding tags/editing the post's link.. pretty much everything with JS... anyway, the error is:               > Error: d.delegate is not a function     > Source File:     > http://www.mysite.com/wp-admin/load-scripts.php?c=1&load=hoverIntent,common,jquery-color,schedule,wp-ajax-response,autosave,wp-lists,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-resizable,jquery-query,admin-comments,suggest,jquery-ui-sortable,postbox,post,word-count,thickbox,media-upload&ver=c1c854f5d9062306d43d7331055686c9     > Line: 42      **UPDATE**   Only solution that seemed to work was downgrading the Wordpress website to 3.0.5   I'm not sure why is this happening, but after 5 hours of debugging - I don't care