Environment Specific Options Token

Is it possible to add a token to any wp-option that could be replaced on get where the token being defined in a plugin’s option or the configure file?               E.g.      http://[[[env_token]]].sitename.com/some-page.html =>      http://staging.sitename.com/some-page.html or      http://dev.sitename/some-page.html or      http://www.sitename.com      To be more specific I am managing a Wordpress instance inside a development life cycle where I often copy production data down to staging and development servers. Often the options tables are unmanageable and have changed since the last dump. However, after analyzing what the most frequent changes are between servers I noticed it is the environmental specific tokens like dev and staging. I am a little concerned with running a string replace on every option get, but I am making use of page, data, and object caching.


filterable portfolio with wordpress and jquery

I used this tutorial in creating portfolio page: http://wp.tutsplus.com/tutorials/creating-a-filterable-portfolio-with- wordpress-and-jquery/ I am working on Thematic child theme: http://www.integritycorp.org/study/?page_id=103#all This is the code I used:   * http://gist.github.com/3024754   * http://gist.github.com/3024748 Why doesn’t the filtering work when I click on one of the tags?


Multiple loops on the same page removing post tags

I am trying to use two loops on my page, one to get the current page's content and so on, and another to get all of the posts of a specific category. When I do that, all of the tags for the current page disappears. Here is my code, Loop one:               <?php if (have_posts()) : ?>        <?php while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
        <?php endwhile; ?>     <?php endif; ?>      Loop two:               <?php query_posts(array('category_name' => 'test')); ?>     <?php if (have_posts()) : ?>        <?php while (have_posts()) : the_post(); ?>
<?php the_excerpt(); ?>
        <?php endwhile; ?>     <?php endif; ?>      Any ideas? Thanx in advance!


Feed error: A feed could not be found at youtube.com/... (1 post)

FeedWordPress doesn't work very well with YouTube feeds. The RSS feed clearly exists when I visit the link via web browser, but FeedWordPress can't find it. YouTube feeds work just fine with other syndication scripts, so I imagine there must be some kind of solution for this. If you don't have a specific answer, I would appreciate a point in the right direction. Any thoughts. http://wordpress.org/extend/plugins/feedwordpress/


How do you prevent headers and html from being sent for an admin page?

I am creating a plugin for the admin section of my wordpress site which downloads a spreadsheet of data from a third party database. I've created an admin page using 'add_menu_page'. The view for that page is simply a button within a form that is targeted at an invisible iframe on the same page. When the form is submitted, I need to stop wordpress from initiating its own headers (b/c my plugin will send an xls header) and sending the wp-admin template. Is there any way to do that?


Download custom file in wordpress backend

I tried to implement a custom download link in the theme settings, section that will give the users to download there custom settings for the backup. I tried this option               if( isset($_GET['download']) && $_GET['download'] == true ) {                      $data = '';                      if( $upanel !== FALSE ) {                     $data .= serialize(                             array(                                 'theme'=>'theme_name',                                  'data'=>$upanel                             )                     );                 }                           $filename = "theme_settings.txt";                           header("Content-Disposition: attachment; filename=".$filename);                 header("Content-Type: application/download");                 header("Pragma: no-cache");                 header("Expires: 0");                      echo $data;                 exit();             }      This section working fine and the data is downloaded correctly but its also insert the header html code into the text file. Like all the HTML codes. Its clue less for me, that without inserting in my text file, hows it comes there? How do i rid from the header html codes. Downloaded sample:               </div>                 </div>     // Above is unexpected html code from starting     // into the theme_settings.txt file     //Data that i want only      a:2:s:5:"theme";s:6:"theme_name";s:4:"data";a:52:s:9:"site_logo";s:0:"";s:12:"site_favicon";s:0:"";s:1


apply_filters to featured image

I have a page where I have embedded the page using these lines of codes at function.php:               //------Embed Content------     //Title     function CustomFunction_ShowPage_Title($id) {         $post = get_page($id);         $title = apply_filters('the_title', $post->post_title);         echo $title;     }          //Content     function CustomFunction_ShowPage_Content($id) {         $post = get_page($id);         $content = apply_filters('the_content', $post->post_content);         echo $content;     }      How do I do this for featured images too? do I simply replace `the_content with` with `the_post_thumbnail`? if so, what do I put on the second parameter? do I simply go `$post->post_thumbnail`?


How to save Admin FTP password

Every time I attempt to upload a plugin or theme, I am asked for the FTP password. Is there a way to save this within Wordpress, or do I have to enter it every time? Thanks.


search content of pages and list in wp-admin

I am developing a plugin, and I want to display a page that lists every page on the site that is using a specific shortcode defined by my plugin. I assume that I need to manually search wp_posts, but I am curious if there is a built in function or a better way to do this. Thanks so much!


Email from new comments

My blogs emails are working fine. I get all emails when new post and new register. But i dont recieve any emails when someone make a comment. Yes i cheked in admin settings. Any idea?


Check if Currently on Static Posts Page

I'm developing a website using WordPress 3.3.2 and have the Front Page and Posts Page set to use static pages. I'm trying to show different menus using `wp_nav_menu()` for the static front page and static posts page respectively. I was able to find `is_front_page()` to check for the front page, however after hours of banging my head against the WordPress Codex and checking the mighty Google I can't find a comparable function or method to check if the user is currently on the static posts page. Has anyone run into this? Any help would be greatly appreciated!


thumbnail image path and file path for gallery thumbnail images

what is the thumbnail image path? When asked for the file path for the gallery thumbnail image, what is needed? the terms: thumbnail image path and file path is not familiar to me.


Saving metabox keys and storing values as array

$key = "key";     $meta_boxes = array(         "item-count" => array(         "name" => "item-count",         "type" => "itemcount",         "std" => "",         "title" => "How many items?",         "description" => "Choose item count",         "options" => array(             "0" => "None", "1" => "1", "2" => "2", "2" => "2", "3" => "3", "4" => "4"),         ),         "item-color" => array(         "name" => "item-color",         "type" => "itemcolor",         "std" => "",         "title" => "Item Colors",         "description" => "Choose item colors",         "options" => array(             "black" => "Black", "white" => "White", "red" => "Red"),         ),     );          function create_meta_box() {     global $key;            if ( function_exists('add_meta_box') ) {           add_meta_box( 'item-div', 'Item Infos', 'display_meta_box', 'post', 'normal', 'high' );       }     }     function display_meta_box() {         global $post, $meta_boxes, $key;              wp_nonce_field( plugin_basename( __FILE__ ), $key . '_wpnonce', false, true );              foreach($meta_boxes as $meta_box) {         $data = get_post_meta($post->ID, $key, true);              switch ( $meta_box['type'] ) {              case "itemcount":         echo '
';         echo '

'.$meta_box['title'].'

';         echo '

';         echo'<select name="'.$meta_box['name'].'[]" multiple size="3">';         function new_in_array( $needle, $haystack )  { if (is_array($haystack)) { return in_array($needle, $haystack); } else { return false; } }     $getcountmeta = get_post_meta( $post->ID, 'key', true );     $getcountmeta2 = $getcountmeta['item-count']; ?>     <?php foreach ($meta_box['options'] as $item_count_key => $item_count_option) { ?>     <option <?php if ( new_in_array($item_count_key,$getcountmeta2)) { ?> selected <?php } ?> value="<?php echo $item_count_key; ?>"><?php echo $item_count_option; ?></option>     <?php }         echo '</select>';         echo '
'.$meta_box['description'].'
';         echo '

';         break;              case "itemcolor":         echo '
';         echo '

'.$meta_box['title'].'

';         echo '

';         echo'<select name="'.$meta_box['name'].'[]" multiple size="3">';         function new_in_array2( $needle, $haystack )  { if (is_array($haystack)) { return in_array($needle, $haystack); } else { return false; } }     $getcolormeta = get_post_meta( $post->ID, 'key', true );     $getcolormeta2 = $getcolormeta['item-color']; ?>     <?php foreach ($meta_box['options'] as $item_color_key => $item_color_option) { ?>     <option <?php if ( new_in_array2($item_color_key,$getcolormeta2)) { ?> selected <?php } ?> value="<?php echo $item_color_key; ?>"><?php echo $item_color_option; ?></option>     <?php }         echo '</select>';         echo '
'.$meta_box['description'].'
';         echo '

';         break;         }         }     }          function save_meta_box( $post_id ) {     global $post, $meta_boxes, $key;          foreach($meta_boxes as $meta_box) {     $data[ $meta_box[ 'name' ] ] = $_POST[ $meta_box[ 'name' ] ];          }          if ( !wp_verify_nonce( $_POST[ $key . '_wpnonce' ], plugin_basename(__FILE__) ) )     return $post_id;          if ( !current_user_can( 'edit_post', $post_id ))     return $post_id;          update_post_meta( $post_id, $key, $data );     }      The code i pasted above, adds the "key" meta_key to database and its meta_value is               a:2:{s:10:"item-count";a:2:{i:0;s:1:"1";i:1;s:1:"2";}s:10:"item-color";a:2:{i:0;s:5:"black";i:1;s:5:"white";}} //i chose counts 1 and 2, colors black and white      What i want to achieve is, instead of unique "key" meta_key, store those values in seperate meta keys such as               meta_key     item_color     meta_value   a:2:{i:0;s:5:"black";i:1;s:5:"white";}      I have no idea how to do this. Any suggestion?


Properly embed javascript into WP (using function.php) - doesn't work?

It seems that my contact form's ajax javascript and the custom.js that I'm using for my drop-down navigation are interfering with each other. The contact form's ajax fuction will only work properly if I won't call the "custom.js" in the header. Furthermore I've had troubles using some jquery sliders, too, because something seemed to be interfering and I think that custom.js might be the cause. I just copied it from another theme and tried to implement it into my theme, but apparently that wasn't such a good idea. This has been a problem for months now. If only I knew how to fix that conflict, I have to admit that I know nothing about javascript! Here's my website and here's my current header.php: http://pastebin.com/XhwqAGBt This is the custom.js: http://pastebin.com/A9ZRySra I need to get this sorted out no matter what, but I really can't do it on my own as my knowledge about javascript is non-existent, so please help me out a little! I'll try hard to figure things out on my own, but I need a little help here, please! EDIT4: I deleted my previous edits as it's getting too much to read and it wasn't that relevant anymore. I've been working on this almost the whole night and I just don't get it. Somebody who knows a bit about javascript, PLEASE help me out a little here. I'm trying to get rid of all the javascript calls in my header.php and put them into my function.php instead as I heard that's better to do?! So, what looked like this in my header.php:               <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-1.4.2.min.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.form.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/cufon-yui.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/Century_Gothic_400-Century_Gothic_700.font.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/javascript/custom.js"></script>      I'm trying to put into my function.php which looks like this right now:               function my_scripts_method() {      // Load jQuery     if ( !is_admin() ) {        wp_deregister_script('jquery');        wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"), false);        wp_enqueue_script('jquery');     }      wp_register_script('custom', get_template_directory_uri() . '/js/custom.js', array('jquery'));      wp_register_script('cufon-yui', get_template_directory_uri() . '/js/cufon-yui.js', array('jquery'));      wp_register_script('century_font', get_template_directory_uri() . '/js/Century_Gothic_400-Century_Gothic_700.font.js', array('jquery', 'cufon-yui'));          wp_enqueue_script('custom');     wp_enqueue_script('jquery.form');     wp_enqueue_script('cufon-yui');     wp_enqueue_script('century-font');          }     add_action('wp_enqueue_scripts', 'my_scripts_method');      Apart from the custom.js nothing else is working!! The cufon-yui etc.! Am I calling them incorrectly? I'm also not sure about the "jquery.form.js". Do I have to register it first? Should I call the WP "jquery-form" instead?! EDIT: Additional information: When I leave the custom.js in the function.php and put the other scripts back into the header, both: the navigation dropdown menu (custom.js) and the contact form (jquery.form + jquery 1.4.2) work perfectly fine. I tried to put the javascript in the contact.php to "no.conflict" mode, but then the contact form stopped working properly again. I really don't get it!! Thanks a lot in advance!


get_the_excerpt() not working in plugin loop

I am new in WordPress plugin development. I am developing a simple WordPress plugin in which `get_the_excerpt()` not working in the loop. Other tags such as `get_the_title()`, `get_the_permalink()` even `get_the_content()` working fine. Please somebody help me out on this. Here is the code               if($loop->have_posts()) :      while($loop->have_posts()) :            $loop->the_post();         $content .= '
'.get_the_title().'
'.get_the_excerpt().'
';     endwhile; wp_reset_postdata(); endif;


the_author_meta not working

I'm trying to use the_author_meta to retrieve some links which users can set in their profile. I set up extra profile fields and they are saving to the database. On my author.php I have the following code.
<a href="<?php the_author_meta('facebook'); ?>" class="facebook" title="Facebook">
      For some reason this appears not to be working. Any idea to why that may be? Cheers


Equivalent to in_category() for subcategories

Wordpress provides conditionals like is_home() and is_category(). I'd like a function to tell me if the current context belongs to a category that is a subcategory (so, not a parent). I tried this, but it returns true on any category (and subcategory) context               function is_subcategory($category) {         if (is_category()) {             foreach ($category as $c) {                 if ($c->parent > 0) {                     return true;                 }             }             return false;         }     }


Exclude Multiple Post Thumbnails From Post Attachments

i am trying to exclude multiple post thumbnails from attachments. i have the following thumbnails setup in my functions.php:               $thumb = new MultiPostThumbnails(array(         'label' => 'Client Logo',         'id' => 'client-logo',         'post_type' => 'clients'         )     );          $thumb = new MultiPostThumbnails(array(         'label' => 'Portfolio Home Image',         'id' => 'port-home-image',         'post_type' => 'clients'         )     );          $thumb = new MultiPostThumbnails(array(         'label' => 'Home Slide Image',         'id' => 'home-slide-image',         'post_type' => 'clients'         )     );      i then have the following code, within the loop to pull in all image attachements and disaply them               <?php           $thumb_id = get_post_thumbnail_id( $post_id );           $args = array(           'post_type' => 'attachment',           'numberposts' => $nimg,           'post_mime_type' => 'image',           'post_status' => null,           'post_parent' => $post->ID,           'exclude' => $thumb_id           );           $attachments = get_posts($args);           if ($attachments) {           foreach ($attachments as $attachment) {           //echo apply_filters('the_title', $attachment->post_title);           echo wp_get_attachment_image( $attachment->ID, array (650,650));               }           }          ?>      this line: `$thumb_id = get_post_thumbnail_id( $post_id );` excludes the featured post thumbnail. any ideas on how i can exclude my 3 other thumbnails? any help would be greatly appreciated. Thanks Danyo http://wordpress.org/extend/plugins/multiple-post-thumbnails


Custom setup of wordpress comments that are displayed

I have setup in admin to have 5 comments per post display, which is what I want, and newest at the top. But the problem is when a 6th comment is made it is the only one displayed and you can read the previous comments which will display 5. What I would like it to do is always display 5 comments, when 6th is made the oldest pushed to the next page. Thanks, Matt


Remove edit or add facility for custom post type

Is it possible to remove all references to 'edit' or 'add' from a particular post type on its post list display screen in admin? So basically what I need is that for this post type, all roles defined, whatever they are, can only view a list of these posts, and not do anything with them except trash them. So that means removing the 'Add New myposttype' button, as well as the 'Edit | Quick Edit' links beneath each entry of the list posts screen. In my custom post type these are my capability related settings:                       'capability_type' => array('food_item','food_items'),             'map_meta_cap'    => true,             'capabilities' => array(                             'publish_posts' => 'publish_food_items',                             'edit_posts' => 'edit_food_items',                             'edit_others_posts' => 'edit_others_food_items',                             'delete_posts' => 'delete_food_items',                             'delete_others_posts' => 'delete_others_food_items',                             'read_private_posts' => 'read_private_food_items',                             'edit_post' => 'edit_food_item',                             'delete_post' => 'delete_food_item',                             'read_post' => 'read_food_item'      In my plugin init function, I'm adding the following:                   global $wp_roles;         $wp_roles->add_cap( 'administrator', 'edit_food_item' );         $wp_roles->add_cap( 'administrator', 'edit_food_items' );      At this point the administrator just cannot see the food items entry in the menu at all.


download count29.php whene loading site

When my site is loading file count29.php to be downloaded from the site avondov.ru. This makes the site not loading completely and sometimes redirect to 404 page not found how can i do ignore this error? my web site is : adinehbajestan.ir


Add User meta fields, which only admin can edit

is there a way to add custom user meta fields (like the one in the profile.php which contain specific user data), but only an admin (or an other user with enough capabilities) can change them? Maybe I'm thinking too complicated, how would you tell your site visitors who from your users is doing which work on the site, if there are too many users (and probably often changing work) that it would be impossible too make a static page or something. Greetings, .wired // edit: you may replace "work" with position. I want to give the users a specific position. That's not the user role!


Re-position footer and force it to drop below blog post excerpts on home page

Site is under construction using a customized blank theme On my blog page, the footer cuts across the blog posts and it appears my footer is at an absolute position since it is at exactly the same spot on all pages. I need the footer to appear at the end of the final blog post/excerpt on Blog page. I have tried changing settings for footer in the css and currently have `<footer>` set at `position: absolute` (I'vei tried `relative`, but it lowered the address content on the right side inside the footer) and `#footer- container` set at `position: relative` which works for home page but will not work on the Blog page and probably won't work on the About or Media pages either once I get all the content completed there. Any suggestions?


how to show last 5 images from the one post gallery

i want to get the 5 images of a one post gallery and show this random, > example : [gallery id="123" orderby="rand" {numberpost=1 } or offset ? ] _[gallery] codex_ tanks for help me.


Can I get the ID of an inserted / linked image?

I am using this code to get the url of first inserted image in a post. Is there any way I can get the ID of that image.                     global $post, $posts;           $first_img = '';           ob_start();           ob_end_clean();           $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);           $first_image = $matches [1] [0];


Theme using masonry layout script  rendering overlaped images in Google Chrome

I have a WordPress theme built with Masonry script , I added a new template file for list gallery, is working ok in FF and IE but in Google Chrome gallery images (inside containers) are overlapped. Seems like the content is loading faster than images but they don't adjust afterwards.


After creating custom post type, URL to custom posts are invalid

So I created a custom post type like               add_action('init', 'create_post_type');          function create_post_type() {       register_post_type(         'portfolio',          array(           'labels' => array(             'name' => 'Portfolio',             'add_new_item' => 'Add New Portfolio Item',             'edit_item' => 'Edit Portfolio Item'           ),           'public' => true,           'capability_type' => 'post',           'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),           'menu_position' => 5         )       );     }      When I add a new custom post (http://localhost/wordpress/portfolio/portfolio- item-3/) and try going to that page, I get a 404. Whats wrong? **UPDATE** This solution works but what does it do and it sounds like its not good to keep flushing my rewrite rules isit? > Add >   >   >     flush_rewrite_rules(); >   > > after you call `register_post_type`.


How do I stop Topsy from spamming my site with those annoying trackbacks?

Every time I publish a post, Tospy adds their pingback to my post. It's annoying, but I don't know how to stop it. Any advice?


Is Using WordPress Supplied WYSIWYG Advisable?

I have been considering using the `the_editor` function to create WYSIWYG editors in my own pages. Is using the WordPress's inbuilt WYSIWYG editor in a plugin meant for general distribution advisable? Is it considered a part of the API that we can rely on to not change and break the plugin in future versions?


Can I have a link within a WP UI Spoiler

I'm using the WP UI plugin, and have a page set up with spoiler shortcodes so that you can "click to show" and "click to hide". Here's a link to the page in question: http://goinspire.com/faq/ My problem is this: I want to include a hyperlink within the text of one of the spoilers (which you only see after you "click to show"). When I inserted the html at wordpress "Edit Page", it displayed the actual html, instead of showing as a link. Here's my spoiler:   `[wpspoiler name="Do I need to buy travel insurance?" style="ui- lightness"]GoInspire highly recommends buying travel insurance for non- refundable tickets and land costs. Speak to our agent at 845-425-8255 ext. 209 for more info, or click here to read about our plans.[/wpspoiler]` Is there a way past this?


Add / Remove Post Type from "Link to existing content" popup

I would like to be able to remove a custom post type AND add attached media (PDF's, Images, Docs, etc) to the "Link to existing content" in the Add / Edit link popup in the WYSIWYG editor. Essentially, I've created a custom content type, but have way to many with the same name. So, I'd like those removed from the search results. In addition, I have a bunch of PDF's I've uploaded and would like to easily be able to link to those. Anyone ever accomplished this, know a plugin or have the hook to modify it?


Increment Page Order As Pages Are Created

In the Admin Panel, is there a way to hook into the page creation and increment Page Order number of each page or to be equal to the number of pages. Right now the default is `0` and when I make a new page i would much rather have it at the bottom of my list than the top.


Reorder dashboard widgets

I recently tried to reorder the dashboard widgets by writing a plugin. I accomplished this: ![enter image description here](http://i.stack.imgur.com/kQS5f.png) with the following code:               <?php     /*      * Plugin Name: Custom Dashboard      * Description: Custom dashboard for Avare sites.      * Author: Avare      * Version: 1.0      */          function sort_dashboard_widgets() {           $left_column_widgets[] = 'dashboard_right_now';      $left_column_widgets[] = 'dashboard_recent_comments';      $left_column_widgets[] = 'dashboard_incoming_links';           $right_column_widgets[] = 'dashboard_quick_press';      $right_column_widgets[] = 'dashboard_recent_drafts';      $right_column_widgets[] = 'dashboard_primary';      $right_column_widgets[] = 'dashboard_secundary';          // Global the $wp_meta_boxes variable (this will allow us to alter the array)     global $wp_meta_boxes;          // We then unset that part of the array     unset($wp_meta_boxes['dashboard']['normal']['core']);     unset($wp_meta_boxes['dashboard']['side']['core']);          // Then we make a backup of the widget areas     $left_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];     $right_dashboard = $wp_meta_boxes['dashboard']['side']['core'];          // Then we merge them in some sort of way (is this necessary?)     $sorted_left_dashboard = array_merge((array)$left_column_widgets, (array)$left_dashboard);     $sorted_right_dashboard = array_merge((array)$right_column_widgets, (array)$right_dashboard);          // Now we add the sorted widgets back in     $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_left_dashboard;     $wp_meta_boxes['dashboard']['side']['core'] = $sorted_right_dashboard;          }          add_filter('wp_dashboard_setup', 'sort_dashboard_widgets');      As you can see in the screenshot I made, it looks like the plugin only looks at the first letter of **$left_column_widgets** and **$right_column_widgets** , which causes the errors (because 'd' is not a valid widget slug). Is there any way to solve this problem? Cheers


Disallow img tag in comments?

I have been looking quite a long time for a way to stop people from posting external images in comments i e               <img alt="my photo" src="http://example.co.uk/pic.jpg" />      and the image is displayed, without permission from the owner. This is hard coded somewhere in core but I can't find a way to unset this behaviour. Thanks!


wp_verify_nonce keeps failing

I needed to assign categories to post from frontend so I am making use of the solution suggested in this thread , in form of a plugin. It is working as expected. I just wanted to add a nonce field in order to make it a bit more secure. I seemed to have failed so far to get it working as I keep getting "Sorry, your nonce did not verify.". Complete code is given below including the changes I made, which are on the lines 42 and 103. Here is also a link to pastebin thread , in case you will need to identify the lines. In both the lines I have tried to take the hint from this wordpress page .Kindly take a look and let me know why the nonce keeps failing to verify.                  <?php         /*         Plugin Name: WPSE Crowded Cats         Plugin URI: http://wordpress.stackexchange.com/questions/43419/how-do-i-create-a-way-for-users-to-assign-categories-to-a-post-from-the-frontend         Description: Allow visitors to change categories of posts. Ready to use with custom taxonomies and post types.         Version: 0.1         Author: WPSE         Author URI: http://wordpress.stackexchange.com/users/2110/maugly         License: GPL2         */                   add_action('plugins_loaded','wpse_init_crowd_cats_class');         function wpse_init_crowd_cats_class(){             new WPSECrowdCatsClass();         }                   class WPSECrowdCatsClass {                  function __construct() {                      // APPEND THE FORM AUTOMATICALLY TO EVERY POST                 add_filter( 'the_content', array( $this,'append_form' ) );                      // TEMPLATE ACTION TAG TO BE USED IN THEME                 // Usage: do_action('wpse_crowd_cats_form');                 // Usage: do_action('wpse_crowd_cats_form', $post_id, $taxonomy );                 add_action( 'wpse_crowd_cats_form', array( $this,'wpse_crowd_cats_form' ), 10, 2 );                      // FORM PROCESSING                 add_action( 'template_redirect', array( $this,'process_request' ) );                  }                  function process_request(){                      // check submission                 if ( ! isset($_POST['crowd-cat-radio']) || ! is_array($_POST['crowd-cat-radio']) )                     return;              if ( !isset($_POST['nonce_name']) || !wp_verify_nonce($_POST['nonce_name'],'nonce_action') )               {            print 'Sorry, your nonce did not verify.';            exit;         } else {    // continue to process form data                      // sanitize and check the input                 $suggested_terms = array_map( 'absint', $_POST['crowd-cat-radio'] );                 $post_id = absint( $_POST['crowd-cats-pid'] );                 $tax = $_POST['crowd-cats-tax'];                 if ( ! taxonomy_exists($tax) )                     return;                      // Allow only existing terms. Not sure if this is needed.                 $args = array( 'hide_empty' => false );                 $args = apply_filters( 'mcc_allowed_terms_args', $args, $post_id, $tax );                 $args['fields'] = 'ids';                 $allowed_terms = get_terms( $tax, $args );                 foreach ( $suggested_terms as $key => $term_id )                     if ( ! in_array( $term_id, $allowed_terms ) )                         unset( $suggested_terms[$key] );                      // Add terms to taxonomy                 $affected_terms = wp_set_object_terms( $post_id, $suggested_terms, $tax, false );                 update_term_cache($affected_terms);                 return $affected_terms;                  }         }                  function get_form( $post_id=null, $tax='category' ) {                      if ( is_null($post_id) || ! taxonomy_exists($tax) )                     return false;                      $args = array( 'hide_empty' => false );                 $args = apply_filters( 'mcc_get_terms_args', $args, $post_id, $tax );                 $all_terms = get_terms( $tax, $args );                      if ( ! $all_terms )                     return false;                      $post_terms = wp_get_object_terms( $post_id, $tax, array( 'fields' => 'ids' ) );                      $permalink = get_permalink( $post_id );                      $out = "<form id='crowd-cats' action='$permalink' method='POST' >
";                      foreach ( $all_terms as $t ) :                          $checked = in_array( $t->term_id, $post_terms) ? 'checked' : '';                     $out .= "
                                <input type='checkbox' id='crowd-cat-$t->term_id' name='crowd-cat-radio[]' value='$t->term_id' $checked />                                term_id' >".esc_attr($t->name)."
";                      endforeach;                      $out .= "
                        <input type='submit' value='Submit' name='crowd-cats-submit'/>                        <input type='hidden' value='".wp_nonce_field('nonce_action','nonce_name')."'/>                        <input type='hidden' value='".esc_attr($tax)."' name='crowd-cats-tax'/>                        <input type='hidden' value='$post_id' name='crowd-cats-pid'/>";                      //TODO: set nonce                      $out .= "</form>";                      return $out;                  }                            function append_form($content){                      global $post;                      if ( 'post' != $post->post_type )                     return $content;                      $form = $this->get_form( $post->ID );                      if ( ! $form )                     return $content;                      return "$content \n $form";             }                       function wpse_crowd_cats_form( $post_id=null, $taxonomy='category' ) {                      if ( is_null($post_id) ) {                     global $post;                     $post_id = $post->ID;                 }                      echo $this->get_form( $post_id, $taxonomy );             }                   } // end of class                       ?>      Pretty new to php here, please be kind.


Passing values by form to create a query

I have this structure:               taxonomy         - term1         -- child term1         -- child term2              -term2         -- child term1         -- child term2      I have two select boxes. First one shows the parent terms (term1 and term2) and the second one shows the childs of the selected parent. I submit the form to "search-results.php". How can I get the values of both selects to create this kind of query?               $args = array(        'tax_query' => array(                                    array(               'taxonomy' => 'state',               'field' => 'slug',               'terms' => array( term1, childTerm2 ),               'operator' => 'IN'            )         )     );      Thanks.


phpMyAdmin Import CSV trying to match with custom ID

Having already imported posts in Wordpress, I have a separate csv file with custom fields which I'd like to import via phpMyAdmin. How do I match the custom-id to imported posts with the same custom-id? `custom-id,image 12345,www.domain.com/12345.jpg`


Hide sharing box and author box with a metabox on Wordpress

I have a little problem with my Metabox. I explain, I created in below each posts a sharing box and author box, I create a Metabox, it works, but I want hide the two blocks when I click the checkbox of the Metabox instead of show he blocks, it's possible? Here is the code for my functions.php file for my Metabox:               add_action( 'add_meta_boxes', 'ks_meta_box' );          function ks_meta_box() {         add_meta_box( 'ks-meta-box', __('Generals Options'), 'ks_meta_box_callback', 'post', 'side', 'default' );     }          function ks_meta_box_callback( $post ) {       global $post;       $values = get_post_custom( $post->ID );       $check = isset( $values['full_width_post'] ) ? esc_attr( $values['full_width_post'][0] ) : '';       wp_nonce_field( 'ks_meta_box_nonce', 'meta_box_nonce' );       ?>
         <input type="checkbox" name="full_width_post" id="full_width_post" <?php checked( $check, 'on' ); ?> /> <?php _e( 'Full-Width Post.' ) ?>
         <input type="checkbox" name="share_buttons" value="open" <?php checked($post->share_buttons, 'open'); ?> /> <?php _e( 'Show Share Buttons.' ) ?>
         <input type="checkbox" name="author_box" value="open" <?php checked($post->author_box, 'open'); ?> /> <?php _e( 'Show Author Information.' ) ?>
            <?php     }          add_action( 'save_post', 'wpsb_meta_box_save' );     function wpsb_meta_box_save( $post_id ) {            if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {         return $post->ID;       }            if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'ks_meta_box_nonce' ) ) return;            if( !current_user_can( 'edit_post' ) ) return;            $chk = ( isset( $_POST['full_width_post'] ) && $_POST['full_width_post'] ) ? 'on' : 'off';            update_post_meta( $post_id, 'full_width_post', $chk );       update_post_meta( $post_id, "share_buttons", $_POST["share_buttons"]);       update_post_meta( $post_id, "author_box", $_POST["author_box"]);     }      And the code for my sharing box and author box in "single.php" file:               <?php if ( get_post_meta( $post->ID, 'share_buttons', true ) ) : ?>     <?php get_template_part('includes/post-share','single'); ?>     <?php endif ?>          <?php if ( get_post_meta( $post->ID, 'author_box', true ) ) : ?>     <?php ks_author_box() ?>     <?php endif ?>      Thank you. I hope you can help me, sorry if you misunderstand me but I am French and I use goole translate.


Include php on a specific page template

I'm using a 'specialized' page template called 'page-courses.php', following the codex: http://codex.wordpress.org/Page_Templates#Specialized_Page_Template In my child theme's functions.php I want to add a php include only when using the page template. I've used get_page_template() as a way of identifying the page template               if(strtolower(basename(get_page_template()))=='page-courses.php'){        include_once('functions_courses.php');     }      However, get_page_template() doesn't return anything at that point in the execution. If I run it after the loop...               function is_courses_page(){       if(strtolower(basename(get_page_template()))=='page-courses.php'){          include_once('functions_courses.php');       }     }     add_action('loop_end', 'is_courses_page');      ... then 'page-courses.php' is returned, but too late for including my functions_courses.php file which includes enqueues. I'm not sure which action reference to use I'm quite new to all this, so maybe I'm going about it in completely the wrong way, so any guidance would be much appreciated.


Full width layout for custom post type pages

I'm trying to remove a widget area called 'Primary' from a certain page on a site. This is the function where I manage the sidebars:               //ADD CATEGORIES IN SIDEBAR OF SINGLE POST TYPE     add_action( 'genesis_sidebar', 'add_mysite_sidebar' );     function add_mysite_sidebar() {         if( get_post_type() == 'post' ){                     dynamic_sidebar( 'News Categories' );         } else if( get_post_type() == 'events' ){                    dynamic_sidebar( 'Event Categories' );         } else if( get_post_type() == 'documentlibrary' ){                   dynamic_sidebar( 'Document Categories' );         } else if( get_post_type() == 'bp_members' ){             include(members_sidebar.php);             unregister_sidebar( 'sidebar' );             dynamic_sidebar( 'Members Widget' );         } else if( get_post_type() == 'bp_group' ){              include(groups_sidebar.php);             unregister_sidebar( 'sidebar' );                 dynamic_sidebar( 'Groups Widget' );         }     }      I need to remove the 'Primary' widget area on the groups and members pages, but I don't see how to do it, and on the front end the widgets in that widget area are not in any overall container otherwise I could just hide it.


Permalinks for Taxonomy and Custom Post Type

Have the following situation here:      Custom post type: 'recipes'   Taxonomy for custom post type 'recipes': 'receitas'   One of the taxonomies slug: 'receitas-whoopie-pie'      The permalink structure MUST be:      example.com/receitas (show all the posts of custom post type 'recipes' ... it can be a page template if need)   example.com/receitas-whoopie-pie (show all posts of custom post type 'recipes' under the taxonomy 'recipescat'->'receitas-whoopie-pie')   example.com/receitas-whoopie-pie/post_name (show a singular post under the taxonomy 'receitas'->'receitas-whoopie-pie')      I tried many of ways do this through filters, the only one that works, give me an 404 page when accessing the .../receitas-whoopie-pie/post_name.      Actually, I have the following structure:         My functions regardless this issue:   example.com/receitas (show all the posts of custom post type 'recipes' - page template)   example.com/receitas/receitas-whoopie-pie (show all posts of custom post type 'recipes' under the taxonomy 'recipescat'->'receitas-whoopie-pie')   example.com/recipes/post_name (show a singular post under the taxonomy 'receitas'->'receitas-whoopie-pie')                 add_action( 'init', 'receitas_posttype', 0 );     function receitas_posttype() {              $labels = array(             'menu_name'           => 'Receitas',             'name'                => 'Receitas',             'singular_name'       => 'Receita',             'parent_item_colon'   => '',             'all_items'           => 'Todas as Receitas',             'view_item'           => 'Ver Receita',             'add_new_item'        => 'Adicionar Receita',             'add_new'             => 'Nova Receita',             'edit_item'           => 'Editar Receita',             'update_item'         => 'Atualizar Receita',             'search_items'        => 'Pesquisar Receita',             'not_found'           => 'Receita(s) não encontrada(s)',             'not_found_in_trash'  => 'Receita(s) não encontrada(s) no lixo'         );                $args = array(             'label'               => 'recipes',             'description'         => 'Receitas',             'labels'              => $labels,             'supports'            => array( 'title', 'editor', 'author', 'thumbnail' ),             'hierarchical'        => true,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_position'       => 100,             'menu_icon'           => get_bloginfo('stylesheet_directory').'/images/receitas.png',             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'capability_type'     => 'post',         );              register_post_type( 'recipes', $args );          }          add_action( 'init', 'receitascat', 0 );     function receitascat()  {              $labels = array(             'name'                       => _x( 'Receitas', 'Taxonomy General Name', 'ickfd' ),             'singular_name'              => _x( 'Receita', 'Taxonomy Singular Name', 'ickfd' ),             'menu_name'                  => __( 'Categorias de Receita', 'ickfd' ),             'all_items'                  => __( 'Todas as categorias', 'ickfd' ),             'parent_item'                => __( 'Categoria pai', 'ickfd' ),             'parent_item_colon'          => __( 'Categoria pai:', 'ickfd' ),             'new_item_name'              => __( 'Nova categoria', 'ickfd' ),             'add_new_item'               => __( 'Adicionar nova categoria', 'ickfd' ),             'edit_item'                  => __( 'Editar categoria', 'ickfd' ),             'update_item'                => __( 'Atualizar categoria', 'ickfd' ),             'separate_items_with_commas' => __( 'Separe as categorias com vírgula', 'ickfd' ),             'search_items'               => __( 'Pesquisar categorias', 'ickfd' ),             'add_or_remove_items'        => __( 'Adicionar ou remover categorias', 'ickfd' ),             'choose_from_most_used'      => __( 'Escolha as categorias mais usadas', 'ickfd' ),         );         $rewrite = array(             'slug'                       => 'receitas',             'with_front'                 => true,             'hierarchical'               => true,         );         $args = array(             'labels'                     => $labels,             'hierarchical'               => true,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => false,             'rewrite'                    => $rewrite,         );         register_taxonomy( 'receitas', 'recipes', $args );          }      The functions that WORKED, but with 404 page in singular page:               add_action( 'init', 'receitas_posttype', 0 );     function receitas_posttype() {              $labels = array(             'menu_name'           => 'Receitas',             'name'                => 'Receitas',             'singular_name'       => 'Receita',             'parent_item_colon'   => '',             'all_items'           => 'Todas as Receitas',             'view_item'           => 'Ver Receita',             'add_new_item'        => 'Adicionar Receita',             'add_new'             => 'Nova Receita',             'edit_item'           => 'Editar Receita',             'update_item'         => 'Atualizar Receita',             'search_items'        => 'Pesquisar Receita',             'not_found'           => 'Receita(s) não encontrada(s)',             'not_found_in_trash'  => 'Receita(s) não encontrada(s) no lixo'         );                $args = array(             'label'               => 'recipes',             'description'         => 'Receitas',             'labels'              => $labels,             'supports'            => array( 'title', 'editor', 'author', 'thumbnail' ),             'hierarchical'        => true,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_position'       => 100,             'menu_icon'           => get_bloginfo('stylesheet_directory').'/images/receitas.png',             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'rewrite'             => true,             'capability_type'     => 'post',         );              register_post_type( 'recipes', $args );          }          // Ativação das categorias (taxonomias) do custom post type     add_action( 'init', 'receitascat', 0 );     function receitascat()  {              $labels = array(             'name'                       => _x( 'Receitas', 'Taxonomy General Name', 'ickfd' ),             'singular_name'              => _x( 'Receita', 'Taxonomy Singular Name', 'ickfd' ),             'menu_name'                  => __( 'Categorias de Receita', 'ickfd' ),             'all_items'                  => __( 'Todas as categorias', 'ickfd' ),             'parent_item'                => __( 'Categoria pai', 'ickfd' ),             'parent_item_colon'          => __( 'Categoria pai:', 'ickfd' ),             'new_item_name'              => __( 'Nova categoria', 'ickfd' ),             'add_new_item'               => __( 'Adicionar nova categoria', 'ickfd' ),             'edit_item'                  => __( 'Editar categoria', 'ickfd' ),             'update_item'                => __( 'Atualizar categoria', 'ickfd' ),             'separate_items_with_commas' => __( 'Separe as categorias com vírgula', 'ickfd' ),             'search_items'               => __( 'Pesquisar categorias', 'ickfd' ),             'add_or_remove_items'        => __( 'Adicionar ou remover categorias', 'ickfd' ),             'choose_from_most_used'      => __( 'Escolha as categorias mais usadas', 'ickfd' ),         );              $rewrite = array(                 'slug'                       => '',                 'with_front'                 => false,                 'hierarchical'               => true,             );              $args = array(             'labels'                     => $labels,             'hierarchical'               => true,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => false,             'rewrite'                    => $rewrite,         );         register_taxonomy( 'receitas', 'recipes', $args );          }          function filter_post_type_link($link, $post)     {         if ($post->post_type != 'recipes')             return $link;              if ($cats = get_the_terms($post->ID, 'receitas'))             $link = str_replace('recipes', array_pop($cats)->slug, $link);         return $link;     }     add_filter('post_type_link', 'filter_post_type_link', 10, 2);      Thanks in advance. Sorry for my bad english. :(


Forcing WP to embedd a video when using a shortcode

With the following shortcode for YouTube videos, how can I make it such that WordPress still automatically embeds the video for me?               <?  /** YouTube shortcode, usage: [youtube align="alignleft" id="123456789" ] */         function shortcode_youtube($atts) {               extract(shortcode_atts(array(                   "id"    => '',                  "align" => 'aligncenter'               ), $atts));               return '
http://www.youtube.com/watch?v='.$id.'
';           }           add_shortcode("youtube", "shortcode_youtube");           ?>      What it currently does, is display the url of the video. What I want is it to embed the video (like it would do if I just pasted the video's url into the wp editor).


Get RSS feed about plugin new update

I would like to know if there is a way to get a rss feed when one of the plugin of my website is available. Indeed, I need to manage updates of some website, but I don't want to lose my time connecting on those websites to see if there are really some plugin updates... So getting a rss feed would be perfect. Is it possible to do it? Thank you very much.


How to keep sharing stats after creating 301 redirects?

I recently changed a lot of URLs for SEO purposes and realized that all of my Facebook likes and Twitter tweet counts were lost on posts created prior to yesterday. Posts created since yesterday already had SEO-friendly URLs so I didn't have to change them and their social stats are of course, fine. I used 301 redirects so I can still use the old URL in Facebook and Twitter code since they support indicating another URL to count.I know how to use custom fields in order to fix the old posts, but how do I do this when I have a mix of old posts with new URLs and new posts with unmodified URLs?


Blank page for edit.php

I get a blank page on /wp-admin/edit.php after change the number of post to display. The bug is due to the PHP memory, but on my hosting I have no possibility to change this value. ![enter image description here](http://i.stack.imgur.com/xT91I.png) How to reset the number of post to display on the edit.php page please. Thanks you


Displaying number of drafts in Posts section of admin sidebar

Is there a WP plugin to show the number of drafts in the _Posts_ section of the admin sidebar in the same way that the number of available updates is shown? I’m looking for something like the following example: ![enter image description here](http://i.stack.imgur.com/6XgY0.png)


Using separate Apache log files for multisite

A while back I left Blogger and downloaded my blogs to my system. I hosted them there with each individual blog as a VirtualHost for a while. Later, I imported them into WordPress and am hosting them from WP now. When I was hosting them locally as virtual hosts, I had each one use a separate Apache log file, but now, all of the blogs are logged to the same file. I cannot find a setting in WordPress, and there is no way to specify it in an `.htaccess` file since the sites are virtual. That is, WordPress blogs are not actually located on the drive as separate directories—(besides, log settings cannot be used in `.htaccess` anyway). How can a WordPress multi installation be configured so that one or more sites log to their own log file? toscho’s second suggestion of using SetEnvIf is promising. I managed to get it to put access to one site in a separate log file and keep it out of the main log by using the directives below.               …     <IfModule log_config_module>       …       # I’m re-using the dontlog environment variable because there is no reason to make a special variable (for me), so it avoids having to use an expression (plus, it just makes sense)       SetEnvIf Request_URI "^/blogs"        dontlog       SetEnvIf Request_URI "^/blogs/blog1"  blog1       SetEnvIf Request_URI "^/blogs/foobar" foobar       …       CustomLog "../Logs/Main/access.log"  common env=!dontlog       CustomLog "../Logs/Blogs/blog1.log"  common env=blog1       CustomLog "../Logs/Blogs/foobar.log" common env=foobar       …       UnsetEnv  dontlog       UnsetEnv  blog1       UnsetEnv  foobar     </IfModule>     …      This works for a single-site blog, but for multisite, the problem is in trying to keep things uncluttered and simplify adding new blogs because it looks like it is not possible to use variables in log filenames as follows, which means making a separate entry for each and every one:               …     <IfModule log_config_module>       …       SetEnvIf Request_URI "^/blogs"         dontlog       # Set environment variable to matched regex subexpression corresponding to blog name       SetEnvIf Request_URI "^/blogs(.+/)"    blog=$1       …       CustomLog "../Logs/Main/access.log"    common env=!dontlog       CustomLog "../Logs/Blogs/%{blog}e.log" common env=blog       …       UnsetEnv  dontlog       UnsetEnv  blog     </IfModule>     …      I end up with a log containing all blog access in a file named `%{blog}e.log`.


Mysqldump add drop table?

I notice in the Codex that the --add-drop-table option is displayed for backing up a database. Before I screw anything up, does this just mean that when the backup is eventually imported, the tables will overwrite if they exist in the destination db? I don't want to drop the tables when I back them up!               user@linux:~/files/blog> mysqldump --add-drop-table -h mysqlhostserver      -u mysqlusername -p databasename (tablename tablename tablename) | bzip2      -c > blog.bak.sql.bz2          Enter password: (enter your mysql password)     user@linux~/files/blog>      http://codex.wordpress.org/Backing_Up_Your_Database#Using_Straight_MySQL_Commands


Randomizing Post Links Outside of Loop - No Author or Date

I'm developing a home page that is a mishmash of a bunch of information, including a random smattering of several categories, including blog posts (category 192 in the code below) I'm obviously not invoking the standard WP loop to do this. Is there a way to get the date and author to echo properly:                    <?php $rand_posts = get_posts('cat=192&numberposts=2&orderby=rand'); foreach( $rand_posts as $post ) : ?>

Blog | <?php the_date('m/d/Y'); ?>
         <a href="<?php the_permalink() ?>"><img src="<?php the_field('01HomeThumbnail'); ?>" alt="<?php the_title(); ?>" width="113" height="111" />
by <?php the_author(); ?>

<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?>
         <a target="_blank" href="<?php the_permalink() ?>" class="readPost">Read Post
     <?php endforeach; ?>      The two issues I'm experiencing I think are both because I'm outside of the loop, but unfortunately, I'm not sure how to get the info I need. Basically, I am randomize 2 blog posts. Everything outputs as expected, except the date and the author. I know `<?php the_author(); ?>` is deprecated, but it's not returning the expected author anyway. The other thing not working is `the_date`. It seems to output on the first outputted blog post, but subsequent are blank. Any help would be appreciated on either of these. I'm building this on a custom theme based on the twenty ten theme.


Display User Role Next To Comment

I've search around but I can't seem to find exactly what I'm looking for and for the first time I don't even know where to start. How do I display the user role (Admin, Editor, Author Contributor, Custom) next to a registered user's comments? With a condition to display something else if they're not a registered user.


Custom Post Type 'Show on screen' didn't apply to number

I want to be able to show more custom post type in the admin area, and when I try to increase the number of posts by adding a number in the screen options and click apply nothing happen. However this works with the normal posts. My code for my custom posy // Register Post Type               add_action( 'init', 'create_tests_type' );     function create_tests_type() {     $labels = array(         'name'               => _x( 'Test', 'post type general name' ),         'singular_name'      => _x( 'Test', 'post type singular name' ),         'add_new'            => _x( 'Add New', 'book' ),         'add_new_item'       => __( 'Add New Test' ),         'edit_item'          => __( 'Edit Tests' ),         'new_item'           => __( 'New Tests' ),         'all_items'          => __( 'All Tests' ),         'view_item'          => __( 'View Test' ),         'search_items'       => __( 'Search Tests' ),         'not_found'          => __( 'No Tests found' ),         'not_found_in_trash' => __( 'No Tests found in the Trash' ),          'parent_item_colon'  => '',         'menu_name'          => 'Tests'     );     $args = array(         'labels'        => $labels,         'description'   => 'Holds our Tests data',         'public'        => true,         'menu_position' => 5,         'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),         'has_archive'   => true,     );     register_post_type( 'test', $args );         }      I search a lot to solve this but didn't found a right solution. Thanks


Latest posts on all pages

I would like to have the “latest” boxes on all my pages. How can I fix that? As it is now it works on the homepage, on the other only one box apperes and but the content is the same as the page it is in.                   <!--LATEST POSTS-->     <div class="center">     <?php if (is_page() ) { ?>         <?php if(of_get_option('latstpst_checkbox') == "1"){ ?><?php get_template_part(''.$zn_lays = of_get_option('layout_images', 'layout1').''); ?><?php } else { ?><?php } ?>     <?php } else { ?>         <?php get_template_part(''.$zn_lays = of_get_option('layout_images', 'layout1').''); ?>     <?php } ?>     <!--LATEST POSTS END-->


Why isn't my custom function kicking in from my functions.php file?

We'd like to clean some of our WordPress URL's up and have some rewrites in place in the following format: Actual URL: product-one/product-one-guides/ Actual URL: product-two/product-two-guides/ Rewritten URL: product-one/guides/ Rewritten URL: product-two/guides/ This allows us to use the same sub folder name within separate products. (no duplicate slug issues ) Anyway, I have a function in functions.php that does this:               // URL replaces     function updateToPerfectURLs($content) {              $new_content = $content;              $new_content = str_replace("/product-one-", "/", $new_content);         $new_content = str_replace("/product-two-", "/", $new_content);              return $new_content;     }      I now want to do something like this:               <?php updateToPerfectURLs(the_permalink())?>      But for some reason the replaces aren't taking place and my permalinks are still coming out like:               domain.com/product-one/product-one-guides      Can anyone think of a reason why?


Search.php gets metadata from first post

I've got this in header.php in `<head>` section:               $page_color = get_post_meta($post->ID, 'page_color', true);      It works fine because it gets correct `page_color` for posts and pages but when I perform some search and search.php is run, it occasionally gets `page_color` of first post it finds. This is the content of search.php:               <?php       if( have_posts() ) :          while (have_posts()) : the_post(); ?>             <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>             <?php the_excerpt(); ?>         <?php endwhile; ?>       <?php else : ?>             Nothing found.         <?php endif; ?>      Any ideas why is that?


Add_filter rel="prettyphoto" to WP3.4.1

I know there have been a couple of questions in relation to this and had a look at them, but mine differs slightly on the problem experienced and the code. I am basically building my first theme and hoping to implement PrettyPhoto, I have been careful with enqueue'ing scripts and jQuery and have NivoSlider working ok, but have obviously missed something here, hence the question! Firstly I have this code for the WP jQuery in the functions.php file:               function scripts_jquery_load_scripts() {     wp_enqueue_script( 'jquery' );     }         add_action('wp_enqueue_scripts', 'scripts_jquery_load_scripts');      Then for PrettyPhoto I have the following code also in the functions.php:               function prettyphoto_load_scripts() {     wp_register_script( 'jquery.prettyphoto', get_bloginfo('template_directory').'/prettyphoto/js/jquery.prettyphoto.js',      array('jquery'));     wp_enqueue_script( 'jquery.prettyphoto' );     }         add_action('wp_enqueue_scripts', 'prettyphoto_load_scripts');      and for the style               function prettyphoto_load_styles() {     wp_register_style( 'prettyphotocss', get_bloginfo('template_directory').'/prettyphoto/css/prettyphoto.css');     wp_enqueue_style( 'prettyphotocss' );     }         add_action('wp_enqueue_style', 'prettyphoto_load_styles');      and finally to add the rel"prettyphoto" on the link surrounding the image               add_filter('the_content', 'addprettyphotorel', 12);     add_filter('get_comment_text', 'addprettyphotorel');     function addprettyphotorel ($content) {        global $post;     $pattern = "/]*).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>(.*?)<\/a>/i";     $replacement = 'ID.']"$6>$7';     $content = preg_replace($pattern, $replacement, $content);     return $content;     }      I have used Firebug to try and work out where my mistake is, I have the WP includes Jquery appearing in the head, as well as the PrettyPhoto script. Also checking the image container I have the following appearing:                     But the thumbnails still open up in a new window and not with PrettyPhoto. I have set WP_DEBUG to true in the wp-config.php file, resolved a few unrelated issue as well just incase they were having an affect. I am running this all on a WAMP server at the moment, and planning to place online in the next day to see if this helps the issue, I know Jetpack will not work on WAMP. If anyone one has any possible tips it would be really appreciated? Thanks in-advance, Ant Additional information Adding this as some details from Firebug, below is what is being displayed in the head of the page:                               I have also looked at the script tab when running Firebug, in the list responsive images appears first, then Prettyphoto and finally jQuery. I assumed that the scripts load in the order they are listed in the head?


Adding custom field to an array

**How can I add a custom field to an array?** To complicate matters, custom field is on the Author's page, not on a regular post. It's added via Advanced Custom Fields. Typically, that field value would be called with `<?php the_field(author_status); ?>`. Here's the full code I'm working with right now.                <?php      //displays all users with their avatar and their posts (titles)      $blogusers = get_users_of_blog();      if ($blogusers) {        foreach ($blogusers as $bloguser) {          echo '
';         $user = get_userdata($bloguser->user_id);          echo '
' . get_avatar( $user->ID, 128 ) . '
';          $args=array(            'author' => $user->ID,            'post_type' => 'post',            'post_status' => 'publish',            'posts_per_page' => 1,            'caller_get_posts'=> 1          );          $my_query = null;          $my_query = new WP_Query($args);          if( $my_query->have_posts() ) {            //echo 'List of Posts for ' . user->user_firstname . ' ' . $user->user_lastname;            while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
<?php the_time('F jS, Y') ?> by <?php the_author_posts_link(); ?>                     <?php if ( comments_open() ) : ?>                                              <?php comments_popup_link(__('Leave a Comment ↓', 'responsive'), __('1 Comment ↓', 'responsive'), __('% Comments ↓', 'responsive')); ?>                                              <?php endif; ?>

<?php the_excerpt(); ?>
              <?php echo '' . $user->user_firstname . ' ' . $user->user_lastname . '
'; ?>             <?php            endwhile;          }        wp_reset_query();  // Restore global post data stomped by the_post().        }      }      ?>      * * * OMG, I got it to work! Placed this where I need it in the repeatable area: `<?php the_author_meta( 'author_status', $user->ID ); ?>`


Is there a reason why Pages are not publicly_queryable?

I am building a segmented search (by post type) with the ability to filter to a specific post type and realized pages were not publicly queryable. What I know I can do is the following:               function fix_page_query() {         if ( post_type_exists( 'page' ) ) {             global $wp_post_types;             $wp_post_types['page']->publicly_queryable = true;         }     }     add_action( 'init', 'fix_page_query', 1 );      which does allow them to use `post_type` as a query var, but are there any shortcomings to doing this? Was there a specific reason they are not by default? I did see this ticket about the subject, but could not decipher a clear answer. Thanks!


Hook for URL request

I would like to make XML files downloadable, instead of allowing the browser to displaying them inline. I know I can use the `Content-Disposition: attachment` HTTP header (of course, better solutions are welcome!). I want to add this header in all HTTP responses when a user tries to download an XML file. I can use the following PHP code:               header('Content-Disposition: attachment; filename="the_filename.xml"');      The problem is: _when_ I can call this instruction? What hook should I use and how?


Change position of media in admin menu

Is it possible to set the position of an item in the admin menu? I'm trying to move the media link under my custom post types. I know that the media link is position 10. Is it possible to set it to 14? I know that I can change the position of all the links using the `custom_menu_order` filter but I'm not seeing a way to set the position in that filter.


Search with meta_query and tax_query

I'm working on a little database for series based on wordpress. I've implemented a custom post type called "anime", some taxonomies (Genre, a_types..) and a lof of customfields. (based on acf). Now I'm working on a search page for this database and got some   unexplainable errors. I can't unterstand what break the following code. When I only add **on** meta_value query everything works great. When I add two or more meta_values queries the query() breaks. $args ->               Array     (     [post_type] => anime     [post_status] => publish     [orderby] => title     [order] => ASC     [showposts] => 10     [posts_per_page] => 2     [paged] => 0     [meta_query] => Array         (             [relation] => OR             [0] => Array                 (                     [key] => originalname                     [value] => des                     [compare] => LIKE                 )          ==>        [1] => Array                 (     E               [key] => germanname     R               [value] => des     R               [compare] => LIKE     O            )     R       [2] => Array                 (     ?               [key] => englishname                     [value] => des                     [compare] => LIKE     ==>         )              )          [tax_query] => Array         (             [relation] => AND             [0] => Array                 (                     [taxonomy] => a_types                     [field] => slug                     [terms] => Array                         (                             [0] => music                         )                          [operator] => IN                 )                  [1] => Array                 (                     [taxonomy] => Genre                     [field] => slug                     [terms] => Array                         (                             [0] => psychological                             [1] => race                             [2] => shoujo                         )                          [operator] => IN                 )              )      )


Disabling the Admin Bar | Where does code go?

I need to disable the admin bar for subscribing user ( not the admin). I found these code snippets here on SE.   * Best Option   * Another Option However I don't know what file to edit or where to put the code exactly. I have experience with PHP, HTML, etc. Just not so much with the WP (3.4.2). Thanks.


Retrieve page content and pass to PHP?

I'm new to WP but not PHP. I've a custom page that I have a PHP call to do some processing on the page content. `the_content()` even when enclosed in a function call               <?php do_something(the_content()  ); ?>      `echo`s the page content. How do I get the page data without so I can send it to a php function?


How can i remove the paragraph from shortcodes content?

If you have created shortcodes in Wordpress, you may have noticed that when you get the content of your shortcode, it's wrapped in html paragraph tags. I don't know why the progammers did that. It seems like a very bad idea to me to add formatting to the actual content. I've found a post that presents this solution : http://donalmacarthur.com/articles/cleaning-up-wordpress-shortcode-formatting/ But i'm wondering : Is there a solution proposed by the wordpress API itself, or something that i am missing here ?


I am getting this error after loading my php page: > Parse error: syntax error, unexpected end of file in > /Applications/XAMPP/xamppfiles/htdocs/wordpress2/wp- > content/themes/annonciation/page-42.php on line 77 I could understand that it means that I have opened a certain bracket or parenthasis somewhere, and didn't close it, but I can't for the love of god find it! Here is my code:               <?php get_header();?>

- Glossaire -

         <?php     foreach(range('A','Z') as $i) {?>
       <?php echo $i;?>
           <?php          if($i=='Z')           {             break;           }         else{         ?>
.
         <?php }       }          ?>

     <?php //$test=new WP_Query(array('post_type'=>'mots')); ?>          <?php //while ( $test -> have_posts() ) : $test -> the_post();?>          <?php           $args = array(         'post_type'=> 'mots',         'lettres'  => 'alpha',         'order'    => 'ASC'         );           $the_query = new WP_Query( $args );     if($the_query->have_posts() ) : {       while ( $the_query->have_posts() ) : $the_query->the_post();            //some code that is sure not making the error (i removed it and still getting the error)           endwhile;     }?>
     <?php get_footer(); ?>      what could the problem be?


Filter posts with missing attributes

I'm doing house-keeping on my posts, and a lot of `IMG` tags in my old posts do not have `class="alignnone size-full wp-image-xxx"` or `width="xxx" height="xxx"`. The attributes are needed for responsive width templates to scale images proportionately. How do I filter my posts NOT containing those attributes so that I can update my posts instead of going through hundreds of them manually? Theme used: Twenty Twelve, Wordpress 3.7


How can I modify the permalink via a filter?

I would like to make a change to the URL's in my href attribute across my while site when the_permalink is called. For example:
<a href="<?php the_permalink()?>"      Can I use my functions.php file to call my custom functon which deals with the search and replaces in the URL's               function updateToPerfectURLs($content) {


2 Different Taxonomy with Hierarchical Term Relationship

I'm searching a way to combine two different taxonomy by it's term. Here is a picture of what I'm trying to achieve ![screenshot](http://i.stack.imgur.com/l2heX.png) ![relation](http://i.stack.imgur.com/GjFNF.png) I will used this later in a drop down select box with Ajax, if it choose Make Audi, then model will be generating model for Audi. Is it possible to linking the term like I described?


Determining the table that posts belong to in a multisite setting

I am currently running a multisite and I would like to display posts from other sites in a site. To do this, I wanted to use AJAX so that when I click on the post it does not get redirected to the site it belongs to. I have created a custom post type called 'event' and I need to determine the posts that do not belong to the current site. It would be good if anyone can tell me the clever way to achieve this. However, I think it would be wise if we can determine which table in WP database each post belongs to so that we can determine the posts that do not belong to other sites. Any clever ideas as to how to achieve this?


Change the number of categories pr. row in woocommerce

Is there a way to change the number of categories to be shown by Woocommerce, without changeing the product listing as well?


How to add iOS & fav icons to the theme?

I want to add iOs, Android and favourite icons to the website. Generally I udnerstand how they shold be implomented: link files in the head section and you good to go, however there are many lines (for both devices and favico makes more than 10), so I do not know how to add them correctly:   1. Somehow enqueue them in the functions.php?   2. Some people on the internet mention creating a Site-Specific Snippets Plugin?    3. Use some sort of plugin for that (not big fan of this idea)?   4. Just add the links to header.php (that is what codex suggests). Just in case, the code:               <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />     <link rel="apple-touch-icon" href="/apple-touch-icon.png" />     <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png" />     <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png" />     <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png" />     <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png" />     <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png" />     <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png" />     <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png" />


Executing Javascript in Plugin

I am trying to display a google map using short code for a plugin I am building, but I can not get it to work. Does anyone have some advice on this? Here is my code:               add_shortcode( 'show_map', array('hotSpot', 'create_map'));     function create_map() {     ?>                    <?php      return '

';         }


How to override parent functions in child themes?

I've been reading around and trying to figure out how to do this, but for some reason I can't seem to override parent functions in my child theme. I'm using TwentyTen as a parent - can anyone tell me why this function in my child theme isn't overriding the parent function please?               // Override read more link     function osu_twentyten_continue_reading_link() {      return ' ' . __( 'Read on →', 'twentyten-child' ) . '';     }     function osu_twentyten_auto_excerpt_more( $more ) {      return ' …' . osu_twentyten_continue_reading_link();     }     remove_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );     add_filter( 'excerpt_more', 'osu_twentyten_auto_excerpt_more' );      I thought you had to remove the filter/action etc. before re-adding it right? Thanks, osu


Use special fonts on a non-hosted Wordpress blog

I would like to use a font I've paid from webtype.com on my wordpress blog. I don't own the blog so I can't change anything in the main php files as function.php or add any plugins. So, the only solution I've found is to add this content in the css customization file :               @font-face {      font-family: "Scout Normal";      src: url("http://the/url/of/the/file") format("woff");      font-style: normal;      font-weight: normal;     }     .block p {      font-family: "Scout Normal";     }      The problem is that every time I save the file, Wordpress remove the url in the loading of the font, that means               src: url("http://the/url/of/the/file") format("woff");      become               src: format("woff");      Here is a screenshot to show you where I add those css rules. Do you have any ideas to force the loading of the font, or an other idea to load it ? Thank you for your help.


Template for Taxonomy and all its Terms

Hy! I've searched high and low, up and down, left and right to find an answer. I've tried all that I have found, even the ones that are suggest for the title I wrote. I am working on a theme under a up to date Wordpress Multi Site (subdomains). I have several post types and for each post type there is a taxonomy that categorizes it. For the post type Event I have a taxonomy called Events that has its own terms and substructure. $args and registration for Event (post type)               $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'show_in_menu' => true,         'query_var' => true,         'rewrite' => array('slug' => 'event', 'with_front' => false),         'capability_type' => 'post',         'has_archive' => true,         'hierarchical' => false,         'menu_position' => 5,         'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments'),         'taxonomies' => array('post_tag');     register_post_type('event', $args);      $args and registration for Events (taxonomy)               $args = array(         'hierarchical' => true,         'labels' => $labels,         'show_ui' => true,         'show_admin_column' => true,         'query_var' => true,         'rewrite' => array(             'hierarchical' => true,             'slug' => 'events',             'with_front' => false         ),     );     register_taxonomy('events', array('event'), $args);      I want/need each taxonomy to be displayed using its own template. So:               taxonomy-events.php      So far it only worked with I added a specific term:               taxonomy-events-all-events.php      What should I do in order to make it term-less. Adjacent I have few more combos of post type & taxonomies like Promotion/Promotions, Contest/Contests. If the pluralization is annoying know that I only care slug-wise from a permalink-display perspective. Thank you.


How can I add another option to this custom post function?

I'm currently developing a games database for my wordpress site and one of the custom functions is entering a review score for a game, we have a 1-10 based rating system but I wish to add another option to this loop "No Review", how can I do this?               <select style="width: 100px" name="games_database_rating">       <?php // Generate all items of drop-down list       for ( $rating = 10; $rating >= 1; $rating -- ) {       ?>       <option value="<?php echo $rating; ?>" <?php echo selected( $rating, $game_rating ); ?>>       <?php echo $rating; ?>/10 <?php } ?>     </select>


Displaying Custom Field Array

I know that this is such a basic question but I have very little Wordpress experience and was hoping I could get some help. I have a plugin that creates Custom Post Types and Custom Fields. It does both of these things easily, but provides zero support, not even a forum. I created a meta box (meets_on) with three fields. The first field I created is a multi-check box with day of the week options (called day) and options Sunday, Monday, Tuesday, etc. The second field I created is a multi-check box with location options (called location) and lists all the options for cities. The third field I created is a multi-check box with age range options (called age_range) and lists all the options for age range (18-24, 25-30, etc.) I absolutely cannot figure out how in the world to get these fields to display either on a single post or in the archive loop. I've tried the Wordpress codex suggestions and other answers but nothing is working. Simply nothing displays. I've used get_post_meta, etc. I just simply need a post to display what I've selected in the back-end; i.e., this group meets on Fridays, in Akron, with an age range of 18-24. From the admin panel, everything is perfect - but I can't get it to display the selections I've made as admin in a single post or category view. I know this is a long post, but thanks so much for ANY help. I've spent hours trying to figure this out on my own. Ashley EDIT: Here is my code from content.php. My theme basically has a bunch of if:else statements about what kind of entry it is: if is_page, if is_archive, id is_single and this is what I put in if is_single :
         <?php cyberchimps_featured_image(); ?>             <?php the_content( __( 'Continue reading', 'cyberchimps' ) . ' →' ); ?>                             <?php $meta_data = get_post_meta($postid,'meets_on');     // var_dump($meta_data); // debugging     echo $meta_data['day']; ?>             <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'cyberchimps' ), 'after' => '
' ) ); ?>
      EDIT 2:                       <?php $postid = get_the_ID(); ?>           <?php           $meta_data = get_post_meta($postid,'meets_on');     // var_dump($meta_data); // debugging     echo $meta_data['day']; ?>      EDIT 3: This code solved the issue:               <?php     $meets_on = get_post_meta( $post->ID, 'meets_on', true );      foreach( $meets_on as $meet){     echo $meet['day'];     } ?>


How Do I include/Import a Custom Widget from the Parent theme into My Child Theme?

I'm trying to make a small modification to a custom widget that was included with a clients parent theme. Whenever I remove the parents version of the widget (for testing purposes) the child version of the widget does not take over. Instead, the widget simply disappears. I've mimicked the directory structure of the parent theme, copied my modified widget .php file into the proper location, and have included the following code in my child themes function.php:               include("../maxmag-child/widgets/widget-tabs.php");      Any idea why the child's version of the widget isn't available?


How can i summerize posts or news automatically in word press site?

Is there any module or sample code for summerize post by intelligence algorithms? I want to summerize 1000 last posts automatically


Limit Form Access and Require Some Fields

I have gotten a "post from frontend" php code example, and I have tested that it works for my site. But I found that it can't define only logged in user to submit post. Also the code can't display error message on submit post page. I want to do two things:   1. Only allow logged in user to submit posts.   2. Define some must be input fields to display error messages when it haven't content to submit, error message display on the submit page. The best choice is display it on the side of blank fields. Here is the code:               <?php     // Check if the form was submitted          if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] )) {              // Do some minor form validation to make sure there is content         if (isset ($_POST['title'])) {             $title =  $_POST['title'];         } else {             echo 'Please enter a title';         }              if (isset ($_POST['description'])) {             $description = htmlentities(trim(stripcslashes($_POST['description'])));              } else {             echo 'Please enter the content';         }              $nonce=$_REQUEST['_wpnonce'];         if (! wp_verify_nonce($nonce, 'new-post') ) die('Well that was naughty.');              $tags = $_POST['post_tags'];         $customfieldone = $_POST['customfieldone'];         $customfieldtwo = $_POST['customfieldtwo'];              // You can add more custom fields by replicating the lines above and any other references to customfieldone and customfieldtwo, and changing them to your custom field values              // Add the content of the form to $post as an array         $type = trim($_POST['Type']);         $post = array(                 'post_title'    => $title,                 'post_content'  => $description,                 'post_category' =>   array($_POST['cat']),  // Usable for custom taxonomies too                 'post_status'   => 'pending',               // Choose: publish, preview, future, etc.                 'tags_input'    => array($tags),                 'tax_input'     => array( $type),                 'comment_status' => 'closed',                 'post_author'    => '2',   // Set to 1 for the main admin account as author, provided that is user ID 1                 'customfieldone'    =>   $customfieldone,                 'customfieldtwo'    =>   $customfieldtwo         );         $post_id = wp_insert_post($post);         wp_set_post_terms($post_id,$type,'Type',true);         add_post_meta($post_id, 'metatestcustomfieldone', $customfieldone, false);         add_post_meta($post_id, 'metatestcustomfieldtwo', $customfieldtwo, false);         wp_redirect( home_url('/listing-submitted/') ); // redirect to this page after submit         exit();          ?>     <?php get_header() ?>

Submit your listing
                           <form id="new_post" name="new_post" class="post_work" method="post" enctype="multipart/form-data">             <?php wp_nonce_field( 'new-post' ); ?>
Title
                             <input type="text" id="title" class="required" value="" tabindex="1" size="20" name="title" />

Description
                             <textarea id="description" type="text" class="required" tabindex="3" name="description" cols="50" rows="6"></textarea>
                          <fieldset class="category">                             Category:                             <?php wp_dropdown_categories( 'tab_index=10&taxonomy=category&hide_empty=0' ); ?>                 </fieldset>                           <fieldset class="customfieldone">                     Custom Field One:                             <input type="text" value="" id="customfieldone" tabindex="20" name="customfieldone" />                 </fieldset>                           <fieldset class="customfieldtwo">                     Custom Field Two:                     <input type="text" value="" id="customfieldtwo" tabindex="20" name="customfieldtwo" />                 </fieldset>
Tags: <input type="text" value="" tabindex="35" name="post_tags" id="post_tags" />
                      <input type="hidden" name="post_type" id="post_type" value="domande" />                 <input type="hidden" name="action" value="post" />
<input type="submit" value="Submit" tabindex="6" id="submit" name="submit" />
                  </form>

          <?php get_footer(); ?>


Tracking multiple tags or categories

I'm trying to find a way to track the popularity of multiple categories, tags or custom taxonomies.      On our site we often use multiple categories for a single article - e.g. an article would be classified under "graphic design" and "illustration". Another article might be tagged with only "illustration".      All the methods I've seen to track the popularity of different categories don't take multiple categories into regard. I can't do this using Custom Variables in Google Analytics, nor can I seem to find a sufficient solution with Event Tracking. Custom Variables only allow for one key value and using event tracking would mess up my bounce rate data (each pageload would trigger an event). The plugins available are also not very accurate - they rate popularity on the amount of articles inside each category, not as views of those articles (over the past month for e.g.). Is there a method to do this?


Disallow user from editing their own profile information

I'm currently developing an intranet and I am using Justin Tadlock's Members plugin to control roles and capabilities. I have created a `HR` role to allow Human Resources staff to create and edit user accounts. All staff created in WP are given the `contributor` role with a select few members of staff given `editor` and `administrator` roles. What I want is to stop staff from logging in and changing their own profile information. Only staff of the `HR` role should be able to edit profile information.


How to remove "prev, next, shortlink" from wp_head()?

I'm using these filters to clean the head of my theme:               remove_action('wp_head', 'wp_generator');     remove_action('wp_head', 'rsd_link');     remove_action('wp_head', 'feed_links', 2);     remove_action('wp_head', 'index_rel_link');     remove_action('wp_head', 'wlwmanifest_link');     remove_action('wp_head', 'feed_links_extra', 3);     remove_action('wp_head', 'start_post_rel_link', 10, 0);     remove_action('wp_head', 'parent_post_rel_link', 10, 0);     remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);     remove_action('wp_head', 'locale_stylesheet');     remove_action('wp_head', 'noindex');     remove_action('wp_head', 'wp_print_styles');     remove_action('wp_head', 'wp_print_head_scripts');      However, I can't seem to get rid of these:               <link rel='prev' title='Top Menu Item 1' href='http://localhost/test/test-prev.html' />     <link rel='next' title='Internal title test default title' href='http://localhost/test/text-next.html' />     <link rel='shortlink' href='http://localhost/test/?p=528' />


activate custom sidebar widgets

Hey guys I'm trying to activate a sidebar for wp widgets. So my HTML looks like this:

           So I want to put the widget inside "contents" and its title in h3 tag. How my activate function should be and what php to put in my html if needed? I didn't find any examples near mine so I appreciate any help 10x a lot in advance.


Order taxonomy terms by the frequency of use in the last 30 days

I would like to know how to order the terms in some taxonomy according to their frequency of use in posts in the last 30 days. What I am looking for is the most optimal method how to add "orderby" parameter or apply the array compare on the list of the terms or maybe some smart SQL select. I know this would include some extra columns in table to store a count and a last changed (added) time data. Any suggestions?


what template-part to call, to have my post in the center of the page?

i was wondering if you could help me : i would like to change the center of my page only with my posts : (all my posts will be in the same category) : how can i construct the page : so : 1.my menu in header.php   2.a single post in the center of the page   3.and the bottom div in footer.php, which contains the menu for the posts i'm wondering, if n°2 is "index.php", what page should i call? for example in twenty_ten, they call "content" in index.php :               <?php while ( have_posts() ) : the_post(); ?>     <?php get_template_part( 'content', get_post_format() ); ?>      how can i proceed, if i would like to click on n°3 menu, and have a new page with the post in the center of the page? Do you know what i mean? Thanks if you can be of any help


How to assign specific users the capability to edit specific pages / posts / custom post types

I'm trying to implement what seemed like a relatively straight forward idea, basically I am building an access control plugin to control viewing and editing of a custom post type (in this case 'Projects'). How I intend for it to work is that there are multiple users who either have read-only access or read/write access to specific 'Projects'. There are multiple Projects in the system and read access is controlled by enabling checkboxes for the specific Projects within the User Profile settings on the site (shown below): ![Additional edit options added to User Options](http://i.stack.imgur.com/hrwHy.png) So you assign access to these Projects via this interface then code on the actual Projects page restricts the content from being viewed if the ID of the Project does not match any of the IDs of the checked Projects. That is all working fine, however, I need to also allow edit capabilities in the same way. So I could enable a user to read a specific page but also to edit that specific page. The problem I am having is that what I'm after doesn't seem to fit into the regular Roles and Capabilities as basically I just want all users to have the same Role (basically just the Subscriber Role). But I want to add edit capability to a specific user for a specific page, whereas Roles are generally about adding Capabilities to a 'type' of user. Hopefully I've managed to explain what I'm trying to here, I'm struggling to find the correct code / function for doing this although I'm sure it must be possible as there are Plugins out there that can enable access to specific pages etc, but obviously in this case I don't want to rely on a plugin as what I'm building is a plugin itself! Update: I've persevered further trying to resolve this, but so far I still can't see how to enable access to specific posts / pages etc without resorting to creating a custom-role / capability for each specific page, but this seems a bit overkill and I'm not even sure that would work. Update 2: I've added a bounty to this question now to hopefully inspire someone! ;) I've looked further into this but even though I've found other plugins that seem to be capable of what I need (along with loads of other features I don't need!) I just haven't managed to figure out what code is required to restrict specific instances of a post type to a specific user. Update 31st Oct: I've been able to get something running thanks to the code that @alexey posted. I now have two lists of IDs, one of which controls Read access and one for Edit access. I'm using `current_user_can('read_projects')` to limit viewing of the page content, however, I've got a problem in it takes two page loads before it actually restricts the content. The first time I click on a page the content shows, but if I reload the page then the content is hidden correctly. It seems to be something to do with the timing of when `user_has_cap` is being triggered but I can't seem to track anything down, as far as I can tell this should be triggered before the page content is rendered. I'm not going to post any further code here in this update as if there's no simple reason why this isn't working then I'd be better posting a new question rather than continuing this one.


Generate images according to proportion of original image

I'm looking into if it's possible to generate images with different sizes depending on the proportions of the original image. For example. If the uploaded image has a proportion 4:3 it should generate three different images named landscape-mini, landscape-medium and landscape- large with whatever measurements they have assigned to them. But if the format is 16:9 it should generate wide-mini, wide-medium and wide-large with their own set of measurements. It's crucical that only three sizes are generated for each image uploaded. What sort of functions would come in handy to achieve this?


Adding Sub Menu In a theme which Do not have Menu Options

I am a new bee in wordpress but i can code in PHP. I have a free wordpress theme installed on my local host. The theme Do not have an option to add to add menu/sub menu in it. It comes with predefined number of menus. What i want is , can i add sub menu in the theme using some php skills? what i want is, a drop down sub menu when we hover over a menu.. Can i do it? if yes, How can i do it? i searched a lot, got videos and help about sub menus, but all of the help is about the themes which allow sub menu. **Clarification :-** i am not an expert, but what i know and what i think is that, it is a wordpress issue, i would need to code in menu.php or function.php to append sub menu to each element of main menu. The theme does not allow sub menu. I need sub menu be created in theme. i am using Wordpress Christmas theme 1.1 (free) by instantshift


On new server, site got hacked, permissions a bit strange? Please help

I moved to a new server recently, a week later a site got hacked, all they did was change the index.php file of the current enabled theme, no big deal. I did have a few security precautions in place, no admin user name, all latest versions, no timthumb issue, .htaccess security etc. I dont want this to happen again, what I did notice is when logged into my WP admin I can edit the permalinks, or any file within the editor (I tested editing the index.php) and it will save. On my last two servers, I had to go into the FTP set the permissions of the files to 755 or 777 before making any changes, then put them back to 644. They are currently set to 644 but I can fully edit them within the admin, do you think this is my problem? Kinda worries me. Thanks, Matt