Convert textarea with wp_editor

I have a custom tabbed menu which has some input fields that works properly. I followed this tutorial: http://wp.tutsplus.com/tutorials/the-complete-guide- to-the-wordpress-settings-api-part-8-validation-sanitisation-and-input-ii/ But, I need to replace the textarea input for the rich text element. I tried to use the function wp_editor() but I do not know how to pass the id from the textarea. How can I add or manage de editor inside? I saw some tutorials but still with problems. Thanks in advance This is de Code: This is the code. Here. I create de field:               add_settings_field(      'Textarea Element',      __( 'Textarea a TinyMCE', 'mymenu' ),        'textarea_element_callback',         'theme_input_examples',      'input _section'         );      And here I made and echo to show it on my admin page:               function textarea_element_callback() {     $options = get_option( 'theme_input_examples' );     echo '<textarea id="textarea_example" name=" theme_input_examples[textarea_example]" rows="5" cols="40">' . $options['textarea_example'] . '</textarea>';     }       This is the menu where I display the textarea:               add_submenu_page(     'theme_menu',     __( 'Opfolgning pa kontrakt', 'mymenu' ),     __( 'Opfolgning pa kontrakt', ' mymenu ' ),     'administrator',     'theme_input_examples',     create_function( null, 'theme_display( "input_examples_4" );' )     );


ZIP up all images displayed in a [gallery] and offer as download link

I would like to offer my visitors the option to download the entire photo gallery (displayed on dedicated [gallery] pages) as a ZIP file displayed at the bottom of each gallery page. - The full-sized image will have to be included. David Walsh has given some code in his post here to zip up files but I'm having troubles integrating that with Wordpress functions. I'm aware there is a NextGEN gallery download plugin but I'm not in a position to use that as I use the native wordpress gallery functions. A similar question with an alternative (manual method) of completing the above can be found here: Plugin to download attached media files? Any help would be greatly appreciated. Thanks.


get_term_link not working

I am trying to use the below code snippet to display an image and then wrap it in a link to a specific term archive page. In this case, I have a custom taxonomy (Series) with a few different terms. The variable $series outputs the Term Object, therefore I want to use the get_term_link function to get the URL to the terms archive page. The documentation for get_term_link (http://codex.wordpress.org/Function_Reference/get_term_link) says that I should simply be able to provide the term object and it will work, but it's not. I'm getting a partial-page load, meaning the code is breaking when it reaches this function. Any help is appreciated!               $imageid = get_sub_field('series_banner', 'options');     $image = wp_get_attachment_image( $imageid, 'home-series-banner');     $series = get_sub_field('series_link', 'options'); //Returns the term object ?>     <a href="<?php echo get_term_link($series); ?>"><?php echo $image; ?>


Gallery image must open up in fancybox directly not post page

I am inserting a number of galleries onto a page using the multiple galleries plugin. I want the image to open up in fancybox (highslide js variant or some such) when clicked and installed another plugin called easy fancybox. The problem I am facing is that when the image is clicked in the gallery the image opens up its own post page and when that image is clicked it opens up in a fancybox. I want it to open up directly in a fancybox. I would also like the fullsize image to open up in a fancybox not just the thumbnail. I am quite sure this is possible and I am just doing something silly. Thanks in advance. Nandakumar Chandrasekhar


Linking to Child Theme PHP Files

I have an existing website with html, css, js, and image files that I am trying to convert over to wordpress. I installed a clean local install using mamp on my hard drive and created a new child theme folder that references the twenty eleven theme. My style.css, header.php, footer.php, and index.php files are customized. When I load the main page in my browser it loads exactly as it should. Now my problem is that I am trying to create the other content pages for the website...about, services, etc.. I created an about.php file and included the header.php and footer.php as I did in the index.php. I also put in the html as well. When I try to link to this page or visit it in the browser I simply get a page not found error. This is how I am referencing my links in the menu of the header.php file...               <a href="<?php bloginfo('stylesheet_directory') ?>/about.php" title="About">about      Am I linking incorrectly? Am I doing the entire process incorrectly? Really confused about how to link the remainder of those content pages...I have all of the html and css ready to go just need to know this. Help would be greatly appreciated thanks in advanced.


Add menu/submenu items programmatically

Newbie question here. I'm hoping to modify a menu programmatically and am having trouble figuring out the right way to do it. My site uses a membership plugin. Users pay to become members, and depending on what kind of member they identify themselves as, they get to view different content. In my case, I want to have one menu where the last menu item changes depending on what kind of user you are. If anonymous, you get a "join now" link; other members see links to the content they can access. The rest of the menu is the same for everybody. I see I can hook into `wp_nav_menu_items`, but that looks like formatted HTML already. Ideally my theme would do the formatting and I'd just feed it a list of pages that the user would see for the last menu item & its submenu items. What's the right hook to do this? FWIW, this is WordPress 3.9 running the Customizr theme. I'm too new with WP to know if that makes a difference.


how to include a simple jquery file into a wordpress plugin

ok this is my first time to include jQuery into wordpress and it has taken me the 2 full days trying to figure this out. No matter how many articles I read I cannot find a perfect example. Ok so this is my plugin file... very simple.               <?php         /*         Plugin Name: jQuery Include Test         Plugin URI: http://jquery.com         description: A test to include jQuery.         Author: blah blah         Author URI:          */               // jQuery alert to pop up when the page loads.              function pop_jquery_test() {         $src = plugins_url('includes/jquerytest.js', __FILE__);         wp_register_script( 'jquerytest', $src );         wp_enqueue_script( 'jquerytest' );         wp_enqueue_script( 'jquery' );     }     add_action('init','pop_jquery_test');       and this is the jquerytest.js file that               $j=jQuery.noConflict();          $jQuery(document).ready(function(){           alert('hi there');     });      now the question is how do i get this to work? in the sense when i activate the plugin, it pops-up like the jquery code above says.


WordPress fails to embed video URL

WordPress or my theme fails to embed this video URL: `https://www.youtube.com/embed/vsTrAfJFLXI?rel=0?controls=0` but works with this URL:               https://www.youtube.com/watch?v=vsTrAfJFLXI      I need to get rid of the youtube control buttons in the preview, but cannot use embed or the iframe because that just creates an hyperlink. Any ideas? WP version 3.7.1


Bulk update all posts from plugin settings screen

I'm writing a plugin right now that will populate custom metadata for all posts on the site based on a certain rule. I've already created a Plugin's settings page and a logic that should be triggered for each post. See below:               add_action('admin_menu', 'plugin_admin_page');          function plugin_admin_page() {       add_options_page('Plugin Page', 'Plugin Section', 'manage_options', 'plugin_page', 'plugin_options_page');     }          function plugin_options_page() {       // I need to add a button to trigger bulk operation from here. This is a "start_bulk_operation" function.       // Also, I'd like to display progress on this Settings page.     }          function start_bulk_operation() {       $posts = get_posts( array('post_type' => 'post', 'numberposts' => -1 ) );       foreach ( $posts as $post ):         // Do something with the post       endforeach;     }      What I don't know how to do is how to trigger my custom logic (plugin's function) from the Settings page. Also it would be great if the approach will let me show progress as well, like "Updating post #50 out of 897". Any ideas? Thanks in advance!


Need edit profile link in the menu for logged in users

I have a page called edit profile, i have installed the profile builder plugin,so the users can edit their profile from front end, if the user is logged in i want to show the edit profile and logout else it is login. how can i achieve that? i am using wp-bootstrap responsive theme, i am new in wordpress development any one please help me.Do i need to change any thing in the header.php file?


Multitenant with a single site

**What are the best practices to create a multitenant enviroment in wordpress?** I've created an app with wordpress. Now i would like to make it as a multitenant solution. I've ended up with two options:   * Create a multisite registration and use the wp network solution (each tenant is a site - a lot of dbs / separated content )   * Single site and use authors on queries (tenant content not well separated / single wp db) The app is the same for everyone, all interfaces, content types, available options are the same.


writing a plugin, how to disable the comment form altogether?

I'm writing a protected-page plugin and want to disable comments on protected pages. I'm usually hooking into `the_content` but that's not enough for comments. I got into `comments_array` to block the existing comments, but how do I block `comments_template`?


Custom Post List View: Page or something else?

I have a workflow / best practice question about making views for Custom Post Types (both list and detail). Currently, I put the "list" view for my Custom Post Type (called, "Menu Items") into a Wordpress Page called "Menu". I then use a custom template for my Menu "Page":               <?php          $type = 'menu_item'; // name of my custom post         $args=array(           'post_type' => $type,           'post_status' => 'publish',           'paged' => $paged,           'posts_per_page' => 5,           'ignore_sticky_posts'=> 1         );         $temp = $wp_query;  // assign orginal query to temp variable for later use            $wp_query = null;         $wp_query = new WP_Query($args);               if( have_posts() ) :              while ($wp_query->have_posts()) : $wp_query->the_post(); ?>                      // my custom menu item post meta stuff                     <?php endwhile; ?>         <?php endif; ?>      I put my "detail" view into a PHP page called "single-menu_item.php". On the front-facing side, this works well. However, I was just wondering if there is another way to do this because I see a few non-intuitive things about this:   1. My user goes to a top-level menu item called "Menu Items" but then the content is displayed on a Wordpress Page (which they basically don't touch). Do I just "hide" this page from the user using permissions, and if so, can someone point me in the right direction as to how to go about doing this??   2. Sometimes on the site I just need to show a list view for the custom post but not the "detail" view...so I haven't built a single view page for that particular custom post (say I make another custom post type called something other than "menu item"). So...when the user hits "view", because I haven't make a proper single view for that post, they get bumped to the default view, which might not be properly formatted at all? I'm interesting in knowing how other people go about dealing with these issues (or if they bother with it at all)...


Using SMTP for outgoing mails (PHPMailer) on AWS instance?

I moved one of my wordpress site to an AWS instance. But once I got it working, noticed that none of the notifications or contact emails were being sent through. On researching the issue, I found that if I set the SMTP server to be an external SMTP (my AWS instance doesn't have one), it should work. I don't need membership emails sent out from my site, just the contact form. So I tried 2 different approaches   1. Used the Configure SMTP plugin and configured it to route all emails via an SMTP account   2. Using Custom Contact Forms plugin, specified SMTP the settings so emails are sent using SMTP settings in PHPMailer None of these work. I am not getting any emails. The test email from Configure SMTP works but no emails are sent from the contact forms. Can someone please help me with what might be wrong? Is any additional configuration needed when doing this via AWS?


How to get post category title within the loop?

I'm stuck in a rather simple task: to get the category title for the current post, within the loop, to be used in the function (not to be automatically printed). Any ideas?


Wordpress <!--more--> adding a <br> to my anchor for Read More

When creating a post within my wordpress site (using the editor) I want to add the short code, or even use the link at the top of the editor to do so. The end result is (it does create the excerpt and add the "Read more" link) but that link is broken and the editor has seemingly inserted a   tag within my anchor breaking the link.    `<a href="http://www.seekersolutions.com<br /> /a-test-post/" class="more-link">Read more »</a>` Anyone have an idea as to why this would be happening?


How to get post bulk edit action trigger and get edited post ids?

I want to send email if a postmeta of a post is changed to the expected value.So previously i was doing loop to check the post meta in each post. In here am running the loop in `admin_init` hook. But this slow down the site, so i'm thinking to do this on save post only. SO the edited post may have the meta value am expecting then i'll send the mail. Previous               $the_query = new WP_Query( $args );     if ( $the_query->have_posts() ) {              while ( $the_query->have_posts() ) {             $the_query->the_post();             if(get_post_meta($the_query->post->ID,'custom_post_meta',true)=='ok'){             //mail() function goes here             }         }          }           wp_reset_postdata();      This is unwanted because only certain post may be edited. Blindly checking post meta with a loop every time is waste. So i thought to use on `save_post` on save we'll check whether the post meta is changed to the expected value then we'll do the mail.like below               function testing($post_id){         if(get_post_meta($the_query->post->ID,'send_mail',true)=='ok'){             //mail() function goes here             }             //only for edited post alone i'm checking here     }          add_action('save_post','testing');      There are another two scenario where the post meta may be changed which are **bulk edit** and **quick edit** For quick edit i found this               function check(){     var_dump($_REQUEST);//can able to get the post id, i can do the rest     }     add_action('check_ajax_referer','check');      But for bulk edit i don't have any clue. I tried searching, In this answer i found that `$_REQUEST` may contain `action` and `postid`. So i thought for bulk edit there might be an action in `$_REQUEST['action']` but i couldn't find when i try like this               function another_check(){     var_dump($REQUEST['action']);     }          add_action('admin_init','another_check');      I found this `check_admin_referer` too but i couldn't able to figure out as it does not print when i var dump. Will this(`check_admin_referer`) work or suit on this? Is there any other easy way to get the edited post ids? **How can i get the List of post id on bulk edit?** From then i can able to do the check and send mail accordingly


How to Put Custom Taxanomy Meta Box in Main Column

WordPress added the Custom Taxonomy Meta box at sidebar, Is there any way which we can relocate it in the main column , Under Edit box? Thansk


Defined Blogname Override?

Is there a way to override the blogname such as `define("WP_BLOGNAME","My Blog");` I've looked high and low and have found nothing. Testing it doesn't work either. This is so I can help determine between dev and production environments easier. Thanks!


PHP if post is already displayed, then

I have created a new page with a jquery carousel which rotates between various different news topics. You can see here: However below the carousel is a static list of additional headlines. What I need to do is find php code that says IF a story appears in the carousel, THEN exclude it from the posts below. This is to avoid duplication. I cannot simply increase the offset. The offset is currently set to '4'. The carousel contains 12 unique posts at any given time. I cannot increase the offset because if I get five or six posts in a row from one category, then they would be missed from the section below by increasing the offset. I hope this makes sense. I'm not even sure my goal is attainable(!). Does this all need to be done within the one loop? The carousel is a loop - it works with the following code:               <?php query_posts("showposts=1&offset=0&cat=$panel"); ?>      where               <div id="panel<?php print $panelCount; ?>" class="panel">      from               <?php      $panelArray = array('131','129,131,313,318','129','318');      $panelCount = 0;      foreach( $panelArray as &$panel ) {          $panelCount = $panelCount + 1;     }     ?>      Thanks, Andy


Filter Media Library by author or post_parent

I am trying to filter the Media Library so only media items that are uploaded by the current user OR children of the post being edited are visible. I've had no problem doing it if the conditions are both required, but I can't figure out how to OR queries. I've found that you can define relations for inner queries like meta_query and tax_query and so on, but not the outer query. (Please note, I've tried to read extensively in the codex, but WordPress development is still very new to me, so I may be missing something obvious.) This is as far as I've gotten:               add_filter( 'ajax_query_attachments_args', 'filterMediaLibrary', 10, 1 );     function filterMediaLibrary($query = array()) {         $query['post_parent'] = $_POST['post_id'];         //$query['author'] = get_current_user_id();         return $query;     }      Both queries (post_parent and author) work separately. Is there a way to combine them so it's an additive filter rather than restrictive?


WP_Query() show posts that end later than today

I have a query as follows:               $wp_query = new WP_Query(         'meta_key'     => 'end_date',         'meta_value'   => 'today',         'meta_compare' => '>=',         'post_type'    => 'vehicle'      );      I want to show only those posts of the vehicle post type that have the meta key end_date which contains a date that is later than today's date. How can this be accomplished?


Easy (no code) way to open a form in a lightbox (a plugin?)

I'd like to open content (text or a simple form) in a lightbox when a user clicks a specific URL. like this Every plugin I've found so far opens a lightbox when someone comes to the site or goes to a page -- nothing I've found is setup to open the lightbox when the user clicks on a link. There are some hacks using Fancybox and jquery -- but if one exists I'd much prefer using a plugin, I'm not to comfortable messing with javascript and the theme files.


Shortcode in my childtheme is not working

function get_employee_func(&$totalCount)     {         global $wpdb,$_POST;         $query='';         $sql='';         $query="Select * from wp_users as U left join wp_company_user as CU on U.ID = CU.user_id LEFT JOIN  wp_company as C on CU.company_id = C.company_id  where CU.owner = 'N'";                   $employee = $wpdb->get_results($query);              $totalCount=count($employee);              $countRows=1;                    $result = $DB->RunSelectQueryWithPagination($query,$totalCount);              if ($busCount >10)         {               return $obj;            }         else         {                  return $employee;         }              }          add_shortcode("get_employee", "get_employee_func");      I am calling my plugin using via this shortcode               [get_employee]      I just made a WP- plugin and shortcode for all levels of staff I want to call it in my child theme as [get_employee] but when i write it in my child theme file it shows like a string as [get_employee]. It should show the result in table format but it don't Please suggest me if any one has some answer


AJAX requests within templates

I'm trying to come to an accurate decision here about safe ajax requests from a template. The thing about AJAX that always scares me is that the called script location is public:               http://www.mydomain.com/wp-content/themes/mytheme/inc/myscript.php      I just don't feel comfortable with that kind of public knowledge. Is there a proper way of keeping prying eyes out of that script while still being able to make AJAX calls confidently?


How to preview Google Fonts in a combobox

I have an option in my WordPress theme in which I can select +600 Google Fonts in a combobox. I added this option using a huge array containing them. But the problem is that I have to save the options and reload the page to see the Font. I would like to see it in the options page directly, if it's possible, in the combobox itself. I'm using the API Settings of WordPress, and this is the code of my combobox:

<?php if (isset($value['name'])) { echo $value['name']; } ?>

         <select style="width:240px;" name="<?php if (isset($value['id'])) { echo $value['id']; } ?>" id="<?php if (isset($value['id'])) { echo $value['id']; } ?>"><?php foreach ($value['options'] as $option) { ?>           <option<?php if (get_option($value['id'], $value['std']) == $option) { echo ' selected="selected"'; } ?>><?php echo esc_attr($option); ?></option><?php } ?>         </select>
<?php if (isset($value['desc'])) { echo $value['desc']; } ?>

      I need ideas about how to do this. I'm adding the following line in the SELECT:               style="font-family:<?php echo esc_attr($option); ?>"      But it's not working at all. **UPDATE:** Like this example: http://cdn.elegantthemes.com/blog/wp- content/uploads/2013/05/font_preview.jpg


It doesn't matter if I have more than one comment. get_comments_number still equal to one?

It doesn't matter if I have more than one comment. get_comments_number still equal to one. single.php:               <?php get_header(); ?>

              <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>                          <div class="post" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

                         <?php twentyten_posted_on(); ?>

<?php the_content('', 'FALSE', ''); ?>

                     <?php comments_template(); ?>
                   <?php endwhile; ?>
                 <?php posts_nav_link(); ?>
              <?php else : ?>

<?php _e('Not Found'); ?>

              <?php endif; ?>
     <?php get_sidebar(); ?>

     <?php get_footer(); ?>      comments.php:               <?php $i;          if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) die ('Please do not load this page directly. Thanks!');     if (!empty($post->post_password)) {         if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {     ?>
<?php _e('Password Protected'); ?>

<?php _e('Enter the password to view comments.'); ?>
          <?php return;         }     }          $oddcomment = 'alt';      $i = 0;     if ($comments) : ?>
<?php         printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number() ),         number_format_i18n( get_comments_number() ), '' . get_the_title() . '' );         ?>

     <?php $i = 0; ?>     <?php foreach ($comments as $comment) : ?>     <?php $i++; ?>     <li id="comment-<?php comment_ID() ?>">     <div class="commenttext  <?php if($i&1) { echo 'odd';} else {echo 'even';} ?>">        <?php        echo get_avatar( $comment, $size = '96', $default = '' );        ?>          <?php comment_author_link() ?>
<?php comment_time() ?> on <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> <?php edit_comment_link('edit','  ',''); ?>     <?php comment_text() ?>
     <?php if ($comment->comment_approved == '0') : ?>     Your comment is awaiting moderation.     <?php endif; ?>
     <?php     $oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';     ?>          <?php  endforeach; ?>
          <?php else : if ('open' == $post->comment_status) :           else : ?>
Comments are closed.
              <?php endif; ?>     <?php endif; ?>               <?php if ('open' == $post->comment_status) : ?>
Leave a Reply
          <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in to post a comment.
          <?php else : ?>          <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">     <?php if ( $user_ID ) : ?>
Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout »
          <?php else : ?>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="40" tabindex="1" />     Name <?php if ($req) echo "(required)"; ?>

<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="40" tabindex="2" />     Email (never published) <?php if ($req) echo "(required)"; ?>

<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="40" tabindex="3" />     Website
          <?php endif; ?>
<textarea name="comment" id="comment" cols="60" rows="10" tabindex="4"></textarea>

<input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />     <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
          <?php do_action('comment_form', $post->ID); ?>          </form>          <?php endif;  ?>          <?php endif; ?>      Any suggestions to fix this?


What can I do when an outside party hacks into my weblog and changes my display name?

Last night I wrote a mildly controversial blog post about religion on my weblog, and this morning I woke up to find that my display name had been changed to the name of a fanatic religious leader. The name was actually added to the user_meta database; deleting that value reverted my display name back to my username. How could this happen and what can I do to protect against it?


Extend 3.5 media uploader plugin to change button name

I have followed a tutorial on how to upload images using Wordpress' 3.5 media uploader. All is well. I would just like to change the text of the actual upload button "Insert Into Post" to something like.. "Insert Image". I'm also trying to do this as a plugin option so it can be dynamic. Any help on getting this to work? I'm okay with jQuery, but nothing this advanced yet.               $.fn.wptuts = function(options) {        var selector = $(this).selector; // Get the selector        // Set default options        var defaults = {           'preview' : '.preview-upload',           'text'    : '.text-upload',           'button'  : '.button-upload',           'upload'  : 'Upload Image'        };        var options = $.extend(defaults, options);             var _custom_media = true;        var _orig_send_attachment = wp.media.editor.send.attachment;             // When the Button is clicked...        $(options.button).click(function() {           // Get the Text element.           var button = $(this);           var text = $(this).siblings(options.text);           var send_attachment_bkp = wp.media.editor.send.attachment;                _custom_media = true;                wp.media.editor.send.attachment = function(props, attachment) {              if(_custom_media) {                 // Get the URL of the new image                 text.val(attachment.url).trigger('change');              } else {                 return _orig_send_attachment.apply(this, [props, attachment]);              };           }                // Change Button Text           wp.media.frames.file_frame = wp.media({               title: defaults.upload,               button: {                   text: defaults.upload               },               multiple: false           });                wp.media.editor.open(button);                return false;        });             $('.add_media').on('click', function() {          _custom_media = false;        });             $(options.text).bind('change', function() {           // Get the value of current object           var url = this.value;           // Determine the Preview field           var preview = $(this).siblings(options.preview);           // Bind the value to Preview field           $(preview).attr('src', url);        });     }          // Usage     $('.upload').wptuts(); // Use as default option.


Get aggregate list of all custom fields for entire blog

So, like the title says, I'd like a single function to get an aggregate list of all custom fields, site-wide (all posts, pages, CPT's). Normally, I do this with a couple SQL statements and juggle the results, but I was wondering if anyone's come up with a more core-oriented way of doing this. Mostly, though, I wanted something available online and easy-to-find for someone else searching for this. Here's the SQL I normally use:               SELECT DISTINCT `meta_key` FROM `prefix_postmeta` WHERE `meta_key` NOT LIKE "\_%"      Here's a function to pull a single page or post's custom fields:               $custom_fields = get_post_custom($post->ID);          foreach ( $custom_fields as $field_key => $field_values ) {         if ( ! isset( $field_values[0] ) ) continue;         if ( in_array( $field_key, array( "_edit_lock", "_edit_last" ) ) ) continue;         echo $field_key . '=>' . $field_values[0];     }      So basically, I'd like a one-off function that I can stick in `functions.php` and call up when I need an up-to-date cut/paste list of all my custom fields for a plugin that makes you list them all out by hand - Broken Link Checker, for example.


Is it safe to run wp-cron.php twice if the first instance takes too long?

Let's say I disabled "DISABLE_WP_CRON" in wp-config.php Is it OK to run wp-cron.php twice overlapping? I've noticed sometimes wp-cron.php needs several minutes. I'd give it a full hour but the blogger I work with does a lot of scheduling through the day, she's very busy. Like say I have it running every 10 mins with a real crontab */10 * * * etc. And it needs a full 15 minutes to do its business. 15 minutes is just a random example here. There doesn't seem to be any rhyme or reason for how long it takes. Can two "instances" of wp-cron.php safely run together? Does the oldest instance die and the new one takes over? From what I can tell from my bash script that runs wp-cron.php, the first instance fails when the new instance starts. Example: cron kicks off wp-cron.php at 11:01pm. `php /home/www-data/example.com/wp-cron.php && echo "wp-cron.php done" | mailx pj@example.com` 11:21pm wp-cron.php starts again (*/20) and I still haven't got my "done" email. But this time I get the "done" email 17 seconds after the subsequent wp-cron.php ran. (Not sure if wp-cron.php failed on its own or if wp-cron.php killed itself after running 2x.) So I'm wondering: Is data lost from the first instance? The abrupt failure of a process that was running for 10 minutes seems "bad" to me. At this point, I'm tempted to stop using crontab and go back to the wp-config default behavior because this is way more trouble than I bargained for. This doesn't sound very reassuring either: How is WP Cron Locking implemented? What if the "transient" is not deleted before the first process dies? Are the unfinished tasks forever unfinished then? And what is a transient? I assume it's some kind of flag. I'm having major problems with this today. Server got slow, triggered some timeouts which I assume caused wp-cron.php to fail, resulted in double postings, scheduled posts not posting, what a nightmare! Update: Attempting to call wp-cron.php from the operating system with crontab was a huge waste of time for me and the client. On my end, wp-cron.php seemed to execute fine, used memory and CPU time for various durations, but the scheduled posts never posted according to my client. It would be nice if there was a "verbose" mode to indicate what it's actually doing. I ran out of time to investigate this and went down another route. I just worked on improving the speed of the server which somehow fixed the problem. (My guess is, some timeout was reached because the server was overloaded.) I was hoping I could just get a crontab working quickly before I worked on upgrading the server. But the more I looked at wp-cron.php, the more I distrusted it. Failed scheduling, double posts, conflicting advice how it should be executed. So that's why I came here. I have a similar script for one of my own websites that runs hourly--it's not designed to overlap itself but it's fairly safe if it does, within reasonable parameters. Then again, I know what's reasonable to me. I don't know what's reasonable to the author of wp-cron.php. So this was a distraction and a dead-end for me. I changed wp-config.php back to the default (deleted DISABLE_WP_CRON) and let WordPress deal with wp- cron.php. Now with a faster server, WordPress schedules posts again just fine. Always safer to stick to defaults. More details of the story here: http://tomakefast.com/when-wp-cron-php- sceduling-fails-3003/


Display Latest Post on a Page Conditionally

So I'm wondering exactly how I could display my latest post on a page only in certain conditions. I've been looking over the conditions page in the codex, but I'm not seeing how I could do what I have in mind. For example: I will have multiple vendors selling on my site. Each vendor will have their own page on the site. There will be one featured item for sale on the home page,(which we figured out how to do here: Display newest post's custom field content on homepage, daily ) and when it happens to be a certain vendor's item, I would like the post to display on their specific page as well. So I would need to only show the newest post(again, I got help with this in the provided link) on their page, ONLY when it happens to be their item. As always, thanks in advance!


Plugin or method to delete uploads not in media library?

Over time working on a local and development server I've accumulated some junk in my `wp-content/uploads folder` which are not in the database. The folder and database entry are fairly large and so I was wondering if there was a plugin or way to do some type of "garbage collection" and delete items in the uploads folder which are not in the media library.


How to assign capabilities to user NOT to User Role

Is there any way to assign custom capabilities to user, I'm NOT talking about User Role. I'm running a multi author blog where I assigned user role of "Author" to all of my authors. But I need a plugin or function.php snippet that remove a capability(not the role) from USER-ID ### NOTE - I dont want to assign/revoke capabilities to role ( administrator/author etc) I want to assign/revoke them to specific user using that users ID. ### UPDATE - 08/01/2012 I have blog with suppose 50 authors, A author have capabilities to do post, comment, edit, update, send emails, share etc. but when a user misuses one of this feature I want to revoke that capability/capabilities from that user. But If I decide to using roles I'd have to create so many user roles with different capabilities such as   * cannot send   * cannot send & comment   * cannot send & comment & post etc. Is there a way to revoke a capability from user(not the USER-ROLE)


Update Theme Location Programatically

I've been trying to update my theme location programmtically and while the menu gets created with menu items, the theme location never gets set. Here is what I have:               function create_my_menu() {     if(!is_nav_menu('primary-menu')) {       $menu_id = wp_create_nav_menu('primary-menu');       //$menu = array( 'menu-item-type' => 'custom', 'menu-item-url' => get_home_url('/'),'menu-item-title' => 'Home', 'menu-item-status' => 'publish' );       $menu = get_term_by('name', 'primary-menu', 'nav_menu');       wp_update_nav_menu_item($menu->term_id, 0, array( 'menu-item-type' => 'custom', 'menu-item-url' => get_home_url('/'),'menu-item-title' => 'Home', 'menu-item-status' => 'publish' ));     //    wp_update_nav_menu_item( $menu_id, 0, $menu );       $locations = get_theme_mod('nav_menu_locations');       $locations['primary-menu'] = $menu->term_id.         set_theme_mod('nav_menu_locations', $locations);     }     }      My menu is registered in my functions file.               add_action( 'init', 'register_my_menu' );          function register_my_menu() {     register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );     }      **EDIT** I'm working on a plugin for a multisite setup. I need the menu to be created when a user creates a new site. I suppose I could modify the default menu that gets created when wordpress is installed.


How do I extend one plugin I'm writing with another I'm writing using classes?

I have a set of plugins that do different things. I'm wanting to write a plugin with a class I can extend in each of my custom plugins to meet a common goal. In my "socket" plugin I have something like this               class socketPlugin {             function __construct($extendedClass){         global $wpdb;         $tablename = $wpdb->prefix."tableName";              $classCount = $wpdb->get_var(             "SELECT COUNT(id) FROM $tablename WHERE extendedClass='$extendedClass'"         );              if($classCount && $classCount > 0){             $wpdb->insert(                 $tablename,                 array(                 'extendedClass' => $extendedClass                 )             );         }          }      I then want to do something like this:               class myCustomClass extends socketPlugin {          }      And pass a variable into the constructor. Right now, if I do the above I get the PHP "white screen of death". Any ideas why I'm getting a white screen? How can I propperly extend the class of the socket plugin?


How to find out if option exists but is empty?

I am using something like this on one of my plugins:               $myOption_def = "myOption Default Value";     $myOption = get_option( 'myOption' ) ? get_option( 'myOption' ) : $myOption_def;      That works fine, but the problem is that I need to be able to set the option to "empty", but when I do that (from a textarea on my plugin's option page), I get the default value instead of an empty string because get_option( 'myOption' ) returns the same if my option value is empty than if it doesn't exists. So how can I figure out when my option doesn't exist (and then set $myOption to my default value), or when my option value is empty (and then set $myOption to an empty string)?


is_single query calling the wrong stylesheets?

> **Possible Duplicate:**   >  is_singular won’t call my functions? So I am trying to call different style sheets for each of my post types single page. Here is the code I am using in my header file.               <?php     if ( ! is_home() ) {          if ( is_single() == 'pretty-little-liars' )  {     echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-pll.css" type="text/css" media="screen" />';     }     if ( is_single() == 'revenge' )  {     echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-revenge.css" type="text/css" media="screen" />';     }     if ( is_single() == 'once-upon-a-time' )  {     echo '<link rel="stylesheet" href="http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-onceuponatime.css" type="text/css" media="screen" />';     }     }     ?>      and I also learned that I had to add this code in my functions.php in order for it to work properly               add_action( 'wp_enqueue_scripts', 'wpse78368_enqueue_custom_stylesheet' );     function wpse78368_enqueue_custom_stylesheet() {     if ( is_single( 'pretty-little-liars' ) ) {         wp_enqueue_style( 'style-pll', get_template_directory_uri() . '/posttypecss/style-pll.css' );     }      if ( is_single( 'revenge' ) ) {         wp_enqueue_style( 'style-revenge', get_template_directory_uri() . '/posttypecss/style-revenge.css' );     }     if ( is_single( 'once-upon-a-time' ) ) {         wp_enqueue_style( 'style-onceuponatime', get_template_directory_uri() . '/posttypecss/style-onceuponatime.css' );     }     }      But the problem is that, the code is calling the last stylesheet of the code. It is calling the "Once Upon A Time" stylesheet for each custom post type singular page. How can I fix this?


How to use extract shortcode in loop?

Actually I need to gallery in any new post so i use shortcode for making gallery for every new post. I use images and videos in slider. problem is that I have custom html slider need to convert dynamic. so how to extract shortcode and use images and videos in `<li></li>`tag?


How to create a list of items with fields in WordPress?

I'm new to WordPress and hoping some of you experts can help me figure out the best way to attack what seems like such a simple problem. I need to have two lists of items that the user can add to, delete and update that will show up on the home page of the site. Both lists will be variable in length. They will live on a static home page if that matters. The first list contains items that need to have two fields and the second list contains items that need to have three fields. Then I need to be able to loop through them to display them with CSS styling. If I can somehow get an array of these items, I can handle that part. I've read and read and read stuff, and the more I read, the more confused I'm getting on how best to do this. Custom post types? Taxonomies? Custom Fields? Some combination of those? If I was building this from scratch, this would be such a simple thing, but I can't figure out the best way to do this with WordPress? Can anyone give me some guidance?


The loop does not show users

I'm trying to show all post made by the author. Code author.php               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <?php if( get_post_type() == 'post' ) {?>          <?php } if( get_post_type() == 'post-type' ) {?>          <?php } else; endwhile;?>     <?php endif; ?>      But just shows the post_type "post".


How can I list recent posts excerpts?

I am using this directly from the codex to list 3 recent articles titles.
     <?php     $args = array( 'numberposts' => '3');     $recent_posts = wp_get_recent_posts( $args );     foreach( $recent_posts as $recent ){     echo '
' .   $recent["post_title"].'
 ';     }     ?>
      This works fine however, when I change the post_title to post_excerpt it does not show the excerpt. How can I solve this?


Get whole <li> linked with wp_list_pages

I'm using wp_list_pages for my sidebar and it works fine to me, i just wanna add new feature which seems is not listed on codex or i don't know how to use it.               $args = array(       'child_of'     => 284,       'post_type'    => 'page',       'sort_order'  => 'ASC',       'sort_column' => 'post_date',       'title_li'     => '',      );      ?>     <div id="#sidebar">     <ul>     <?php wp_list_pages( $args ); ?>     </ul>     </div>      and here is my CSS, as you see i get the ' * ' a background color with some padding.               #sidebar li {     font-size: .75em;     padding: 10px;     margin: 0 0 5px 0;     background: #f18c21;     color: white;      So the think is, the only text on the li got the link, but what i would like to do is get the whole li section linked to the pages. Is there any way to do that?


Set a custom URL for image in the Media Library?

I'm having some real frustration with the Media Library, as a WP beginner. What I'm expecting is that I can upload an image, and then reuse that image where I want within the site, using a standard identifier of some sort. Seems simple and intuitive, but apparently that's not how things work. I've been searching for answers, but a lot of the stuff I'm coming across... I don't even understand the wording of the search results and page titles.... What I'm experiencing (3.5.1, btw) is that images are uploaded and stored at a URL that has the date of upload encoded in it, so that even if I try to upload a new image with the same name, rather than replacing the old one, it is simply added, because it has a unique upload date. I'm using a plugin that asks me to enter a URL for images that it is displaying. Now see how this works out: I have already added image X with a given date, and copy-pasted its URL into the plugin's fields for lots and lots of pages. Now if I want to change the image, there's no way to replace the image at a given URL and have everything just work! I need to go back and change all the many, many references to the unique date-coded URL, which seems crazy! I also don't understand the idea of "attaching" an image to a post/page. Why can it only be attached to ONE post/page? I'm sure I'm probably missing something, but this is definitely the most frustrating aspect of WP for me. I guess if I were to boil this down to a simple question (because I don't want to hear someone tell me I've done it all wrong and have to redo the site from the beginning!), it would be: How can I upload an image and give it a custom, unique URL that I can embed into other places in the site, and such that I can _replace_ that image whenever I want, etc. I hope this makes some sense, and that someone can help. I'm normally a rational person and good explainer, but I feel out of my depth with this thing... because of not having learned yet how to "think WP" no doubt. Thanks in advance.


Add Protocol to Custom Menus

I've been using `tel:` links in Custom Menus combined with Responsive Design to add a "Call Now" button to my themes for smartphones. It's been working well. A client just asked me to also add a "Send Text" button. I thought I would use `sms:` which seems to have passable device support. However, WordPress is stripping it out of the URL when I save the menu. After research, I concluded it has something to do with `esc_url()` and/or `wp_kses()` (see Trac ticket #18268). I concocted the following code in an effort to add the SMS protocol myself and put in it functions.php:               <?php     function add_new_protocol() {         global $protocols;         $new_protocols = array( 'sms' );              return array_merge( $protocols, $new_protocols );     }     add_filter('pre_kses', 'add_new_protocol');     ?>      It didn't work :) This was a bit of a shot in the dark; I'm still pretty green at using filters etc. I would love a pointer on the correct method for adding new protocols to Wordpress for use in Custom Menus.


Why should I password protect WP-Admin?

Just occured to me: what's the point of password protecting www.yoursite.com/wp-admin when a user can just type www.yoursite.com/wp- login.php, bypassing the password on /wp-admin? Am I missing something here? I've ready many blogs/posts that suggest adding this extra layer of protection to wp-admin using .htaccess/.htpasswd.


random code at the end of file after plugin upload

I uploaded to a WordPress site (3.3.1) a plugin that works perfectly in my other sites (3.3.1 and 3.4), but when try to activate it I get Fatal Error. When I go to check the plugin's main file content to do some changes and identify the error I detect that at the end of my code appears some random code from my file repeated. If I edit it and save again another random code is placed at the end of the file again. Any suggestion will be appreciated, even if are suggestions to do more research about it. I really don't know what to check for this issue. Edition to add information requested: I test deactivating all the plugins and with Twenty Eleven theme and I obtain the same behaviour Example of the random code added               <?php     /*     Plugin Name: My plugin     Description: desc     Version: 1.0     */          /**      * Version of WordPress      * @global  string  $wp_version      */     global $wp_version;          $exit_msg = __('This plugin require WordPress 3.1 or newer','seo-pressor').'. '.__('Please update','seo-pressor').'';     if (version_compare($wp_version, "3.1", "<")) {          exit($exit_msg);     }          // Avoid name collisions.     if (!class_exists('WPPostsRateKeys')) {         class WPPostsRateKeys         {     (... long piece of code ...)         }     }          // create new instance of the class     $WPPostsRateKeys = new WPPostsRateKeys();     if (isset($WPPostsRateKeys)) {         // register the activation function by passing the reference to our instance         register_activation_hook(__FILE__, array(&$WPPostsRateKeys, 'install'));         register_deactivation_hook(__FILE__, array(&$WPPostsRateKeys, 'uninstall'));     }][      As you can see at the end was added the "][" that make my code fail. Another information: when I open my text file using WordPress edit plugin file feature I see the random code at the end that will make my code file, but if I open the same file with the cPanel file manager this utility ask me for the encoding first (assign the file UTF-8) and opens it without any extra code added at the end. Anyway the activation of the plugin continue failing in WordPress due to this extra code. I already save my files as FTP-8 without BOM and follow all the suggestions from http://www.toddlahman.com/the-plugin-generated-x-characters-of- unexpected-output-during-activation and doesn't works. When in the WordPress editor I open the file the random text appears but when I open the same file using my FTP client the random text doesn't appears. How do I need to code or save my PHP file so it works correctly? Thanks in advanced Leticia


Plugin remove-slug-from-custom-post-type very slow

I have installed the remove-slug-from-custom-post-type plugin but the whole website is very slow. Does someone has also this experience and the solution? Thanks! Not a good question?!


Allow user role "salesman" to view only "client" role users

I have created two new roles in my theme, salesman and client. I want, when "salesman" is logged in to be able to view and edit only "client" users. I am trying this code (taken from an answer in this site)               add_action('pre_user_query','yoursite_pre_user_query');     function yoursite_pre_user_query($user_search) {       $user = wp_get_current_user();            if ($user->has_cap('salesman')) {         global $wpdb;         $user_search->query_where = str_replace(             'WHERE 1=1',           "WHERE 1=1 AND {$wpdb->users}.ID=6",$user_search->query_where);       }     }      but actually, I can only filter (ID=6) using the ID of user. I want to change the code and make it like                 "WHERE 1=1 AND {$wpdb->users}.role='client'" <-----      but it doesnt work of course. Any idea how to solve this?


Need help to get sticky notes shown with "List-category-post" Plugin

Well a few days ago I installed "list-category-post" Plugin and it works great, but one problem is still present, I cant see my sticky posts at the top of the list. So I hope someone can help me, maybe its just a argument thing. Thx so far. Patrick


add_image_size wont work after get_intermediate_image_sizes

I am using the function               get_intermediate_image_sizes()      to check if an image size already exists, and if not create it. However when I use               add_image_size( 'test3', 150, 150, true );      after the call to get_intermediate_image_sizes() the image size is not created. The image size is created if I call add_image_size() before get_intermediate_image_sizes() Full code http://pastebin.com/NMYHvzLn Any ideas appreciated :)


Custom Post Type, Saving Multiple Checkboxes

For a custom post type, I'm pulling in a list of another custom post types that I need to select for saving ...               <input type="checkbox" name="32"> My CPT
     <input type="checkbox" name="41"> My CPT 2
     <input type="checkbox" name="42"> My CPT 3
     <input type="checkbox" name="43"> My CPT 4      It's easy enough to save a single input, but how do I save multiple checkboxes?               update_post_meta( $post->ID, 'mycpt', $_POST['myinput'] );


Multiple loop issue - pull one featured and then continue the loop

I am writing a custom multiple loop to be used on a custom category template page. The loop should put one post that is checked as featured in admin, in a separate div, and continue the loop displaying all posts from the category except the featured. Similar to the example provided on the codex page except I don't want to create a separate category for the featured post. I am using Advanced Custom Fields plugin for the check box that sets posts as featured. I have the following issue with my code: `if ($post->ID == $do_not_duplicate) continue;` prevents rest of the loop to be executed. The code below just pulls the latest featured post. Here is my function:               function featured() {     $featured = new WP_Query(array(     'meta_query' => array(         array(             'key' => 'featured',             'value' => '"top"',             'compare' => 'LIKE'             )         ),     'posts_per_page' => 1     ));          while ( $featured->have_posts() ) : $featured -> the_post();      $do_not_duplicate = $post->ID; ?>
         //featured post
     <?php      endwhile;     if(have_posts()) : while (have_posts()) : the_post();     if ($post->ID == $do_not_duplicate) continue;     ?>
     // normal posts
     <?php      endwhile;     endif;     }


Why am I getting an infinite loop with have_posts?

I have the following code, which causes an infinite loop for some reason. Can anybody explain what's going on please? Thanks!               <?php           $flagged_stores = new WP_Query( array ( 'post_type' => 'store', 'orderby' => 'post_id', 'meta_key' => 'flagged', 'limit' => 10 ) );             if($flagged_stores->have_posts()): ?>

                         Store	                         Flag Reason	                         Delete Flag
                     <?php while($flagged_stores->have_posts()): ?>                         <?php echo the_title(); ?>	                         <?php// echo get_post_custom_values('flagged'); ?>	                         <?php// echo "Delete"; ?>	                     <?php endwhile;?>
         <?php else: ?>                 No flags found.         <?php endif; ?>


jQuery in Wordpress - Why is it not working?

I am using this as my starter template: www.html5reset.org/ It's pretty nice, but I believe something is wrong with jQuery in there. In the `functions.php` it says:               // Load jQuery         if ( !function_exists(core_mods) ) {             function core_mods() {                 if ( !is_admin() ) {                     wp_deregister_script('jquery');                     wp_register_script('jquery', ("//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false);                     wp_enqueue_script('jquery');                 }             }             core_mods();         }      This seems fine to me - is it alright? There also is a premade JS file. In this file it says:               // remap jQuery to $     (function($){})(window.jQuery);      I don't know really what this does, but it seems also ok. To test if jQuery works, I tried the following - none of it is woking, jQuery is not defined.               $(document).ready(function() {         alert("This is a test.");     });          jQuery(document).ready(function() {         alert("This is a test.");     });          $(document).ready(function($) {         alert("This is a test.");     });      So, can you tell ma what could be wrong with this? Thank you!


Display all subcategories for a product category in woocommerce

Is there a way to add a shortcode to a page, in order for that to display the subcategories of a category? (not the products themselves) I know that you can configure Woocommerce to display it, but I need to have it on a page, so that I can hide it via UAM plugin. I am aware of the shortcode: > [product_categories number="12" parent="0"] But that displays only the top categories. I need the child categories of one top category.


Make Author Archive Page URL be a Subdirectory of a Custom Post Type URL

I have a custom post type with a custom URL structure so it works like:               http://domain.com/custom-post-type/post1     http://domain.com/custom-post-type/post2     http://domain.com/custom-post-type/post3     etc.      Now I have multiple authors of these posts, so I want to enable an "Author Archive" for only these custom post types at urls like this:               http://domain.com/custom-post-type/authorname1     http://domain.com/custom-post-type/authorname2     http://domain.com/custom-post-type/authorname3      Is this possible? Any ideas? Thanks! UPDATE: @Milo points out (I believe correctly) that "WordPress wouldn't be able to discern what is a post title and what is an author name," so given that, how would I get URLs like http://domain.com/custom-post- type/author/authorname1 ? Thanks!


Connecting Google Site Search with Wordpress Taxonomies/Categories/Tags

A client is pushing to have Google Site Search set up. Currently, their search is filterable (using dropdown) by category, tag, other taxonomies. How can I implement this filtering with paid Google Site Search?


Problem with tags after changing custom post type permalinks

I've follow this post to create a permalink structure for my custom post type and custom taxonomy and it works great. I'm using the Portfolio Post Type plugin to register the custom post type, and now I'm introducing taxonomy tags to the custom posts and listing them in my sidebar menu but there are not linking anywhere. There're working fine when I disable all the rewrite rules functions, so I know my problem it's there, but I don't know how to solve it. I can get to the tag archive page so it's url is not changing, is: domain/portfolio_tag/tag-slug/ My code for the rewrite rules:               add_filter('rewrite_rules_array', 'mmp_rewrite_rules');     function mmp_rewrite_rules($rules) {         $newRules  = array();         $newRules['products/(.+)/(.+)/(.+)/?$'] = 'index.php?portfolio=$matches[3]'; // my custom structure will always have the post name as the 5th uri segment         $newRules['products/(.+)/(.+)/?$'] = 'index.php?portfolio_category=$matches[2]';                return array_merge($newRules, $rules);     }          // URL portfolio post type     function filter_post_type_link($link, $post){         if ($post->post_type != 'portfolio')             return $link;              $terms = get_the_terms($post->ID, 'portfolio_category');              if ($terms){             $link = str_replace('%portfolio_category%', get_taxonomy_parents(array_pop($terms)->term_id, 'portfolio_category', false, '/', true), $link);               }         return $link;     }     add_filter('post_type_link', 'filter_post_type_link', 10, 2);          // URL portfolio post type taxonomy     function filter_term_link( $permalink, $term ) {         $term_parents = get_term_parents( $term );              foreach ( $term_parents as $term_parent )             $permlink = str_replace( $term->slug, $term_parent->name . '/' . $term->slug, $permalink );              return $permlink;     }     add_filter( 'term_link', 'filter_term_link', 10, 2 );      The slug for the custom post type is 'products/%portfolio_category%' and the slug for your taxonomy is 'products'. Any idea? I'll appreciate any help. Thanks!


Create a dropdown list displaying users meta data

I want to display a `dropdown` list of users using information from the `wp_usermeta` table. I know that there is a method `wp_dropdown_users` that outputs a `select` list of users but I can't figure out how to modify the code in order to allow me to display a column from my `meta` table. Can anyone help me out? Currently I've modified `wp_dropdown_users` but it only outputs a list displaying `options` like this `()`.               function wp_dropdown_users( $args = '' ) {         $defaults = array(             'show_option_all' => 'Choose Grower to Share...', 'show_option_none' => '', 'hide_if_only_one_author' => '',             'orderby' => 'display_name', 'order' => 'ASC',             'include' => '', 'exclude' => '1', 'multi' => 0,             'show' => 'display_name', 'echo' => 1,             'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '',             'blog_id' => $GLOBALS['blog_id'], 'who' => '', 'include_selected' => false         );              $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0;              $r = wp_parse_args( $args, $defaults );         extract( $r, EXTR_SKIP );              $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) );         $query_args['fields'] = array( 'ID', 'user_login', $show );         $users = get_users( $query_args );              $output = '';         if ( !empty($users) && ( empty($hide_if_only_one_author) || count($users) > 1 ) ) {             $name = esc_attr( $name );             if ( $multi && ! $id )                 $id = '';             else                 $id = $id ? " id='" . esc_attr( $id ) . "'" : " id='$name'";                  $output = "<select name='{$name}'{$id} class='$class'>\n";                  if ( $show_option_all )                 $output .= "\t<option value='0'>$show_option_all</option>\n";                  if ( $show_option_none ) {                 $_selected = selected( -1, $selected, false );                 $output .= "\t<option value='-1'$_selected>$show_option_none</option>\n";             }                  $found_selected = false;             foreach ( (array) $users as $user ) {                 $user->ID = (int) $user->ID;                 $_selected = selected( $user->ID, $selected, false );                      if ( $_selected )                     $found_selected = true;                 $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';                 $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n";             }                  if ( $include_selected && ! $found_selected && ( $selected > 0 ) ) {                 $user = get_userdata( $selected );                 $_selected = selected( $user->ID, $selected, false );                 $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';                 $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n";             }                  $output .= "</select>";         }


How do I allow family commenters to upload photos?

I'm trying my first WP site - a family blog. I'm hosting it on GoDaddy with a few other websites I work on. Less than 20 people have access/permission to the family site. We're collecting old family photos and genealogy information (text). I'd like each person to be able to upload the photos they have found and use a comment area to describe the photo. I will gladly switch to WP.com if it would make it easier. I just want this functionality. How should I proceed? TIA your help.


Permalink of some posts change

Having strange problem, When I change permalinks to post name some of the posts permalink changes some just show `www.example.com`. Below is my htaccess               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>


I am moving a WordPress site from a shared hosting package to a VPS at 1and1 hosting. They have PHP ver. 5.1.6 but PHP5 support is there. I added the following 2 lines on the top of .htaccess file to use that:               AddType x-mapp-php5 .php     AddHandler x-mapp-php5 .php      .htaccess is in `mydomain.com/httpdocs` But is shows me this error: `Cannot get media type from 'x-mapp-php5'` and php file appears as simple text file. Please visit this Cannot understand the reason. Please help me out.


Is it possible to list post attachments in a sub URL endpoint with a dedicated template?

Wordpress provides templates for displaying media attached to a post or page (`attachment.php` and more). They're also displayed with nice permalinks, such as:               site.com/projects/a-project/an-attachment/      Where `projects` is the slug for my custom post type `project`. `a-project` is the post name, and `an-attachment` is the name of an attached image. **The functionality I'm asking for is a sub URL endpoint for listing all post attachments with a dedicated template file.** It would be great with a permalink for a post's attachments, wouldn't it? Such as:               site.com/projects/a-project/attachments/     or     site.com/projects/a-project/images/      Is it possible? If not with pretty permalinks, is it with some kind of query variable? Apart from showing a single attachment, I haven't ever seen another form of sub URL endpoint to a Wordpress post before. Thanks in advance! **EDIT** Some interesting resources: http://johnbeales.com/20090824/endpoints-a-little-secret-for-url-manipulation- in-wordpress/ http://wordpress.org/support/topic/custom-rewrite-approach-with- add_rewrite_endpoint http://www.rlmseo.com/blog/passing-get-query-string-parameters-in-wordpress- url/ http://codex.wordpress.org/User:DavidHouse/WP_Rewrite_API URL Design for Sub-Posts? http://codex.wordpress.org/Template_Hierarchy


Starting a Wordpress site

What is the best way to start-up my site on wordpress? I have a website made on Weebly, but that can no longer do what I need, so will be changing over to a WP site. Do I need to install wordpress on my computer? Do I use wordpress.org to run my site or do I need to find a host?


Wordpress hiding posts without content on custom taxonomy query. How to solve?

I have a custom taxonomy query for a custom post type with the following code:               $args = array(        'post-type' => 'network-partners',        'posts_per_page' => -1,         array(           array(              'taxonomy' => 'network-partner-type',              'field' => 'slug',              'terms' => $current_term          )     );      Each of the queried posts have a title, a thumbnail, ... but not every post has a content. WordPress does not show any posts which have an empty content. Why? Does anybody know how to solve this?


Difficultly changing date format in post meta value

I have a custom post type with a custom field that takes a date. The posts are later ordered by the date in that custom field. Unfortuately I formatted the date incorrectly and there are already a number of posts with the post meta value as dd-mm-yyyy. I have found that to use this value as orderby (WPQuery) it needs to be yyyy-mm-dd. So I was going to try:               $args = array(                 'posts_per_page' => -1,                  'post_type'=> 'match_report'                 );                 $wp_query = new WP_Query();                       $wp_query->query($args);           if ( $wp_query->have_posts() ) :                          while ( $wp_query->have_posts() ) : $wp_query->the_post();           $matchdate = get_post_meta($post->ID, 'report_date', true);              $new_matchdate = strftime("%Y-%m-%d", $matchdate);               update_post_meta($post->ID, 'report_date', $new_matchdate);           endwhile;          wp_reset_postdata();          endif; ?>      but I am getting               Notice: A non well formed numeric value encountered in...      and when I echo `$new_matchdate` I get 1970-01_01 so obviously I am doing this incorrectly. Any help would be appreciated.


retina.js, timthumb with Amazon s3?

I have a WP site, I use amazon s3 for CDN. My WP theme support retina.js & timthumb.php but it doesn't load retina & image with amazon s3. How to make it works now? For example: Retina: On my sourcode, I see http://cdn.mydomain.com/images/img.png . It should show @2x image http://cdn.mydomain.com/images/img@2x.png but it doesn't load @2x from s3 Timthumb: It also doesn't load thumb image from http://cdn.mydomain.com/timthumb.php?..., it still showing http://mydomain.com/timthumb.php?... How to make them work with amazon s3? Thanks for your help.


how to check if a shortcode is used more than one time in the same post

I've written a shortcode plugin. Basically the plugin has the following structure:               PL::setup();          class PL {          public static function setup() {     add_shortcode("myshortcode", array ( __CLASS__,"myshortcode_handler"));     }          public static function myshortcode_handler(     ... some variable assignment?        if (time the shortcode is invoked == 1) {           ...         }        else {           ...        }     ... some other code lines     }          }      I need to distinguish the case the shortcode is invoked for the first time or not. I think I have to declare some variable, but I do not know how and where I have to declare it.


How to install WPMU with composer?

I am looking for a way to install WPMU and a premium ACF plugin with composer, but have not found any functional way of installing them. The best alternativ I found is to upload them to a private bitbucket and then install them with Satis. If someone could point me in to a practical example and/or a better alternative then Satis.


Listing Post Categories on Home Page

I'm trying to list categories for my posts on the home page with each of their posts under them. I'm not really sure how to go about doing this. Example of what I want. ## Category 1 Post 1 - Post 2 - Post 3 - Post 4 ## Category 2 Post 1 - Post 2 - Post 3 - Post 4 ## Category 3 Post 1 - Post 2 - Post 3 - Post 4 EDIT 2: Got this to work.               <?php         $args = array(             'orderby' => 'name',             'order' => 'ASC'         );              $categories = get_categories($args);              foreach( $categories as $category ) {              echo '
term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'
';                  global $post;                  $args = array(                 'posts_per_page' => 4,                 'offset'=> 0,                 'category' => $category->term_id             );                  $posts = get_posts( $args );                  foreach( $posts as $post ) {                 echo '                     guid . '" title="' . $post->post_title . '">                         ' . get_the_post_thumbnail($page->ID, 'small') . '                                      ';             }         }      ?>


How to create categories out of a list of words?

I have a simple text file with a list of words (Berlin Hamburg Stuttgart ...) and so on. They are cities of germany an nearly 2000 counted. I need everyone of them as a category in my wordpress site and looking for the best way to achieve this. Is there a faster way than to create every single category manually from the dashboard? Thanks for your help!


Add custom php database code above <head>

I have a non plugin script that has it's own database and I want to use it with Wordpress. How can I add custom php code that connects to this separate database in my wordpress pages? It needs to go at the top of each page above `<html>` I am using Genesis Framework. # Any help is appreciated. Here is the custom function I have in my functions.php file                   /** Activate IP Timer Countdown */     add_action( 'init', 'your_script_function' );          function your_script_function() {          $notimeleft_str = "There is no time left";     $hours          = 48;     $minutes        = 0;     $days           = 0;     $months         = 0;     $db_host        = "localhost";     $db_user        = "xxxxx";     $db_pass        = "xxxxx";     $db_dbname      = "xxxxx";     $str = "+" . $months . ' months +' . $days . ' days +' . $hours . ' hours +' . $minutes . ' minutes';          // DO NOT EDIT BELOW THIS LINE!     date_default_timezone_set('UTC');     include_once("mysql.class.php");     $db = new MySQL(true, $db_dbname, $db_host, $db_user, $db_pass);     $db->ThrowExceptions = true;          $script_name = $_SERVER["PHP_SELF"];     $cookie_expire = 60*60*24*365*20;          $str_interval = "+" . $months . ' months +' . $days . ' days +' . $hours . ' hours +' . $minutes . ' minutes';          if($_COOKIE['cd_until']) $cookie = json_decode($_COOKIE['cd_until'], true);     else $cookie = Array();          if(isset($_GET["reset"])) {         //$db->DeleteRows("cd_until", Array("ip" => '"' . $_SERVER["REMOTE_ADDR"] . '"', "page" => '"' . $script_name . '"'));         unset($cookie[$script_name]);         header("Location: " . $_SERVER["PHP_SELF"]);     }     else {         $query = "SELECT * FROM cd_until WHERE ip='" . $_SERVER["REMOTE_ADDR"] . "' AND page='" . $script_name . "'";         $value = $db->QuerySingleRow($query);         if($value) {             $thedatetime = new DateTime();             $thedatetime->setTimestamp(intval($value->until));                  $cookie[$script_name] = intval($value->until);         } else {             if($cookie[$script_name]) {                 $thedatetime = new DateTime();                 $thedatetime->setTimestamp( intval( $cookie[$script_name] ) );             } else {                 $thedatetime = new DateTime();                 $thedatetime->modify( $str_interval );                      $cookie[$script_name] = intval( $thedatetime->format("U") );             }                  $new_id = $db->InsertRow(                     "cd_until",                     Array(                             "ip" => '"' . $_SERVER["REMOTE_ADDR"] . '"',                             "until" => intval( $thedatetime->format("U") ),                             "page" => '"' . $script_name . '"'                     )             );         }     }          setcookie("cd_until", json_encode($cookie), time() + $cookie_expire, "/");          }


orderby meta_value breaks taxonomy term archives

I have a People post type with a Person Type taxonomy (e.g. "Staff"). On the Person Type Term Archive pages, I want to sort by a "Sort Name" custom field. To do so, I'm using a `pre_get_posts` call:               <?php     function my_query_tweaks( $query ) {              // stop immediately if we're in the admin or not working with the main query         if( is_admin() || !$query->is_main_query() )             return;              // order people by sortname         if( is_post_type_archive( 'ciswa_people' ) || is_tax( 'ciswa_person_type' ) ) {             $query->set( 'meta_key', 'cis_sort_name' );             $query->set( 'orderby', 'meta_value' );             $query->set( 'order', 'ASC' );         }          }     add_action( 'pre_get_posts', 'my_query_tweaks' );      However, when I do this, the term archive pages return no results! Commenting out the `meta_key` line brings up the correct posts but, of course, unordered. When I look at the query WordPress is generating, I think the issue is that WordPress is trying to also _query posts_ based on the meta_key rather than just ordering by it. From `$wp_query` on the relevant empty taxonomy term archive page:               ["tax_query"]=>       object(WP_Tax_Query)#343 (2) {         ["queries"]=>         array(1) {           [0]=>           array(5) {             ["taxonomy"]=>             string(17) "ciswa_person_type"             ["terms"]=>             array(1) {               [0]=>               string(5) "staff"             }             ["include_children"]=>             bool(true)             ["field"]=>             string(4) "slug"             ["operator"]=>             string(2) "IN"           }         }         ["relation"]=>         string(3) "AND"       }       ["meta_query"]=>       object(WP_Meta_Query)#344 (2) {         ["queries"]=>         array(1) {           [0]=>           array(1) {             ["key"]=>             string(13) "cis_sort_name"           }         }         ["relation"]=>         string(3) "AND"       }      ...and...               ["request"]=>       string(498) "SELECT SQL_CALC_FOUND_ROWS  fi_posts.ID FROM fi_posts  INNER JOIN fi_term_relationships ON (fi_posts.ID = fi_term_relationships.object_id) INNER JOIN fi_postmeta ON (fi_posts.ID = fi_postmeta.post_id) WHERE 1=1  AND ( fi_term_relationships.term_taxonomy_id IN (6,10) ) AND fi_posts.post_type = 'ciswa_people' AND (fi_posts.post_status = 'publish' OR fi_posts.post_status = 'private') AND (fi_postmeta.meta_key = 'cis_sort_name' ) GROUP BY fi_posts.ID ORDER BY fi_postmeta.meta_value ASC LIMIT 0, 10"


Load custom script on a single template

So I placed two scripts in the plugin folder, but I can´t figure out why they wont load. I created a custom template where I have placed the following code:               <?php     function my_enqueue_scripts() {     wp_register_script('ajax', plugins_url('ajax.js', __FILE__), array('jquery'),   'false', 'true' );     wp_register_script('ajax2', plugins_url('ajax2.js', __FILE__), array('jquery'), 'false', 'true' );     }     if (is_page_template('page_blankett.php')){     add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts' );     }     ?>


Editing the permalink of image in Gallery Carousel plugin

I'm looking to edit the permalink that is displayed when an image loads when using the Gallery Carousel without Jetpack plugin (which is just forked from Jetpack). Currently it looks something like: http://mywebsite.com/#jp- carousel-238 but I'm looking for something a bit 'prettier' eg. http://mywebsite.com/#beautiful-sunset How do I go about changing the permalink/deeplink to use the image title instead of this generated number? I'm comfortable delving around and editing the plugin files but not sure where to start! Many thanks


WordPress plugin won't create custom tables

I’m making a plugin that uses custom tables. On my local dev site the tables are being created and everything is working, but when i activate the plugin on a live site the tables aren’t being created. here’s the code I’m using               // activation hook     register_activation_hook( __FILE__, array( 'Gripper_Activate', 'activate' ) );          // activation class     class Gripper_Activate {         /**          * Class Constructor          */         public function __construct() {             // Activate plugin when new blog is added             add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );         }         /**          * Fired when the plugin is activated.          *          * @param boolean $network_wide True if WPMU superadmin uses "Network Deactivate" action, false if WPMU is disabled or plugin is deactivated on an individual blog.          */         public static function activate( $network_wide ) {             if ( function_exists( 'is_multisite' ) && is_multisite() ) {                 if ( $network_wide  ) {                     // Get all blog ids                     $blog_ids = Gripper_Get_Blog_IDs::get_blog_ids();                     foreach ( $blog_ids as $blog_id ) {                         switch_to_blog( $blog_id );                         self::single_activate();                     }                     restore_current_blog();                 } else {                     self::single_activate();                 }             } else {                 self::single_activate();             }         }         /**          * Fired when a new site is activated with a WPMU environment          *          * @param int $blog_id ID of the new blog          */         public function activate_new_site( $blog_id ) {             if ( 1 !== did_action( 'wpmu_new_blog' ) ) {                 return;             }             switch_to_blog( $blog_id );             self::single_activate();             restore_current_blog();         }         /**          * Fired for each blog when the plugin is activated          */         private static function single_activate() {             Gripper_WP_Version_Check::activation_check('3.7');             Gripper_Create_Tables::create_syn_result_table();         }     }          // Class to create tables     class Gripper_Create_Tables {         static $gripper_db_version = '1.0.0';         public static function create_syn_result_table() {             global $wpdb;             $table_syn_result = $wpdb->prefix . "rsg_syn_result";             if($wpdb->get_var("show tables like '$table_syn_result'") != $table_syn_result){                 $sql = "CREATE TABLE " . $table_syn_result . " (                     `id` int(10) unsigned NOT NULL AUTO_INCREMENT,                     `page_no` int(11) DEFAULT NULL,                     `language` varchar(30) NOT NULL,                     `position` int(11) DEFAULT NULL,                     `gdomain` varchar(100) DEFAULT NULL,                     `keyword` varchar(500) DEFAULT NULL,                     `synonym` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,                     `keyword_id` int(11) DEFAULT NULL,                     `type` enum('heading','description') DEFAULT NULL,                     `created` datetime DEFAULT NULL,                     `updated` datetime DEFAULT NULL,                     PRIMARY KEY (`id`)                 );";                 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');                 dbDelta($sql);                 if( !get_option( "gripper_db_version" ) ) {                     add_option( "gripper_db_version", self::$gripper_db_version );                 }             }         }     }      The activation hook is working, because the version check is running, but the tables just aren’t being created on the live server.


Capabilities Not Changing

I want editors to be able to list, add and edit users. I thought the following code would do it, but it doesn't work - no new User menu appears for any editors. Have I missed something?               function increase_editor_role(){         $role = get_role('editor');         $role->add_cap('list_users');          $role->add_cap('edit_users');          $role->add_cap('create_users');      }     add_action('admin_init', 'increase_editor_role');


Extending content width with twentyfourteen theme

I'm new to WordPress. I'm using the twentyfourteen theme and have successfully removed the content (right) sidebar. However I now want to stretch my content to cover the space left by removing that sidebar. I have added the following to my style.css:               .site-content .entry-header, .site-content .entry-content, .site-content .entry-summary, .site-content .entry-meta, .page-content { width: 100%; }      This increases the width of the content, but it still only covers half of the available width. How can stretch the content to cover the full width of the page?


Loop to get current parent page "content" and his children content

I am tring to write a loop to get the content of a current-page; and below the content of every children of this page. After reading on wordpress codex website and outside on the web; I can't still figure out the solution....


Show post thumbnail only if it exists using timthumb

I am using timthumb as the image size management script throughout my wordpress site but I just noticed that an empty image tag shows up even when there is no thumbnail.               <?php if(has_post_thumbnail()):         $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');     ?>
             <img src="<?php bloginfo('template_url'); ?>/scripts/timthumb.php?src=<?php echo $src[0]; ?>&w=145&h=80&q=100&zc=1" height="80" width="145" alt="<?php the_title(); ?>" class="wp-post-image" />
<?php the_post_thumbnail_caption(); ?>

     <?php endif; ?>      I am doing it this way because I wanna show the caption whenever it exists. I also tried doing it all in php. I never do it like this, so I'm not sure if it's correct but It also shows the same thing and also echos the template_url before the image.               <?php if(has_post_thumbnail()){         $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');         echo '

'. the_post_thumbnail_caption() .'

';     } ?>      Am I doing something wrong here. That img tag is inside the condition right? Still a broken image place holder is showing up with every post. _Image below_ ![broken image placeholder](http://i.stack.imgur.com/4rky9.jpg) Can anyone tell me what's wrong with the code. Thanks! I appreciate all the help.


How we filter the search base on post-meta tags

I am using my custom filter. So in this search there are many checkboxes (have city name) and user selected some of them the post show the search result base on the checkbox. First i sotre the city/state name by using the `add_post_meta`               add_post_meta($post_id, 'post_state' , $state, true);      So after that when user filter the post. i am using the code               if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'sortbydestination' ) :     $stateName = $_POST['stateName'];          unset($_POST);     endif;     $args = array(                 'posts_per_page' => 30,                 'paged' => $paged,                  'post_type' => 'post',                  'post_status' => 'publish',                 'meta_query' => array(                                 'key' => 'post_state',                                 'value' => array($stateName)                                      )                  );      The checkbox html is generated by jquery which is               jQuery('#state_div').append('<label><input type="checkbox" name="stateName['+ state_arr[x] +']" id="" value="'+ state_arr[x] +'" >' + state_arr[x] + '</label');      So the name of the `input` is a `array` it self, which give me values like this               stateName[cityname1];     stateName[cityname2];     stateName[cityname3];     stateName[cityname4];      and so on. So someone tell me wether i am using right way to get these data or make correct `query` or not. Thanks


Query Results not being displayed please help

$args = array(          'post_type' => 'shows',          'operator' => 'AND',          'tax_query' => array(                       array(                       'taxonomy' => 'location',                       'field' => 'slug',                       'term' => 'california',                       ),                         array(                           'taxonomy' => 'genre',                       'field' => 'slug',                       'term' => 'comedy',                          )         )     );          $my_query = new WP_Query();     $my_query->query($args);          while ( $my_query->have_posts() ) : $my_query->the_post();          echo '<li>';     the_title();     echo '</li>';          endwhile;          wp_reset_postdata();      my taxonomy:               register_taxonomy('location',array (       0 => 'shows',     ),array( 'hierarchical' => true, 'label' => 'location','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => 'location'),'singular_label' => 'location') );          register_taxonomy('genre',array (       0 => 'shows',     ),array( 'hierarchical' => true, 'label' => 'genre','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => 'genre'),'singular_label' => 'genre') );      my objective is to display the posts with terms ex. california and comedy, i tried to do the relation but unfortunately no results are displayed


Adjust layout most recent post, taking pagination into account

I'm displaying two posts on my main page, and using post pagination to go through the older posts. My problem is I want to change the layout a bit of the most recent post. This sounds like a very basic question, and I have seen a lot of answers, but they only solve the problem for the first post on the page, not the actual -one and only- most recent post. Right now I tried something like this:               <?php if(have_posts()):?>        <?php $pcount = 0;?>     <?php endif;?>          <?php while (have_posts()): the_post(); ?>        <?php $pcount++;?>        <?php if($pcount < 2): ?>            /*some html changes*/        <?php endif; ?>     <? endwhile; ?>      This worked great. The first post on the page, which is by default the most recent one, has a changed layout. But when I navigate to the next page, I see the same. The first post (which is actually the third recent post, not the most recent), is also changed... So, my actual question: How can I check if the post is **actually** the single most recent one. Not the first on the page. Thanks


Multisite, either change the name of sample-page or create new page

Is there a way to either change the name of the default Sample Page or create a new page entirely everytime a user creates a new blog on WP multisite?


Create custom field key upon theme activation

Upon theme activation I want to create an 'URL' key for the custom fields. Like in ![this screenshot](http://i.stack.imgur.com/BSUpY.png). I know who to run functions when a theme is activated, I don't know how to create this custom field key though. Any thoughts? I don't want to be using custom meta boxes.


Jquery Slider for profile template

I want to show the posts under a category in my page.The first 5 posts should be shown when the page loads and When the user clicks the next button/link next 5 posts should be shown. Currently I show all posts under the category.The following is the template I use to show all the posts under that category.I know I need to change the code.But I don't know how to change. Please Help.
     <?php $bloggers = new wp_Query("category_name=bloggers-blog&order=ASC&orderby=ID");?>     <?php          while ($bloggers->have_posts() ) :$bloggers->the_post();          $blogger_name = get_post_custom_values("blogger_name");         $blogger_desig = get_post_custom_values("blogger_desig");         $blogger_profile = get_post_custom_values("blogger_profile");     ?>

<?php the_title();?>

             <?php                 if ( has_post_thumbnail() )  {                      the_post_thumbnail();                 }             ?>

             <?php                  if( is_array( $blogger_name ) )                 {                     foreach($blogger_name as $key => $value );                     echo "$value</n>";                  }             ?>

             <?php                  if( is_array( $blogger_desig ) )                 {                     foreach($blogger_desig as $key => $value );                     echo "$value</n></n>";                  }             ?>

             <?php                  if( is_array( $blogger_profile ) )                 {                     foreach($blogger_profile as $key => $value );                     echo "$value</n>";                  }             ?>
              <div id="options_to_connect" class="<?php the_ID();?>">             Options To Connect

          <?php endwhile; ?>     <?php wp_reset_query(); ?>     prev     next
      I need to show only 5 posts and when clicking on next I need to show the next 5( Currently There is only one) Any suggestions for this? Hope I have made myself clear.


WP_Query can't exclude more than 1 author?

It seem wp_query have the problem where it does not accept more than 1 negative value in author argument. for example:               $args = array('author=-2,-3,-4');      $newquery = WP_Query($args);       This grab everything else. Simply doesn't work. I found this trac, but seem still no official patch for this. Any suggestion?


Add "Logout" link to navigation menu

How can I add a link to the primary navigation menu with the `class="right"` attribute? I tried to add a static link to `example.com/wp-logout.php?action=logout` but that leads to a logout confirmation page. Is there any way to make it a log out link?


How to add plugin to blog

I just created a new blog and I'd like to add a plug-in to the blog. I am following this tutorial on how to do it, but on my admin screen there is no "Plugins" option (under "Appearance"). What am I doing wrong? What can I do to get my desired plugin for my blog?


If the only permalink setting is %postname% what happens in the case of old duplicates?

I am tempted to change my blog to be site.com/postname. I know that for new posts Wordpress is smart enough to add a unique number to them, but what about old posts that would get updated? I can run a database check for duplicates and manually fix them but I was wondering if this was already covered by some Wordpress magic?


Detailed form plugin, with ability to export to excel etc. OR edit PDF live?

I have a client who wants to have online application forms for their non profit service. I have used Contact Form 7 in the past, since its pretty flexible and you can have lots of fields, radio buttons etc which I LOVE. The only concern is that just sends a plain text email, they want a way that they can save the data into a spreadsheet or database of some sort. Weither it attaches a xml to an email when the form is filled, or it saves it in the admin where you can then export it. Is there anything out there like this? OR is there even a way to have a PDF online where people can type in it, fill it in then email it off? Since all the documents are in PDF form already this would be even easier.


Switch to other theme at url

I want to switch to other theme at this url - www.mysite.com/m/ . And then redirect mobile users to www.mysite.com/m/ with htaccess based on their "user- agent". I have htaccess redirect rules and it is work for me. But how to switch to mobile theme based on the url? Virtual theme plugin (http://wordpress.org/extend/plugins/virtual-theme/) is great solution for me, but unfortunately it doesn`t work for mobile browsers.


multiple blogs on single site

In my custom theme, I had to set one of the templates to home and then under Reading Settings set that to be the Posts Page. That allowed the site to read from the content of my home.php. And I customized it to display blog posts. However, now I want to create another blog post on the site. But the Reading Settings only allows you to select one of the pages as the Posts Page, so how can I get around that?


Image Insert into posts and pages not working after 3.2.1 update

And I've tried disabling all plugins and using the Twenty Eleven theme. In our sites network, I'm the network admin, so it's not a permissions issue. Any explanation or ways I might be able to approach debugging this? **UPDATE** I apologize for the original lack of detail; I was in a rush to a meeting. By "not working", I mean specifically:   1. On none of my network sites do I see 3 of the 4 insertion icons you would usually see at the top of the post/page editors. The one that looks like a starburst (Media Insert) is there, but literally does nothing when you click it.   2. Images from previous articles that have been embedded: If you click them, you still get the edit and remove buttons overlaying them. But clicking the edit button only serves to bring up the darkened screen overlay, and no media wizard.   3. This only happened after our upgrade to 3.2.1 from 3.0   4. We _can_ upload media through the media area of the admin backend, but _only_ through that area. I hope this helps paint a better picture of what's happening. Cracked open the Chrome debugger on that window, and I'm getting this error: may be related. ![enter image description here](http://i.stack.imgur.com/5RZu9.png) _Edit-Note: (From a comment to an answer below) "I guess maybe I used the wrong verbiage, but in the post, I was trying to convey that I had already tried fixing by disabling all plugins. No avail."_