Better handling of WP-CRON server load abuse

There are multiple reports on how wp-cron is a far from ideal solution because it runs every time a page is loaded, which is unnecessary in most scenarios (one scenario in which it would be necessary is when you use _scheduled posts_ ) The common advice is to add `define('DISABLE_WP_CRON', true);` to wp- config.php then schedule a real cron job (if you have enough admin access to so). But **as of WP 3.3, there isWP_CRON_LOCK_TIMEOUT**, which " _defines a period of time in which only one cronjob will be fired_ ". If you run hundreds of WP installs you would have to create (and delete, when that wp install is removed) a LOT of cron jobs, which can become a nuisance. Therefore, it **seems that the best solution these days is setting`define('WP_CRON_LOCK_TIMEOUT', 900);`** (if you want wp-cron to run every 900 seconds). **The question is: has anyone used WP_CRON_LOCK_TIMEOUT with this purpose yet? Is this its intended use?**


Wordpress ajax works on FF but not on IE & chrome

I have the following code               Show More      and the following PHP code:               add_action('wp_ajax_load_posts', 'pe_ajax_load_posts');     add_action('wp_ajax_nopriv_load_posts', 'pe_ajax_load_posts');     function pe_ajax_load_posts() {         $offset = $_POST['offset'];         $html = pe_load_posts(intval($offset)+1);         echo $html;         die();     }     function pe_load_posts($page)  {         $news = new WP_Query(array('posts_per_page' => 2, 'post_type' => 'post', 'paged'=>$page));         if ($news->have_posts()):              $html .="
";             while($news->have_posts()): $news->the_post();                 $html .='

'.get_the_post_thumbnail(get_the_id(), 'fp-thumb' ).'
';                 $html .= '

'.get_the_title().'
';                 $html .='
'.get_the_excerpt().'
';                 $html .= '
'.__('Read More', 'pe').'

';             endwhile;              $html .= "
";         endif;         return $html;     }      The code works fine on FF and I get an extra 2 posts blocks on IE & chrome however it does not. I get an empty response any idea? this is the link: http://test.hannitcohen.co.il/pe/?lang=en


Nested shortcodes

I'm using 2 plugins in my wordpress blog - WP-Members and Dropbox Folder Share. I want to do something like this:               [dropbox-foldershare-hyno link="[wp-members field="some_link"]" ver_como='lista']      Is this possible?


Add dynamically Get Request For Every links On the Site For Style Switcher

<?php session_start(); ?>          <?php        $_SESSION['sel_color'] = "blue";       if ( isset($_GET['color']) ) {              switch ($_GET['color']) {           case 'red':             $_SESSION['sel_color'] = "red";             break;                case 'green':             $_SESSION['sel_color'] = "green";             break;                case 'orange':             $_SESSION['sel_color'] = "orange";             break;                     default:             $_SESSION['sel_color'] = "blue";             break;         }            }       //Let's say this is a draft set session               ?>      This is a color changer links                    <a href="<?php echo $_SERVER['PHP_SELF']; ?>?color=red">Red
     <a href="<?php echo $_SERVER['PHP_SELF']; ?>?color=green">Green
     <a href="<?php echo $_SERVER['PHP_SELF']; ?>?color=orange">Orange
          <?php        // This is draft print out for which session name is on the page!       echo $_SESSION['sel_color'];     ?>      If I select one color, how do I dynamically add " **?color=color_name** " to every links on the site. As you know, a site can have hundreds of links, So, how to add "?color="color_name" automatically in every links on the site after I clicked one selected color.! Thanks all.


Where does the time get pulled from in the_time()

I am currently using the following function in my footer               <?php the_time( 'Y' ); ?>      But the footer keeps showing 2011, instead of 2013. So where does this time stamp get called from exactly?


Redirect Main Site to Subsite in Multisite Wordpress

I have multi-site wordpress, I want to redirect the main site to one of the sub-site but redirection in .htacecss gives error. Is there any way to redirect a main site to its sub-site. That looks not possible but I am not a wordpress expert so just verifying. The redirect should be like redirect 301 www.example.com/main-site www.example.com/main-site/sub-site Or if there is any other way to do that?


Insert new term during new post creation

i am currently working on a snippet to insert a new post dynamically (it's a custom post type). During this new post creation i need to insert terms in custom taxonomies associated to the custom post type. I am having the famous "invalid taxonomy" error message and i don't know how to solve this. Here is the code i'm using:   * the custom post type is: property   * the custom taxonomy is: type Code:               // Insert property into DB     $property = array(         'post_title'   => $title,         'post_content' => $description,         'post_status'  => 'draft',         'post_author'  => 1,         'post_type'    => 'property'     );          // Insert the post into the database     $property_id = wp_insert_post( $property );                   // Taxo Property Type     if( $property_type ) {              // check if term exists         $property_type_term = term_exists( $property_type, 'type' );              if( $property_type_term !== 0 && $term !== null ) {             // Term exists, get the term id             $property_type_term_id = $property_type_term;         } else {             // Create new term             $property_type_term_id = wp_insert_term(                                         $property_type,     // the term                                          'type'          // the taxonomy                                     );         }              // Assign term id to post         wp_set_post_terms( $property_id, array($property_type_term_id), 'type' );          }      With this code, the post is correctly created but the term not. Any help would be much appreciated!


Import posts with featured images

I am trying to make an import of posts from my old blog installation. It works fine for posts content but fails for featured images. I've done: tools -> export -> posts -> selected a category. In the xml i can see the fields of the featured images with the old path...but in the back-end i can't see any featured image uploaded... Is there something i am missing?


Pre-populate Username Field

I have a strange request, but hopefully it's doable. I want to be able to have several logos, for my clients, on my site. Depending on what logo they click it takes them to the login page with the username already entered. So, if they click on the "Bob's Grill" logo, it takes them to the login page with the "Bob's Grill" username already entered. Is there any way to do this? Thanks!


Theme compression/ minifying or W3 Total Cache - which should I use?

I run a WP3.x Multisite setup. One of the themes I use on a site has options for minifying, using Gzip compression and using data URIs for images (not sure what the latter function is or does). In the past, I have used W3 Total Cache, in combination with Cloudflare. What is the best practise here - should I defer to the theme's compression settings, or is it prudent to let W3 Total Cache take care of everything?


Plugin to auto convert custom fields to tag

I have 3 custom fields that i would like to have automatically converted to tags anytime the post has them. Custom field names: tag_name1, tag_name2, tag_name3 Is there a plugin or function that i can add to do this? I added it to my functions but i get this error: Warning: Invalid argument supplied for foreach() in /home/content/46/8529846/html/wp-content/themes/super-light/functions.php on line 94 Warning: Cannot modify header information - headers already sent by (output started at /home/content/46/8529846/html/wp-content/themes/super- light/functions.php:94) in /home/content/46/8529846/html/wp- includes/pluggable.php on line 866               <?php     if ( ! isset( $content_width ) )     $content_width = 650;          add_action( 'widgets_init', 'super_light_sidebars' );          function super_light_sidebars() {     register_sidebar(array(         'name' => __( 'Sidebar Widget Area', 'super_light'),         'id' => 'sidebar-widget-area',         'description' => __( 'The sidebar widget area', 'super_light'),         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
',     ));     }          register_nav_menus(         array(           'primary' => __('Header Menu', 'super_light'),           'secondary' => __('Footer Menu', 'super_light')         )     );          //Multi-level pages menu     function super_light_page_menu() {          if (is_page()) { $highlight = "page_item"; } else {$highlight = "menu-item current-menu-item"; }     echo '
';     wp_list_pages('sort_column=menu_order&title_li=&link_before=&link_after=&depth=3');     echo '
';     }          //Single-level pages menu     function super_light_menu_flat() {         if (is_page()) { $highlight = "page_item"; } else {$highlight = "menu-item current-menu-item"; }         echo '
';         wp_list_pages('sort_column=menu_order&title_li=&link_before=&link_after=&depth=1');         echo '
';     }                         add_editor_style();     add_theme_support('automatic-feed-links');     add_theme_support('post-thumbnails');          set_post_thumbnail_size( 120, 120, true ); // Default size          // Make theme available for translation     // Translations can be filed in the /languages/ directory     load_theme_textdomain('super_light', get_template_directory() . '/languages');          function catch_that_image() {       global $post, $posts;       $first_img = '';       ob_start();       ob_end_clean();       $output = preg_match_all('//i', $post->post_content, $matches);       $first_img = $matches [1] [0];            if(empty($first_img)){ //Defines a default image         $first_img = "/images/default.jpg";       }       return $first_img;     }          add_action('save_post','custom_field_add_tags');          function custom_field_add_tags($post_id) {           $post = get_post($post_id);           //get values of custom fields and put into array           $tag1 = get_post_meta($post_id, 'tag_name1', true);      $tag2 = get_post_meta($post_id, 'tag_name2', true);      $tag3 = get_post_meta($post_id, 'tag_name3', true);      $tag4 = get_post_meta($post_id, 'tag_name4', true);      $tag5 = get_post_meta($post_id, 'tag_name5', true);      $tag6 = get_post_meta($post_id, 'tag_name6', true);      $tag7 = get_post_meta($post_id, 'tag_name7', true);      $tag8 = get_post_meta($post_id, 'tag_name8', true);      $tag9 = get_post_meta($post_id, 'tag_name9', true);           $tags_to_add = array($tag1, $tag2, $tag3, $tag4, $tag5, $tag6, $tag7, $tag8, $tag9);           //now check if tag does not already exist (if no - add tag from custom field)           $add_tags = array();           foreach(get_the_terms($post_id, 'post_tag') as $term)              if(!in_array($term->slug, $tags_to_add))             $add_tags[] = $term->slug;           if(!empty($add_tags))         wp_add_post_tags($post_id, implode(',', $add_tags));     }          ?>


Related post thumbnail not showing up

I have created a 'related posts' custom field and would like to loop through all the posts that are added as a relation and show a bit of info from each (the title, a link and the featured image). I've got the title and permalink coming through nicely, but for some reason I can't get the related posts featured image to appear. I'm hoping someone can point me in the right direction? Here's the code I'm using to create an array of all the post info:               $relatedPosts = get_custom_field('relatedposts:to_array', 'get_post');          foreach ($relatedPosts as $p) {       $postTitle = $p['post_title'];           $postID = $p['ID'];       $postPermalink = $p['guid'];       $postTNID = $p['thumbnail_id]'];            $post_html[] = '
' . $postTitle . ' '. wp_get_attachment_image($postTNID). '
';          }//end foreach      Then I use the following to show it on the page:               if ($relatedPosts != "") {      echo implode("\n", $post_html);     }      Everything except the image works...


Wrong image dimensions in Insert Media after add_image_size()

I am creating a custom Wordpress theme based on the Bones WP theme. I'm having a problem where an image size that I've specified in functions.php using `add_image_size()` isn't showing the correct `width x height` in the Insert Media dialog. This is how I add the new image size in functions.php               add_image_size( 'portfolio-image-full', 800, 400, true );      And using the existing Bones functions, this is how I make this image size appear in the Attachment Display Settings               add_filter( 'image_size_names_choose', 'bones_custom_image_sizes' );          function bones_custom_image_sizes( $sizes ) {         return array_merge( $sizes, array(             'portfolio-image-full' => __('Portfolio large image'),             'portfolio-image-small' => __('Portfolio small image')              ) );     }      But after uploading an image the 'Portfolio large image' size is 640x320, when it should be 800x400: ![enter image description here](http://i.stack.imgur.com/X9tbg.png) What am I doing wrong?


A page created with url of blog redirects to the posts page, how do I stop this?

I have a simple site where I want to handle blog posts with a custom page template. So I've created a new page called blog with a document url value of "blog". My custom php template page was created with               /*     Template Name: Blog Page     */      and this "blog page" has been assigned to my new wordpress page. All that works as expected until I try to view the WP page. Instead of seeing the custom HTML I would expect I instead see the standard wordpress posts listing page. To clarify: the custom template page I made is definitely not being presented to the screen even though no url redirect has occurred and we are apparently viewing my "blog" page. I added unique HTML markup to my custom template so I would be able to clearly identify it when it shows and that isn't appearing. I've made sure in Settings/Reading that the "Posts page" dropdown is set to my custom page but still no luck. Can someone tell me whats going wrong here=? I assume a page url name of "blog" is maybe not allowed as its reserved? Although WP doesn't complain about it at any point.


I need to disable Disqus comments pre-approval, but i can't find where

I've tried contacting Disqus support but they haven't answered. I need to disable pre-approval for comments but i can't find where to set that option. Could anyone help me? Thanks.


Can I rewrite URLs for tags to be children of the CPT they refer to?

I'm creating a site with multiple custom post types and taxonomies, and I need to restructure the URLs for the taxonomies so that they appear "beneath" the urls for the CPT archives. For example, I have a CPT archive page at:               /portfolio/      And I have taxonomies called               skills           /* which can be found at /skills/ */     technologies     /* which can be found at /technologies/ */      Both of those custom taxonomies are specific to the `portfolio` custom post type, and I could do with rewriting the URLs for them to appear like this:               /skills/        -->  /portfolio/skills/     /technologies/  -->  /portfolio/technologies      Because they apply only to the portfolio CPT, it makes sense for me to do this (more importantly, it's what the client wants), but I'm not too familiar with WP_Rewrite class, and don't know how to go about implementing such a change. I've tried using `add_rewrite_rule` but it doesn't seem to be working, even after flushing the rewrites. I'm not sure I've fully understood the docs at Codex.wordpress. Can anyone help? Just need an idea of how one of these rewrites would look, and I can work it out from there. Thanks


Running a wordpress action when a custom post type term (taxonomy category) is changed

Trying to make a system whereby a function is called upon an admin changing the taxonomy category (term - if i understand correcrtly) of a custom post type. I thought the action tag "edit_category" would do this, but doesnt seem to work:               add_action('edit_category_form', 'myFunction');      Any ideas? Thanks!


Drop down list with posts within the "add new" page

Quick explanation : When I add a new "Company" (custom post type), I have a drop down menu listing all the companies to choose if the one i'm creating depends from another one. I got 3 metaboxes, the dropdown is in the first one.               In functions.php :     <select value="<?php echo $subsidiary; ?>" name="subsidiary">     <?php     $args = array( 'post_type' => 'company');     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();     ?>     <option value="<?php echo the_ID(); ?>" ><?php the_title() ?></option>     <?php     endwhile;     ?>     </select>      The dropdown is listing all the companies as i want, but when i create a new company, all fields located after my dropdown take the values from the first company in my list, and i can't change them. Any clues? Thanks in advance.


Community Moderation Plugin for Comments

Is there any wordpress plugin that allows the community to moderate the comments by themselves in Slashdot style? I found a plugin that allows the visitors to like or dislike the comments. But it doesn't provide any moderation functionality beyond collecting the ratings. I would like to be able to set rules based on these ratings such as whether a comment will be hidden. The plugin should also manage the reputations of the commenters in Stackexchange style.


Update Wordpress automatically on its own

Is it possible to update Wordpress automatically so that when there's a new version of Wordpress, my installation will update itself automatically without me having to login to admin > update ?


Linking doctors posts to specific services for a medical practice

Hi I am creating a website for a doctors clinic and I need some help with the code and structure. I have different service posts i.e. Dentistry, Exercise ecg and Chelation Therapy, all these posts have a category with the same name of the the post i.e. Dentistry, Exercise ecg and Chelation Therapy. I then have posts about each doctor i.e. dr joe and dr jane. I need to link the Doctors with the services they practice so the service pages would be like this: **Dentistry.php** Dentistry is blah blah blah. Practiced by **Dr. Joe** (link to dr.joe.php) **Exercise ecg.php** Exercise ecg is blah blah blah. Practiced by **Dr. Jane** (link to dr.jane.php) **Chelation Therapy.php** Chelation Therapy is blah blah blah. Practiced by **Dr. Joe** (link to dr.joe.php), **Dr.Jane** (link to dr.jane.php) I presume it is an if statement but my PHP is pretty basic so i am not sure where to start. Thanks for your help.


Why WordPress doesn't show pictures when I upload them in a new post?

I have a serious problem. When I write a new post in the edit window, I try to upload a picture via the media upload button, and it just doesn't add them. I just cant upload any type on media at all to my posts. How can I fix it?


Web System Architecture

We are building a web system in wordpress. I have read some articles on how to architect a wordpress web system. I really liked the one which suggested using loose MVC Pattern. I have read a couple of books and they all have topics on plugin development and theme development but none talk about architecture choices. **Question** : I am thinking of implementing the loose MVC Pattern (as suggested in the article) for a wordpress project. I would like to know if I should have a plugin for each module developed on the site or just have one big plugin for the whole site. If your answer is small plugins doing specific things, then what do I do with the Utilities that I write? Should they go in a plugin by itself? I need some suggestions on how to architect my solution.


Custom the_content filter?

I have written a plugin which uses a WYSIWYG editor to output a custom success or error message that the user can specify. HTML is allowed within the WYSIWYG editor, and I have used the_content filter to format the messages on the front end. One issue I am running into, is that some of my users use other third party plugins such as sharedaddy or share this which also hook into the_content filter to output custom share buttons. To work around this, I have tried to create a custom content filter of my own to use (which replicates the original) but have renamed it something else to try and avoid the other plugins from hooking in. This is my custom content filter function:               /****     Custom The_Content filter     used to prevent other plugins from hooking here     ****/         function yks_mc_content() {             //Create our own version of the_content so that others can't accidentally loop into our output - Taken from default-filters.php, shortcodes.php, and media.php             if ( !has_filter( 'yks_mc_content', 'wptexturize' ) ) {                 add_filter( 'yks_mc_content', 'wptexturize'        );                 add_filter( 'yks_mc_content', 'convert_smilies'    );                 add_filter( 'yks_mc_content', 'convert_chars'      );                 add_filter( 'yks_mc_content', 'wpautop'            );                 add_filter( 'yks_mc_content', 'shortcode_unautop'  );                 add_filter( 'yks_mc_content', 'prepend_attachment' );                 $vidembed = new WP_Embed();                 add_filter( 'yks_mc_content', array( &$vidembed, 'run_shortcode'), 8 );                 add_filter( 'yks_mc_content', array( &$vidembed, 'autoembed'), 8 );                 add_filter( 'yks_mc_content', 'do_shortcode', 11);             } //end has_filter         } //end yks_mc_content         add_action( 'init', array( &$this, 'yks_mc_content' ), 1 );      When displaying the content on the front end, I am doing this:                echo apply_filters( 'yks_mc_content' , $custom_message );      But for whatever reason, it looks like other plugins such as share this and sharedaddy are still able to hook in to the function which is causing styling/javascript errors. Do I need to remove one of the above filters to my filter, or have I just missed something? I want to use the_content filter but I don't want any other plugins to be able to hook into this function. Thanks!


Plugin settings page template

When creating plug-ins for WordPress, there are times when you need to make a settings panel. Sometimes, you need more than one page, and they can be quite complicated. So far, I have been programming/coding them alone. I try to make most of the WordPress original Admin design, but for sophisticated panels, I get a spaghetti of PHP and HTML code. Also, every time, I have to write code that gets the data submitted by the user, analyses and saves it, and return a response. What solution are you using for your plugins? Are you using a template engine, or just mixing PHP code with HTML? Are there ready framework that offers such a solution? **Update** I found the solution to this problem. It's provided by WordPress, and it's very simple and intuitive. This blog post describes how to use the settings API which allows to create a settings/option page with ease.


Saving Custom Fields Defined in BuddyPress' register.php

I am writing a custom app for a client that is based on BuddyPress and WordPress. One of the requirements is a custom registration form. To accomplish this, I have managed to hack a custom register.php together inside of a child theme which does the trick. The part where I am stuck, however, is getting BP to save my custom fields without hacking the core. I understand that I might be able to use the "user_register" hook to save the fields but I am not sure if that is the best way and if it is where in the database to store the custom fields. Can anyone point me in the right direction? Thanks! P.S. I also need a second submit button that redirects to a different page than the normal one for further processing but I may be able to figure this out myself.


How to get sub-categories to display same look as there parents

so I am trying to use the category.php to do all this, and basically I have 3 main/parent categories, Dream it. Build it. Get The Hell Out. and will have many sub-categories under them. What im trying to do is display the title / and related image etc of the parent category through-out the parent and sub-categories so for example : If I am in a sub-cat that is under the parent cat "Dream It", it will still say the title / related styles from the parent. I hope this makes sense. right now I'm messing with and trying to achieve this like so , here is the code:
     <?php     if (is_category('dream-it'))     {echo '
Dream It.
';}     if (is_category('build-it'))     {echo '
Build It.
';}     if (is_category('get-the-hell-out'))     {echo '
Get The Hell Out!
';}     ?>
      But of course when i go into a sub cat, its just blank, could this maybe be achieved by using an else if, or somthing? any help would be amazing! thank you so much!


Mixing custom post type and taxonomy rewrite structures?

I have the following setup: **post types**   fashion **Global Taxonomies (linked to all post types)**   issue_name **Singular Taxonomies (just linked to fashion post type)**   men   women I want my permalink structure to be:   /%issue_name%/%posttype%/%postname%   which would output:   myissue/fashion/men/mypostname I've tried Taxonomic SEO Permalink plugin which works well for Taxonomy based permalinks, but my permalink has taxonomy AND posttype & postname.. Thankyou for helping!!


Flash Intro is embedded in a html, how do I integrate as my first page

I still learning how to work with WordPress. I know little of php. I have a flash intro that was done in a html file. I would like to find out how to integrate this as the first page on the website. The website is already set up to be a static website. I do not want the header, footer, navigation bar or anything else to display. I just want the intro then it automatic goes to the website. If you click on http://jds-productions.com/Intro it will show you how I want it set up. I want this but when they type in http://jds-productions.com/ it displays just the intro first not the website, just like the link above does. I already tried following Wordpress Creating_a_Static_Front_Page, that did not work. It displays all the other information and puts the intro in the body of the website. I don't know if it is due to the whole website is already set up as a static pages. Can someone steer me in the right direction. Thanks


Overstand theme set up issue

I've just begun setting up the overstand theme to work with my blog, but I've run into a problem. Check out my site: http://beachief.com/, the problem is pretty obvious. Those two black categories have been like that since I first installed the theme - I have done nothing to change them. I'd like those two areas to stretch out across the entire page. They are both set to use the "latest2" class which is coded to be 465px, but neither are responding to it. What's wrong? You can find the files for the overstand theme here:http://forums.digitalpoint.com/showthread.php?t=2212542 Thanks


Plugin Development: Wordpress processes twice on post update. How to skip process on the first?

When you create a plugin and set up a process function, Wordpress will run the plugin process function twice upon clicking the update button. I believe the first process is for the versioning (revision) post, and the second the actual post. Now, I've got an INSERT function in my process, so it is now inserting the data twice. What is the best way to ensure that processing doesn't happen while creating the revision and and only on the actual post processing? *** Note: Targeting Wordpress 3.0+ *** An Example (complete plugin):               <?php     /*     Plugin Name: Something Amazing     Plugin URI: http://www.somewhere.com/     Description: Displays something.     Author: Some guy     Version: 1.0     Author URI: http://www.somewhere.com/     */     function call_something() {      return new something();     }     if (is_admin()) add_action('load-post.php','call_something');          class something {           public function __construct() {       add_action('add_meta_boxes',array(&$this,'something_add_boxes'));       add_action('save_post',array(&$this,'something_process'),1,1);      }           public function something_add_boxes() {       add_meta_box('something','Some Thing',array(&$this,'something_form'),'post','side','default');      }           public function something_form($post,$args) {       echo '
<input type="text" name="somethingnew" />
';      }           public function something_process($id) {       echo 'hey there! I\'m going to cause a redirect warning, but you will see this line twice per submit!';       //do_something_amazing();      }     }     ?>      Perhaps there is a better hook to use to process that doesn't make it write twice?


A question on creating filters for custom posts using taxonomy

This is my first foray into custom post types and taxonomies. I created a taxonomy-services.php page to display posts that are associated with the 'websites' slug. That seems to be working fine. However, I want to be able to show other posts on services.php that are associated with another slug, like 'video'. These both fall under the Services taxonomy. I'm just not sure how to filter them on the services.php page. Can someone please help me with this challenge. I'm both PHP/WordPress noob, and need to get a quick win on this one.


Display post image in a size defined by add_image_size()

As I already used the featured image for something else, I want to add another image and display it in one of the sizes defined in my functions.php with add_image_size(). I know how to do that with a featured image : I just have to use the_post_thumbnail() function and indicate the size I want in the parameters. But what about a post image ?


Add a category on all archive category pages

I wonder if it is possible to have the default category WordPress on all category archives? Here is my situation: I created a website of video games and I renamed the default category "multiplatform". But I want all posts in this category are displayed on other categories like the category "PS3" for example. If possible, could you help me to access this feature? **Edit** : Here's a little example to explain it: **Currently:**   * The archive of the "Android" category displays only the items with the category "Android" assigned.   * Assign a post to the "multiplatform" category will only appear on the archive section of posts and the archive of the category "multiplatform" page. **What I want:**   * Assign a post to the "multiplatform" category will appear on the archive section of the category "Android" as well as all other categories.


Divide Menu into Separate Menus and Display them Side by Side

I'm having problems saving a large menu. I keep getting a 500 Internal Server Error. I'm using WP 3.1. I use a HostGator dedicated Linux server and the Superb theme. I have a menu with 4 main headings each with dropdown menus. Is it possible to divide my menu into "4 menus" and display them side by side? The Superb theme has one menu area. Is this possible? If so, how can I do that? Thank you. -Laxmidi


Hide/Show only specific categories in wp-admin new-post.php

Can anyone give me a function or an idea of the method I would need to use to hide categories from the selection box in wp-admin? I have a custom post type and I would like my authors to be able to choose ONLY between 5 of those categories while they are editing their posts. I would like this to only be the case with the custom post type and NOT for regular posts.


Simple Facebook Connect: Access tokens not found

I'm not able to configure Simple Facebook Connect v1.5 correctly. The plugins admin panel tells me that: > No User or Access Token found. Try re-saving this page.   >  Application Access Token not found. Try re-saving this page.   >  Fan Page Access Token not found. Try re-saving this page. But according to the documentation my configuration should be fine. I double checked `Facebook Application ID`, `Facebook Application Secret` and `Facebook Fan Page ID` I have also populated the field "Website with Facebook Login - Site URL" with "http://mysite.com" Not sure if I need to define a value for "App Domains:". OpenSSL v1.0.0c is installed on my server, the URL contains `http://` as outlined in some posts. **Update** : The SFC plugin also advices to set extended permissions: > In order for the SFC-Publish plugin to be able to publish your posts > automatically, you must grant some "Extended Permissions" to the plugin. To > do so, click this button. This will also cause the page to refresh, in order > to save the results This button is not visible to me. When debugging the SFC admin panel with FireBug I see one `oAuth` request to FB is performed. The response has the URL parameter `error=not_authorized` (HTTP 302). Then there are two more requests for `https://www.facebook.com/plugins/login_button.php?...` returning with status codes `302` and `200`. The button is not shown in the admin panel but when I copy the URL to a new tab it shows up correctly, is clickable and I'm able to grant permissions. ![enter image description here](http://i.stack.imgur.com/Uv7LS.jpg) Still the tokens are not available in SFC.


Way to use one template but be able to call different top graphics?

On a site I'm designing (business site versus blog - static homepage, etc.) for a client I have 7 different top -level product/service pages which have the same layout except for a graphic that stretches across the top, below the horizontal navbar and above the page content. Everything up to and including the navbar will end up in the header.php. I would like the graphic to be in the page template as opposed to being part of the page content that the clients could access via the TineMCE editor. I don't want to have to create 7 page templates just for different top graphics. Does that make sense? I've come a long way with WP; I'm pretty solid with HTML and CSS but am a cutter/paster when I get to php, but I'm thinking I might be able to put some kind of if/then call in the page template basically saying "if service page, use servicehead.jpg; if customersupport page, use customerhead.jpg," etc. Is this possible? If so, could someone tell me how I would write the call? Here is my current page.php code:               <?php get_header(); ?>

     <img src="<?php bloginfo('template_url'); ?>/images/customerhead.jpg"     alt="" height="120" width="1020" border="0" />

      After the colL div I have the loop and then I call a sidebar and the footer. I'm thinking I would put a call in the pageheads div? Any help would be greatly appreciated! Thanks!


Validating a cloned/repeatable input (jQuery)

I'm trying to create a repeatable field an upload image input with image preview for my Theme Options page and I have the following:               function theme_options_validate( $_POST ){          if (isset($_POST['submit']) ) {     $theme_options = array();         foreach ($_POST['image'] as $key => $value) {             if (empty($value))  continue;              $theme_options[] = array(                 'image'     => $_POST['image'][$key],             );         }     $valid_input['image'] = $_POST['image'][$key];     }          return $valid_input;          }      for this input:               <input type="hidden" class="image" name="custom_options[image][]" value="<?php echo esc_url( $theme_options['image'] ); ?>" />      So far, everything works fine, the problem is that I'm using jQuery `.clone()` to clone this input and add more images, but the clone always overwrite the original input when submitting! Tried using jQuery to count the input as well(`name="custom_options[image][0],[1],[2]`..."), but have had no luck, the clone never returns. Any idea on how can I fix this?


get post custom value

I have a portfolio custom post type with a text field for a site link, I need to echo that link in the template page. What i have so far is this:                           <?php $site= get_post_custom_values('projLink');                      if($site[0] != ""){                 ?>
<a href="<?php var_dump($site); ?>">Visit the Site
                      <?php }else{ ?>
Live Link Unavailable
                 <?php } ?>      The problem is that it is not working, I have this on the link:               http://localhost:8888/p3dra/portfolio/array(1)%20%7B%20%20[0]=%3E%20%20string(18)      Thanks.


How to show category based post in home page?

Suppose I have 3 categories (cat 1 , cat 2 , cat 3) , and my blog home page shows 6 recent posts . I want to show 2 recent posts from every category. How can I do it?


On one of my sites a file is shown as 404 but the file IS there

(Cross-posted from stack overflow) I am building a WordPress plugin. The plugin works beautifully on one site. But on every other site I've tried so far one of the resource files used it getting a 404 (Not Found) error in the console. If I post the url, displayed in the console as not found, in the address bar the file is accessible. The site it works on is not in a root directory, while one it doesn't work on is on the same server, in the root directory and is a multisite installation. I've tried it on other servers, and sometimes it works, on others it doesn't'. I'm baffled by what might cause this... Any feedback would be appreciated. The following code is posted using a action into the header of a page:               echo '<script type="text/javascript">         (function($){                 $(document).ready(function(){                                    lpStart();                 });                 var lpOnComplete = function(response) {                          // do more processing                     lpStart();                 };                      function lpStart() {                     $.post("'.plugin_dir_url(__FILE__).'filename", {varname: "'.$value.'"}, lpOnComplete, "json");                 };             })(jQuery);     </script>';      The URL that is said to not exist is the one that is posted to in function lpStart(). Interestingly, when it doesn't work I get the following error in the console as the page loads.               GET http://example.com/undefined 404 (Not Found)      Thank you in advance.


tags not showing on custom post type single page

I have a single-events.php and in there i want to show the tags on that post. I have tried using this but nothing comes up. I have put it within the loop but still nothing. This is my code               <?php while ( have_posts() ) : the_post(); ?>        <?php get_template_part( 'content', 'single' ); ?>
Tags
     <?php the_tags(); ?>     <?php endwhile; // end of the loop. ?>      Am i missing something?


Display specific posts on home page

Can someone please help me figure out if the "List category posts" plugin is the easiest solution to my problem: My goal is to be able to choose which posts are displayed on our homepage under "Latest News". Right now, all new blog posts published are featured in "Latest News." I'd like to be able to create new blog posts and based on the category selected, they will either show up on the homepage, or just be added to our blog. This is the current code I have in the `home.php` file for the "Latest News" box on my homepage:               <?php     $args = array( 'numberposts' => '5' );     $recent_posts = wp_get_recent_posts( $args );     foreach( $recent_posts as $recent ){         echo ''.$recent["post_title"].'
'.$recent["post_excerpt"].'

 ';     }?>      We also have a Custom Field set up for "Content under Latest News." I'm not sure if my solution has anything to do with this. I'm familiar with HTML and CSS, and am in the process of learning more about PHP, so any suggestions on this question would be super appreciated!


custom post data - how to

We're setting up a site to showcase a series of archival recordings. We have the custom post types sorted out thanks to all the help from this site (many, many thanks):               add_action( 'init', 'create_radiotalks' );          function create_radiotalks() {     register_post_type( 'radiotalks',         array(             'labels' => array(             'name' => __( 'Radio Talks' ),             'singular_name' => __( 'Radio Talk' ),             'add_new' => __( 'Add New' ),             'add_new_item' => __( 'Add New Radio Talk' ),             'edit' => __( 'Edit' ),             'edit_item' => __( 'Edit Radio Talk' ),             'new_item' => __( 'New Radio Talk' ),             'view' => __( 'View Radio Talk' ),             'view_item' => __( 'View Radio Talk' ),             'search_items' => __( 'Search Radio Talks' ),             'not_found' => __( 'No radio talks found' ),             'not_found_in_trash' => __( 'No radio talks found in Trash' ),             'parent' => __( 'Parent Radio Talk' ),          ),             'public' => true,             'taxonomies' => array( 'category', 'post_tag' ),         )     );     }      (I think my syntax is correct, but I'll take any critiques:) It turns out we want to add some more info to each of the individual custom posts. Namely, we'd like to make use of excerpts and custom fields--they aren't showing up on the 'add new radio talk' entry. I've dabbled a bit w/the supports tag, but no luck so far. Additionally, we'd like to enter a recording ID#, total run time (TRT), # of CDs per set and year of recording for each entry. Is the best approach to register custom taxonomies for this data? Or does it make more sense to make use of custom-fields? Thanks in advance for all your help.. Don.


Need help on creating If-statement for custom meta fields

I'm using Wordpress. I have a movie review website called Filmblurb. For my blog posts, I'm trying to create posts with different categories. Under the "Reviews" category, I have a "Details" box that serves as meta information for all my reviews. The problem is when I try to create a post that has the category of "Features" or something else, that "Details" box still remains. Basically, I want to try to create a PHP if statement that will only return the following code sequence when I only write a "Reviews" post. I'm using the "`get_post_meta();`" tag in Wordpress to fill in this "Details" box for every "Reviews" post I write. A sample post can be found here.

Details

Genre

<?php echo get_post_meta($post->ID, 'genre', true); ?>

Rated

<?php echo get_post_meta($post->ID, 'rated', true); ?>

Release Date

<?php echo get_post_meta($post->ID, 'releasedate', true); ?>

Runtime

<?php echo get_post_meta($post->ID, 'runtime', true); ?>

Director

<?php echo get_post_meta($post->ID, 'director', true); ?>

Cast

<?php echo get_post_meta($post->ID, 'cast', true); ?>

Grade

<?php echo get_post_meta($post->ID, 'grade', true); ?>

      Let me know if I need to explain more.


Master menu item for multiple plugins?

I guess this question is more or less about aesthetics and organization rather than functionality, but I'm curious nonetheless... I know I can add a custom menu item in the dashboard for my plugin using the `add_menu_page()` function, but my question is: Is it possible to add a "master" menu item with "sub-menu" items which would correlate to individual plugin options pages? In other words, let's say my company name is "Guru Guy" and I have released 4 different plugins... Would it be possible to create a menu item that looked something like this: > Guru Guy <\-- Main menu item > > \-- Plugin 1 <\-- Plugin 1's options page link > > \-- Plugin 2 <\-- Plugin 2's options page link > > \-- Plugin 3 <\-- Plugin 3's options page link > > \-- Plugin 4 <\-- Plugin 4's options page link


What are these undocumented arguments for register_taxonomy?

The Wordpress codex has an example of the `register_taxonomy()` function at http://codex.wordpress.org/Taxonomies that shows arguments that are not documented in http://codex.wordpress.org/Function_Reference/register_taxonomy. In particular `args['sort']` and `args['args'][order_by]`. What's the story with these?


empty dashboard for custom role

I setup a custom post type `employee` with an `agent` role that mimics an `author` role for this particular post type, and so far everything is working fine, except that when I created a `test` user and granted it an `agent` role, the dashboard that `test` sees is empty as in: ![enter image description here](http://i.stack.imgur.com/PUZaM.png) I was hoping it would be something like what an `author` user would see, like: ![enter image description here](http://i.stack.imgur.com/hDaDb.png) Could anyone please help me on this? Thanks in advance.


Custom post type Permalinks with hierarchical Taxonomies

I Would use Custom Post Type and hierarchical Taxonomies with same Slug. Fortunately I found a good solution based on post_type_link filter here from TheDeadMedic.               mysite.com/products/category1/product-name1      mysite.com/products/category2/product-name2     mysite.com/products/category1/subcategory1/product-name1     mysite.com/products/category2/subcategory2/product-name2     ...      The only problem is subcategory pages get 404. So these URLs work:               mysite.com/products/category1/product-name1     mysite.com/products/category1/subcategory1/product-name1       But subcategory pages don't work in hierarchical structure:               mysite.com/products/category1/subcategory1     mysite.com/products/category2/subcategory2      I can only access these subcategories without hierarchical structure. So these URLs work:               mysite.com/products/subcategory1     mysite.com/products/subcategory2      Have you got any idea how I could extend TheDeadMedic's solution to hierarchical taxonomies too.


Links do not open from click, only in new tab

I'm fairly new to Wordpress, but I'm encountering a strange issue. I have a menu set up, and I've put links to some of my pages inside of it. But, when I try to click on any of the menu items, nothing happens. I can see the URL in the bottom left of my screen when I hover over the links, but when I click on them, I'm not redirected. The weird thing is that, when I open the links in a new tab (using either middle-mouse click or right click -> open in new tab), all of the links work. Does anyone have any idea what this might be? I'm completely lost.


Loading Scripts For Specific Template

I'm attempting to load a couple of scripts based on the template in use. However, the `is_page_template` is not activating. From my functions.php in the child theme I have:               function sectionDescription (){     if (is_page_template('taxonomy-tableofcontents.php')){                 wp_enqueue_script('descriptionsectiontitle');                 wp_enqueue_script('descriptionsectionbody');     }     }     add_action('wp_enqueue_scripts', 'sectionDescription');      I can't see a syntax problem. I'm assuming that you can use this conditional in the functions file to control the enqueueing of scripts, I can't find anything to the contrary. As I've looked around at other examples my formatting seems to be correct. I'd appreciate any suggestions on a possible source of the problem. Note: The scripts are registered in another section of the functions file. When I first loaded the scripts I had the registration and enqueue together and loading on every page. This worked as expected so I don't doubt the syntax of the registration and enqueueing. I added some test php to the page to test the activation of the `is_page_template` and it indicates that the conditional statement is not working. I'm thinking that I don't understand how to use this conditional but I can't see what's missing.


Permalink options page corrupts web.config file

Whenever I got to http://example.com/wordpress/wp-admin/options-permalink.php my config file at http://example.com/wordpress/web.config instantly gets corrupt and I have to delete the config file. What could be causing this? I am using the newest version of Wordpress and am running it on IIS 7 on Windows Server 2008 R2.


Serving wp-includes (front-end) javascript from a different domain?

The WordPress Codex points to an extremely simple way to change the **URL** of the wp-content directory, which is, adding this in wp-config.php:               define( 'WP_CONTENT_URL', 'http://example.com/wp-content');      And that does the job of serving most of the JavaScript and CSS files on my website from the different domain, except two.               http://mywebsite.com/wp-includes/js/comment-reply.js     http://mywebsite.com/wp-includes/js/quicktags.js      The reason is very clear — these JavaScript files are served from within the **wp-includes** directory, which is not affected by the aforementioned rule. So, is there a similar or simple method to have them served from `example.com` i.e. the domain of my choice? or is unregistering and enqueuing the scripts from a custom URL (done in functions.php) the only way?


Calling Posts from Specified Cat

The following is not working to call posts from a specific category and only grab the number of posts selected. I'm using more than one loop on a page as I am using this to create a "featured content" section on my homepage.                   <?php         ('cat=111&posts_per_page=1');         if (have_posts())         ?>         <?php while (have_posts()) : the_post(); ?>     <?php endwhile; ?>


How to change the title of google Analytics?

I am using google analytics in my wordpress site. I am showing the top viewed content using Google Analytics Top Posts Widget. I am using the shortcode to add them in my posts. My post titles were in this format: `post-title >> Site-title` Recently the post-title of all the posts disappeared because of an error. So, google analytics stored them without the title. This happened 15 days ago. All the posts before that time retain their original title which leads to the conclusion that google analytics store the title only one time. The top post widget show the most viewed pages from the google analytics data which means the title will get cropped for these posts. Is there a way to force google analytics to flush the old title and track the titles again for these pages. I don't want to remove the visit counts, only the title of the post of the last 15 days. Can anyone help me with this?


Constant Contact plugin forbidden error

I am developing site in local. it works fine. but when i setup that on client server in the join us form after clicking join button the following error occurred. I am using `constant contact api` plugin for join us page.               "You don't have permission to access /demo/wp-content/plugins/constant-contact-api/form.php on this server."      I tried setting permissions to 777 temporarily on the setup folder, but that gave me a bigger error. Is this a server problem? Or how can i solve this...please guide me...


How does offset works on pagination? (get_results)

I followed this link and created my own custom query with pagination, But I don't really understand how the offset work. This pagination does not work well, and I'm getting zero value for offset:               function spiciest(){     global $wpdb, $paged, $max_num_pages;          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $post_per_page = intval(get_query_var('posts_per_page')); //6     $offset = ($paged - 1)*$post_per_page;     /* Custom sql here. I left out the important bits and deleted the body      as it will be specific when you have your own. */     $sql = "         SELECT DISTINCT * FROM $wpdb->posts         INNER JOIN (SELECT *, SUBSTRING(name, 6) as 'post_ID',         votes_up  AS votes_balance,         votes_up + votes_down AS votes_total         FROM thumbsup_items) AS thumbsup         ON $wpdb->posts.ID = thumbsup.post_ID         WHERE $wpdb->posts.post_status = 'publish'         AND $wpdb->posts.post_type = 'post'         AND $wpdb->posts.post_password = ''         ORDER BY votes_up DESC, votes_balance DESC         LIMIT ".$offset.", ".$post_per_page."; ";          $sql_result = $wpdb->get_results( $sql, OBJECT);          /* Determine the total of results found to calculate the max_num_pages      for next_posts_link navigation */     $sql_posts_total = $wpdb->get_var( "SELECT FOUND_ROWS();" );     $max_num_pages = ceil($sql_posts_total / $post_per_page);          print_r("offset ". $offset."\n") ;     print_r("\n"."sql_posts_total ". $sql_posts_total."\n") ;     print_r("\n"."max_num_pages ". $max_num_pages."\n") ;     return $sql_result;     }


add_image_size() for specific Post Types

set_post_thumbnail_size( 80, 80, true ); // true for all post types      Suppose I have two post types in play on my blog: Post, Video and Product. I may want a 80x80 image size for my posts, but 100x100 for my videos and a 50x100 for my Products. To my knowledge, I am forced to create thumbnails for my Post images in the dimensions of 100x100 and also 50x100. And for my products, I'm forced to create thumbnails that are 80x80 and 100x100, even though I won't use those ever. Is there a way to create image sizes that are based on post types so you don't end up making a bunch of images you don't plan on using, and wasting resources that could be used elsewhere?


plugin inside a wordpress theme

Ok so I have this theme and inside it is a plugin. When i installed and activate the theme the I can use the plugin as it appears on the left side bar on my dashboard screen but when i change theme i am unable to use the plugin. Is there a way for me to activate that plugin so that I can use it whenever? I have tried to install the plugin by it self without the theme by removing it from the theme folder , zipping it and then trying to install it but that did not work.


Getting $comments outside the comment template

I have a ajax request hooked on "template_redirect" (the ajax requests the post's url), and I want to display only the comment template:               function get_comm(){       if(isset($_GET['get_my_comments'])):         $offset = intval($_GET['get_my_comments']);         echo $offset; // offset will be the same as "cpage"         global $comments, $wp_query, $post, $id;         print_r($comments); // nothing ?         print_r($wp_query->comments); // nothing ??         wp_list_comments('type=comment', $comments); // same :(         exit();       endif;     }     add_action('template_redirect', 'get_comm');      the javascript part works and it's like this:                  $("a.show-more-comments").live("click", function(){           var offset = $(this).attr('rel');           var list = $(this).closest("#comments");                $.ajax({             url: "<?php echo get_permalink($post->ID); ?>",             type: "GET",             data: ({               get_my_comments: offset             }),             success: function(data){               list.append(data);             }           });         });      The problem is that `$comments` or `$wp_query->comments` don't seem to be initialized. What am I doing wrong here?


Auto-retrieve YouTube Image for Thumbnail?

I have a custom post type that accepts a YouTube embed HTML snippet, title, and a featured image. Currently, I'm going and finding an image for the featured image, but ideally I would be able to automatically download and resize the first frame of the video itself based on the video URL during the saving process of the post itself. If done right, my post type could require nothing more than the link and could get the image and the embed code from that. For instance, if the video link is http://www.youtube.com/watch?v=2Jnpi-uBiIg the value of _v_ would be extracted and used to download the the image at http://img.youtube.com/vi/2Jnpi-uBiIg/0.jpg. I'm very new to wordpress development, but something tells me I would be looking into hooks (if I understand those correctly).


How do I delete all UNUSED images from my uploads directory?

I am trying to clean out my uploads folders as they are now starting to take up too much room on my server. I have tried to use plugins to achieve this end such as DNUI and Cleanup Images but these plugins are either unworkable or in DNUI's case (which has been updated recently and works) do not achieve the exact results that I am after. This is because my site uses Woocommerce and a theme which both use images within other places rather than just posts or pages such as headers, footers and galleries. It seems as if WC uses it's own built in Lightbox plugin called Pretty Photo which is where the images that are detailed as "unused" by DNUI are called from. I know that it is a bit of an ask but I am wondering if anybody could point me in the right direction? I am no developer, so probably should not even be posting on here, but I can work things out with time and determination. I have seen scripts on this site that achieve the same results as the DNUI plugin but nothing that takes into account other image uses (if it is even possible?). Any help would be much appreciated.


List posts with common custom field value

Hi I'm trying to create a list of posts that have a common custom field value that are the same as the custom field value for the post they are displayed on. I've found a few examples where the value is specific but I'm after an example where the value is common. So it might be something like Find the value for the common field for this post and then display a list of posts (with links to the post) that have custom fields that have the same value as this post. But don't include this post (the post they are displayed on) in the list. Thanks.


How do I display only the latest post on my home page, while maintaining proper plugin hooks?

What I'm trying to do is display the most recent post (a la my theme's "single.php") on my "home" page. This is complicated by the fact that I have certain plugins (specifically, Scripts n Styles) that are hooking wp_head and wp_enqueue_scripts. In these hooks, they are checking is_singular() to see if my per-post javascript should be injected into the page or not. They then check attributes of the global $post variable to determine which scripts to inject. I want the per-post javascript to be properly injected on the home page if needed. For reference, the plugin in question's source code is here and the specific function I'm concerned with running properly is called `scripts_in_head()`:               static function scripts_in_head() {         // Global         $options = get_option( 'SnS_options' );         if ( ! empty( $options ) && ! empty( $options[ 'scripts_in_head' ] ) ) {             ?><script type="text/javascript" id="sns_global_scripts_in_head"><?php             echo $options[ 'scripts_in_head' ];             ?></script><?php         }              if ( ! is_singular() ) return;         // Individual         global $post;         $SnS = get_post_meta( $post->ID, '_SnS', true );         $scripts = isset( $SnS['scripts'] ) ? $SnS[ 'scripts' ]: array();         if ( ! empty( $scripts ) && ! empty( $scripts[ 'scripts_in_head' ] ) ) {             ?><script type="text/javascript" id="sns_scripts_in_head"><?php             echo $scripts[ 'scripts_in_head' ];             ?></script><?php         }     }      I'm pretty new to Wordpress development, so I've probably made a boneheaded mistake here that is making my life overly difficult. Here are the various and sundry ways I've beaten my head against the wall: From what I understand, I can't just change my `home.php` template, since the template isn't even executed until after all these hooks would have already run. Therefore, modifying the query at this point or creating a new one would be pointless. I could use a HTTP header redirect, although I'm not sure that would work without manually updating the redirect every time the latest post changes. I could change `home.php` to have a javascript redirect, but that seems like it would be a lot of time/effort wasted loading the "dead" home page just to get redirected to another page. If this is the only way, so be it, but it seems like I should be able to do better. I've tried creating a plugin that hooks earlier than Scripts n Styles, and modifies $wp_query, but this doesn't seem to work properly. Likely, I'm doing it wrong:               function make_single_from_home()         global $wp_query;         if ( $wp_query->is_home() ) {             $last = wp_get_recent_posts( '1');             $last_id = $last['0']['ID'];             $wp_query->set( 'p', $last_id )             $wp_query->set( 'post_count', 1);             $wp_query->set( 'is_home', false);             $wp_query->set( 'is_single', true);         }     }      I've tried attaching this to several events prior to Scripts n Styles' hook, (send_header, template_redirect, etc), and it doesn't seem to help. I don't see the javascript blocks being added to my `<head>` tag. (It's possible that this is a valid solution and I or the plugin are just Doing It Wrong) It's also possible that there's a really easy way to make my homepage a singular page displaying my latest post, and I'm just too new to figure it out. Is there some way to create a home page that displays just the latest post, while making the `$post` variable valid, and `is_singular() == true` early enough for my plugin dependencies?


When would it make sense to use Jetpack?

There was a news item today possibly of interest to those who self-host WordPress: Automattic unveiled the Jetpack plugin. I hadn't heard of it before, but going off the announcement and the site FAQ, it looks as if it's going to provide multiple bits of functionality in one package (WP.com Stats, Twitter widget, shortcodes, etc). My issue is wondering whether this might be overkill. Wouldn't it make more sense to use a few small specific plugins that do what you need, rather than installing some big assembly when you only have a few specific needs?


category.php displays ALL posts instead of just those with the current category

I'm simply trying to display a list of categorised posts (with the custom post type of 'project') on the default category.php page. I can't get it to work! If I simply use the base theme category.php template I get a 'No posts available' message as it is looking for standard WP posts with a specified category (and there are none). However once I try and get the template to use my custom post type instead it simply prints a list of ALL the projects - no matter what category they are assigned to. My current code is as follows:
     <?php      query_posts(array(      'post_type' => 'project'      ));        ?>     <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

Project: <?php the_title(); ?>
         <?php the_content(); ?>
         <?php endwhile; ?>
      The template should 'know' what category it is supposed to be displaying by default. If I'm on www.mysite.co.uk/category/client-x then it should be showing only those projects that have the category 'client x'. I'm sure this can't be too hard! Any help would be greatly appreciated. Thanks Dan


How can I output completely custom content with plugin while still having header, footer, sidebar etc

What I want to do is make some url rewrites that will be handled by classes in my plugin. When one of these urls is matched I want to hit an external api and then put out custom html with the content of api response while still having footer/header/sidebar etc from the current active theme. I've been testing different methods for a couple of days and seems like outputing my code and the exiting before wordpress runs the default queries could be a good way to do this, but I'm not sure how to use the header/footer from the theme.


admin bar disappears completely in 2010 theme

I've installed a plugin to upload local avatars through a front end form to edit user profiles provided by another plugin (user frontend). While the upload and modification of the db seems to work just fine, clicking the update button of the form does apparently lead to the WP 3.1 admin bar no longer being rendered for some unexplicable reason. There's simply no $wp_admin_bar object being created. I have no idea what could possibly cause this, but I have also no idea how to activate the admin bar if the default init function fails. Does anyone have an idea for me? Thanks!


post author if statement

Hi I'm try to get an if statement to work. I want to display some HTML code if the post is created by a specific author. This is what I'm come up with but it doesn't work.               <?php if ( get_posts ($post->ID, 'post_author', true) == '20')       { ?>  HTML <?php } ?>       Thank You


Logout user and delete cookies from the client side?

I'd like to be able to logout the user. I can do this by calling wp_logout() on the server but if the user drops connection is there a way to log them out? The wp_logout() method clears the cookies. Is there a way to do this on the client? Maybe like a clear all cookies (logout) for this domain or path. **More Info:**   For example, say they are at school or at the library on a public computer and the connection drops (which happens a lot).


Is it possible to create a separate page for custom posts gallery?

# Here is what i have so far. ### single-cpt.php On this page I would like to create another custom meta box, which will be an additional 'editor'. I would like to be able to add a gallery to this editor. That's fine and I've tested it and it works. In addition to this I would like to; \- Just display a link to the gallery and have the gallery open its own page. Which would be a child of this post/page? \- Or the gallery could be hidden and the link, when clicked shows/displays the gallery using css. I require the feature as I have many images and don't want to overload the visitor with them, but if they are interested i want show them! Any suggestions would be greatly appreciated. Thanks


How can i give a download link to the thumbnail or featured image

I am using the code below to give users download the thumbnail image, as i have a wallpapers site:               <a class="downloadbutton" href="<?php echo $src[0]; ?>" download="imageName">Download this Wallpaper      But the above code is giving download of a htm file not the image download, can anyone please help me solve this. Thank you


How can I avoid code duplication for a blog with lots of source code?

I'm writing a tutorial on using the R language to do some applied statistics. An example post is: http://mcmcinirt.stat.cmu.edu/archives/223 I would like to have all of the blocks of source code be loaded from local files on the webserver. In that way, I could use git to sync them with the files that I'm actually using to develop the examples. As it stands, I write the code on my machine, generate the graphs / check that it works, and then copy the final code into the text of the blog. This leads to duplication headaches. Is it possible to avoid this kind of code duplication? (Either in the way I suggest or perhaps a more WordPress friendly way?)


Top menu link anchor href value change after online server?

I was recently launch localhost server on my computer to create local website. If I create new link that add to top menu. The href value was http://localhost.com/something/something. Does this href value will change to my website name after I upload my website online ? http://mywebsite.com/something/something.


Active class on side menu

Does anyone know how to add an active class onto the side navigation page you are currently on? The code below works fine but doesnt add an active class               <ul class="side-nav">         <?php global $post;         $current_page_parent = ( $post->post_parent ? $post->post_parent : $post->ID );              wp_list_pages( array(              'title_li' => '',              'child_of' => $current_page_parent,              'depth' => '1' ));         ?>     </ul>


Custom wp_nav_menu output (displaying all child elements of top menu element in current branch)

I would like to create a walker function, or modify somehow current `wp_nav_menus` so it can produce a custom output. Let's imagine this structure:               menu item 1     menu item 2      submenu item a      submenu item b     menu item 3      submenu item c      submenu item d      submenu item e      The easiest part is to show in one place only main menu items (main menu 1,2,3), and it can be done with wp_nav_menus, so we don't need to code it. The problematic part is to show in other place submenu items of currently main item... So if user is on 'menu item 1' page, nothing shows. If user is on 'menu item 2' page, our "new" custom menu shows:               submenu item a     submenu item b      Same menu items renders when user is on either of two above pages (menu items). When user clicks 'menu item 3' and visits its target page, he sees submenu items c,d,e, same as after clicking on any of those submenu items. If the menu has 3rd level elements (and deeper), custom menu should display all child elements of current most top menu element, beside that top element itself (which will be listed in top part of the site described in first place) Is there a way of creating such functionality? The idea is close to: Display a portion/branch of menu just it needs to be dynamic and display child elements of current menu branch/all child elements of top menu branch element if they exist. AFAIK I can't use `get_ancestors`, because it works only with hierarchical taxonomies, and here we are not talking about menu created from post/pages hierarchical structure, but with use of menu editor. **SOLVED:** Seems I was able to create correct functions kombining few methods:               /**      * The API function, just a wrap for wp_nav_menu adding filter first and removing after      */      function filtered_nav_menu( $args = array() ) {         $echo = isset($args['echo']) ? (bool)$args['echo'] : true;         $args['echo'] = false;         add_filter( 'wp_nav_menu_objects', 'gmfnv_filter', 999 );         $menu = wp_nav_menu( $args );         remove_filter( 'wp_nav_menu_objects', 'gmfnv_filter', 999 );         if ( $echo ) echo $menu;         else return $menu;     }          /**      * The filter callback, return the filtered elements      */     function gmfnv_filter( $items ) {         $found_top_parent_ID = false;         foreach ($items as $item) {             if ( ($item->menu_item_parent == 0 && $item->current_item_ancestor == 1) || ($item->menu_item_parent == 0 && $item->current == 1) ) {                 $found_top_parent_ID = $item->ID;             }         }         $children  = submenu_get_children_ids( $found_top_parent_ID, $items );         foreach ( $items as $key => $item ) {             if ( ! in_array( $item->ID, $children ) )                 unset($items[$key]);         }         return $items;     }          /**      * Helper function: return children of an element using wp_filter_object_list      */     function submenu_get_children_ids( $id, $items ) {         $ids = wp_filter_object_list( $items, array( 'menu_item_parent' => $id ), 'and', 'ID' );         foreach ( $ids as $id ) {             $ids = array_merge( $ids, submenu_get_children_ids( $id, $items ) );         }         return $ids;     }      What it does - it search for current branch top ancestor by going through each $items element and checking against:               ($item->menu_item_parent == 0 && $item->current_item_ancestor == 1) || ($item->menu_item_parent == 0 && $item->current == 1)      This conditional needs to be 2 part, because top level menu element might also be current one. If top level $item is found, then function `submenu_get_children_ids` is used to list all its child elements.


Remove Ellipses from Excerpt

I use two custom functions for my excerpts, the first modifies the length of the excerpt and the second allows me to use the_excerpt in two ways - with a read more link and without as long as the appropriate code is included while calling the_excerpt (see here). When I use the traditional the_excerpt it generates three ellipses in brackets after it [...] - how do I remove these brackets and ellipses to just display the_excerpt itself without any link when calling it in posts, but still using my code below for the read more link elsewhere?               // Excerpt         // Changing excerpt length         function new_excerpt_length($length) {             return 25;         }         add_filter('excerpt_length', 'new_excerpt_length');              // Changing excerpt more         function new_excerpt_more($post) {           remove_filter('excerpt_more', 'new_excerpt_more');            return ' ID) . '">' . 'read more' . '';         }


How to avoid wp-load.php within a PHP/CSS file?

This is tricky, as people usually mix wp-load with AJAX and I can't really find a proper answer. **Case 1** I have a dynamic style.php file that looks like this:               <?php header("Content-type: text/css");     require_once('../../../../wp-load.php'); ?>          body {        background: <?php echo get_option('background_color'); ?>;     }      **Case 2** I'm using AJAX call:                 jQuery.post('<?php bloginfo('template_directory');  ?>/framework/foo.php',{ foo: smth, bar: else });      Then I'm running some WordPress functions within foo.php (it's not JS as in other examples):               $foo = $_POST['foo'];     $bar = $_POST['bar'];          $theme_options = get_option('theme_options');     $theme_options[$smth] =  $foo;      update_option('theme_options', $theme_options);      How to avoid wp-loads in both of these cases? Thanks a lot :)


modifying the comment form

I see that there are lots of filters and things you can do to remove fields or modify them. I have found some useful ones on this site. I want to take it a step further because I want to do some things that there does not seem to be a filter for. Like removing the labels. At least I have not found one yet. I also need to remove the submit button and want to replace it with an actual button. For styling purposes. So I thought I could copy the comment_form function out of the wp-includes/comment-template.php file and put it in my functions.php file so that I could make any modifications I wanted. Problem with that is that WordPress throws you one of those previously declared functions errors. So I was looking for the filter or action to unregister that function so that I can use it in my functions.php file but I can't find it. Do you know how I can do this? I tried                remove_action('comment_form');      but this did not work


Why WP_Query('showposts=5') shows only 1 post?

I am trying to do a simple query to get the latest 5 posts into an unordered list, but this is only showing 1 result even though I have several posts. I even did an offset, but it shows the next post yet still 1 result. What am I doing wrong?
         <?php $the_query = new WP_Query('showposts=5'); ?>         <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
                 <a href="<?php the_permalink() ?>"><?php the_title(); ?>
<?php the_content_limit(250); ?>

         <?php endwhile;?>


get dynamic_sidebar() value in array in wordpress

I have a sidebar. Till now I am calling this as               dynamic_sidebar( 'home-left-widget-area' );       and this shows data in `<li>`. But I need data in `<option>` . How to store values in array so I can use `<option>`


How do I show child categories if in a parent category, and posts if in a child?

I was hoping to do all of this within the category.php template, with help from the functions.php if needed. If my setup is:               Parent 1     --Child 1     --Child 2     Parent 2     --Child 3     --Child 4     Parent 3     --Child 5     --Child 6      ...and so on I would like to be able to do this: If I was viewing Parent 1 (or 2/3), it would show me Child 1 and Child 2. However, I don't want to use wp_list_categories because for each Child, I would like to show a thumbnail (from a plugin function), the Child's name, and the category description. If I was viewing Child 1 (or 2/3/4/5/6), it would show me the latest 2 posts using the standard Loop. I would like avoiding having to do this using hard-coded contitionals with the specific names of the categories, in case new ones will be added in the future. Any assistance will be appreciated. Thank you!


Add unique id to Preview URL

Is there an easy way to append a unique ID to the preview URL when the preview button is clicked by a user? So this: http://example.com/news/1/title/?preview=true Becomes: http://example.com/news/1/title/?preview=true&v={unique_id} I ask because our setup caches heavily on the server-side so when updating it takes a while for the changes to show up in the preview. Manually adding a parameter to the end of the URL allows the changes to show up immediately. I tried searching for a plugin but didn't have any luck. Is there a way to do this by adding a custom function in functions.php?


Shortcode default attributes over-riding non-default attributes

I have a shortcode with default attributes. It works fine with the default attributes, but the user-entered attributes do not over-ride the default attributes. Here is my shortcode code:               function wpa_success_stories_shortcode( $atts, $content = null ) {          // Attributes     extract( shortcode_atts(         array(             'category' => 'success-stories',             'maxposts' => '10',         ), $atts )     );          /* print_r and echo to test values */         print_r($atts);     echo $category;     echo $maxposts;          /* a bunch of stuff here to output code */          return $output;     }     add_shortcode( 'success-stories', 'wpa_success_stories_shortcode' );      If the user inputs [success-stories category="news" maxposts="6"], then 'print_r($atts)' gives me `Array ( [0] => category="news" [1] => maxposts="6" )`, but `echo $category` returns `success-stories` and `echo $maxposts` returns `10`. So how do I use the user-entered values in my code?


Slow Wordpress admin panel with a total query time of 1664ms

I have a problem with my wordpress website, he is realy slow, i installed a debug bar to check queries in the home page, the result is like: 202 queries, and a total query time equal to 1665ms ![enter image description here](http://i.stack.imgur.com/47o3S.png) The cpu and the ram are in critical use. ![enter image description here](http://i.stack.imgur.com/SAev3.png) Here is what i tried to do:   * i used Optimize pluginDB to defragment the DB.    * i used ThemeCheck plugin to analyse my theme and clean my theme.   * i am using the w3 total cache plugin with the page and object cache enabled. The installed and necesary plugins are:   * Wordpress SEO by YOAST   * Jetpack service by Wordpress.com   * Contact form 7 Thank you


disable lightbox in a plugin

i'm using the PHOTO ALBUM plugin for wordpress and I would like to disable the lighbox effects - meaning, i just want to show the thumbnails... is that even possible? Thank!


new_to_publish fires multiple times

i have been trying to use draft_to_publish & new_to_publish   to create an update when ever a post of a specific type (cpt) is published... it works but published 600+ times instead of one time! **So... my question is**   1. why does this happen & how to verify it only posts once   (took me 10 minutes to delete) **here is code i currently have:**               add_action('new_to_publish', 'new_webnews_published');     add_action('draft_to_publish', 'new_webnews_published');     function new_webnews_published($post_id){              $postData       =   get_post($post_id);         $post_id        =   $post_id;         $postData       =   get_post($post_id);         $postType       =   get_post_type($post_id);         $postTitle      =   $postData->post_title;                   if($postType == 'webnews') {                  // LINK TO WEBNEWS PAGE             $webnewsPage    =   of_get_option(THEME_NAME.'_webnews_select_page');                     // PREPARE UPDATE DATA             $update_title   =   __('News',THEME_NAME);             $update_content =   $postTitle;             $update_url     =   'index.php?p='.$webnewsPage;                       $post = array(                 'post_title'    => $update_title,                  'post_status'   => 'publish',                 'post_type'     => 'miniupdate'             );                  $updatedid  = wp_insert_post($post, 10, 1);                  // Do the wp_insert_post action to insert it             do_action('wp_insert_post', 'wp_insert_post', 10, 1);              update_post_meta($updatedid, THEME_PREF.'miniupdates_content', $update_content);             update_post_meta($updatedid, THEME_PREF.'miniupdates_link', $update_url);              }     }      .   **Last Thing:** i would like to test variables   example: "echo 'something'; i guess i need to create a second function and attach to admin_init?   But what are the timing restriction here? should i add something to the   initial draft_to_publish hook ?


Cannot apply custom css to IE in the theme

For the twentythirteen, twentyfourteen or any theme made by Wordpress, editing `ie.css` which is in `themefolder\css\ie.css` doesn't result in any changes in Internet Explorer. I'm actually using IE11, but whatever I change the document mode or the user agent to, it's still not resulting to any changes. I also noticed Wordpress injects `ie` class to the `<html>` tag when browsing from IE. So, I applied such CSS codes: `.ie body { display: none !important; padding: 100px; }`, but still no results.


post ordering question

I have a custom type posts and I need to make it ordering by something different way. not by date, id, names. Is there any way to put ordering numbers and listing by the numbers? Because we have a several new posts should be placed 2nd, 3rd,...etc but I don't it's easy to do. So I was thinking if there is any place to put ordering numbers and order by the numbers would be the best. Is there anyway or plugin for it?


Changing the homepage

Is it possible to change the Home page so it's not a blog, but a page? And also is it possible to change the name of the homepage? If yes, how is this done? Thanks, Richard


Setting a url for a page

Is there a way to set a url for a page, as per the following example: I want to change this url: http://richardclunan.com/?page_id=2 To: http://richardclunan.com/copy-critiques Is this possible? (I clicked Permalink Settings and specified 'copy-critiques' as Category Base, but this didn't do the trick...) Thanks, Richard


How to change order of menu items

How can I change the ordering of menu items -- for example to make 'Wordfruit Copywriters' appear before 'How can you sell more of your product?' here: http://richardclunan.com/ Thanks, Richard


Formatting text in posts

In a post on WordPress, is there a way of selecting items of text and applying formatting, such as font / font style and font size? I see that there is a 'Format' dropdown... should I change the styles of the items here first? And if so, how is this done? Thanks, Richard


Possible to hide Custom Post Type UI/Menu from specific User Roles?

What I'm looking to do is completely hide the UI for a custom post type from specific user roles...Ive previously found many resources on how to disable access to using those CPTs but nothing that really allows you to completely hide the CPT UI all together based on what user is logged into the dashboard. This is important since I need clients to completely stay out of custom post types for the store, and if they can see the store CPT UI in the dashboard still it doesn't make a difference if their capabilities are restricted since their still going to inquire how they can go about adding product on their own as a result. Id really prefer to not accomplish this with a plugin however if there is something that can do the trick in a non-bloated way that would still be great I suppose. Thanks for your help, SB


Do all themes accommodate all features?

Do different themes accommodate different features, or can all themes accommodate any feature? I.e. do I need to bear in mind what features I'll need when I choose a theme, or are themes only how things are laid out visually? Also, is it possible to change the image in the default theme 'Twenty Eleven'? Thanks, Richard


How can I achieve something like has_post_format( 'standard' )?

In opposite to `get_post_format`, the conditional `has_post_format()` function returns a boolean value and should be the perfect function for a conditional check like:               if ( has_post_format( array( 'gallery', 'image' ) ) {         // I'm a gallery or image format post; do something     }      (see this answer) Unfortunately, `has_post_format()` is not sufficient to check for the _standard_ post format. So how would I achieve something like:               if ( has_post_format( 'standard' ) {         // I'm a standard format post     }


Pagination for a category

Hi I have page displaying 20 featured images and info of a specific category, I wish to able to have pagination so I can have multiple pages for the category. How do I do this? I cant seem to get it work. Any help would be appreciated Thanks               <?php get_header(); ?>
          <?php query_posts(array('category__in' => array(5), 'posts_per_page' => 20)); ?>                 <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                              <?php $currentid = get_the_id(); ?>

                                                                     <?php if (get_the_post_thumbnail($currentid, array(167, 167)) != "") { ?>                                             <a href="<?php the_permalink(); ?>" /><?php echo get_the_post_thumbnail($currentid, array(300,600)); ?>                                     <?php } else { ?>                                          <a href="<?php the_permalink(); ?>" /><img src='<?php bloginfo('template_url') ?>/images/default.png' alt='Default'/>                                     <?php } ?>

<a href="<?php the_permalink(); ?>"><?php echo get_the_title($currentid); ?>

<?php echo get_the_excerpt( $post->parent ); ?>
                                     <a href="<?php the_permalink(); ?>" class="info">Read More...

                               <?php                     endwhile;                 endif;                      wp_reset_query();                 ?>

     <?php get_footer(); ?>


Buddypress: remove forum tab in user profile page?

I need to remove the forum-tab in user profile pages. I have tried alot of things but no result. I do not want to do it by css. Tried this: http://www.themightymo.com/2012/01/26/how-to-add-remove-and- change-the-order-of-buddypress-component-menu/ but no luck. Any advice? Thank you in advance, Emily


Allow the access over wp-login.php

I created a maintenace template, and redirected to the folder where it is located via the functions.php file inside the theme folder; this is the code:               function maintenance_redirect(){     if( !is_user_logged_in()){       include("maintenance/index.html");                 exit();     }         }     add_action( 'init' ,'maintenance_redirect' );      but i can't access to the log in page via wp-login.php or wp-admin/ beacause i get redirected to the maintenance page, how can i esclude from redirection the path of log in page? Thanks in advance :)


How set featured posts using checkbox in post edit screen?

I want to make selecting a featured post is just by checking a checkbox in edit screen AND be able to retrieve these featured articles from only specific category ? in short what I'm looking for :   * set featured post   * loop throw featured posts in a specific category (not all posts) Any help? and thanks in advance :)


Page templates for custom post types

Currently wordpress "pages" can have a particular page template associated with it. Can this feature also be available for custom post types ?


Action wp_login_failed not working if only one field is filled out

I created a login form in the frontend with `wp_login_form()`. In my **functions.php** file I added an action to prevent the redirect to **/wp- login.php** if the login failed with > add_action('wp_login_failed', …. As it turns out the action only hooks if the **username** and **password** fields are filled in. If one of them is left empty I still get redirected to **wp-login.php.** Is there a possibility to check if both fields are filled in to prevent the redirect? Thanks Julian


WordPress Theme variables scope

I need to create a variable that can be accessed throughout my WordPress Theme template files (index.php, header.php etc..). I know function definitions go inside the `functions.php` template file (in your theme path), but there's no such thing for variables. For example I constantly need to retrieve Categories in my Theme, so I would like to have this accessible from anywhere in my theme: `$categories = get_categories(); /* get_categories() is a wordpress function */ ` This way I can simply access to allocated data, without having to re-allocate it every time I need to get my categories. Unfortunately adding that piece of code in my `functions.php` file, doesn't work, neither does making the variable `global`.


HTML to WORDPRESS

I am very very new at this but would like to expand my creativity. I would like to design/build my own wordpress. Because this is a huge task I have read that first designing the page with just html and css THEN bringing it into wordpress is a better a solution. Would you say this to be true?


How can I hide previous_image_link() on first attachment page?

I'm using `previous_image_link()` and `next_image_link()` to show thumbnails in my image.php template page. I'm surrounding the thumbs with some styling, so need to be able to hide the whole previous image thumb/link block when showing the first attachment.. and the same for the next image link/thumb when displaying the last one. How can I ascertain whether a first or last image is being displayed using core functions? (at the moment I'm using a modified version of `adjacent_image_link()` that returns not echo's the gubbins, but would like a non-hacky way)


Add More Fields to Users Pages (Admin Panel)

So I'm trying to create some custom fields for users. I need to give users access to a 30 day trial of some software and I want to keep track of that in the users page of administration panel. If the user is in the trail I want to add "Trial" at the top and "Yes" or "No" next to the username on the All Users page. I'm assuming this would be a core file somewhere, but I'm not sure which one.


Wordpress Installation for multi-domains with nginx and php-fpm

I am new to Wordpress. I googled around but could not find precise steps to install Wordpress with nginx multi-site configuration. I want to install wordpress 3.3.1 on Ubuntu 11.10. I already installed   * php5-fpm   * nginx   * mysql I have two domains that I want use same wordpress installation               domain1.com      domain2.com      Could you provide nginx and wordpress configuration for multi domain setup? Thanks for all.


Wordpress Custom Post Type Children Template

I have created a hierarchical custom post type in wordpress called "films." It is hierarchical so it can have children elements. When a "film" is clicked, wordpress automatically uses the template called 'single-films.php'. That is great, but I wish to use a different template when one of the film's children pages is clicked. For instance, a child of a film might be "press." When that film's press link is clicked, I want it to use a different template than single-films.php. I was hoping there is some way I can use a template like single-children- films.php. Any ideas how I can change a hierarchical custom post type's children template?


Filtering custom taxonomies

This is a cross post from the WordPress forums, which I apologize for, but it has been almost a week and not getting any response there so hoping someone here can help. If I do get a reply in either place I will update the post with a link to it. I am attempting to extend functionality to my client's custom theme, and I am having issues trying to get query_posts() to pull a list of custom taxonomies filtered by category. The creation of the custom post type in functions.php is this:               //Custom Post Types     add_action('init', 'create_myportfoliotype');     function create_myportfoliotype() {         $myportfoliotype_args = array(             'label' => __('Portfolio'),             'singular_label' => __('Portfolio'),             'public' => true,             'show_ui' => true,             'menu_position' => 5,             'capability_type' => 'post',             'hierarchical' => false,             'publicly_queryable' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'portfolio', 'with_front' => false ),             'can_export' => true,             'supports' => array(                 'title',                  'editor',                  'post-thumbnails',                 'custom-fields',                 'page-attributes',                 'author',                 'thumbnail'               )            );       register_post_type('myportfoliotype',$myportfoliotype_args);     }               //Taxonomias     register_taxonomy("categories", array("myportfoliotype"), array("hierarchical" => true, "label" => "Category", "singular_label" => "Category", "rewrite" => true));     register_taxonomy( 'tags', array("homepage"), array( 'hierarchical' => false, 'label' => 'Tags', 'query_var' => true, 'rewrite' => true ) );     register_taxonomy( 'specifics', array("myportfoliotype"), array( 'hierarchical' => false, 'label' => 'Specifics', 'query_var' => true, 'rewrite' => true ) );      Currently the site has a page that pulls in all of the posts, then filters out what is visible via jquery. The query that pulls in the posts is this:               query_posts( array( 'post_type' => 'myportfoliotype', 'paged' => $paged, 'posts_per_page' => 80))      This works, but as I said pulls in everything. What they want now is 2 custom templates that pulls in only 2 specific categories each. I can't do the filtering via jquery since it doesn't work visually to do that in this case. I am attempting to pull in just the 2 categories, but for some reason no variation of the following code seems to work:               query_posts( array( 'post_type' => 'myportfoliotype', 'paged' => $paged, 'posts_per_page' => 80, 'tag_id' => '9' ))      Everything I have tried either still pulls in all posts, or pulls in none of them. ps. Does anyone know of a function to dump the raw query that query_posts generates? If I could see what the actual query was doing with each variation I tried and compared that to the info in wp_postmeta it might help in figuring out where the issue lies.


Difficulties filtering manage_nav-menus_columns

I realize I've asked similar in the past, but I've currently running in some difficulties editing/removing the admin nav menu advanced menu properties. (without using jQuery)               add_filter( 'manage_nav-menus_columns', 'cor_wp_nav_menu_manage_columns');     function cor_wp_nav_menu_manage_columns() {       return array(         '_title' => 'test',         'cb' => '<input type="checkbox" />',         'link-target' => __('Link Target'),         'css-classes' => __('CSS Classes'),         'xfn' => __('Link Relationship (XFN)'),         'description' => __('Description'),       );     }      In this case I was trying to rename the title key to something like 'test' to see if my filter would work. The outcome however stayed the same ' _title' => __ ('Show advanced menu properties'),. If possible, this is what I'm actually trying to accomplish:               add_filter( 'manage_nav-menus_columns', 'cor_wp_nav_menu_manage_columns' );     function cor_wp_nav_menu_manage_columns() {       return '';     }      Would someone know what I might be overlooking perhaps? **Edit:** I'm able to remove the advanced menu properties using `add_filter( 'manage_nav-menus_columns', '__return_false', 200 );` I'm however still struggling (meaning, I can't remove them) to remove the property fields


wp_head function outputs after <head>

I have a function in my functions file where i output Google Analytics code.                   function mytheme_trackingcode(){         $mytheme_option = mytheme_get_global_options();         $tracking_code = $mytheme_option['tracking_code_head'];         if($tracking_code){             echo '$tracking_code';         }     }     add_action('wp_head', 'mytheme_trackingcode');      The problem is that the output comes right after the tag. I'm not sure what the problem is? wp_head is placed last in head-section.


Information and Videos for Customers in the Backend

I am looking for ideas or plugins that would allow me to have a backend area for clients to log into my site and access files specifically assigned to them. I provide video IT help files for clients which contain information specific to their setup and would also like to have the ability to offer or accept files from them through this backend (files that would never make it through email). Does such a backend plugin exist? Thanks in advance stack!


What permissions should I give directories if I want to make WordPress more secure?

A follow up to a previous question found here How can I lock down an old wordpress install I don't intend to update? Same info still stands. WordPress install will (probably) not be updated. Never ending caching has been enabled. Database can only be read. I thought my WordPress installation was pretty well locked down, however it seems that at some point, something was able to create a file in the theme directory of a funny looking nature (ending in eval(blah)). I wouldn't class myself as a sysadmin type of guy, but I'm thinking that someone would know what directories I should set with particular permissions to harden my security. Can anyone help on this? Thanks in advance


Unbind postbox click handler

I'm trying to unbind the click handler on post metaboxes so they no longer hide when the handle is clicked. I need to do this because I use the handle to contain `<select>` elements & when changing these the `click` event is fired. The code that binds the click handler is here: https://github.com/WordPress/WordPress/blob/master/wp- admin/js/postbox.dev.js#L8 Unfortunately the only way to unbind it seems to be editing this file & inserting the unbind inside `add_postbox_toggles` Hope anyone can help