![Removing default image size list in Media Box](http://i.stack.imgur.com/8xYfy.gif) I trying to remove unused image size (Thumbnail, Medium, Large) in MediaBox Any function can i use in functions.php ? or some trick ? PS : I know i can use jQuery trick but any better function to use ?


title: post_content is empty

text: I'm trying to make some plugin. This plugin is some kind of auto posting.               function new_post($title,$content)     {     $post = get_post($id);     $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );     $title = $post->post_title;     $content = $post->post_content;     echo $title;     echo $content;     }     add_action( 'publish_post', 'new_post' );      I can see only `$title`, `$content` is empty. I've checked mysql in draft status, I can see `post_title` fields has data but `post_content` has no data. `post_content` has data when I click publish or auto save. I think this plugin run faster than wordpress insert data process. This plugin have to run after publish or make different way. How can I fix this code... I hope wordpress developer's can help.


title: How to reply to Buddypress notifications?

text: Currently, when I receive notifications from Buddypress, I have to log in the site to post a comment on an event, or a reply to a message. Is there a way to reply directly in the MUA ? My idea was to generate a UUID that would be used as a reply-to field ,e.g. msg.59326d09-821e-4d32-b77c-096ac7507a02@reply.domain.com , find the related event when the message is received using postfix content filter, parse the email body to extract the reply, and to insert the comment into the database. Is this secure? Can it be done without having high privileges on the server ?


title: blank page with no code or errors on blog

text: I'm encountering some trouble moving a Wordpress installation from a development to a production server. The development server works just fine, but when moving to production the blog page suddenly stops working. Homepage: http://www.elireview.com Blog: http://www.elireview.com/blog/ The homepage and the sub-pages of the site work fine, but when in Settings > Reading I set posts to display on the homepage, it them stops working and /blog/ works like expected. The page produces absolutely no HTML or error messages, and nothing is recorded to the server logs, so I am working blind here. I've tried just about every recommendation for "blank page" on the web, but I can't find any solution that works. Any assistance is greatly appreciated.


title: Edit format of Paginate_Links()

text:
I'm using paginate_links to paginate the results of a loop. I want to style the pagination using dots instead of numbers, but I'm not sure how to go about doing this. I could try to play around with the css but I would prefer a clean method.               example.          <-                 o o o                ->          currently.          <-                 1 2 3                ->      This is currently how I am outputting my links.               <?php          $big = 999999999;          $paginate_links = paginate_links( array(         'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),         'format' => '?paged=%#%',         'current' => max( 1, get_query_var('paged') ),         'total' => $the_query->max_num_pages,         'prev_text'    => __('

'),         'next_text'    => __('

'),         'type' => 'array',         'n_display' => 'test'     ) );          foreach ( $paginate_links as $pgl ) {         echo "$pgl";     }          ?>      Looking at the core paginate_links() function in Wordpress is there anyway I can modify the output of $n_display before or after.


title: Undefined index: at_nonce in custom post metabox

text:
I'm getting this error with my custom post metabox. The custom post and metabox works fine, but if i have debug on and when i try to save any other page or post, i will get an error: > Notice: Undefined index: at_nonce in /Users/jay/site/wp- > content/themes/mytheme/dogs-post-type.php on line 53 > > Notice: Undefined index: at_nonce in /Users/jay/site/wp- > content/themes/mytheme/dogs-post-type.php on line 53 > > Warning: Cannot modify header information - headers already sent by (output > started at /Users/jay/site/wp-content/themes/mytheme/dogs-post-type.php:53) > in /Users/jay/site/wp-includes/pluggable.php on line 876 My code:                <?php                // Add new custom post for dogs           function example_dogs_custom_init() {               $args = array(                  'label' => 'Dogs',                 'public' => true,                 'capability_type' => 'post',                 'hierarchical' => true,                 'has_archive' => true,                 'menu_position' => 5,                 'supports' => array('title', 'editor'),                 'rewrite' => array('slug' => 'pets/dogs', 'with_front' => false)               );               register_post_type( 'dogs', $args );           }           add_action( 'init', 'example_dogs_custom_init' );                     // METABOX breed           add_action("add_meta_boxes", 'test_add_post_meta_boxes_breed');                function test_add_post_meta_boxes_breed() {             add_meta_box(             'breed-meta',      // Unique ID             'Breed',   // Title             'breed_cb',   // Callback function             'dogs',         // Admin page (or post type)             'side',         // Context             'default'         // Priority             );           }                function breed_cb() {             global $post;             $breed_input = get_post_meta($post->ID, 'breed_field', true);                  // unique identifier, name of hidden field             wp_nonce_field(__FILE__, 'at_nonce');             ?>             Breed:             <input type="text" name="breed_field" id="breed_field" value="<?php echo $breed_input; ?>" />
<?php           }                add_action('save_post', function() {             global $post;             if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return;             // security check - nonce                  // verify this came from the our screen and with proper authorizarion,             // because save_post can be triggered at other times             if ( $_POST && !wp_verify_nonce($_POST['at_nonce'], __FILE__) ) {                 return;             }                  if ( isset($_POST['breed_field']) ) {                   update_post_meta($post->ID, 'breed_field', $_POST['breed_field']);             }                });              ?>      There is something wrong with the nonce field but i cant figure out what. If it helps, the code structure is from Jeffrey Ways The Magic of WordPress Custom Post Types course.


title: How to build a multi-taxonomy, multi-term query based on user input

text: Thanks to Otto's excellent post on advanced taxonomy queries, I (mostly) understand how to create multi-taxonomy and multi-term queries. However, what I don't know is how to build those dynamically based on user input. I'd really like to end up with something like Amazon.com has on their site, with check boxes next to the various terms for a taxonomy in the sidebar (and multiple lists of terms, each with a taxonomy heading). Something like this: ![Taxonomy with list of terms and check boxes to select those terms](http://i.stack.imgur.com/PkYVW.png) How should I go about building something like this? Displaying the content dynamically (content changes when a box is checked) would be great, but I'd certainly settle for having a "submit" button.


title: Disable Individual Plugins (specifically in Custom Post Types) on a per-post basis?

text: The title pretty much says what I'm trying to accomplish, but more specifically I have a plugin that I made and it creates a custom post type, lets call them `newpages`. On these pages I have used `template_redirect` to take over the design of the pages, but some plugins appear, but I don't want to remove all of the plugins from loading, just a couple. So I was wondering if it's possible to use something like custom fields to disable certain plugins on a per-post basis. Can anybody point me in the right direction? Thanks!


title: How to get any tag ID

text: I want to exclude a certain tag from my home page not a category only post that hold the tag for example "olive"; I found a function for that which is like this                   function exclude_tag($query) {     if ( $query->is_home) {         $query-> set('tag__not_in',array(x));         }     return $query;     }     add_filter('pre_get_posts','exclude_tag');      Whereas X is the ID of the tag I want to exclude. How can I find that ID?


title: Change background color with a dominant from picture

text: Im looking for a smart way to change the background color for a page, but taking the #xxxxxx value from the dominant color of the headline picture. In twenty eleven theme, I can set a random image for each page loaded, I would change the background color to match the picture. I know that's possible but I don't know how to modify the CSS or the template to take the value from a specific function (I found this that seems promising: http://stackoverflow.com/questions/2541481/get-average-color-of-image-via- javascript Is that too complicated? thanks alot


title: working with term_relationships table

text: I have this little code to insert posts via custom form:                $post = array(          'post_author' => 1,          'post_title' => 'my title,          'post_content' => 'my content',          'post_category' => array(3),          'post_type' => 'post',       );          if ( $post_id = wp_insert_post( $post ) ){         echo 'post added!';      }      but now I need to insert the last $post_id to `term_relationships` table, basic scheme of term_relationships:               object_id | term_taxnomy_id | term_order     -----------------------------------------      Wordpress have a function to update that table?, or I need to build a custom query?


title: Changing Login Logo

text: After modifying the code in my functions.php file to display a different logo on my login page, I'm getting a blank square instead. I've added a custom .png image (326x67) to my (child) theme's image folder, and the code I've added to `functions.php` is as follows:               function custom_loginlogo() {         echo '<style type="text/css">         h1 a {background-image: url('.get_bloginfo('template_directory').'/images/login_logo.png) !important; }         </style>';     }     add_action('login_head', 'custom_loginlogo');      Could it be a permissions problem (like an `.htaccess` file blocking the image)?


title: How can I echo out the user id in user meta?

text: I need to generate a unique ID number for each new member. I was going to use WP_query, but am not getting anything but an array.


title: WP E-Commerce Custom Meta > Serialized array

text: I have an issue where I am adding custom meta to my products. Everything works fine until I update my product. This is before: ![enter image description here](http://i.stack.imgur.com/LIoY9.png) This is after update: ![enter image description here](http://i.stack.imgur.com/37S75.png) I am thinking it has something to with how it is pulling the data from the database. Anyone else have this problem before? Thanks in advance for your help.


title: WordPress plugin for scheduling appointments

text: I have searched and found a few plugins which help me offer appointment scheduler for the site owner. Is there something in existence which can offer the same functionality to all the users of the site instead of just the site owner? Like a visitor can schedule an appointment with any user of the site? Do you know of such a plugin? If such a plugin doesn't exist, any options which can fill my cup up? Or I will have to write something of my own probably using code of some existing one but which one (any suggestions?)


title: How can I show different menu for different pages?

text: I have a website that has a main menu(Top-Horizontal) like this:               Main menu      - Home      - About Us      - contact us      On Home page I have a link to "Company" page like this www.xyz.com/company. When I am on this company page I want my website to chnage my menu items and use this:               Different menu      - Home (same Home page link that will take user to www.xyz.com)      - promoters      - Gallery      - Maps      I think i can do this using wordpress Conditional_Tags, but really dont know how should I start.


title: How to upload images manually to wordpress?

text: I would like to know if it is possible to manually upload images to WordPress (ftp/scp) and make it recognize them and add them to the media browser. This also has to work with Wordpress running in multi-site mode (network).


title: Fix warning: Missing argument

text: i want to submit a theme to the wordpress.org. when i put the `define('WP_DEBUG', true);` in my `wp-config.php`. my theme showed some errors.but i don't know how to correct theme. Q1:`Warning: Missing argument 2 for cutstr() in ....htdocs\wordpress\wp- content\themes\warm-home\functions.php on line 156`. the following is my function.               function cutstr($string, $length) {              $string =strip_tags($string);             preg_match_all("/[x01-x7f]|[xc2-xdf][x80-xbf]|xe0[xa0-xbf][x80-xbf]|     [xe1-xef][x80-xbf][x80-xbf]|xf0[x90-xbf][x80-xbf][x80-xbf]|[xf1-xf7][x80-xbf][x80-xbf][x80-xbf]/", $string, $info);                for($i=0; $i<count($info[0]); $i++) {                     $wordscut= '';                     $wordscut .= $info[0][$i];                     $j='';                     $j = ord($info[0][$i]) > 127 ? $j + 2 : $j + 1;                      if ($j > $length - 3) {                              return $wordscut." ...";                      }              }              return join('', $info[0]);     }     add_action('after_setup_theme','cutstr');      invoked the function line is: `<p><?php echo cutstr($post->post_content,150) ?></p>`.there is no Missing argument 2 . why shows the above error? how correct it?


title: wordpress sql posts query won't display the latest post in a specific category

text:
Hi I tried to display 5 posts titles from a specific category also show the date, but it won't display the most recent one that just published, I had to change the recent post date 2 months so it'd show up .. I used in_category to filter the post does in_category work with sql query ?? Thanks !
          <?php     $max_loop=0;      $month = array('','January', 'Febuary', 'March', 'April', 'May', 'June', 'July',          'August', 'September', 'October', 'November', 'December');          $work_items = $wpdb->get_results("SELECT YEAR( post_date ) AS year, MONTH( post_date )         as month, post_title as title, ID as post_id, COUNT( id ) as post_count FROM $wpdb-      >posts WHERE post_status = 'publish' and post_type = 'post' GROUP BY year ORDER BY      post_date DESC");          foreach($work_items as $work_item) {          if(in_category("photography",$work_item->post_id)){     echo "
";     echo "title).")'>";     echo $work_item->title;     echo "".$work_item->year." / ".$month[$work_item-         >month]."";     echo "";     echo "
";     $max_loop++;     if($max_loop==4){break;}     }      }     ?>


title: How to enlarge thumbnail on mouseover?

text: I am currently using NextGen Gallery and I want to view full images when I hover over the thumbnail, it is much better than waiting the user to click. Currently I obtain this functionality in Chrome by using the extension Hover Zoom but I want to enable this functionality to all my visitiors. I suppose that this should be a generic solution, not something special for NextGen.


title: Pulling Featured Images in to a WordPress Menu

text:
I've got a simple static list marked up like this that I'd like to turn in to a WordPress Menu:

      I'd like each list item to link to a specific post, and pull in the Featured Image rather than the title. If I setup a default WordPress Menu it would output like this:

Blog Post 1

Blog Post 2

Blog Post 3

Blog Post 4

      How would I instead output it like this:

      So essentially I'd just like to return the Featured Image of each post I specify in a WordPress Custom Menu rather than the post title.


title: Plugin: Events manager - Next and previous event

text: I'm trying to get a navigation in the events of event manager the next/previous post links work but they are ordered by creation date instead of event date. How could it be possible to change this?


title: Problem with permissions in wp-content/plugins

text: I have a WP installation on my local machine and trying to get my hands dirty with plugins. I wish to clone a project from github which has this plugin code. However, i dont have the permissions inside plugins to do this as a normal user without su priveleges. (of course i can become root and do this but i dont think thats the way it should be). Then by default the folders in a WP installation have group set to "tape", which appears strange to me. What exactly should be the right permissions for the internal folders on a local WP installation?


title: Read more link for blog listing page

text: I have a blog page setup to list posts. The "Read More" link is added by                <?php       global $more;       $more = 0;             the_content('Read More'); ?>      How do i add the_permalink in where the "#" is without breaking the php?


title: When Front page and Posts page are specified is it possible to just have front-page.php as the home page?

text: Right now I have a Front page and a Posts page specified in dashboard. The Front page is a page called "home" using a page-home.php template. However I don't want to have to create a WP page for the home page, I just want WP to use my front-page.php or home.php template. And at the same time I still want it to have a specific page for posts. How to do that, is it even possible?


title: Custom taxonomy admin page

text: If you want a custom admin page for a taxonomy, you can set `'show_ui' => false` when you register it to suppress the default admin page and then create a new admin page to replace it. However `edit-tags.php?taxonomy=taxonomy-slug` still takes you to the 'hidden' default admin page. Is there way of directing it instead to the custom admin page. Or otherwise is there another method than circumvents this issue?


title: Find the post an attachment is attached to

text: I have a list of attachment IDs which are built using this array:               $all_images = get_posts( array(     'post_type' => 'attachment',     'numberposts' => -1,     ) );      Is it possible to take the image ID from this list and find the Title and permalink of the POST the image is attached to? I know it's feasible because the Media Library shows it, but I can't find the right way to do this with the codex. I have tried this code, however it returns the title and permalink to the attachment itself, not the post it's attached to:               $parent = get_post_field( 'post_parent', $imgID);     $link = get_permalink($parent);


title: Remove post from new menu in top bar

text: I have removed the post menu from the admin side bar like so:               add_action('admin_menu','remove_default_post_type');          function remove_default_post_type() {         remove_menu_page('edit.php');     }       How can I now remove it from the top bar 'new' menu as well?


title: Import JSON feed to Wordpress

text: We have received a URL which is a JSON file apparently:               http://www.domain.com/tools/export-json/?destination=hawaii      I am completely clueless when it comes to JSON and Wordpress. Anybody know where to start? We will need to create individual posts from this JSON file I presume..


title: Custom page with variables in url. Nice url with add_rewrite_rule

text: Using WP3.1 I Have a custom page with a WP_Query and the query gets dynamic variables from the url. And i want safe variables and clean urls. Example: > carpage/?carmodel=honda&location=finland TO > carpage/honda/finland/ I made add_rewrite_rule in to functions.php and it works, but iam not sure it's safe to use this. Functions.php                 function fcars() {            add_rewrite_rule('carpage/[/]?([a-zA-Z-]*)[/]?([a-zA-Z-]*)$', 'index.php?pagename=carpage&var1=$matches[1]&var2=$matches[2]');            add_rewrite_tag('%var1%', '[a-zA-Z]+');       add_rewrite_tag('%var2%', '[a-zA-Z]+');     }          add_action('init', 'fcars');      And in Custom template i get the vars Could someone please help me with this. How can i make this safe to use and is this the right way in WP3.1 What is the right way to make add_rewrite_rule in this case: > carpage/honda/finland/ (just hyphens and small letters in url) carpage is the static template page.


title: What's the sql for this condition?

text: I want to delete all records from `wp_usermeta` with user_id whose meta_value is "tonetone" which is spam accounts. As you know already, there are many records with one user_id in wp_usermeta. I tried like this but doesn't work. Thanks to anyone who can show me the way.               delete from wp_usermeta where user_id = (select user_id from wp_usermeta where meta_value = "tonetone")


title: Somebody guide me to implement tag subscription plugin.

text: I would like to implement tag subscription and follow/nofollow for registered users. I mean when the user goto tag page, left side widget should show subscribe/unsubscribe button. And when the user goto author page, left side widget should show follow/nofollow button. Front page posts should have two other tabs called "subscribed" and "following". When the user click `subscribed tab` it should show the posts which contains user subscribed tags. Likewise `following tab` should only show user following author posts. Is there any readymade plugin available??? If not can i use existing plugins like subscriber2 to implement this feature. What are the steps? I should store the tag and author id in the database right? PS: I don't want you to code my plugin. This is my first wordpress plugin which requires database related work. So i just wanna understand how the database works. I just want to know whether i should create a new table or can i use existing meta tables to implement this feature.   If i can use existing table which table i should use to store tag id and author id.


title: get listed category's id?

text: ok - so i'm listing categories and their sub-categories. How can i get the ID of the category that's being shown with a function? ( i know what it is in the admin ) ie /category/events/women-in-art/ women-in-art-ID = ? any help appreciated! Dan.


title: Incorrect Blog Root

text: I have a blog at http://leghumped.com which I moved from a subdirectory to the site root a few months back. The problem is, the root still seems to resolve to /blog/. Eg: Instead of seeing http://leghumped.com/ when I use bloginfo('template_url'), I instead see http://leghumped.com/blog/ I've checked in the control panel in Settings->General, the WP-Config.php file and wp-settings.php. I have nowhere else to look. Is there anywhere else this could conceivably be defined?


title: Wordpress pagination with wp_query_columns

text:
I'm using the code from here to split my loop up in to columns. The columns work. I have 7 posts in the databese and showposts set to 6. I cannot get nextpage link to show? I have a $paged variable in my $args array I have set number of posts per page to 5 in admin/reading. Full loop below. Many thanks in advance.               <?php      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args = array(     'showposts' => 6,     '&paged=' => $paged,     'tax_query' => array(         array( 'taxonomy' => 'post_format',             'field' => 'slug',             'terms' => array('post-format-audio')                  )         )     );     $the_query = new WP_Query($args);?>     <?php foreach(new WP_Query_Columns($the_query, 3) as $column_count) : ?>
             <?php while ($column_count--) : $the_query->the_post(); ?>

<a href="<?php echo get_post_meta($post->ID, '_format_audio_embed' , true); ?>">

                  <?php echo get_the_date(); ?>                  <a class="spch-bub-inside" href="<?php comments_link(); ?>">                                            <?php comments_number('0', '1', '%'); ?>                                                                 <?php the_tags(' '); ?>                                                       <a href="http://twitter.com/share" class="twitter-share-button"                   data-url="<?php the_permalink(); ?>"                   data-via="jillowen"                   data-text="<?php the_title(); ?>"                   data-count="horizontal">Tweet

                       <?php endwhile; ?>
                    <?php endforeach; ?>

<?php previous_posts_link('« Previous Entries') ?>

<?php next_posts_link('« Older Entries') ?>


title: How can I add an options page for my class based plugin?

text:
I'm trying to use the new Settings API with a class based plugin to add a settings page. This is the code I have so far:               class simple_sample_plugin{         function simple_sample_plugin()         {             add_action('init', array(&$this, 'init'));         }         function init()         {             add_action('admin_menu', array(&$this, 'admin_menu'));             add_action('admin_init', array(&$this, 'admin_init'));         }         function admin_init()         {             register_setting(                 'sample'  // A settings group name. Must exist prior to the register_setting call.                 ,'sample_options' //  The name of an option to sanitize and save.                 ,array($this, 'set_options') //  A callback function that sanitizes the option's value.             );             // Register our settings field group             add_settings_section(                 'sample_section1', // String for use in the 'id' attribute of tags.                 'Section 1', //  Title of the section.                 '__return_false', // Function that fills the section with the desired content. The function should echo its output.                 'sample' //  The type of settings page on which to show the section (general, reading, writing, media etc.)             );             // Register our individual settings fields             add_settings_field(                 'color_scheme'  // String for use in the 'id' attribute of tags.                 ,'Color Scheme' // Title of the field.                 ,array($this, 'color_scheme') // Function that fills the field with the desired inputs as part of the larger form. Passed a single argument, the $args array. Name and id of the input should match the $id given to this function. The function should echo its output.                 ,'sample' //  The type of settings page on which to show the field (general, reading, writing, ...).                 ,'sample_section1' // The section of the settings page in which to show the box (default or a section you added with add_settings_section, look at the page in the source to see what the existing ones are.)                 ,array() // $args - Additional arguments that are passed to the $callback function. The 'label_for' key can be used to give the field a label different from $title.             );         }         function set_options()         {              }       function color_scheme()         {           echo "<textarea type='text' rows='2' cols='80' name='sample_options[color_scheme]'>";           echo time();           echo "</textarea>";       }         function admin_menu()         {             add_options_page(                 __('sample') //page title                 ,__('sample') //menu title                 ,'edit_posts' //capability                 ,'sample' //menu-slug                 ,array(&$this, 'settings_page') //function callback             );              }         function settings_page()         { ?>

sample Options
         <form class="myform" method="post" action="options.php">          <?php                  settings_fields('sample');             do_settings_sections('sample_section1');                   ?>                  <input type="submit" value="Save" />         </form>
         <?php         }     }     global $simple_sample_plugin;     $simple_sample_plugin = new simple_sample_plugin();      I've tried to keep that as clean and simple as possible, and I've tried to do it according to a lot of tutorials and documentation. I also have a jQuery line in there to show hidden fields. The only problem though is that this does not work. That is to say it adds a sample options page, but the field values are not there. Screenshot: ![screenshot-with- shadow.png](http://img600.imageshack.us/img600/4526/screenshotwithshadow.png) Help! What am I doing wrong? I've been trying this for 24 hours now.


title: How to redirect a link to a new link?

text: I am about to change the slug for my page's permalink. Since I dont want to loose the traffic, i would like to redirect the visitors to the new more SEo friendly link. Can I achieve this with the mod_rewrite? (I use Apache on Ubuntu) Or any other easier alternative? (I prefer not using any plugin if possible) Many Thanks,


title: Set Default Category to Username

text: I installed a plugin called "Symbiosis" which creates categories automatically copying a user's username upon them signing up. Whenever any user creates a post on the site, I am trying to figure out how to assign that category that was already created with the new post. I want to set WP Default Category to the authors username so that when anyone creates a post it automatically posts under their name. (my users do not have access to default wp-panels) I know about the dropdown in the settings > writing panel but that's not what I'm looking for as I cannot customize the slug to a users username. Is this possible via plugin or programatically somewhere else? The categories are all already created. I can pull the loggedin users username and echo it but I'm not sure where to put it:               <?php global $current_user; if ( isset($current_user) ) {echo $current_user->user_login;}?>


title: scheduled event not getting executed

text: class checkPost{       function __construct()       {         if ( !wp_next_scheduled('my_task_hook') ) {           wp_schedule_event( time(), 'hourly', 'my_task_hook' ); // hourly, daily and twicedaily         }         add_action('my_task_hook', array(&$this,'my_task_function'));       }       function my_task_function()        {         add_action('wp_head', array(&$this,'wp_head'));       }       function wp_head()       {         echo '<!--This is a test!-->';       }     }      That's the stripped code of my plugin, but it's somehow not working. Why is it not?


title: Custom post type with file upload - need to "set as field" instead of "send to editor"

text: I've created a custom post type. It requires a file to be uploaded. I found the following tutorial which I've successfully adapted to do what I need with one exception: http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in- your-plugin-or-theme/ The tutorial provides JavaScript code to override the "send to editor" button, however that's not what I want to do. I want to set the filename as a meta value of the post so I can pull it out in my display template. Ideally I want to display another custom link in the file upload thickbox, similar to "set as post thumbnail", which will do this. My custom JavaScript file contains this (the first function has been customised to my post type, the second hasn't):               jQuery(document).ready(function() {          jQuery('#upload_resource_button').click(function() {      formfield = jQuery('#upload_resource').attr('name');      tb_show('', 'media-upload.php?type=file&TB_iframe=true');      return false;     });          window.send_to_editor = function(html) {      imgurl = jQuery('img',html).attr('src');      jQuery('#upload_image').val(imgurl);      tb_remove();     }          });      If I need an additional hidden field to assign the filename back to, I can probably work that out - really what I need to know is what hook to use to add a new link to the thickbox to use instead of "Send To Editor". I hope that makes sense - I'm not sure of all the correct terminology. Thanks!


title: How to call a plugin function in footer.php

text: I want to call this http://wordpress.org/plugins/easy-media-gallery/   easy media gallery plugin in footer.php or recommend me any image gallery plugin like its in the footer of this website http://ssmrudrapur.org/


title: Facebook share post dialog not showing post information

text: I recently created a new blog in Wordpress.com and wanted to share my post with my Facebook friends. When I tried to post using the Facebook share from my post, the "Share on Facebook" page opens with the message `http://myblog.wordpress.com is marked private by its owner. If you were invited to view this site, please log in below. Read more about privacy settings.` I checked the blog's settings in **Dashboard -> Settings -> Reading**. `Site visibility` option is set as `Allow search engines to index this site`. Am I missing some configuration? Here is a screenshot of the Facebook dialog I am getting. ![enter image description here](http://i.stack.imgur.com/qwBgV.png)


title: Personalized images in widget MU site

text: I am using the module image-widget and is it possible to create personalized images for Multi user sites ? I want to make header, footer and right sidebar in image-widget. That is admin uploaded pre-designed images for these three sections and users only need to select from uploaded images. The upload option is to be removed. Please share your thoughts here, its very helpful for me. I am using WP 3.6 Is the way I can implement the idea ?


title: Open Source Forum for wordpress similar to stackexchange or stackoverflow

text: I have to add forum feature in my wordpress blog.I see bbpress but would like to add forum similar to stackexchange or stackoverflow. Please let me know.


title: How to code schedule / cron job

text: I am using `wp_schedule_event` to hourly insert items from an rss news feed into my client's blog. Here is how I am setting it up in my functions.php:               add_action('init', function(){          $timescheduled = wp_next_scheduled('update_feed');          wp_unschedule_event($timescheduled, 'update_feed');              if (!wp_next_scheduled('update_feed'))         wp_schedule_event(time(), 'hourly', 'update_feed');     });          add_action('update_feed', 'update_fashion_news');          /* rest of the code for updaring feed goes here */      So first I unschedule it and then schedule the event. Now this seems to work some days and other times it doesn't. Is the unscheduling part necessary? Am I doing this right? What I want to know is:   1. Am I using my function calls in the right order?   2. Are the schedule and unschedule calls cancelling each other out? Here is the full code in a gist if you want to see it: https://gist.github.com/3984658


title: How to add new tab to admin list of posts and handle result list

text: ## ![Admin links](http://i.stack.imgur.com/65m51.jpg) The goal is to show posts with special values of custom field (post meta) in separate tab. I know how to add new tab, here is a code:               add_action( 'views_edit-post', 'remove_edit_post_views' );     function remove_edit_post_views( $views ) {             $views['pre'] = 'Name of Sort';             return $views;     }      but I have no idea how and where I can filter posts. Any ideas?


title: Why is the $old_instance needed for the widget update function?

text: In the PHPdoc of the function `WP_Widget::update()` located under `wp- includes/widgets.php` it says the following:               /**      * ...      * This function should check that $new_instance is set correctly.      * The newly calculated value of $instance should be returned.      * If "false" is returned, the instance won't be saved/updated.      * ...      */      It is unclear to me why the `$old_instance` is needed when updating the values and how can it be used to validate that the `$new_instance` is set correctly.


title: posts and cms and posts again

text: I'm setting up a WP site as a CMS that will sell CDs. I have set up the individual titles as posts on a page I call recordings, and have a number of categories that make up the collection of discs. I'm not sure if this is the best way to setup the site as a CMS, though. Additionally, I want to set up another page for a blog under the "about us" section of the site. Is this possible, since I've already allocated the recordings page as the posts page? Or can I just make a blog entry on the Posts page w/the category of Blog and call only those posts? Is there a better way to make a 'recordings' database besides using the posts approach?


title: Limit image upload to one and disable audio, video and other document file types to upload

text: Somebody knows some trick in Add new Post to:   1. Disable the upload of audio, video and other filetypes.   2. Only accept the upload of an image (jpg, png, gif).   3. Limit the upload of each Post to only One image (no more than one). Thanks in advance.


title: Custom taxonomy list page?

text: I've been searching Google for this to no avail. I'm working on a restaurant site, and I have a custom post type for dishes, like so:               $args = array(         'labels'=> $labels,         'public'=> true,         'publicly_queryable'=>true,         'show_ui'=>true,         'show_in_nav_menus'=>true,         'query_var'=>'dish',         'rewrite'=>true,         'capability_type'=>'post',         'hierarchicial'=>false,         'menu_position'=>5,         'supports'=>array(             'title',             'editor',             'thumbnail',             'excerpt',             'custom-fields',             'revisions'         )        );            register_post_type('dish', $args);      An example of one of the custom taxonomies I want to use is this:               register_taxonomy('Main Ingredient', array('dish'), array(         'hierarchical' => true,         'label' => 'Main Ingredient',         'singular_label' => 'Main Ingredient',         'query_var'=>true,         'rewrite' => true)     );      The custom taxonomies are working fine in the admin, and I can go to myurl.com/main-ingredient/pork and see a list of all dishes with pork in them. What I'm wanting to do is be able to hit myurl.com/main-ingredient and get a list of all the various main-ingredient values. I found this reference, which is exactly what I'm trying to do: Custom taxonomy listing page when no term set (all terms) But the solution is not working for me - I'm still getting a 404 when going to myurl.com/main-ingredient Any suggestions on how best to do this?


title: Proper implementation/use of code/syntax highlighting

text: I've already read what I can on a couple of sites and installed this plug-in: http://en.support.wordpress.com/code/posting-source-code/ http://alexgorbatchev.com/SyntaxHighlighter/ I'm missing how to make it work. Question 1: Do I have to type in the Visual window or the HTML window? Question 2: Does TinyMCE mess with this? I've seen my code disappear in the HTML window. I currently have typed in my code in Visual Window like this:               [sourcecode language="php"]     <?     Header( "HTTP/1.1 301 Moved Permanently" );     Header( "Location: http://CMSTrainingVideos.com" );     if ($_GET["page_id"] == 1)        Header( "Location: http://CMSTrainingVideos.com/?p=35");     if ($_GET["page_id"] == 2)        Header( "Location: http://CMSTrainingVideos.com/?p=43");     ?>     [/sourcecode]      I also tried `<pre language="php">` with the "Geshi" syntax highligher, and no luck there either. But nothing is happening, i.e. no syntax highlighting: http://cmstrainingvideos.com/?p=53


title: Error passing post_content to function

text: The purpose of this function is to simply wrap the first occurrence of the keyword in bold tags. I'm getting an error on the line marked below. Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: error parsing attribute name in Entity, line: 4 in C:\xampplite\htdocs\testsite\wp- content\plugins\mylugin\test.php on line 40 Is this the correct way to pass the post_content object?               add_filter('wp_insert_post_data', 'my_bold_keyword' );     function my_bold_keyword($content){       $myKeyword = "test 123";       $d = new DOMDocument();       $d->loadHTML($content['post_content']); //ERROR OCCURS HERE       $x = new DOMXpath($d);       $Matches = $x->query("//text()[contains(.,$myKeyword) and not(ancestor::h1) and not(ancestor::h2) and not(ancestor::h3) and not(ancestor::h4) and not(ancestor::h5) and not(ancestor::h6)]");       if($Matches && $Matches->length > 0){         $myText = $Matches->item(0);         // need to wrap #myText in <b> wrapper       }       return $content;     }


title: Get posts after today (upcoming events)

text:
I'm using PHP Exec to build a widget to show a list of upcoming events:               <?php     function filter_whene($whene = '') {         $whene .= " AND post_date >= '" . date('Y-m-d') . "' ";     return $whene;       }     add_filter('posts_whene', 'filter_whene');     query_posts('cat=10&showposts=3&');     if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_date(); ?> <a href="<?php the_permalink(); ?>">       <?php the_title(); ?>
     <?php endwhile;     else: ?>
Não há eventos agendados.
     <?php endif; ?>     <?php remove_filter('posts_whene', 'filter_whene'); ?>     <?php wp_reset_query(); ?>      It seems to work on the front end but I get: Fatal error: Cannot redeclare filter_whene() (previously declared in /home/content/a/c/a/acamorg/html/cea2/wp-content/plugins/exec- php/includes/runtime.php(42) : eval()'d code:3) in /home/content/a/c/a/acamorg/html/cea2/wp-content/plugins/exec- php/includes/runtime.php(42) : eval()'d code on line 6 on the widget backend. Any suggestions? Thank you.


title: Wordpress blog post cloned and stolen?

text: I'm not sure if this is the right place to ask this but last night i made a post on my wordpress powered blog here: http://blog.twostepmedia.co.uk/css3-still-novelty-or-usable-in-everyday-web- development/ then this morning i see this: http://buzzgamesnews.blogspot.com/2011/01/css3-still-novelty-or-usable-in.html Is this right? Can someone completely clone a post of mine or am i overreacting?


title: $wpdb->insert is changing a value

text: I'm writing a plugin called 'Featured Releases' for a client. The user fills out a short form in the admin area which inserts some text and an image id into the wordpress database via $wpdb->insert. On my development machine it works fine, but on the production server (which has over 500 posts of all sorts, mostly images), the value of the image id is being changed to 127 no matter what I do. 127 is the id of a post, but its not an image and certainly not the id that was passed from the form. The image is uploaded via the native wordpress media uploader. The image's post id (from the wp_posts table) is passed to a hidden input in the form. On submit, this function handles the $_POST data:               function fr_add_album() {         global $wpdb;              if ( isset($_POST) && (count($_POST) > 0) ) {                  check_admin_referer('featured-releases-add_album');                  $table_name = $wpdb->prefix . 'featured_releases';                  $desired_keys = array('fr_band', 'fr_album', 'fr_album_description', 'fr_image_id', 'fr_shop_url');                  $data = array();             foreach( $desired_keys as $key ) {                      // Define and sanatize data                 if ( isset($_POST["$key"]) ) {                     $accepted_html = array('a' => array('href' => array(),                                             'title' => array()));                      $data["$key"] = wp_kses($_POST["$key"], $accepted_html);                          unset($_POST["$key"]);                 } else {                     $data["$key"] = '';                 }             }                  // Sanitize the shop url             if ( isset($data['fr_shop_url']) ) {                 $data['fr_shop_url'] = esc_url($data['fr_shop_url']);             }                  $data['fr_modified'] = date('Y-m-d h:i:sa');                  error_log($data['fr_image_id']); // This returns the correct value!                  $wpdb->insert($table_name, $data, array('%s','%s', '%s', '%d', '%s'));                  // After the insert, the fr_image_id column always reads "127"              }     }      The insane thing is that there _are a few images which do post correctly_. These were the first images I uploaded when I created the wordpress install. Every other image from any other date, including any new image I upload is saved as 127 in the database. All the images have the same owners and same permissions. I also can't see any difference in wp_posts between the new images and the old. Any ideas? I'm dyin' here. Thanks for your help!


title: Can Wordpress realistically handle a site with 500 'pages'?

text: I'm building it from scratch and probably a 100 or so of those pages will be ecommerce. I would like to create meaningful, normal looking permalinks for aesthetics and SEO. I would really love to use Wordpress for this but I'm concerned about performance issues with this volume of pages.


title: Query between two meta values?

text:
How do I limit the query by two custom meta fields, a start date and an end date? This is what my data looks like:               meta_key   | meta_value |     ------------------------|     start_date | 20100131   | //Jan 15, 2010     end_date   | 20100206   | //Feb 6, 2010     ------------------------'          $today = date(YYYYMMDD);      The post will show if `start_date = $today` and it will expires when `end_date = $today`. > > update Here is the structure on my single.php First Query I use here your answer               <?php     query_posts( $query_string );     if (have_posts()) : while (have_posts()) : the_post();         ?><a href="<?php the_permalink() ?>"><?php the_title() ?>
<?php     endwhile; endif;     wp_reset_query();     ?>      and Second Query with regular wordpress function but this second query doesnt work properly               <?php     query_posts('showposts=5&meta_key=start_date&meta_compare=>&meta_value='.date("Ymd"));     if (have_posts()) : while (have_posts()) : the_post();         ?><a href="<?php the_permalink() ?>"><?php the_title() ?>
<?php     endwhile; endif;     wp_reset_query();     ?>


title: ex-style bulk post editing

text: I imported my twitter stream into WP: http://wordpress.barrycarter.info/index.php/category/twitter/ but all the entries now have "barrycarter:" at the beginning. I realize I could just re-import w/ different settings, but I want a more general solution. Is there a plugin/etc that lets me do "s/barrycarter://isg" on selected (or all) posts? In other words, mass-edit, but not by hand. I realize I could use the API for something like this, but would prefer an existing plugin/etc if there is one.


title: How to protect wp-admin from third party access?

text: How can the wordpress administration panel and the login page wp-login.php be hidden such that only the website administrator can access it? Can the URL be rewritten through some mod_rewrite rule without worrying about breaking anything (leaving aside all the plugins)? Preferably the solution should not be IP address based which will mean the administrator can access the website from only one or a set of computers.


title: Warn me about 'uncategorized' posts

text: I always want new posts to have a category, but sometimes I forget. How can I make Wordpress warn me when I'm about something 'uncategorized'?


title: wp_insert_post does not insert string with apostrophes correctly

text: I'm using wp_insert_post (for several reasons) in a script I'm writing and it's causing any string that has an apostrophe in it to be truncated up to that character (including the character). Here's the code I've got to test it:               $question = "If you’re in need, this is who you call";          echo $question."<br />";          $post = array(         'post_title'     => $question,         'post_status'    => 'publish',         'post_type'      => 'question'     );            echo $post['post_title'];          $the_post_id = wp_insert_post($post);      It's weird because when I echo out both the strings, the echo the correct thing on both ends so I've isolated it down to the wp_insert_post function that's causing the issue. When I view it in WordPress, the title is just 'If you' and then ends. I found a similar problem here:               http://premium.wpmudev.org/forums/topic/q-wp_insert_post-truncates-post-content-on-quotes-is-there-a-proper-way-to-escape-these-things      But there doesn't seem to be any solution to it on that page. Any ideas on what's going on here and how to solve it? No idea why it's causing it. I'm looking into it to see if has something to do with something else in my code but it seems like it shouldn't because the array element seems formatting just fine when it's echoed out before the wp_insert_post() function. Thanks for your help! ## EDIT I should have specified that these are having to be called from an array where I'm grabbing data from a different source so I won't necessarily have access to the strings directly. I tried mysql_real_escape_string() which should do that job automatically as well and that didn't seem to work...


title: How to change category translation in Polylang afterwards

text: If I translate Tag or Category with Polylang-plugin (http://wordpress.org/plugins/polylang/ ) in Wordpress, how can I change the translation afterwards or remove the translation without removing current tags? There seems to be no way to do it on admin side. With posts and pages you can manually change the id of translation on posts pr pages edit view.


title: Customizing Responsive Themes Menu

text: I use the popular theme: https://wordpress.org/themes/responsive I would like to change the color of one of the menu items and if possible also have a jquery popup from one of the menu items. How can I accomplish this? Thanks


title: Server Side Includes not working in text widget

text: I'm trying to add Server Side Include code to a WordPress text widget, but the content is not being displayed. I've added SSI before on my non-WP site, but for some reason its not working with my WP text widget. Do I need to do something different where this is within WP? Note my WP installation is in a subfolder of my domain. I've tried adding the following to my text widget:               <!--#include virtual="http://www.mydomain.com/mycontenturl.html"-->      and also tried               <?php include ('http://www.mydomain.com/mycontenturl.html'); ?>


title: Proper way to pass credentials in a custom login form to avoid "headers already sent"

text: I'm working on a custom login page plugin. I'm trying to figure out how to log the user in without creating "headers already sent" errors. I was calling `wp_signon` directly after the user clicked "login," but quickly found that this approach yields "headers already sent" errors. I've switched to using hooks:               private function attemptLogin() {         add_action( 'after_setup_theme', array( $this->Cms, 'authenticateUser' ), 10, 2 );         do_action( 'after_setup_theme', $_POST['username'], $_POST['password'] );     }      But, as you've probably guessed, this yields the same errors since I'm still, in essence, executing the login immediately. How can I leave the hook to run on its own schedule to avoid errors, while still making the user's credentials available to it? I've searched both Google and this site for the answer to no avail. The closest to an answer I've found is this, but I'm still unsure how to implement the advice while still passing the user's credentials.


title: File upload from front-end form (as attachment) not working

text: I have a front-end form that is supposed to allow the user to upload a CV which is then sent along with the rest of the form as an attachment. To do so I have used `wp_handle_upload()` like so:               if ($_FILES) {          if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );     $uploadedfile = $_FILES['file'];     $upload_overrides = array( 'test_form' => false );     $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );         if ( $movefile ) {             echo "File is valid, and was successfully uploaded.\n";             var_dump( $movefile);         } else {             echo "Possible file upload attack!\n";         }      }      The form is then sent with wp_mail after checking for errors: (`$receiver_email, $subject, $body, $headers` are all fine and can be seen here               $attachments = $uploadedfile;          if (wp_mail($receiver_email, $subject, $body, $headers, $attachments)) {              $jobs_email_sent = true;          } else {         $jobs_email_sent_error = true;     }      However I am getting the following from `var_dump($movefile)` when I submit the form.               File is valid, and was successfully uploaded.     array(1) {      ["error"]=>      string(212) "File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini."     }      And natually no attachment with the email. I checked php.ini and file_uploads is indeed on and upload_max_filesize is 128M. I have tried to add a pdf and a jpg file which are both quite small. I would greatly appreciate any insight as to what I'm doing wrong here. UPDATE just read that for `wp_mail()` the file path has to be fully specified as in `$attachments = array(WP_CONTENT_DIR . '/uploads/file_to_attach.zip');` which should be returned in `wp_handle_upload();` as file. When I var_dump($_FILES) I get:               array(1) {       ["upload_file"]=>       array(5) {         ["name"]=>         string(5) "3.jpg"         ["type"]=>         string(10) "image/jpeg"         ["tmp_name"]=>         string(14) "/tmp/php3aeSzD"         ["error"]=>         int(0)         ["size"]=>         int(53262)       }      }      My file is named 3.jpg.


title: Send value to RSS feed to create custom feed

text: So, i've got a bunch of code calculating a few things resulting into a simple echo               echo $confirmation;      There is just one thing I want to do; I want to send the $confirmation to an RSS feed. Any ideas?


title: Advanced meta query help

text: I want to get posts according to the following logic: "If post status = publish or pending then get all records which have a meta value of less than todays date. If the post is in trash, get it regardless of meta query" So I have the following args but these bring in only the trash posts that have meta value of less than todays date and I want to get all trash posts.               $args = array(         'posts_per_page' => -1,         'post_type' => 'jobs',         'post_status' => 'pending, publish, trash',         'author' => $current_user->ID,         'meta_key' => 'JOBS_ad_end',         'meta_query' => array(             array(                 'key' => 'JOBS_ad_end',                 'value' => date("Y-m-d"),                 'compare' => '<=',                 'type' => 'NUMERIC,'             )          )     );     $posts = get_posts($args);      I'm guessing this probably isn't even possible and will need a custom query, but thought I'd check if anyone knows a way to do it.


title: Remove Rewrite Rule

text: after adding a rule:               add_action( 'init', 'wpse26388_rewrites_init' );     function wpse26388_rewrites_init(){     add_rewrite_rule(         'usuario/([0-9]+)/?$',         'index.php?pagename=usuario&property_id=$matches[1]',         'top' );     }          add_filter( 'query_vars', 'wpse26388_query_vars' );     function wpse26388_query_vars( $query_vars ){     $query_vars[] = 'property_id';     return $query_vars;      }      My xampp went to space. I can't access my localhost/phpmyadmin, it gives me 403 error and everything I put on url, as localhost/test it's redirects to my wordpress. How can I disable this? Thanks


title: How to modify the query in taxonomy-custom.php to sort term archives by a custom meta field?

text: I am trying to create theme pages for custom taxonomy terms in which the archives are ordered by a custom meta field. I can do this with a new wp_query as follows:                       <?php $directory_archive_query = new WP_Query(                  array(                      'post_type' => 'directory',                     'posts_per_page' => 200,                     'meta_key' => 'surname',                     'orderby' => 'meta_value',                     'order' => 'ASC' ) ); ?>                          <?php while($directory_archive_query->have_posts()) : $directory_archive_query->the_post(); ?>      However, I need this to work on the taxonomy-custom.php page so that each individual taxonomy term's archive page is listed according to the custom meat field (called 'surname'). If I use the wp_query, then of course that doesn't work, because it no longer shows results for each specific term. I have also tried to do this using pre_get_posts, but can't make that work either. What I am expecting to happen is that all posts listed on the term archive page will be listed in ascending order by the surname meta key. That is not happening. Instead, they are just listing in the same order as if there were no pre_get_posts there. The code I have used is as follows:               <?php               function customize_customtaxonomy_archive_display ( $query ) {             if (($query->is_main_query()) && (is_tax('services')))                  $query->set( 'post_type', 'directory' );                              $query->set( 'posts_per_page', '200' );             $query->set( 'meta_key', 'surname' );                        $query->set( 'orderby', 'meta_value' );             $query->set( 'order', 'ASC' );         }               add_action( 'pre_get_posts', 'customize_customtaxonomy_archive_display' );          ?>      Really hoping that someone can help. Thanks for your time. Andrew.


title: Hosting WordPress on AWS EC2 using CloudFront Dynamic Content Origins for page content

text: Is it possible to **completely** host WordPress on AWS with EC2, S3 and CloudFront Dynamic Content Origins, in the way that WordPress is currently built / architected? **Further Details:** I would like to install my WordPress on an EC2 instance. Store all my assets: images, videos and download etc on S3 And use CloudFront Dynamic Content Origins serve the pages and posts from the WordPress website. Therefore making is very quick for page load and only needing a very small EC2 instance, because all content is cached in CloudFront. Read more   * Amazon CloudFront Now Supports Dynamic Content   * CloudFront Concepts **N.B. CloudFront does not support POST HTTP method** **Notes**   * Please do not suggest plugins that only stores assets on S3    * Please do not suggest that I rewriting WordPress to make this work


title: is_page not working when loading javascript with add_action in functions.php

text: This code is working in my functions.php and it's loaded properly:               add_action('wp_enqueue_scripts', 'js_custom', 50);     function js_custom() {         wp_register_script( 'js_custom', get_template_directory_uri() . '/js/custom.js', false, null);         wp_enqueue_script( 'js_custom' );     }      However, this is not working and not loaded:               if ( is_page(273) ) {         add_action('wp_enqueue_scripts', 'js_custom', 50);         function js_custom() {             wp_register_script( 'js_custom', get_template_directory_uri() . '/js/custom.js', false, null);             wp_enqueue_script( 'js_custom' );         }     }      Why it's not loaded? I am on the page with the id equal to 273.


title: Apache extensions for WordPress' working without troubles

text: I have a new web server at the Hetzner EX60. With this new site I have many problems. First of all I need to say that **I have problems with default theme and without any plugins.** I tried to resolve them abuot a month. All of these problems are related to admin area. Fail to load jQuery and the same things. I already added               define('CONCATENATE_SCRIPTS', false);      to config.php file. And now I have problems only with post-new.php and post.php?post=##&action=edit pages. And only when I try to edit or add new post. With adding/editing pages I haven't any problems. What's the problem on those pages? I have missing visual editor. The page isn't loaded to the bottom. 'Upload meadia' button not works. All that is related to js and in particular with jQuery. I resolved a part of this problem with installing W3-Total-Cache. Also I added these lines to config.php               define('AUTOSAVE_INTERVAL', 300 );     define('WP_POST_REVISIONS', false );      Now sometimes I have visual editor and full loaded page and sometimes not. If have problems I purge cache and refresh the page. From 5 page loads I have a case when all is great. It is very uncomfortably and awkward. Because W3-Total-Cache helped me partially to resolve my problem, I make conclusion that I have bad server config and something with cache. But my friends that are also located with me at this server and using other CMS have no problems. **About server:** At the server front-end is nginx and at the backend is Apache. How to make best configuration for it? Currently is installed:               bz2.so     calendar.so     cgi-fcgi.so     соre.so     ctype.so     curl.so     date.so     dcm.so     ereg.so     exif.so     fileinfc.so     filter.so     ftp.so     gd.so     gecip.so     gettext.so     gmp.so     hash.so     iconv.so     imagick.so     json.so     libxml.so     mbstring.so     mcrypt.so     memcached.so     mhash.so     mysql.so     mysqli.so     cpenssl.so     pcntl.so     pcre.so     pdo.so     pdo_mysql.so     pdo_sqlite.so     phar.so     readline.so     reflection.so     session.so     shmcp.so     filter.so     ftp.so     gd.so     gecip.so     gettext.so     gmp.so     hash.so     iconv.so     imagick.so     json.so     libxml.so     mbstring.so     mcrypt.so     memcached.so     mhash.so     mysql.so     mysqli.so     cpenssl.so     pcntl.so     pcre.so     pdo.so     pdo_mysql.so     pdo_sqlite.so     phar.so     readline.so     reflection.so     session.so     shmcp.so     simplexml.so     sockets.so     spl.so     sqlite3.so     standard.so     tokenizer.so     wddx.so     xcache.so     xml.so     xmlreader.so      xmlrpc.so     xmlwriter.so      xsl.so      zip.so      zlib.so


title: Why does not my metabox save?

text: I know there are many questions about variants of this, but I have not been able to find an answer. I have a metabox on the post type `page`, containing nothing but a checkbox. It seems like it won't save no matter what I do. Here is all the code for the metabox.               /*--------------------------------------------------------------------------*      * Register metabox     /*--------------------------------------------------------------------------*/     function kasparabi_page_left_menu() {         add_meta_box( 'kasparabi-left-menu-meta', __( 'Left Menu', 'kasparabi' ), 'kasparabi_render_left_menu_meta_box', 'page', 'side' );     }     add_action( 'add_meta_boxes', 'kasparabi_page_left_menu' );          /*--------------------------------------------------------------------------*      * Callbacks     /*--------------------------------------------------------------------------*/     function kasparabi_render_left_menu_meta_box($post) {         wp_nonce_field( basename( __FILE__ ), 'kasparabi-left-menu-meta_nonce' );              ?>             <p>                 <div>                     <label for="left-menu-checkbox">                         <input type="checkbox" name="left-menu-checkbox" <?php (get_post_meta( $post->ID, 'left_menu_checkbox', true) == 'on') ? ' checked="checked"' : ''; ?> />                         <?php _e( 'Display left menu', 'kasparabi' )?>                     </label>                 </div>             </p>         <?php     }          /*--------------------------------------------------------------------------*      * Save functions     /*--------------------------------------------------------------------------*/     function kasparibi_left_menu_meta_save( $post_id, $post ) {              // Checks save status         $is_autosave = wp_is_post_autosave( $post_id );         $is_revision = wp_is_post_revision( $post_id );         $is_valid_nonce = ( isset( $_POST[ 'kasparabi-left-menu-meta_nonce' ] ) && wp_verify_nonce( $_POST[ 'kasparabi-left-menu-meta_nonce' ], basename( __FILE__ ) ) ) ? 'true' : 'false';              // Exits script depending on save status         if ( $is_autosave || $is_revision || !$is_valid_nonce ) {             return $post_id;         }              /* Get the post type object. */         $post_type = get_post_type_object( $post->post_type );              /* Check if the current user has permission to edit the post. */         if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )             return $post_id;              /* Get the posted data and sanitize it for use as an HTML class. */         $new_meta_value = ( isset( $_POST['left-menu-checkbox'] ) ? sanitize_html_class( $_POST['left-menu-checkbox'] ) : '' );              $meta_key = 'left_menu_checkbox';         $meta_value = get_post_meta( $post->ID, $meta_key, true);              /* If a new meta value was added and there was no previous value, add it. */         if ( $new_meta_value && '' == $meta_value )             add_post_meta( $post_id, $meta_key, $new_meta_value, true);              /* If the new meta value does not match the old value, update it. */         elseif ( $new_meta_value && $new_meta_value != $meta_value )             update_post_meta( $post_id, $meta_key, $new_meta_value );              /* If there is no new meta value but an old value exists, delete it. */         elseif ( '' == $new_meta_value && $meta_value )             delete_post_meta( $post_id, $meta_key, $meta_value );     }     add_action( 'save_post', 'kasparibi_left_menu_meta_save' );


title: How to Set Featured image In Wordpress without Showing it into Post?

text: I just want to set featured image of my post but don't want to show it in my post. How can I do that? Detailed : I want to post to show its thumbnail in main page but not to show it when we expend the post ie: Not to show that featured image in post when somebody open that post by clicking Read-More Plugin will be great.


title: How to have post count after each listed category

text:
How can I have a post count after each listed category with the following function? Also, how can I apply this with wp_get_archives and also with the same option as the below function?
     <?php     $args = array(       'orderby' => 'name',       'order' => 'ASC',       'number' => 10, // how many categories            );     $categories = get_categories($args);       foreach($categories as $category) {          echo '
term_id ) . '" title="' . sprintf( __( "View all posts in: %s" ), $category->name ) . '" ' . '>' . $category->name.' ›
';         }           ?>
      Examples: |(get_categories) Category item 1 > ()   Category item 2 > () (wp_get_archives) Archive item 1 > ()   Archive item 2 > ()


title: How to make a listing of my custom_post_type that the user can dynamically sort from the front-end?

text: I have a custom_post_type that I want my users to see a list of, which they can dynamically sort by certain attributes. The list would be in a html table format with pagination. Ideally with a "jquery" like dynamic activity, but a "low-tech" version would be nice, too. Could you please point me in the right direction? Maybe there is a plugin that supports custom_post_types?


title: Not able to override plugin's default css rules

text: I'm not able to override the "Total Control HTML5 Audio Player Basic" plugin default css file. I've copied the plugin css default content inside `style.css` file in my child theme, and then I've tried to change some stuff, but the new css rule are not displayed. I've checked with Firebug that the custom css file is loaded after the default file, so I don't understand why the new rules are not applied. I've also tried with this suggestion: Override CSS settings of plugins               add_filter( 'style_loader_src', 'wpse106104_replace_stylesheet' );     function wpse106104_replace_stylesheet( $stylesheet_src, $handle ){              if( 'plugin-script-handle' == $handle ){              $stylesheet_src = get_template_directory_uri() . '/css/themes-copy-of-plugin.css';         }         return stylesheet_src;     }      but this only throws these errors:               Warning: Missing argument 2 for wpse106104_replace_stylesheet() in /home/me/MyServer/myproject/wp-content/themes/twentyfourteen-child/functions.php on line 451          Notice: Undefined variable: handle in /home/me/MyServer/myproject/wp-content/themes/twentyfourteen-child/functions.php on line 453          Notice: Use of undefined constant stylesheet_src - assumed 'stylesheet_src' in /home/me/MyServer/myproject/wp-content/themes/twentyfourteen-child/functions.php on line 456          Warning: Missing argument 2 for wpse106104_replace_stylesheet() in /home/me/MyServer/myproject/wp-content/themes/twentyfourteen-child/functions.php on line 451      Any suggestion?


title: How to get certain part from widget

text: I want to use only some part of the widget. I have multisite network so to link the posts and pages I am using a plugin called Multilingual Press which also comes with widget to switch sites. Now I have registered a widget area on my header and I want only the part: ENGLISH FINNISH form the widget, but it is coming with all the divs and title and everything how can I get the only link part from the widget and place is on my desired location.


title: How to use media upload on metabox post page without breaking TinyMCE?

text: I'm using the following code for upload in multiple mextaboxes in a post or page admin section. Works for metaboxes but breaks the TinyMCE insert image. I want to know please how I can achieve this without breaking the TinyMCE. Off course the issue comes when I overwrite the windows.send_to_editor function.               jQuery(document).ready(function() {         jQuery('.st_upload_button').click(function() {              targetfield = jQuery(this).prev('.upload-url');              tb_show('', 'media-upload.php?type=image&TB_iframe=true');              return false;         });         window.send_to_editor = function(html) {             imgurl = jQuery('img',html).attr('src');             jQuery(targetfield).val(imgurl);             tb_remove();        }     });      A possible solution would be hiding "Insert into post" button which by the way is not to semantic in the metaboxes and put a new button like "Select image" and writing a function with take the img o attach url a assign to the input. How can I do that o something else you recommend? Thanks in advance.


title: List of users that clicked a 'Join' button at single post

text: The title might be a bit vague while I'm not quite sure how to describe it. **What I want:** At every single post (in this case of post type 'event') a logged in user must be able to click a 'Join' button (and when clicked a 'Unjoin' button). The admin must be able to see which users have joined an event and which event. It doesn't matter if this must be a custom field at the User profile info or a new list in the admin. **What I already have:** I have made a custom checkbox list of posts at the User profile info. And I do know how to make a button in at a single post. But it must be connected to this list, so when it's clicked the specific post must be checked at the Users profile page. I'm not sure what the easiest method is to make this, any idea? It's actually a quite simple function. Thanks in advance.


title: How do I flush the rules after saving settings using the Settings API?

text: I'm using the Settings API to allow the user to toggle the `has_archive` option on some custom post types. When the user turns archives on or off, I want to flush the rewrite rules. If I had written the saving function myself, I could just call `flush_rewrite_rules()` and be done with it, but the Settings API takes care of the saving for me. Is there a hook somewhere that I can use? ## Chosen Solution @Stephen Harris               add_action('admin_init', 'my_plugin_register_settings');     function my_plugin_register_settings() {         if (delete_transient('my_plugin_flush_rules')) flush_rewrite_rules();         register_setting('my_plugin', 'my_plugin_settings', 'my_plugin_sanitize');         // add_settings_section(), add_settings_field(),...     }          function my_plugin_sanitize($input) {         set_transient('my_plugin_flush_rules');         return $input;     }


title: localizing variable on front-page.php template fails but succeeds on single page and taxonomy archive

text:
I have the following code in a php include file:               function pass_the_var() {         $video_embed_code = jkaw_oembed_code();         return array(             'embedCode' => $video_embed_code             );     }      earlier in the same file I also enqueue my scripts:               wp_register_script('jkaw-js', get_template_directory_uri() . '/lib/js/jkaw.js', false, '1.0', true);     wp_enqueue_script( 'jkaw-js' );     wp_localize_script( 'jkaw-js', 'phpVars', pass_the_var() );      I am using this code on a custom post type 'portfolio'. `wp_localize_script` successfully returns the array and populates the $video_embed_code variable on `single-portfolio.php` and on `taxonomy-portfolio-cat.php`. However on `front-page.php` template (I am using a static front page with it's own wp_query to list all the 'portfolio' posts), the $video_embed_code is returned as an empty string. `single-portfolio.php`, `taxonomy-portfolio-cat.php` and `front-page.php` all call `get_template_part( 'content', 'portfolio' );` which contains an if.. else.. statement.                   if ( !is_single() ) { ?>                  <a class="wrapper" style="width:100%; padding-bottom: <?php echo $thumb['padding']; ?>%" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                     <img class="ll" data-original="<?php echo $thumb['src']; ?>" />
                           <?php } else {              // code for a single post          } ?>      If I call `pass_the_var()` inside the `if(!is_single)` statement it returns the correct code but for some reason when it's called via the `wp_localize_script` on `front-page.php` it fails. I guess this has something to do with the loop and the order that things are fired but I cannot work out why it is failing and how to solve the problem. Any suggestions would be gratefully received, thanks.


title: Hide one admin from another admin

text: How can I hide one admin from another in the users list? I want to give admin permission to another person without giving him the ability to see/edit my details.


title: Proper syntax for simple conditional bloginfo language

text: I need to do something like this:               <?php $bloginfo = get_bloginfo( 'language' );       if($bloginfo->en-US){          the_time('jS F Y');       }else{ the_time('d/m/Y');       };      ?>      I cant find the proper way to wrap en-US. Any ideas? Thank you in advance, people.


title: including post-specific feed without full wp_head()

text: I'm not including the wp_head() call in my header.php, but I would like to include the feed links for each post. Is it possible to call wp_head() with arguments only to include specific functionality? Or alternately, can you call specific functionality (admin toolbar css, feed links, etc) directly?


title: Custom post type Featured Image popup not working

text: I added a custom post type with thumbnail support. When I navigate to the custom post type in the admin backend and add a new one, I can add a featured image. The problem is, when I click the link to select a featured image, the media library doesn't show in the same window as a popup but is just navigates to the link. (The media library is displayed over the entire screen as a page and not as a popup) I used the following code to add my custom post type:               // Register Custom Post Type     function sponsors_custom_post_type() {          $labels = array(         'name'                => _x( 'Sponsors', 'Post Type General Name', 'bluespeer' ),         'singular_name'       => _x( 'Sponsor', 'Post Type Singular Name', 'bluespeer' ),         'menu_name'           => __( 'Sponsors', 'mycpt' ),         'parent_item_colon'   => __( 'Parent Item:', 'mycpt' ),         'all_items'           => __( 'Alle Sponsors', 'mycpt' ),         'view_item'           => __( 'Bekijk Sponsor', 'mycpt' ),         'add_new_item'        => __( 'Voeg nieuwe Sponsor toe', 'mycpt' ),         'add_new'             => __( 'Voeg toe', 'mycpt' ),         'edit_item'           => __( 'Bewerk Sponsor', 'mycpt' ),         'update_item'         => __( 'Update Sponsor', 'mycpt' ),         'search_items'        => __( 'Zoek Sponsor', 'mycpt' ),         'not_found'           => __( 'Geen Sponsor gevonden', 'mycpt' ),         'not_found_in_trash'  => __( 'Geen Sponsor gevonden in prullemand', 'mycpt' ),     );     $args = array(         'label'               => __( 'post_type_sponsors', 'mycpt' ),         'description'         => __( 'Sponsors', 'mycpt' ),         'labels'              => $labels,         'supports'            => array( 'title', 'thumbnail', ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'capability_type'     => 'page',     );     register_post_type( 'post_type_sponsors', $args );          }          // Hook into the 'init' action     add_action( 'init', 'sponsors_custom_post_type', 0 );      EDIT: The following error was in the developer console: `Uncaught TypeError: Object [object Object] has no method 'dialog'` This is causing the problem but I have not found a solution yet...


title: Installing wp3.2.1 on IIS; getting empty sessions

text: i have to install wordpress 3.2.1 on IIS 5.0 (yeah, i know...) here. Brand new default wordpress installation, no plugins ore previous versions installed. So, i downloaded the 3.2.1.zip and the 3.2.1-IIS.zip, unzipped everything and set up the database, but i get the same issue every time: everything works, except when i try to login to the admin area it keeps redirecting me back to `wp- login.php?redirect_to=http%3A%2F%2Fmydomain.com%2Fwp-admin%2F&reauth=1` without any error message. config:   1. all requests to http://www.mydomain.com are rewritten to http://mydomain.com   2. tbl wp_options has `siteurl` and `home` set to `http://mydomain.com`   3. i can see 2 cookies: `wordpress_test_cookie=WP+Cookie+check` and `PHPSESSID=617cdf1966c78a56e2dd901942d41124` in my browser   4. there is an empty file `sess_617cdf1966c78a56e2dd901942d41124` in my session folder It looks like a session problem to me. I have a cookie set in my browser, and there is a corresponding session file in my webservers session folder, but it's always empty (0 Bytes). when i create a simple test script in the same folder as my wp-installation and manually add               session_start();     $_SESSION['foo'] = 'bar';      then i can also see those values in my session files. For the last 2 days i tried to figure out whats wrong here. The installed php files and my database are both ok, it works as it should when i moved the installation to a diffent xampp webserver on a different box. Crosschecked my php.ini and the session handling is the same as on xampp. I pretty much tried out any suggestion i found on wordpress.org and other forums for this topic; but nothings seem to work.


title: Protecting Wordpress login page

text: How can i do this: Whenever visitors open the login page (wp-login.php), they will be redirected to the mainpage. Only the admin (me) can view the page to login. I am doing this to protect my wp sites. Is there any better way to protect WP login page?


title: Cleanest Way to Select Every Second Element in a Loop?

text:
What's the quickest and easiest way to select every second element in the loop? At the moment I'm using this strange method:
     <?php $k = 1; ?>       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <li class="<?php if($k%2 == 0) echo 'last'; ?>"><?php the_content(); ?>
     <?php $k++; ?>     <?php endwhile; ?>     <?php endif; ?>
      Can't use nth-child since IE doesn't support it and CSS3 PIE isn't playing nice with my site at the moment.


title: Can't Post to my Wordpress Anymore!

text: I'm at my rope's end with this whole thing and have tried everything I can to solve it. I have a WordPress site with a SQL database on Azure, but recently all of the users associated with the site lost the ability to post and can only "submit for review" despite maintaining admin status. Attempting to update or reinstall Wordpress versions puts me in a loop of "Database Update Required" and "Update Completed." Looking into the SQL database as outlined in this page: http://www.clickonf5.org/2247/solution-database-upgrade-required/ only lead to the discovery that the main account for the database was also in a read-only mode. We couldn't fix this as we can't even access the website's dashboard on Azure management! Another attempted solution involved following the manual instructions here: http://www.johnpapa.net/azurecleardbmysql/ only to get an access denied message when trying to back-up the database. Exporting through MySQL also failed due to 12 errors. We checked our site size and it's below the limit imposed by ClearDB. Needless to say, any help here would be greatly greatly appreciated. Thanks in advance


title: Get current category id from post page wordpress

text: I have a problem to get category id of current post. We are using `<?php get_the_category( $id ) ?>` for finding out category of current post. If a post like 'demo' has 2 category like cat1 and cat2. When i open a cat1 page and then go to demo page, i want different layout.. and when i open a cat2 page and then go to demo page, i want to open this demo page with other layout. It can be only done when i will identify.. from which post has called.. but how??


title: How to print partial URL after #?

text: In WordPress, is it possible to retrieve the part of the URL after a `#`? I'm trying `echo the_slug();` but it's showing front slug. But I want after #tag For example: I'm searching and land on this page. And print last anchor text. http://www.mywebsite.com/test/#test1 >> Output: test1 http://www.mywebsite.com/test/#test-test2 >> Output: test-test2


title: recent posts grid using isotope

text:
I'm trying to match this mockup for recent posts on a home page. ![grid posts mockup](http://i.stack.imgur.com/K6Pw8.png) I've gotten close but the grid items aren't positioning correctly and the bottom one is partially hidden: http://endgenocide.org/ueg2014/ It needs to be filterable so I'm using isotope. Any guidance is appreciated! Here is the jQuery code:               jQuery(function ($) {          var $container = $('#isotope-list'); //The ID for the list with all the blog posts     $container.isotope({ //Isotope options, 'item' matches the class in the PHP         itemSelector : '.item',            layoutMode : 'masonry',           columnWidth: '.grid-sizer'     });          //Add the class selected to the item that is clicked, and remove from the others     var $optionSets = $('#filters'),     $optionLinks = $optionSets.find('a');          $optionLinks.click(function(){     var $this = $(this);     // don't proceed if already selected     if ( $this.hasClass('selected') ) {       return false;     }     var $optionSet = $this.parents('.option-set');     $optionSets.find('.selected').removeClass('selected');     $this.addClass('selected');          //When an item is clicked, sort the items.      var selector = $(this).attr('data-filter');     $container.isotope({ filter: selector });          return false;     });          });      Here is the code in page-frontpage.php
     <div id="content" class="site-content <?php echo $col; ?>" role="main">          <?php if ( have_posts() ) { ?>

         Recent stories

All
         <?php          $terms = get_terms("category"); // get all categories, but you can use any taxonomy         $count = count($terms); //How many are they?         if ( $count > 0 ){  //If there are more than 0 terms             foreach ( $terms as $term ) {  //for each term:                 echo "
slug."'>" . $term->name . "
\n";                 //create a list item with the current term slug for sorting, and name for label                 }             }          ?>

         <?php /* The loop */ ?>         <?php while ( have_posts() ) { the_post(); ?>         <?php get_template_part( 'post-templates/content', get_post_format() ); ?>         <?php } ?>              <?php echo zee_pagination(); ?>              <?php } else { ?>         <?php get_template_part( 'post-templates/content', 'none' ); ?>         <?php } ?>

          <?php the_post(); ?>     <?php the_content(); ?>      And here is the code in content.php               <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>               <?php $the_query = new WP_Query( 'posts_per_page=50' );      //Check the WP_Query docs to see how you can limit which posts to display ?>     <?php if ( $the_query->have_posts() ) : ?>
     <?php while ( $the_query->have_posts() ) : $the_query->the_post();      $termsArray = get_the_terms( $post->ID, "category" );       //Get the terms for this particular item     $termsString = ""; //initialize the string that will contain the terms         foreach ( $termsArray as $term ) { // for each term              $termsString .= $term->slug.' '; //create a string that has all the slugs          }     ?>      <div <?php post_class( $termString . 'item' ); ?>>
         <?php if ( has_post_thumbnail() ) {                        the_post_thumbnail();                 } ?>

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

<?php echo __('posted', ZEETEXTDOMAIN ); ?> <time datetime="<?php the_time( 'c' ); ?>"><?php the_time('F j, Y'); ?></time> <?php echo __('by', ZEETEXTDOMAIN ); ?> <?php the_author_posts_link() ?>

<?php the_category(', ') ?>
         <?php the_content( __( 'Continue reading →', ZEETEXTDOMAIN ) ); ?>

           <?php endwhile;  ?>
      <?php endif; ?>                             <?php zee_link_pages(); ?>
      Here is relevant CSS               .isotope-item {      z-index: 2;     }          .isotope-hidden.isotope-item {     pointer-events: none;     z-index: 1;     }          #iso-container{     padding:0 0 10px;     clear:both;     overflow:hidden;     }     #iso-item{     position:relative;     }          .item{     float:left;     overflow:hidden;     margin: 20px;     }          .format-standard{      width:300px;     }          .format-image{      width:300px;     }          .format-gallery{      width:600px;     }          .relative {position:relative;}          .recent {     background: #1a1a1a;     overflow:hidden;     padding: 0 60px;}


title: Set user role based on invitation code

text: I'm working on a site where I'd like anyone to be able to sign up, but people who sign up with an invite code would automatically be promoted to a role with more privileges. I'm aware that there are plugins that handle invite codes, but so far I haven't found any that will do quite this. For my purposes, one invite code used by many people would work best. I'd be sending out the invite code to a mailing list, and I'm not _that_ concerned about limiting access.


title: Display a list of posts whose meta field values are equal to the ID of the post being viewed?

text: SOLUTION PASTEBIN LINKS::   * http://pastebin.com/YmXVC1kn \- Author Single Post   * http://pastebin.com/g0xgvxgh \- Book Archive Template Please refer to these files here - solved by storing the post ID in a variable and reworking how I was nesting my loops. * * * I would like to display a single post (from a custom post type "authors") - then immediately underneath this post's content I want to display a list of other posts that I have _assigned_ to this specific post (from a custom post type "books"). For the "books" custom post type I am currently using a custom meta box containing a dropdown (select field) - this field pulls in a list of published posts("authors") and saves the "author" post's ID to the meta field. What I want to do on the single template is only show posts whose meta field value is equal to the ID of the post currently being display. Basically only show the list of "books" for this single "author" ... is this doable? * * * I would need to do the reverse as well ... so when viewing an archive of "book" posts I would like to show the "author" post associated with it underneath... so one loop to pull in the "book" content and nested inside is another loop to pull in the "author" post title, etc... I am assuming by comparing the content of a meta field against the post ID? How do I store the ID of the "author" post to compare across loops? How do I store the meta field value to compare against the ID - again across loops or nested loops? Or If I am totally going the wrong way with this please enlighten me ;) If anyone can point me in the right direction it would be most greatly appreciated!


title: wp_query for the first sticky, then display the rest of the posts excluding the first sticky

text:
I've been reading this by @nacin and getting to grips with wp_query over query_posts that I used to use. What I want is:   1. to put this in a template file   2. to query all posts of this category, in this case '3'   3. to display, if available, the first result on the page the latest sticky post   4. after the first sticky, if one is set, display the rest of the posts excluding that sticky if it was set Problems I have seen are: \- if I do posts_per_page = 1 on the sticky loop, I can not do posts_per_page = -1 on the rest of the posts loop. To workaround this I've just set the number to 999. I should say now that the code I have **works**. However this is for a very high traffic site, and I want to make sure this is the best way of doing it, and I'm not sure I'm using wp_query right to do this since the original query's are essentially the same as one another just with and without sticky posts.               global $wp_query;     $wp_query = new WP_Query(array(         'post_type' => 'post',         'posts_per_page' => 1,         'category__in' => 3,         'post__in'  => get_option( 'sticky_posts' )     ));     while ($wp_query->have_posts()) : $wp_query->the_post();         $exclude_featured = $post->ID;         echo the_title();         echo '
';     endwhile;           echo '
';     echo '
';          global $wp_query;     $args = array_merge(         $wp_query->query_vars,         array(             'post__in' => null,             'posts_per_page' => 999,             'ignore_sticky_posts' => 1,             'post__not_in' => array($exclude_featured)         )     );     query_posts( $args );     while ($wp_query->have_posts()) : $wp_query->the_post();          if ( $exclude_featured == get_the_ID() )             continue;             echo the_title();             echo '
';     endwhile;       Thanks for any help guys.


title: Get rid of Wordpress category, tag and author archives?

text: I have searched the net with no success on what should be an easy thing. I have a highly customized blog with pages, sub pages and posts. While I rely heavily on the use of categories and tags I don't want them to be viewable in a url. The same goes for authors and date categories. Basically I wan't to throw a 404 error if someone tries to access these pages. Can someone point me in the right direction? Thanks! The following should not be accessible: example.net/category/books/ example.net/tag/ebooks/ example.net/author/dickens/ example.net/2012/10/


title: [Plugin: Posts 2 Posts] How does it work?

text:
I recently discovered Scribu's Posts 2 Posts plugin, which seems to be exactly what I was looking for in order to connect pages and posts for a big editorial website. But I cannot get it to work, which is frustrating because the principle seems really easy. I followed the wiki basic usage example, in my functions.php I have :               function my_connection_types() {     if ( !function_exists( 'p2p_register_connection_type' ) )         return;          p2p_register_connection_type( array(          'from' => 'post',         'to' => 'page'     ) );     }     add_action( 'init', 'my_connection_types', 100 );      And in page.php :               $connected = new WP_Query( array(         'post_type' => 'post',         'connected_from' => get_queried_object_id()     ) );     echo '
Related posts:
';     echo '
';     while( $connected->have_posts() ) : $connected->the_post();         echo '
';         the_title();         echo '
';     endwhile;     echo '
';     wp_reset_postdata();      I have a post called "Tacos", which I connected to the page called "About". When I go to the "About" page, I see "Related posts:", but nothing else after that (ie. where is my Taco ?) a `print_r( $connected )` gives the following :               WP_Query Object ( [query_vars] => Array ( [post_type] => post [connected_from] => 2 [error] => [m] => 0 [p] => 0 [post_parent] => [subpost] => [subpost_id] => [attachment] => [attachment_id] => 0 [name] => [static] => [pagename] => [page_id] => 0 [second] => [minute] => [hour] => [day] => 0 [monthnum] => 0 [year] => 0 [w] => 0 [category_name] => [tag] => [cat] => [tag_id] => [author_name] => [feed] => [tb] => [paged] => 0 [comments_popup] => [meta_key] => [meta_value] => [preview] => [s] => [sentence] => [fields] => [category__in] => Array ( ) [category__not_in] => Array ( ) [category__and] => Array ( ) [post__in] => Array ( ) [post__not_in] => Array ( ) [tag__in] => Array ( ) [tag__not_in] => Array ( ) [tag__and] => Array ( ) [tag_slug__in] => Array ( ) [tag_slug__and] => Array ( ) [meta_query] => Array ( ) [ignore_sticky_posts] => [suppress_filters] => [cache_results] => 1 [update_post_term_cache] => 1 [update_post_meta_cache] => 1 [posts_per_page] => 10 [nopaging] => [comments_per_page] => 50 [no_found_rows] => [order] => DESC [orderby] => il_posts.post_date DESC ) [tax_query] => WP_Tax_Query Object ( [queries] => Array ( ) [relation] => AND ) [post_count] => 0 [current_post] => -1 [in_the_loop] => [comment_count] => 0 [current_comment] => -1 [found_posts] => 0 [max_num_pages] => 0 [max_num_comment_pages] => 0 [is_single] => [is_preview] => [is_page] => [is_archive] => [is_date] => [is_year] => [is_month] => [is_day] => [is_time] => [is_author] => [is_category] => [is_tag] => [is_tax] => [is_search] => [is_feed] => [is_comment_feed] => [is_trackback] => [is_home] => 1 [is_404] => [is_comments_popup] => [is_paged] => [is_admin] => [is_attachment] => [is_singular] => [is_robots] => [is_posts_page] => [is_post_type_archive] => [query_vars_hash] => 90a220b2f180d3ea6ccbd9473e26ec4c [query_vars_changed] => [query] => Array ( [post_type] => post [connected_from] => 2 ) [request] => SELECT SQL_CALC_FOUND_ROWS il_posts.*, il_p2p.* FROM il_posts INNER JOIN il_p2p WHERE 1=1 AND il_posts.post_type = 'post' AND (il_posts.post_status = 'publish' OR il_posts.post_status = 'private') AND il_posts.ID = il_p2p.p2p_to AND il_p2p.p2p_from IN (2) ORDER BY il_posts.post_date DESC LIMIT 0, 10 [posts] => Array ( ) )      What am I missing? ps. Wordpress 3.1.1, Posts 2 Posts 0.7 and PHP 5.3.3


title: wp theme.. Could not create directory

text: Could anyone help me with this please? I am trying to install my wp theme Recital (it came out quite recently), but when I upload the zip and press install, it says Could not create directory... What am I supposed to do?


title: How to solve 500 Error on WordPress Admin Dashboard due to time-out on getdirsize

text: **problem:** Only some blogs did not show the dashboard (but did show all other admin pages). I have left this problem for some time (months) since Googling did not bring up anything relevant and I was too lazy to investigate (and could work around it by logging in, getting a 500 error and then press back and click comments). In my mind were .htaccess changes it did, plugins that drop bad rss feeds etc...but... it was core. So today I went commenting out all passages in dashboard.php and unfortunately it was Murphy since the problem was with the bottom line...               add_action( 'activity_box_end', 'wp_dashboard_quota' );      In which I commented the line               //$used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;         // returns: 1418.9275159836     $used=0;      Whereafter my dashboard was so speedy that I got tears in my eyes. I'm logging this here since I hope people searching for the problem now will shortcut time and recognize the reason. Especially with the combo: 500 and admin dashboard. ~~**Question:** I **assume** that the bigger the uploaddir gets, the slower dasboards will load for blogs. I also assume that this happens for every blog out there since this is a line in core. ~~ ~~Am I correct and could I log this as issue or am i stupid - missing something essential that does not cause this to be problem for every multisite blog with large quota after some time?~~ ~~Now I connected 500 and getdirsize I foundhttp://trac.mu.wordpress.org/ticket/1175 and http://trac.mu.wordpress.org/changeset/2027 ...... In there a transient check was implemented by james collins. What happened to the transient check? that would resolve this I think.~~ The transient check as implemented in ticket 2027 is still in place (see Rarst answer below) and disabling the quota completely will also shortcut the 500 error since that is what is checked in wp_dashboard_quota. So: if you do not disable the quota it means you will get a 500 error eventually if you have a large quota limit. IMHO that could be improved / ticketed or not?


title: Upload post thumbnail from the front end

text: We would like users to be able to upload the post thumbnail when editing posts. How would this be done. I would imagine it would make use of the ajax functions of wordpress. Any ideas, Marvellous