register_post_type exclude_from_search argument not working

I have a post type registered with this code, however `'exclude_from_search' => true` seems to have no effect as I still find output in the search page. Am I making some mistake?               add_action('init', 'abundant_life_slides_register');     function abundant_life_slides_register() {         $args = array(             'label' => 'Slides',             'description' => '',             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'show_in_nav_menus' => true,             'has_archive' => false,             'capability_type' => 'post',             'hierarchical' => false,             'rewrite' => array('slug' => 'slides'),             'query_var' => true,             'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),             'labels' => array (             'name' => 'Slides',             'singular_name' => 'Slide',             'menu_name' => 'Slides',             'add_new' => 'Add Slide',             'add_new_item' => 'Add New Slide',             'edit' => 'Edit',             'edit_item' => 'Edit Slide',             'new_item' => 'New Slide',             'view' => 'View Slide',             'view_item' => 'View Slide',             'search_items' => 'Search Slides',             'not_found' => 'No Slides Found',             'not_found_in_trash' => 'No Slides Found in Trash',             'parent' => 'Parent Slide',             'exclude_from_search' => true,     ));          register_post_type('slides', $args);     }


Display WP posts in 3 responsive columns

I'm trying to display 6 random WordPress posts in 3 responsive columns, 2 rows, by using:               <?php $the_query = new WP_Query("showposts=6&cat=1&orderby=rand");?>      For example,

             Random Post 1

             Random Post 2

             Random Post 3

             Random Post 4

             Random Post 5

             Random Post 6

      I'm using WP Bootstrap. Any help would be much appreciated.


restore_current_blog() vs. multiple switch_to_blog() followed by removing $GLOBALS['_wp_switched_stack']

Related to this answer, which states > After every instance of `switch_to_blog()` you **need** to call > `restore_current_blog()` otherwise WP will think it is in a "switched" mode > and can potentially return incorrect data. I've done some testing, and can confirm that this is an issue. (It also answers a question I've had at work regarding file upload URLs, so two big thumbs up for that.) In my testing (detailed below) I found that there were two ways to proceed:   1. Always pair `switch_to_blog()` with `restore_current_blog()`   2. Use a chain of `switch_to_blog()`, with the last one switching back to the blog where you started from, and then `unset( $GLOBALS['_wp_switched_stack'] );` at the end. My question: Is method #2 in keeping with WordPress development best practices, or is it an ugly hack? ### My Testing I added the following code to `functions.php` on one of my WordPress Multisite installations:               add_action( 'shutdown', 'pj_stb_test' );     function pj_stb_test() {         if( ! current_user_can( 'update_core' ) )             return;              $home = get_current_blog_id();         $checklist = array(             'constants' => array( 'UPLOADS', 'MULTISITE', 'BLOGUPLOADDIR' ),             'functions' => array( 'ms_is_switched', 'wp_upload_dir' ),         );         $site_ids = array( 1, 2, 3 );              echo( "switch_to_blog() chain:
" );         foreach( $site_ids as $id ) {             switch_to_blog( $id );         }         switch_to_blog( $home );         _pj_dump( $checklist );              echo( 'switch_to_blog() chain followed by                 unset( $GLOBALS[\'_wp_switched_stack\'] )
' );         foreach( $site_ids as $id ) {             switch_to_blog( $id );         }         switch_to_blog( $home );         unset( $GLOBALS['_wp_switched_stack'] );         _pj_dump( $checklist );              echo( 'switch_to_blog() / restore_current_blog() pairings
' );         foreach( $site_ids as $id ) {             switch_to_blog( $id );             restore_current_blog();         }         _pj_dump( $checklist );          function _pj_dump( $checklist ) {         $constants = $checklist['constants'];         $functions = $checklist['functions'];         echo( "
Constants:
" );         echo( "
\n" );         foreach( $constants as $c ) {             echo( $c . ': ' );             var_dump( constant( $c ) );             echo( "\n" );         }         foreach( $functions as $f ) {             echo( $f . ': ' );             var_dump( call_user_func( $f ) );             echo( "\n" );         }     }      The output that was returned on an arbitrary site in my network:               switch_to_blog() chain:     UPLOADS: string(30) "wp-content/blogs.dir/94/files/"     MULTISITE: bool(true)     BLOGUPLOADDIR: string(50) "/path/to/wp/wp-content/blogs.dir/94/files/"     ms_is_switched: bool(true)     wp_upload_dir: array(6) {       ["path"]=>       string(57) "/path/to/wp/wp-content/blogs.dir/94/files/2013/11"       ["url"]=>       string(74) "http://example.com/my-site/wp-content/blogs.dir/94/files/2013/11"       ["subdir"]=>       string(8) "/2013/11"       ["basedir"]=>       string(49) "/path/to/wp/wp-content/blogs.dir/94/files"       ["baseurl"]=>       string(66) "http://example.com/my-site/wp-content/blogs.dir/94/files"       ["error"]=>       bool(false)     }           switch_to_blog() chain followed by unset( $GLOBALS['_wp_switched_stack'] )     UPLOADS: string(30) "wp-content/blogs.dir/94/files/"     MULTISITE: bool(true)     BLOGUPLOADDIR: string(50) "/path/to/wp/wp-content/blogs.dir/94/files/"     ms_is_switched: bool(false)     wp_upload_dir: array(6) {       ["path"]=>       string(57) "/path/to/wp/wp-content/blogs.dir/94/files/2013/11"       ["url"]=>       string(50) "http://example.com/my-site/files/2013/11"       ["subdir"]=>       string(8) "/2013/11"       ["basedir"]=>       string(49) "/path/to/wp/wp-content/blogs.dir/94/files"       ["baseurl"]=>       string(42) "http://example.com/my-site/files"       ["error"]=>       bool(false)     }           switch_to_blog() / restore_current_blog() pairings     UPLOADS: string(30) "wp-content/blogs.dir/94/files/"     MULTISITE: bool(true)     BLOGUPLOADDIR: string(50) "/path/to/wp/wp-content/blogs.dir/94/files/"     ms_is_switched: bool(false)     wp_upload_dir: array(6) {       ["path"]=>       string(57) "/path/to/wp/wp-content/blogs.dir/94/files/2013/11"       ["url"]=>       string(50) "http://example.com/my-site/files/2013/11"       ["subdir"]=>       string(8) "/2013/11"       ["basedir"]=>       string(49) "/path/to/wp/wp-content/blogs.dir/94/files"       ["baseurl"]=>       string(42) "http://example.com/my-site/files"       ["error"]=>       bool(false)     }      Sorry for the verbosity, but I wanted to make sure I had everything in here.


Using wp_cron with wp_mail to send bulk email

I am working on a custom plugin to send recurring invoices on the 1st of every month. So far, the plugin is working pretty well. It creates new invoices for each user based on their order and does send 1 email. But it only sends 1 email to the last email address from the query, not to every user. So here is my current function, maybe someone can see something I could do to make this send an individual email to each user with wp_mail. Note** This is in testing phase, so I am using the exact date in the IF statement at the beginning to see the emails and invoices be created...               function mps_send_annual_notification()  {           // START BY CHECKING THE DATE...       // WE ONLY WANT TO RUN THIS ON THE 1ST OF EACH MONTH          date_default_timezone_set('America/Chicago');     $cron_date = date('m-d');          // BEGIN DATE VERIFICATION     if ('11-21' == $cron_date) {          // GET THE USERS AND INFO FOR RECURRING ORDERS       global $post;     $args = array(          'post_type' => 'purchase',         'posts_per_page' => -1,         'meta_query' => array(             array (             'key' => 'purchase_cycle',             'value' => 'Annually Recurring',             'compare' => '='             )         )     );          $myposts = get_posts( $args );     foreach( $myposts as $post ) :  setup_postdata($post);          $client = get_post_meta($post->ID, 'purchase_user', true);     $email = get_post_meta($post->ID, 'purchase_user_email', true);     $service = get_post_meta($post->ID, 'purchase_service', true);     $price = get_post_meta($post->ID, 'purchase_price', true);          $timestamp = date('Ymd');     $today = date('m-d-Y');              // CREATE A TITLE BASED ON USER NAME, THE MEMBERSHIP TYPE, AND THE DATE          // Turn User Name into Initials     $words = explode(' ', $client);     $acronym = '';          foreach ($words as $w) {     $acronym .= $w[0];     }          // Turn Service into Initials     $svc = explode(' ', $service);     $svc_letters = '';     foreach ($svc as $value) {         $svc_letters .= $value[0];     }          $title_date = date('YmdHis');          $invoice_title = $acronym.$title_date.$svc_letters;             // CREATE AN INVOICE             $invoicepost = array(         'post_status' => 'publish',          'post_title' => $invoice_title,         'post_type' => 'invoice',          'post_author' => 1);       remove_action( 'mps_cron_hook_example', 'mps_update_message');     $pid = wp_insert_post( $invoicepost );             // ADD THE INVOICE META     add_post_meta($pid, 'invoice_user', $client, true);      add_post_meta($pid, 'invoice_user_email', $email, true);      add_post_meta($pid, 'invoice_date', $today, true);      add_post_meta($pid, 'invoice_due_date', $today, true);      add_post_meta($pid, 'invoice_timestamp', $timestamp, true);      add_post_meta($pid, 'invoice_total_due', $price, true);     add_post_meta($pid, 'invoice_balance', $price, true);     add_post_meta($pid, 'invoice_description', 'Annual Membership Dues', true);     add_post_meta($pid, 'invoice_type', 'Dues', true);     add_post_meta($pid, 'invoice_name', $service, true);                  // SET MAIL FILTERS     add_filter ("wp_mail_content_type", "cron_invoice_mail_content_type");     function cron_invoice_mail_content_type() {     return "text/html";     }          add_filter ("wp_mail_from", "cron_invoice_mail_from");     function cron_invoice_mail_from() {     return "no-reply@example.com";     }          add_filter ("wp_mail_from_name", "cron_invoice_mail_from_name");     function cron_invoice_mail_from_name() {     return "Website Name Goes Here";     }             // CREATE EMAIL MESSAGE     $email_subject = 'You Have a New Invoice';          ob_start(); ?>
             Hi <?php echo $client; ?>!

             Message to user goes here...

 Invoice Number:  <?php echo $invoice_title; ?>
             Invoice Date:  <?php echo $today; ?>
             Invoice Due Date:  <?php echo $today; ?>
             Account Status:  <?php echo $service; ?>
             Amount Due:  <?php echo $price; ?>

 View your invoice online.
             Sincerely,
             Website Name Goes Here

         This message was automatically generated by the online account    management system.
                           <?php // SEND THE MESSAGE     $message = ob_get_contents();     ob_end_clean();          wp_mail($email, $email_subject, $message);               // end the beginning query        endforeach;          } // END OF DATE VERIFICATION         }


Problems Displaying Multiple WP Menus

Not sure where my error is (I did piece most of this together from snippets on different websites,) but when I test my theme, only "Left Menu" displays. There are definitely two menus, however where "Menu Right" should be is a duplicate of "Menu Left." Here's my header               <nav id="navigation" role="navigation">        <?php wp_nav_menu( array('menu' => 'Left Menu' )); ?>        <?php wp_nav_menu( array('menu' => 'Right Menu' )); ?>     </nav><!-- /Navigation -->      And here's my functions.php               function register_mp_menus() {     register_nav_menus(     array( 'left-menu' => __( 'Left Menu' ), 'right-menu' => __( 'Right Menu' )));     }          add_action( 'init', 'register_mp_menus' );      Any ideas or help would be greatly appreciated!


the_excerpt() does not work with has_excerpt()?

I'm trying to shorten the excerpt but it does not work. It shows the full excerpt which I write in the post edit! I've added this to the functions.php               function custom_excerpt_length( $length ) {         return 20;     }     add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );      To show the excerpt I'm using in content.php: `if(has_excerpt()) { the_excerpt(); } else { the_content(); }` The above code display full excerpt, not shortened! Without `has_excerpt()` `if statement` it displays correctly. Where can be the problem? Any ideas what can cause this?


Need a conditional to test if title of parent page matches title of child page

In my main loop, I need to incorporate proper html markup into a conditional to test if title of parent page matches title of child page and do (or do not) display certain content. Default might be to keep h1 tag , otherwise do not display.                    <?php if (have_posts()) : while (have_posts()) : the_post() ; ?>
          <?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?>
          <?php     $children = get_pages('child_of='.$post->ID);     if( count( $children ) != 0 ) {           echo 'NO children';          }     else { echo 'has children';}     ?>
<?php the_title(); ?>
          <?php the_content(); ?>     <?php endwhile; endif; ?>       ex) I want h1 to show here... http://howlingwolfmedia.com/site3/my- club/facilities/ but not here: http://howlingwolfmedia.com/site3/my-club/ **solution here as function:**               function testchildren () {         global $post;          $childtest = get_pages('child_of='.$post->ID);             if( count( $childtest ) != 0 ) {             return false;             } else {             return true;            }      }       **and implementation as markup:**                  <?php if (have_posts()) : while (have_posts()) : the_post() ; ?>
<?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?>
         <?php if ( testchildren() ) : ?>
<?php the_title(); ?>
         <?php endif; ?>         <?php the_content(); ?>         <?php endwhile; endif; ?>


How to create a widget on witch a registered user can create a checklist

I have no idea where to start. I want to create a widget. with the following features   1. show a button to create a checklist.   2. Show a list of already created checklists created by the user.   3. Mark checklist as done.   4. Send monthly report of the completed checklists. Should I rather go with drupal or is this possible in wordpress?


'Auto Draft' Post showing in wordpress loop

When running a wordpress loop, I am seeing these weird posts called auto draft. I have never seen this before. Does anyone know what they are and how to get rid of them? Any help is appreciated as I am lost on this one. ![enter image description here](http://i.stack.imgur.com/LBoFN.png) THe loop I used is:

                   <?php // WP_Query arguments              $args = array (                 'post_type'       => 'step_to_hs',                 'post_status'     => 'published',                 );                      // The Query              $query = new WP_Query( $args );                      // The Loop              if ( $query->have_posts() ) {                 while ( $query->have_posts() ) {                    $query->the_post(); ?>

                                <a data-toggle="collapse" data-parent="#accordion" href="#<?php the_id(); ?>">                                   <?php the_title(); ?>

                          <div id="<?php the_id(); ?>" class="panel-collapse collapse collapse.in">
                                <?php the_content(); ?>

                    <?php }                 } else {                    echo 'Sorry - there are no steps to display right now';                 }                      // Restore original Post Data                 wp_reset_postdata(); ?>

      I am using the bootstrap collapse javascript to style the loop. I have tried just doing a regular loop without the jQuery and styling, but same thing still shows.


Wordpress Query Default Order if Meta Values Same?

If the main query args look like this:               'orderby' => 'meta_value_num',     'meta_key' => 'price',     'order' => 'DESC'      What orderby does the query use if the meta_key value is the same for multiple results? So, in the above example, if multiple items have the same price, how does the query order those items? Like a sub-orderby... I thought it would be publish date, but it isn't.


Sync comment data

I have a site that used Facebook comments for a period of time and then removed them for native WP comments. I was able to write a function that grabbed all the comments and re-inserted them into the WP database (as FB comments do not store in WP). However, Facebook's OpenGraph API does not provide email addresses (which I understand). So what I want to accomplish is the following:   1. Query the comment table for a specific name using the `comment_author`   2. Pull all comments by that name   3. If there is an email address present in one comment array, copy it over to the one that is missing I have accomplished #1 and #2, but I'm at a loss for #3. Any ideas?


Custom Fields for Page Edits

Currently using the code below for SEO. When the Code Below if added to the header works perfectly but then you have to manually create the fields that are queried. Most Clients hardly get around the WordPress UI let alone create a field. I trying to write a plugin that can make the fields visible on every page edit by default so that the client would just put the value. Thanks               <title>          <?php if ( is_single() || is_page() ) { ?><?php $title = get_post_meta($post->ID, 'Title', true);  if ($title) { ?>     <?php echo $title; ?> | <?php bloginfo('name'); ?>     <?php } else { ?>     <?php wp_title(''); ?> | <?php bloginfo('name'); ?>     <?php } ?>     <?php } ?>          </title>          <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <meta name="description" content="<?php $description = get_post_meta($post->ID, 'Description', true);  if ($description) { ?><?php echo get_post_meta($post->ID, "Description", true); ?>     <?php } else { ?><?php the_excerpt_rss(); ?><?php } ?>" />     <?php endwhile; endif; elseif(is_home()) : ?>     <meta name="description" content="<?php bloginfo('description'); ?>" />     <?php endif; ?>          <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <meta name="keywords" content="<?php $keywords = get_post_meta($post->ID, 'keywords', true);  if ($keywords) { ?><?php echo get_post_meta($post->ID, "keywords", true); ?>     <?php } else { ?><?php the_excerpt_rss(); ?><?php } ?>" />     <?php endwhile; endif; elseif(is_home()) : ?>     <meta name="keywords" content="<?php bloginfo('keywords'); ?>" />          <?php endif; ?>      **Plugin structure**               <?php     /*     Plugin Name: WP Site GPS     Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates     Description: Non Complicated Search Engine Optimization plugin     Version: 001     Author: Chibueze Okechukwu     */                    function mySEO() {         include ('wp-site-gps-transport.php');     }               // Add hook for admin      add_action('admin_head', 'mySEO');     // Add hook for front-end      add_action('wp_head', 'mySEO');          ?>      **Plugin Include File**               <title>          <?php if ( is_single() || is_page() ) { ?><?php $title = get_post_meta($post->ID, 'Title', true);  if ($title) { ?>     <?php echo $title; ?> | <?php bloginfo('name'); ?>     <?php } else { ?>     <?php wp_title(''); ?> | <?php bloginfo('name'); ?>     <?php } ?>     <?php } ?>          </title>          <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <meta name="description" content="<?php $description = get_post_meta($post->ID, 'Description', true);  if ($description) { ?><?php echo get_post_meta($post->ID, "Description", true); ?>     <?php } else { ?><?php the_excerpt_rss(); ?><?php } ?>" />     <?php endwhile; endif; elseif(is_home()) : ?>     <meta name="description" content="<?php bloginfo('description'); ?>" />     <?php endif; ?>          <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <meta name="keywords" content="<?php $keywords = get_post_meta($post->ID, 'keywords', true);  if ($keywords) { ?><?php echo get_post_meta($post->ID, "keywords", true); ?>     <?php } else { ?><?php the_excerpt_rss(); ?><?php } ?>" />     <?php endwhile; endif; elseif(is_home()) : ?>     <meta name="keywords" content="<?php bloginfo('keywords'); ?>" />          <?php endif; ?>


URL field in metabox with page links select

I am building my first metabox and I need to add special field when **user can write your own link** (URL) to outside page (with http://) or **select existing page** /post. If user selected that he want to add link to existing page/post, he should see list of all pages, post, custom-post just existing, and if selected one of them in field should appear correct URL (for example "/blog/my-post/"). Can you help me and suggest some idea?


Update feed more frequently

When i publish new posts, i notice the new posts do not appear in the feed `http://mysite.com/feed` instantaneously, there is always lag time, one or several hours. When i change something in `wp-includes/feed-rss2.php` file (just `echo 'test'`), it also takes one or 2 hour to see the `test` word in `http://mysite.com/feed`, it means wordpress only use that file periodically. Anyone know how to solve this problem? I want whenever the `http://mysite.com/feed` page is open in browser, it must use `wp- includes/feed-rss2.php` file. Thanks!


Send email to all registered users

I've got a about 60 registered users. How can I send an email out to all of them? Any suggestions on how to achieve this. The users have registered, so I don't think they are going to mind an email send to them, but how could I get that to work? would a plug in do what you said? send an email out to the registered users? or should I install a newsletter plug in and get everyone to sign up to that again/separately? I'm not looking for specific plug in names (although that would be handy) more how it works in theory?


Blank screen after moving WordPress to new server with same domain name

I need to move my WP install. Domain name is the same. This is what I did:   1. I backed up the DB and "wp-content" folder.   2. I installed fresh WP install on new server   3. I emptied the DB of the fresh install and imported into it the content of the old DB (because prefix rules prevent me to create a DB carrying the same name as old DB)   4. I replaced the "wp-content" folder of new install by the "wp-content" of old install Now I have the new DB (containing old content) with the new "wp-config.php" that comes with it. Yet I get a blank screen. Why?


How to add a Custom Meta Box for more than one Post Type?

I am using the following code in `functions.php` for adding a custom meta box. The custom post type is `themes`. I want to add more post types, how can I?               add_meta_box(          'my-meta-box-id',          'Demo & Download',          'cd_meta_box_cb',          'themes',          'normal',          'high'      );


Rearrange elements outputted by comment_form()

I'm currently developing a custom theme from scratch. In the past week, I've been trying to change the order of the HTML elements output by the `comment_form()`. I basically don't know any PHP, and I was unable to find information on the `comment_form()` that successfully covers how to rearrange the layout of its output, including the WordPress Codex. Can anyone please explain how to rearrange the elements outputted by the `comment_form()`, preferably without having to be proficient in PHP and the inner workings of WordPress? Please don't provide solutions that rely on re-positioning elements with CSS; this can't be the way you're intended to customize the output. If it turns out there isn't an optimal way to achieve this, would it then be possible to customize `comments.php` without using the `comment_form()`, like you would before the function was introduced? The following links cover some of the most relevant methods I've tried. They either don't work at all or don't achieve the correct result:   * http://freetexthost.com/wplcq61i3d (Sorry, but I'm not allowed to post more than two links directly in the post.) Thank you.


How to map ids of taxonomy with custom post type objects?

My wordpress installation contains of $locations (which are actually categorycourses which is a a taxonomy).               foreach($locations as $location) {                               $categorycourses_ids_array = get_term_children( $location->cat_ID, 'categorycourses' );              //Show children for categorycourses                               foreach ( $categorycourses_ids_array as $categorycourse_id ) {                  $category_course = get_term_by( 'id', $categorycourse_id, 'categorycourses' );                                        $loop = get_loop_courses($category_course);                           if($loop->have_posts()) {                      //code etc...      For the moment I do loop like above, but I want to do it faster :-) The issue is the `get_loop_courses(`) that is called for each and every **categorycourse**. This is actual code:               function get_loop_courses($categorycourse) {         $terms_slug = strtolower($categorycourse->slug);         $terms_slug = str_replace(' ','', $terms_slug);              $args = array(             'posts_per_page' => -1, //Show ALL coures (no limit)             'post_type' => 'course',             'tax_query' => array(                 array(                     'taxonomy' => 'categorycourses',                     'field' => 'slug',                     'terms' => $terms_slug                 ),             ),          );           $loop = new WP_Query($args);         return $loop;     }      I understand that the "bottleneck" is that a whole lot of WP_Query's has to be run to achieve this. Number of categorycourses is about 50 and number of custom type courses are about 10 for each coursecategory. I'm trying to do:               foreach($locations as $location) {          //Children of location = categorycourses     $categorycourses_ids_array = get_term_children( $location->cat_ID, 'categorycourses' );          $cc_array = array();     foreach ( $categorycourses_ids_array as $categorycourse_id ) {              $cc_array[] = get_term_by( 'id', $categorycourse_id, 'categorycourses' );        }     $loops = get_loop_courses_array($cc_array);         //code etc...      And the loop courses array look like this:               function get_loop_courses_array(array $categorycourses) {         $slugs_array = array();         foreach($categorycourses as $categorycourse) {             $terms_slug = strtolower($categorycourse->slug);             $terms_slug = str_replace(' ','', $terms_slug);             $slugs_array[] = $terms_slug;         }              $args = array(             'posts_per_page' => -1, //Show ALL coures (no limit)             'post_type' => 'course',             'tax_query' => array(                 array(                     'taxonomy' => 'categorycourses',                     'field' => 'slug',                     'terms' => $slugs_array                 ),             ),          );           $loop = new WP_Query($args);         return $loop;     }      I don't understand how I could get an array of courses mapped to each coursecategory in one single WP_Query-call. I want to achieve something like:               foreach($locations as $location) {                                   $categorycourses_ids_array = get_term_children( $location->cat_ID, 'categorycourses' );         $cc_array = array();     foreach ( $categorycourses_ids_array as $categorycourse_id ) {              $cc_array[] = get_term_by( 'id', $categorycourse_id, 'categorycourses' );        }     $loops = get_loop_courses_array($cc_array);                   //Show children and their courses                              foreach ( $categorycourses_ids_array as $categorycourse_id ) {                  $category_course = get_term_by( 'id', $categorycourse_id, 'categorycourses' );                                        $loop = $loops[$coursecategory_id]; //THIS I WANT TO DO                 if($loop->have_posts()) {                      //code etc...


Wordpress before save / update member

I have a site that requires to search for lat long information before been saved / updated a member profile, this is searched from google on reverse geolocation through a custom file name location. I am not looking the function on solve that, I ma looking way on hook the function Any suggest on how to solve that?


Execute shortcode only in another shortcode

I wonder if it's possible to do a shortcode **only in another shortcode**. For example I got following code pieces:               [heading]some pricing page[/heading]     [pricing_box]       [heading]Some title[/heading]     [/pricing_box]      Now I don't want to define one shortcode **heading** which would apply to both the nested one and the first level shortcode. I want the both **heading** shortcodes to produce different outputs. Of course, I could try to solve this by renaming one of the shortcodes to **title** or something, but this doesn't always result in optimal naming arrangements.


How do I add a nested conditional within an echo - to use a default image if there isn't one in the post?

I'm trying to add a conditional that will display a default image if the "image" field isn't populated... here's what I'm trying to work with:               $args = array(        'posts_per_page' => 3,        'post_type' => 'post',        'meta_query' => array(            array(              'key' => 'is_featured',               'value' => '1',              'compare' => '!=', // NOT Featured           )        )     );          $second_query = new WP_Query( $args );     if ( $second_query->have_posts() ):        while( $second_query->have_posts() ) : $second_query->the_post();              $attachment_id = get_field('image');        $size = "customfeatins"; // (thumbnail, medium, large, full or custom size)        $image = wp_get_attachment_image_src( $attachment_id, $size );                  echo '

' . get_the_title() .'

' . get_the_date() .'

             ';             endwhile;     endif;     wp_reset_postdata();      I've tried this but it breaks the page:               $args = array(        'posts_per_page' => 3,        'post_type' => 'post',        'meta_query' => array(            array(              'key' => 'is_featured',               'value' => '1',              'compare' => '!=', // NOT Featured           )        )     );          $second_query = new WP_Query( $args );     if ( $second_query->have_posts() ):        while( $second_query->have_posts() ) : $second_query->the_post();             if( get_field('image') ){              $attachment_id = get_field('image');         $size = "customfeatins"; // (thumbnail, medium, large, full or custom size)         $image = wp_get_attachment_image_src( $attachment_id, $size );              } else {              $image = wp_get_attachment_image_src( 'http://placehold.it/136x90' );              }                     endif;                  echo '

' . get_the_title() .'

' . get_the_date() .'

             ';             endwhile;     endif;     wp_reset_postdata();


ReWriteRules and WordPress Multi-Sites with Sub Directories

I'm having a diffucult time getting the ReWriteRules and URL structures setup for a Wordpress 3.4.2 (latest version as of this post) blog with multi-site enabled. www.ourdomain.com/ is the homepage of an e-commerce site. We also have www.ourdomain.com/example-category/ and www.ourdomain.com/example-product/ As our category and product URL structures. This is all working. I have installed the wordpress files in the physical folder /var/www/ourdomain/wordpress. Right now, www.ourdomain.com/wordpress/ goes to the default blog. www.ourdomain.com/wordpress/blog1 is the first blog and www.ourdomain.com/wordpress/blog2 is the second. I've got to this point by adding               ReWriteRule ^/wordpress - [L,NC]      to our vhost file (.htacess is diasabled). Our intention is for direct requests (from users) for `www.ourdomain.com/wordpress(/*)` to redirect to the home page `www.ourdomain.com/` since the `/wordpress` folder is just to store files, not intended as an actual blog for users to access. Requests for `www.ourdomain.com/blog/` should silently redirect to `www.ourdomain.com/wordpress/blog1`. Requests for `www.ourdomain.com/policies/` should silently redirect to `www.ourdomain.com/wordpress/blog2`. So:               /wordpress/ -> 301 /     /blog/ -> silent /wordpress/blog1     /policies/ -> silent /wordpress/blog2      It seems simple in theory, but not so simple in practice. I started with:               ReWriteRule ^/wordpress - [L,NC]     RewriteRule ^/blog/(.*)$ /wordpress/blog/$1 [L,NC]       RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d      RewriteRule ^/blog/ /wordpress/blog/index.php [L]      Which results in a 404 at /blog/. Of course, because `/wordpress/blog/index.php` isn't a file. There is no `blog` folder inside the `wordpress` folder. The file I want to load is `/wordpress/index.php`, which reads the URL to determine which blog to load- But the URL has been modified, so this fails. I need a way to invoke `/wordpress/index.php` from the URL /blog/, but make `/wordpress/index.php` see the request as if the user went to `/wordpress/blog`. Any way to pass a fake URI to PHP from modRewrite? Or an alternative way to achieve this without installing to separate copies of WordPress? **UPDATE:** Since this doesn't seem to be supported in the current version, but I still need this working before the new version is released, I think a work around would be to use something like:               RewriteRule ^/blog/ /wordpress/index.php?site=blog [L]      And then modify the WordPress file that reads the URL and have it set the site variable based on the GET parameter instead. Would that work? Which file contains the code to set the current site?


How to re-post an old post?

I am in need of re-posting random posts to the front page of the blog to make them fresh. Is there any hook that could help me achieve it? Thanks.


Loop posts without any taxonomy

I've grouped my pages by some custom taxonomy. But I need to care about those without any taxonomy set. My code is:               $page_groups = get_terms('page_group'); //get all existing page groups     foreach ($page_groups as $page_group) { //for every of them         $group_name = $page_group->name;    //get group name         $loop = new WP_Query( array( 'post_type' => 'page', 'page_group' => $group_name ) );    //and loop for all pages from that category              while ( $loop->have_posts() ) : $loop->the_post();                  //main stuff here              endwhile;              wp_reset_query();   //reset loop         rewind_posts();     //and rewind posts     } // End foreach $page_groups ?>      It works cool, but after that loop I want to display all the pages that has no 'page_group' taxonomy - only those. I've tried to query without taxonomy but it loops all the pages.


Where is the information about the authors for articles stored?

I have recently been appointed to maintain a Wordpress powered news site. I don't have much experience with wordpress and have been teaching myself as I go. The site I am maintaining was recently migrated to a new wordpress site. While the old site used the standard mechanism for storing authors, the new site uses the Co-author's Plus Plugin. After the migration, all of the articles are shown as written by "admin." I'm sure the information about the authors is stored somewhere in the database, just the website does not know to look for that information. Can someone tell me where I can find this information so I can then proceed to add it through the Co-Authors plus plugin?


How to put a block of code between [shortcode][/shortcode] in do_shortcode()?

So I want to put a loop of post behind a 'like lock' thats created by a plugin that uses the shortcode [to_like ID="XX"]content[/to_like]. But instead of the plugin blocking the content, i just get a page with all the permalinks to the post on it. So I guess what Im asking is how do I put the page contents (ie, the loop in the template that displays the post) inside the shortcode so its hidden by the plugin? This is what Ive got right now:               foreach ( $posts as $post ) :       setup_postdata( $post );          $content  = '

';         $content .= ''.the_title().'';         $content .= '';         $content .= '
';                      $schemaStreet = get_post_meta( $post->ID, 'schemaStreet', $single );                 $schemaCity = get_post_meta( $post->ID, 'schemaCity', $single );                  $schemaState = get_post_meta( $post->ID, 'schemaState', $single );              $content .= ''.$schemaStreet[0].'';         $content .= '
'.$schemaCity[0].', '.$schemaState[0].'';              $content .= '
';         $content .= '
';         $content .= '
';              do_shortcode('[to_like id="1208"]'.$content.'[/to_like]');          endforeach;      wp_reset_postdata();


How do I get my podcast feed created?

I have a wordpress site. I added a plugin to create podcasts. It is the Blubrry PowerPress plugin. Then I uploaded an mp3 to my site. Then I used to plugin to display the podcast. Here is an example page where the podcast is, at the very bottom. But when I go to this url to find my feed: http://glowingstart.com/feeds/podcast/ I get a 404-error. Would anyone know why that happens? And how do I determine whether my feed url has been created and the feed updated? Thanks!


Moving Domain.wordpress.com to a new domain

I have created my website at the following address. http://musivision.wordpress.com/ I would like to move my website to the following domain: http://musivision.ca I found a link on domain mapping 'http://en.support.wordpress.com/domain- mapping/map-existing-domain/ however, it seems to be forcing me to use WordPress hosting which I don't want to do. I want to stay with my current hosting company. In short I would like to: 1) Keep the website that I created   2) Remove the Wordpress from my domain and transfer to 'http://musivision.ca' 3) Keep the same hosting that I use.


How to Hard Set the Parent Page in Template

This template displays child pages of the parent page that calls it. I need to modify it to hard code the parent page to a specific parent, using the slug or other means. Once I know how to do that I think I can then have the template display (in separate divs) the child pages from two different parents. Can anyone get me started on how to hard-set the parent page? thanks               <?php     /*     Template Name: Portfolio Section     */          get_header();          global $post;     ?>
<?php echo $post->post_title; ?>

     <?php     $items = get_pages( array('sort_order' => 'ASC', 'sort_column' => 'menu_order', 'child_of' => $post->ID ) );     foreach( $items as $item ) : ?>
         <a href="<?php echo get_permalink($item->ID); ?>">         <?php          $photosToShow = rand(1,3);         $images = get_posts( array( 'numberposts' => $photosToShow, 'post_parent' => $item->ID, 'post_mime_type' => 'image', 'post_type' => 'attachment' ) );         foreach( $images as $image ) {             echo wp_get_attachment_image( $image->ID, 'Portfolio-Thumb' );         }         ?>                  <a href="<?php echo $item->guid; ?>">
<?php echo $item->post_title; ?>
         <a href="<?php echo $item->guid; ?>">
<?php $fields = get_fields($item-    >ID); echo $fields['location']; ?>

     <?php endforeach; ?>
                    <?php get_footer(); ?>


Integrating WordPress Content into a jQuery Slider

I have a pretty basic 'featured-list - image slider' implemented above my content in my custom WordPress theme. How do I integrate WordPress content into the slider so that the slide content is pulled via 'Recent-Posts' or via a 'Category'? Also, how can I set the 'Featured Imgs' to display as the photo within the slider and to display in my alotted thumbnail sections in list area? Here's a screenshot of the jQuery I plugin I picked this up on; ![enter image description here](http://i.stack.imgur.com/cenJR.jpg)   _(Their demo is broke, so.)_ **Below is the markup I have implemented.**

David King – on his True Crime thriller

Tips from Steve Perry

Tips from Chuck Berry

SFIRS

David King – on his True Crime thriller

David King is Lorem Ipsum Lorem Ipsum Lorem Ipsum...read more

Tips from Steve Perry

Steve Perry is Lorem Ipsum Lorem Ipsum Lorem Ipsum...read more

Tips from Chuck Berry

Chuck Berry is Lorem Ipsum Lorem Ipsum Lorem Ipsum...read more

Create a Vintage Photograph in Photoshop

Quisque sed orci ut lacus viverra interdum ornare sed est. Donec porta, erat eu pretium luctus, leo augue sodales....read more


Displaying Custom Post Types In "At A Glance" Meta Box

I found the following snippet will displays the number of Custom Post Types published in Dashboard's At A Glance widget, like this: ![At A Glance](http://i.stack.imgur.com/K0ujY.png) Is there a way to turn that "81 Wrestlers" text to a link to the post types list. Here's the code:               add_filter( 'dashboard_glance_items', 'custom_glance_items', 10, 1 );     function custom_glance_items( $items = array() ) {         $post_types = array( 'wrestler' );         foreach( $post_types as $type ) {             if( ! post_type_exists( $type ) ) continue;             $num_posts = wp_count_posts( $type );             if( $num_posts ) {                 $published = intval( $num_posts->publish );                 $post_type = get_post_type_object( $type );                 $text = _n( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $published, 'your_textdomain' );                 $text = sprintf( $text, number_format_i18n( $published ) );                 if ( current_user_can( $post_type->cap->edit_posts ) ) {                     $items[] = sprintf( '%2$s', $type, $text ) . "\n";                 } else {                     $items[] = sprintf( '%2$s', $type, $text ) . "\n";                 }             }         }         return $items;     }


Create new database through static page code

I want to create a new table in current database of word press through create a static page. I write code for this as below, but there was no result. Why is that, and how can I get this right?               <?php     /*     Template Name:Register Page     Template URI:     Author:yuva     Author URI:     Description:This Is Page for Gallery.     */          get_header();     ?>

<?php  the_title(); ?>
          <?php     global $wpdb;     $my_table=$wpdb->prefix.'your_users';          $sql="CREATE TABLE IF NOT EXISTS $my_table (id int(20) not null auto_increment,name varchar(40) not null,password varchar(20) notnull,PRIMARY KEY(id))";          include_once(ABSPATH.'wp-admin/includes/upgrade.php');          dbDelta($sql);          ?>
     <?php     get_footer();     ?>


Wordpress Installation

First of all, I am not a techie so be nice to me please. I am trying to install Wordpress. I have followed the installation instructions for Wordpress as best as I could. However when I try to open localhost on Wampserver, I get a message: > The website cannot display The one thing that I believe may be wrong is in the wp-config.php file, I am not sure what to put in "MySQL database username". I put "`root`" as in the example. Any ideas?


Two scrollbars in popup window

I've got an issue with the popup windows that display when I click on the book cover images(from a widget) in my sidebar: there are two vertical scrollbars instead of one. Any idea why this is happening and how I may get rid of one of the scrollbars? Here's a screenshot: ![Two scrollbars](http://i.stack.imgur.com/00RKC.png) Here's my site: WordPress Blog


Creating a thumbnail from an image already on the server?

I'm trying to generate thumbnails on my server that are being uploaded by a plugin. It uploads all images to a directory. I'm trying to target these files and then create a thumbnail with them based on img_resize, but I am not having any lucky. Eventually I'll be inserting the thumbs into the media gallery and into user meta, but I can't even produce a thumbnail yet, so that is the first task at hand! Here's my simple code thus far:               require_once(ABSPATH . '/wp-admin/includes/media.php');     require_once(ABSPATH . '/wp-admin/includes/image.php');          $file = 'http://www.mysite.org/uploads/uploaddir/2012/02/bill.jpeg';          $max_w = 200;     $max_h = 200;     $crop = true;          $filePathInfo = pathinfo($file);     $fileName = $filePathInfo['basename'];          $wpUploadPath = wp_upload_dir();     $destpath = $wpUploadPath['basedir'].'/'.$fileName;          image_resize( $file, $max_w, $max_h, $crop );      I tried using the `$destpath` as well and nothing is happening. No thumbnails are being generated. Am I thinking about this incorrectly? Any light anyone could shed upon this situation would be greatly appreciated. Thanks! Tre SOLVED NOTE: This is the code that finally worked for me. I was using the URI before, to define the image_resize. Not the absolute directory.               $wpUploadDir = wp_upload_dir();     $baseDir = $wpUploadDir['basedir'];     $fileName = 'bill.jpg';     $filePath = $baseDir . "/" . $fileName;     $wp_filetype = wp_check_filetype($filePath, null);     $attachment = array(     'post_mime_type' => $wp_filetype['type'],     'post_title' => $fileName,     'post_content' => '',     'post_status' => 'inherit'     );     $attach_id = wp_insert_attachment( $attachment, $filePath );          require_once(ABSPATH . 'wp-admin/includes/image.php');     require_once(ABSPATH . 'wp-admin/includes/media.php');     $attach_data = wp_generate_attachment_metadata( $attach_id, $filePath );     wp_update_attachment_metadata( $attach_id, $attach_data );          image_resize($filePath, 200, 200, true, '200x200');


Mapping external subdomain to Multisite site

Everything is running under the same shared server. So there's only one IP to refer to. I have WordPress Multisite running at example.com and one of the sites on it is mug2p.example.com. I have a regular WordPress installation/site running at example2.com, but nothing on m.example2.com. I want m.example2.com to mirror/map mug2p.example.com. And I want m.example2.com to display in the browser's address bar. How can I do this? I added a CNAME record under example2.com pointing m.example2.com to mug2p.example.com but no luck. Every time I type m.example2.com in a browser it takes me to example2.com. EDIT: I installed the MU Domain Mapping Plugin and have it properly set up as well.


where to include a php file

I have a php file with some variables which I would like to use. When I include it in the header.php the variables in that file are not recognized at footer.php and some other places. Where is the best place to include this file so its content will be shared all over the wp files.


Gravity form to submit to third party application

I would like to know what the cleanest way to use gravity forms to submit data from my form to another page outside of WordPress is.   Our website is 100% WordPress and I need to use data of my gravity form somewhere else. I found this blog article, that seems to provide a solution, but I really would like to avoid modifying   `/wp-content/themes/*your-theme*/functions.php` I am worried about losing the changes at a WordPress / gravity forms update.


wp_editor not modify html tags of initial content

How can i set the tinyMCE editor in wp_editor to not modify/replace the html tags of the initial content ? I'm loading html content with tags (i know that they are deprecated but i need them) and the tinyMCE editor is replacing them. I tried several things but with no success. I'm getting a little frustrated. I need help. What i need is that the editor do not change the loaded html content. Sorry for my bad english! It's not my native language. Thanks in advance !


How can I pass a variable to a page with a SEF url?

I'm making a website for a small church. They would like to upload sermons to their site. I've looked for a WP plugin to do that, but none of them did exactly what they wanted. So, I'm making a plugin to do what they want. I've made a page called 'sermons' that has a page template 'sermon archive'. That file will display the sermon archive. I'd like to have it so when they click on a sermon, it would go to `sermon/my-sermon-name` (rather than `sermon?name=my-sermon-name`). Is there a way to do that in WordPress? Thanks!


Wordpress Posts Out Of Order after 3.1 Update

The first posts I wrote are now showing on the homepage. After Googling, the problem is because I am using query_posts to exclude a certain category on the main loop.               <?php query_posts($query_string . '&cat=-4'); ?>      * * * how can I still exclude this category, but not have my posts reversed?


Show tags of currently popular (by views) posts

I'm after a sidebar widget that will show the tags of my site's currently (within the last day) most viewed posts, in order to achieve a rudimentary 'trending topics' widget. Does this require a plugin (and if so which one), or can it be achieved with some nifty code?


RSS feed validity and Google Adsense

I want to use Google Adsense code snippets in my blog posts, so in my single.php. However, when I do so, then my RSS feed becomes invalid because of the javascript code in the content and the feed won't be updated anymore. Is there ANY way to fix this? I still have the Google Adsense code in the sidebar where it's not causing any issues. I've seen lots of blogs that have Google ads in their blog posts and a functioning RSS feed, so it seems to be possible, but how? Or rather, why is it causing problems in my case? I've done a looooooooot of research, but couldn't find ANY information about this issue. I think that means that it's not a very common problem. I really hope somebody can help me with this BIG problem. Would something like this work? http://chaosinacan.com/programming/adsense- without-blocking/ For reference, here's my website: http://zoomingjapan.com/ Here's my feed: http://zoomingjapan.com/feed/ Thanks a lot in advance!


Thumbnail and Featured Image With Fixed Sizes?

In my index.php file, I'm trying to create a thumbnail for each post with the size width: 200px and height 142px. And on the single.php, I would ike for the featured image to be width: 598px and height: 300px; for the index.php i tried `<?php the_post_thumbnail( array (200,150) );?>` but I cant get it to work. Is this something timthumb would be used for? or would it not be needed?


How can I manage and limit disk usage for each author?

I want display and limit disk usage for each author and be able to manage disk usage as an administrator. Example: author1: disk space is 20Mb; if they uploaded more 20Mb the upload button (in media library and post) is disabled. author2: disk space is 30Mb, if they upload more 30Mb the upload button (in media library and post) is disabled.


Discount Code in Easy Digital Download

I doing the custom extension for easy digital download. Following is the little confuse for me. **For Example** Here is the discount code of price `$100` and the product price is `$50` if i use the discount code of checkout page it update and saying the free download option. But my question is to update the coupon code again to say another `$50` if i use the coupon code again for some `max uses` is `1` I want to know how to know how to update the discount code if it is use in any product.(Only if the product price is lesser than discount code). Because my custom extension is doing to create the coupon code for one person itself. I am not sure is there is a way to find which coupon code is for which product. if the coupon code value is higher than the purchasing product then update the coupon code to the edd which the remaining value.               Product Price: $40     Discount Price: $100     Checkout Did with      Product price of $0       But In this case `Update Discount Code as with Remaining $60`. Is it possible to do that in easy digital download. Thanks, vicky


First argument is expected to be a valid callback for cp_admin_init and _canonical_charset

I'm using **WordPress 3.5** with child-theme of **Twenty Eleven 1.5**. Suddenly I'm getting following Warning,               Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'cp_admin_init' was given in /home/templ/public_html/wp-includes/plugin.php on line 406          Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '_canonical_charset' was given in /home/templ/public_html/wp-includes/plugin.php on line 173      I'm using following plugins:   * download-manager 2.3.9   * wordpress-seo 1.4.7   * wp-pagenavi 2.83 Some more points: 1) If I'm giving _mysite.com_ it's giving above 2 line warning. If I give _www.mysite.com_ , the following line also include,               Warning: Cannot modify header information - headers already sent by (output started at /home/templ/public_html/wp-includes/plugin.php:406) in /home/templ/public_html/wp-includes/pluggable.php on line 876      2) If I give _mysite.com/wp-admin/_ or _www.mysite.com/wp-admin/_ , It's giving 1st warning and 3rd warning. 3) If I goto _www.mysite.com/wp-login.php_ , It's giving following 5 warning.               Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'cp_admin_init' was given in /home/templ/public_html/wp-includes/plugin.php on line 406          Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '_canonical_charset' was given in /home/templ/public_html/wp-includes/plugin.php on line 173          Warning: Cannot modify header information - headers already sent by (output started at /home/templ/public_html/wp-includes/plugin.php:406) in /home/templ/public_html/wp-login.php on line 368          Warning: Cannot modify header information - headers already sent by (output started at /home/templ/public_html/wp-includes/plugin.php:406) in /home/templ/public_html/wp-login.php on line 380          Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'wp_authenticate_spam_check' was given in /home/templ/public_html/wp-includes/plugin.php on line 173      4) If I give correct username and password, it's not going to login. giving following problem,               ERROR: Invalid username or incorrect password.     ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.      I'm trying to find solution. I can't. Can any-one help me?


something strange is happening to my code

This is my index.php (my homepage). It displays two loops. The first one displays the sticky posts and the second displays all of the posts. The `<div id="primary">` that is located after the first loop is not appearing in my code or functions in my css. This is my code:                   <?php get_header(); ?>

                <?php           $sticky = new WP_Query( array(             'showposts' => 6,             'post__in'  => get_option('sticky_posts'),             'caller_get_posts' => 1 )            );         while ( $sticky->have_posts() ) : $sticky->the_post(); ?>
             <a href="<?php the_permalink(); ?>">               <?php the_post_thumbnail( 'featuredposts' ); ?>
                 <?php echo get_the_title(); ?>

         <?php endwhile; ?>

       <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>          <?php $countpost = $n++ ; ?>          <?php             if ($countpost % 2 == 0) { ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                Its even
          <?php } else { ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
           Its odd

          <?php } ?>                           <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
                      <?php endif; ?>
          <?php get_footer(); ?>      Do anyone know a solution to this problem? Thanks in advance


how specify a directory to file when downloading it

I use this code to download a file from remote server to mine and the file is created and saved but in the home directory and i want it in the plugin directory               $url ='*.dat';     // Use wp_remote_get to fetch the data     $response = wp_remote_get($url);          // Save the body part to a variable     $fileContent = $response['body'];               // Create the name of the file and the declare the directory and path          $file ='*.dat';          // Now use the standard PHP file functions     $fp = fopen($file, "w");     fwrite($fp, $fileContent);     fclose($fp);


How to add meta boxes to the 'Add new post' screen?

I want the user to fill in a form (when they create a new blog post). The results of the form should be embedded within the new blog post. So I am trying to think of the best way of coding this. Meta boxes might be the best way?       **Edit, the original question changed a little. The old one was:** How can I add a Dashboard Widget into a custom Plugin Options Page? I have followed the example here http://codex.wordpress.org/Dashboard_Widgets_API to create a custom Dashboard Widget, but cannot see how to add it into my custom plugin options page (which is found under the 'Settings' sidebar in the Control Panel).


Can 'numberposts' be passed in the URL query string?

I'm running into circles trying to set up a simple rewrite rule, and thought I'd run the question by some of the rewrite experts here. I have a custom post type, "mealplan", and I'm trying to implement a basic url rewrite where visitng `site.com/mealplan/current` will take the visitor to the most recent post of type "mealplan". I've tried using several variants on this rule:               global $wp_rewrite;     $wp_rewrite->add_rule('mealplan/current',        'index.php?post_type=mealplan&numberposts=1&orderby=date&order=DESC',        'top' );       ... but I can't seem to get either the 'numberposts' or the 'posts_per_page' parameters to do anything in the query string like that. It just goes straight to the archive page with the default number of posts per page. This does what I want:               global $wp_rewrite;     $current_mealplan = get_posts( array(       'post_type'=>'mealplan',       'numberposts'=>1,       'orderby'=>'date',       'order'=>'DESC' ) );     $wp_rewrite->add_rule('mealplan/current',        'index.php?post_type=mealplan&post_id='.$current_mealplan[0]->ID,        'top');      ...but at the cost of an additional query and a potential flush rules on every page load. Even if I optimize this by saving the current post ID in an option that's updated on `update_post` (so rules only have to be flushed when they change), this feels like unnecessary work that could be avoided if I could only get the url parameters above to work correctly.


Best Way to Merge a Dev and Live Site to Become a Staging Site?

I have two Wordpress installs, both with a little bit of different data. I have a LIVE site and I have a DEV Site. I need to merge the content of these two databases together to make a STAGING Site. I need to merge the new Posts/Pages/Comments/Categories from DEV to a LIVE database backup, and then make that database become STAGING. What is best, easiest, and least time consuming way of tackling this? NOTE: XML Importer will not work for this task as the amount of data is too large.


Subscribe to this Blog for a Private P2 Themed Site?

What's the easiest way to get a **subscribe to this blog** for a private P2-Themed Site? I want to have an obvious link on the page without having to modify the theme so that everyone using the site can easily see the link. Ideally I'd also be able to see who is subscribed and if possible subscribe them myself _(it's the team members for the project I want to make sure are subscribed.)_ Suggestion for the best plugin for this?


How to install "Wordpress for ios" on Apple's SDK's iPhone/iPad simulator?

How to install Wordpress for ios on Apple's SDK's iPhone/iPad simulator? and what are other ways to make Wordpress Admin compatible with iphone?


Our plugin tags not appearing in WordPress Plugin Repository

We have an appointment calendar plugin at WordPress Plugin Repository. In our plugin **`readme.txt`** , we have already added tags like:               === Appointment Calendar ===     Contributors: a.ankit, FARAZFRANK, harimaliya      Link: http://appointzilla.com/     Tags: appointment, booking, calendar, appointment scheduling calendar, appointment calendar     Requires at least: 3.3+     Tested up to: 3.4.2     Stable tag: 2.4      **Readme Snap:** ![enter image description here](http://i.stack.imgur.com/5UvuJ.jpg) you can check our plugin **`readme.txt`** file at WordPress Plugin Repository: **here** But these tags are not appearing after plugin description at WordPress Plugin Repository. If anybody have any knowledge about this issue then help me. Thanks...


Performance concerns: index.php vs taxonomy-$taxonomy.php

On one of our latest projects I'm planning to use the index.php file to display different taxonomy layouts. Basically I'm planning to use `is_tax( 'sometaxonomy' )` to display the data/loop for different taxonomies. Are there any performance concerns I should address? Is it better to use taxonomy-$taxonomy.php in this case? if so, why? Also, as a somewhat related issue: when using this technique I will need to customize the loop. Is it safe (performance-wise) to use `global $query_string` to alter the query? Or should I, again, simply use taxonomy-$taxonomy.php? Thanks in advance


How can i simulate "taxonomy__in" in query?

How can I have to set tax_query to get results like 'category__in' => array()? Specifically, I would like to show all the posts that have a term from the city taxonomy with one of these id's: `$cities = array(23,34,45,56);` This is the code I currently use.               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(         'meta_query' => array(         array(                 'key' => 'mar_bedrooms',                 'value' => $bedroomss,                 'compare' => 'IN'             ),         array(                 'key' => 'mar_property_for',                 'value' => $property_forss,                 'compare' => 'IN'             ),         array(             'key' => 'mar_price',             'value' => array( $price_min, $price_max ),             'type' => 'numeric',             'compare' => 'BETWEEN'             )         ),         'post_status'=>'publish',         'post_type'=>'post',         //'cat' => 1,         'category__in'=> $type,         //'taxonomy__in'=> $city,         'orderby'=>'date',         'order'=>'DESC'     );     query_posts($args);          if ( have_posts() ) {         the_post();         $a = 1;     }


ReWrite Permalink to New Permalink Nginx

I used to have `/%postname%/` permalink but something odd happened today, all links that I click suddenly redirect to home. So I changed the Permalink to `/%category%/%postname%/` but this is a big conflict in SEO... Here is my question : Is it possible to rewrite `/%postname%/` into `/%category%/%postname%/` What do you think? * * * Well , don't know what has happened , but /%postname%/ redirects to home... so I needed to change the permalink.... Somebody know how to change correct this? * * * Now I just notices this: my website is on /sites/%postname%/ So what is happening here is that every click on every post or page is redirecting me to home.. rewrite rule in NGNIX maybe the problem


Why won't my taxonomy query show up?

I'm attempting to display **posts** from a **'Uncategorized'** category under a custom taxonomy called **'Reviews'** but without much luck. I'm using `get_template_part('loop','review')` to call `loop-review.php` which contains my taxonomy loop but for some reason, nothing will show up. What gives? Here are the contents of `loop-review.php`...

reviews
         <?php               $args = array(             'post_type' => 'post',             'tax_query' => array(                 array(                     'taxonomy'  => 'review',                     'field'     => 'slug',                     'terms'     => 'uncategorized'                 )             )         ); $review_query = new WP_Query($args); ?>         <?php if ($review_query->have_posts()): ?>                 <?php while ($review_query->have_posts()): $review_query->the_post(); ?>
                                 <?php the_content(); ?>                                 <?php the_title(); ?>
                 <?php endwhile; ?>                                          <?php wp_reset_postdata(); ?>         <?php else:  ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
         <?php endif; ?>
      I call `get_template_part('loop','review')` inside my my `category.php`...               <?php           get_header();           if (is_category('portfolio')):          get_template_part('single','portfolio');          get_template_part('loop','review');     else:          get_template_part("single","blog");     endif;           get_footer();           ?>      Lastly, here is the code from my `functions.php`...               add_action('init', 'build_taxonomies', 0);     function build_taxonomies(){             register_taxonomy('review', 'post', array(                 'hierarchical'    => 'true',                 'label'           => 'Reviews',                 'query_var'       => 'true',                 'rewrite'         => 'true'             )         );     }


One page loop issue with posts

I have been working on this loop for a very long time. I think so far this is my best version as it will get page templates. My problem is that it does not get posts and I am not sure why. When I try to get the posts it will display the homepage template about 11 times.                $page_query = new WP_Query(array(         'post_status' => 'publish',         'post_type' => array( 'post', 'page' ),         'order' => 'ASC',         'orderby' => 'menu_order',         'posts_per_page' => '-1',         'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1     ));          if ( $page_query->have_posts() ) : while ( $page_query->have_posts() ) : $page_query->the_post();           //checking if there is a page template assigned to the page     $template = get_post_meta( $post->ID, '_wp_page_template', TRUE );           //if there is a template and it's not the default or homepage template      if( $template && $template != 'template-home.php' && $template != 'default') {           //here we remove ".php"     $template = str_replace('.php','',basename(get_page_template()));              //including the template the correct way     get_template_part('template', $template);      }      endwhile;      endif;       Any attempt to include posts which should be a part of the `$page_query` array fail. I get bad results. I have tried including `category.php`, `get_template_part('content', get_post_format())`. It just gives me messed up stuff. Any ideas?


Saving an array to get_options

1. I'm trying to save an array to get_options in wordpress, I'm aware that I don't have to serialize the array due to get_options doing that.   2. At the moment I don't get any success of failed message upon hitting the submit button.    3. Am I adding the input data correctly to the database using get_options and update_options. If not how can my code be tweaked to accomplish this. add_action('admin_menu', 'dw_quotes_create_menu');              function dw_quotes_create_menu() {         //create custom top-level menu         add_menu_page('Quotes Settings', 'Quotes Styling', 'manage_options', 'dw_quotes', 'dw_styling_quotes_settings');     }              //generating the random quote     function dw_get_random_quote() {               }          function validate_dw_quote() {         //validation here         if (isset($_POST['submit'] ) ) {                  //checking that $_POST['adding_quote'] is set             if( isset( $_POST['adding_quote'] ) ) {                      //retrieve the stored values                 if( get_option( 'list_of_quotes' ) )                     $list_of_quotes = get_option('list_of_quotes');                 else                      $list_of_quotes = array();                      //add the new quote to the end of the array                  $list_of_quotes[] = $_POST['adding_quote'];                      //store the updated quote                 if ( update_option( 'list_of_quotes', $list_of_quotes ) ) {                     echo "Success your quote was added!";                 } else {                     echo "Failed to add quote!";                 }             }         }     }              //styling the admin menu     function dw_styling_quotes_settings() { ?>
Quote Setting
              <form action="admin.php?page=dw_quotes" method="post">         Enter your quote         <input type="textarea"  name="adding_quote" />         <input type="submit" name="submit" value="add the new quote" />              <?php //test the output          var_dump($list_of_quotes);         ?>


Trying to Implement .pdf File Upload in Admin for plugin

This is the first time in my plugin development that I have had a need to upload a file. UH-OH!!! I create my plugins OOP and I have always used jQuery .serialize to post the data to my plugin.php file but I can't do that and upload a file. The admin form that will allow the admins of the site to upload .pdf files for their users:
                 <?php                      echo '';                 ?>                                   Add New Document

                 <form id="frmNewDocument" action="<?php echo plugins_url('new_document.php', dirname(__FILE__)); ?>" method="POST" enctype='multipart/form-data'>                     <input type="hidden" name="post_date" value="<?php echo date('Y-m-d'); ?>">

                                                                                Select Group (required)                                                                      	         <select name="groupID" id="groupID">                                         <?php foreach($groups as $group): ?>                                             <option value="<?php echo $group->id; ?>"><?php echo $group->name; ?></option>                                         <?php endforeach; ?>                                     </select>

                                                                                Document Name (required)                                                                      	         <input type="text" id="document" name="document" value aria-required="true" />

                                                                                Description (required)                                                                      	         <textarea id="description" name="description" value aria-required="true"></textarea>

                                                                                Upload PDF: (required)                                                                      	         <input type="file" name="doc" id="doc" />

                         <button href="#" class="btnCancelAdd">Cancel</button>                                                       <input class="button button-primary" type="submit" id="btnNewDocument" name="newDocument" value="<?php _e( 'Add New Document' ); ?>" />
                 </form>      In the root of the plugin folder, I created the new_document.php to handle the upload. I want to create a camelCase name for the .pdf created from the "document" field. Here's what I have in that file:               <?php     require_once('/public_html/wp-config.php');     global $wpdb;          define("UPLOAD_DIR", '/public_html/wp-content/uploads/gdocs/');          if( !empty( $_FILES['doc'] ) ):         $uFile = $_FILES['doc'];               if ($uFile["error"] !== UPLOAD_ERR_OK) {             echo "
An error occurred.
";             exit;         }              $post_date = $_POST['post_date'];         $groupID = $_POST['groupID'];         $document = $_POST['document'];         $description = $_POST['description'];              $d_pieces = explode(' ', $document);         $new_name = ' ';         $count = 1;              foreach ($d_pieces as $piece){             if ($count !== 1){                 $piece = ucfirst($piece);             } // end if             $newName .= $piece;             $count++;         } // end foreach              $flName = $newName.".pdf";         $fileName = strtolower( $flName{0}) . substr($flName,1);              $success = move_uploaded_file($uFile['tmp_name'], UPLOAD_DIR . $fileName);     else:         echo "No File Uploaded.";     endif;          $wpdb->insert( 'ppm_group_documents', array( 'groupID' => $groupID, 'post_date' => $post_date, 'document' => $document, 'description' => $description, 'path' => $fileName ), array( '%s', '%s', '%s', '%s', '%s' ) );          header('Location: http://[sitename]/wp-admin/admin.php?page=ppm-doc-viewer');     ?>      ---UPDATE--- The code above works but it is a PHP only rather than WordPress solution. I hope someone could point me to a book or article explaining how to uploads files the "right way" in an OOP plugin. ---END UPDATE-- I am only getting the white screen of death and through FTP, I checked the upload folder and the file isn't there. Since this is a live site, I can't turn on debugging. I am hoping someone will spot something I am doing incorrectly but would also like it if someone could point me to a book or article explaining how to uploads files the "right way" in an OOP plugin. Thanks in Advance!!!


Automate post creation in wordpress

I have a database which has 2000 items. I would like to a) create a page for each item b) Create another page comparing two items. With 2000 items I can create thousands of pages. I am from java programming background so my solution was to write code which will fetch all the items from the database a) run in a loop and create the pages b) run two loops and pass in if of items. Code will fetch details and create the pages. My questions Is the right way to go create searchable, SEO friendly page for each item ? Where do I create the code to execute the desired functionality ? Will it be a plugin or function or a script ?


Plugin Flexible Captcha Image Generates 500 Internal Server Error

I am getting an internal server error on a captcha image at http://dev.smithonstocks.com/newsletter-subscription/ and I do not know why. **Screen Shot Exhibit** ![enter image description here](http://i.stack.imgur.com/xfr9P.jpg) **Research I have Done** - I have Googled this issue extensively for 3 days now. I have posted this issue here on WPSO on 2 other occasions. I have emailed the developer 3 times (no response). I have offered to pay the developer to solve the issue. I have looked at the server logs for the 500 error and they tell me nothing. I have increased my server memory from 256M to 512M. I turned PHP error display on for ALL errors (nothing revealed). I have posted 3 WordPress Forum messages (no helpers). **What I Need to Have Happen** - to get the Captcha Image to render **Server Error Log Excerpt**               123.456.789.012 - - [30/Dec/2013:11:52:45 -0500] "GET /?FC_captcha_request=a3916daa8e4597cbe764dccb03c45cc0&rs=1388422365&cwidth=200&cheight=24&uniqueID=a6346bb16d4c875c15269ae86fabd1fe HTTP/1.1" 500 - "http://dev.smithonstocks.com/newsletter-subscription/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"      **My Custom Tweaks to Server**               PHP_INI('memory_limit'): 512M     PHP_INI('safe_mode'): off     cURL is Enabled     IMAP Extensions are Enabled within PHP     mcrypt() is Enabled within PHP     PDO is Enabled     PEAR is installed     PHP GD Support: bundled (2.0.34 compatible)


Display WP Start bar on front page only

I was wondering if someone could help me display the plugin WP Start bar only on my static frontpage. If it helps my static frontpage url is: http://zackarylundquist.westhostsite.com/portfolio/


Cannot Save Data to the wp_options table using the wp_editor

The following code I have written is not saving the data to the wp_options table:               function create_company_paragraph_1(){     ?>
Write the text you want to be displayed in the first paragraph in the company info secition.
     <?php         $options = get_option('company_info_arraykey');         $args = array(             'wpautop' => false,             'textarea_name' => 'company_info_arraykey[textarea_one]',             'media_buttons' => false,             'textarea_rows' => 5         );         wp_editor( '', "company-paragraph-1-editor", $args);          }      When I type anything into the editor and press submit when the page refreshes the data is gone and not saved. I know this works because on another option using a text input box it works see below:               function create_input_company_title_option() {         $options = get_option('company_info_arraykey');         ?><input type="text" name="company_info_arraykey[company-title]" value="<?php echo $options['company-title']; ?>" /><?php     }      I just need to know what little thing I am doing wrong?


Trouble preventing duplicate posts between 2 loops on homepage

I know this topic has been covered multiple times before, but I've tried every tutorial I've found online and haven't been able to figure it out. I'm using the free NewsMojo theme (http://fthemes.com/newsmojo-free-wordpress- theme/) on my blog (http://eldoradofrontier.com/) and would like to have the posts appearing in the "featured" carousel not also appear in the main feed below it. I don't want to use any category filtering, because I expect my site to have too many new posts for it to make sense to have to go back and remove old posts from the featured carousel. I don't know much about PHP, but I tried the $do_not_duplicate trick mentioned in the codex ( _it won't let me post the link because I'm new_ ) without any success. As far as I can tell, these are the two loops on my homepage: One, in the file template.php in the folders "featuredposts":               <?php                 $featuredposts_source = $this->theme->get_option('featuredposts_source');                 $featuredposts_moreoptions = $this->theme->get_option('featuredposts_moreoptions');                      $featuredposts_query = false;                      if($featuredposts_source == 'category') {                     if($this->theme->display('featuredposts_source_category')) {                         $featuredposts_query = 'posts_per_page=' . $this->theme->get_option('featuredposts_source_category_num') . '&cat=' . $this->theme->get_option('featuredposts_source_category');                     }                  } elseif($featuredposts_source == 'posts') {                     if($this->theme->display('featuredposts_source_posts')) {                         $featuredposts_query = array('post__in'=> explode(',', trim($this->theme->get_option('featuredposts_source_posts'))), 'post_type'=>'post');                     }                  } elseif($featuredposts_source == 'pages') {                     if($this->theme->display('featuredposts_source_pages')) {                         $featuredposts_query = array('post__in'=> explode(',', trim($this->theme->get_option('featuredposts_source_pages'))), 'post_type'=>'page');                     }                  }                      if($featuredposts_query) {                     $featuredposts_excerpt_length = $this->theme->get_option('featuredposts_excerpt_length');                     query_posts($featuredposts_query);                     if (have_posts()) : while (have_posts()) : the_post();                      ?>      And the next, in the file loop.php:               <?php     global $theme;     if (have_posts()) : while (have_posts()) : the_post();     ?>      I think I need to create an array with the post IDs in the first loop, then tell the second loop to ignore those posts ... right? But how do I do that? Thanks in advance for the help, and sorry for the noob question! -Cody


get cat id is not working from custom taxonomy

I have a custom taxonomy "city". I am having a hard time to get cat id. the number. It's also custom post type "job" This works only for default category under the default post.                 $provinceID = get_cat_ID($cityname);       echo "
bb=".$provinceID."
";      I have found this one but it's not also working as well. the function name was get_cat_ID and it caused an error. so I have changed name.                 function get_cat_ID11( $cat_name='$cityname' ) {     $cat = get_term_by( 'name', $cat_name, 'category' );     if ( $cat )         return $cat->term_id;     return 0;       }            echo get_cat_ID11;      How can I get the cat id from custom taxonomy , custom post type?


How to add a new link to the default register form's footer links?

I would like to add a custom link to the footer section of the register form. How can I do this? I am using the `login_footer` hook:               add_action( 'login_footer',array($this, 'add_forum_menu'), 50, 2 );     function add_forum_menu() {         //need code to append the new items on the menu      ) );      ![enter image description here](http://i.stack.imgur.com/ULLVG.png)


Fetching posts that match a User Profile setting

I have a Custom Field in my User Profile page that allows site authors to specify which town they come from when they set up their account. The towns are in the form of a selectable dropdown select element. What I would like to do is query the WP database to populate a dropdown of all the towns on the **front end** of my WP site and, when one town is selected, go to a page that lists all the authors who live in the town selected. I don't have any code as I'm not even sure how to begin such a thing.


How to override the wordpress default widget markup

I am new to wordpress, Here i use the wordpress TwentyEleven theme, i need to customize the widget markup. It means the suppose i want to change the element 'ul' to div and add some class or id to this element. Now currently it was not possible for me because the wordpress default widgets are already available inside wordpress core file..


Replacing a placeholder term with a session variable value in taxonomy filter

I have in my themes some code which will set a session variable. For the sake of example, it's a geolocation routine which will set to either USA, UK or ROW, resulting in:               $_SESSION['region'] = 'USA';      and I have a custom taxonomy of 'regionok' which any or all of the same terms are set. I wish to use the session variable value as the taxonomy term to filter on. The cleanest solution I can imagine would be to have a filter hook in my functions.php which would replace the placeholder term 'auto-region' with the session value before each query is executed. That way I can use widget plugins without having to hack them - I would just use the placeholder term in configuration. However, I don't know what the relevant hook would be. (Other use cases would be session variables for family filter, referrer, etc. The geolocation example is entirely incidental.)


How to add custom columns to Custom Post Type admin screen

I have another dumb question, but I can't get one thing :) I've found this very good article on creating custom post types: http://thinkvitamin.com/code/create-your-first-wordpress-custom-post-type/ I'm not sure how Step 4 works. This guys writes:               add_action("manage_posts_custom_column",  "portfolio_custom_columns");     add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");          function portfolio_edit_columns($columns){       $columns = array(         "cb" => "<input type=\"checkbox\" />",         "title" => "Portfolio Title",         "description" => "Description",         "year" => "Year Completed",         "skills" => "Skills",       );            return $columns;     }     function portfolio_custom_columns($column){       global $post;            switch ($column) {         case "description":           the_excerpt();           break;         case "year":           $custom = get_post_custom();           echo $custom["year_completed"][0];           break;         case "skills":           echo get_the_term_list($post->ID, 'Skills', '', ', ','');           break;       }     }      I have two different post types ('books' and 'movies'). And I can't get how to link this code with right one! I'm sure I'm missing something (most likely in the code), but I didn't see him including "portfolio_edit_columns" anywhere in the code. I have found this in WP Codex: http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column and it seems like > manage_edit-${post_type}_columns does the magic, but I've tried both manage_edit-books_columns and manage_edit- movies_columns and nothing! :) So how to create two separate column layouts for different post types?


Wordpress Theme Development Seemingly Awful Partitioning of Includes?

I just finished a tutorial that told me to create my `header.php` without closing a tag at the bottom of the included file. Now while I realize that in anyone of the parent files which includes `header.php` it includes the closing tag; this really goes against my better judgement as a front-end developer; because someone who edits the theme later (and it could be me, it could be somebody else) would have to know that this tag needed to be closed in the parent file which includes it. It just feels wrong. It feels like when your editor marks the tag as "an extra closing tag" you want to delete it. I'm not breaking a standard if I use:               <?php include(TEMPLATEPATH . '/justTheHTMLHeader.php'); ?>     <!-- AND -->     <?php include(TEMPLATEPATH . '/justTheBlogHeader.php');` ?>      instead of `get_header()`? It seems to me that this approach would be more modular and not leave any extraneous tags not closed between included files and their parents. I also noticed that the default Wordpress template is setup this way, so I'm obviously wrong and breaking some sort of Wordpress theme standard not matter what I think. What's the reasoning behind this?


how could I have a user signing up for a blog, be assigned to that blog only

We have a WPMU instance: http://my.blogs.com/blog1 http://my.blogs.com/blog2 Now, blog1 is closed to used registration, while blog2 us open to users registering and posting. now, how do I get to have a user added to only blog2 when he signs up ? as of now, he is not added to any blog and only this. Now, if I have blog3, which also has registration enabled, how could a user signup only to that ? Is there a plugin that can detect the blog URI and add the user only to that ?


Automatically create a loop for post ID

I am having trouble generating a loop for my post. The JS calls the slide_ID which then needs to display each slide-ID in numeric order for it to work. Example for slide-1 to scroll to its next slide the slide_ID needs to be slide-2 (this is being controlled by a next button). The problem is not in the JS but within the loop. I need to populate each post so each post ID number is in numeric order.                 <?php if (have_posts()) : ?>       <?php while (have_posts()) : the_post(); ?>             <section id="<?php $x=1; do { echo "slide-$x"; $x++; } while ($x<=1); ?>" class="homeSlide">                   <div class="bcg"                          data-center="background-position: 50% 0px;"                          data-top-bottom="background-position: 50% -100px;"                          data-anchor-target="#<?php $x=1; do { echo "slide-$x"; $x++; } while ($x<=1); ?>">
                   <div class="hsContent" data-center="opacity: 1" data-106-top="opacity: 0" data-anchor-target="#<?php $x=1; do { echo "slide-$x"; $x++; } while ($x<=1); ?> h2">
Fade out elements before
they leave viewport

This slide moves background image at a slower speed then the page scroll.

       <?php endwhile; endif; ?>      The loop I am using to display the slide ID number is $x=1; do { echo "slide-$x"; $x++; } while ($x<=1); but I can not seem to figure out how to change the number automatically when a new post has been submitted. Any help would be great


Problem converting tags to categories while having large number of tags

I'm trying to convert some tags in my website to categories, via either Wordpress import tools or Taxonomy Converter plugin. In both cases, I get **Internal server Error** , when I try to query (load) the tags, because my website is having over 20,000 tags. Is there a manual or MySQL query method I can use for converting? Since my website can't just display the 20,000 tags in a single page for me to choose from.


How to add custom rewrite rule to .htaccess?

I want to add a custom rewrite rule to my .htaccess file using a function inside functions.php The rewrite rule I want to add is as follows: `RedirectMatch 301 ^/author/(.+)$ http://name-blog.com/$1` I know there is a wordpress function that adds a rewrite rule to the .htaccess: `$wp_rewrite->add_external_rule( 'mobile/([^/]+)$', 'mobile/index.php?action=$1' );` So, how can I use that to add my rewrite rule to .htaccess? ## SOLVED! I found the solution just after posting here. Here is the codex: http://codex.wordpress.org/User:Amereservant/Editing_and_Customizing_htaccess_Indirectly And this is the code I was looking for:               function my_htaccess_contents( $rules )     {     $my_content = <<<EOD     \n # BEGIN My Added Content     # Protect wpconfig.php     <Files wp-config.php>         Order Allow,Deny         Deny from all     </Files>     # END My Added Content\n     EOD;         return $my_content . $rules;     }     add_filter('mod_rewrite_rules', 'my_htaccess_contents');


Disable user profile editing for one user

I have being looking in internet how can I disable the option of edit profile in Wordpress for a user and I didn't find a good way. The problem is that I want that the 95% of users can edit their profiles (address, telephone,...) but there is another 5% that I don't want them to have access to the profile section. The best solution for me is to select manually the users that I want to disable but I also thought about create a role or a group of users to manage it. There is no plugin for this and the only thing I have found is the following code but it is not working.               add_action('admin_init', 'user_profile_fields_disable');          function user_profile_fields_disable() {              global $pagenow;              // apply only to user profile or user edit pages         if ($pagenow!=='profile.php' && $pagenow!=='user-edit.php') {             return;         }              // do not change anything for the administrator         if (current_user_can('administrator')) {         return;         }         if (current_user_can('custom_role') {           add_action( 'admin_footer', 'user_profile_fields_disable_js' );         }           }     /**      * Disables selected fields in WP Admin user profile (profile.php, user-edit.php)      */     function user_profile_fields_disable_js() {     ?>         <script>             jQuery(document).ready( function($) {                 var fields_to_disable = ['email', 'role'];                 for(i=0; i<fields_to_disable.length; i++) {                     if ( $('#'+ fields_to_disable[i]).length ) {                         $('#'+ fields_to_disable[i]).attr("disabled", "disabled");                     }                 }             });         </script>     <?php     }      You have to substitute the "custom_role" with the name of the role I have assign to the user. Is that code obsolete or bad? Any idea of how to solve it? * * * Thank you very much G.M.! It was a great and perfect solution. I forgot to tell that I am using the Woocommerce plugin and I still have the problem of profile editing in the "my account" page. Could you add something to the plugin above to remove the "edit" link? I don't mind that the user can read his profile but don't allow to edit it. Here is what I am talking about (some fields are in spanish): ![enter image description here](http://i.stack.imgur.com/Py9h1.jpg) Thanks again for your work!


custom processing for posts

Although I'm very well aware of PHP, but I'm kind of new to WordPress. So I created this WordPress site, but there's a bunch of posts that I want them to include some PHP and JavaScript and HTML codes.   for example, let's say that I want some POST to include an HTML code like this

___XXXXXX___

                      <?php          /*some php code here*/      ?>      and the **_ _xxxxx_ _** should be changed according to client input. but the client has no coding background at all. so is there some type of custom forms that I can add to the (add new post) page ? or is there a way to add new post type with different processing ?      also it should be inside the wordpress Dashboard


Multiple post back-to-back display only one gallery

I have 3 post, post1=text, post2=text and gallery1, post3, text and galery2 I like to list ALL the post from one category, and the result is all the data get out, but the gallery associated with the post is ALL THE SAME. yep the second post and post#3 have the same picture... the problem, the shortcode of gallery is associated with post, but with all the post display in a single page, the gallery are not specific what i have done wrong ? some code :               //Add a ShorCode to get a page/post content     add_shortcode ('page','get_page_content');        function get_page_content ($att) {            if (is_array($att)) { $req_id = $att['id']; }            else { $req_id = $att; }            $post = get_page($req_id);             $content = apply_filters('the_content', $post->post_content);            return $content;        }


jQuery conflict

I am trying to run the following jQuery to change the text of my username and password boxes so that they do not need a label (inside `<script>` tags):               jQuery(document).ready(function($) {         $('#user_login1').val('Username');         $('#user_pass1').val('Password');         $('#user_login1').focus(function(){             $('#user_login1').val('');         });         $('#user_pass1').focus(function(){             $('#user_pass1').val('');         });     });       The code works on jsFiddle **[updated]** (proving it's a WP issue not a jQuery issue). I have tried without the `function($)` modifier and replacing the `$` with `jQuery` but to no avail. ~~I am "trusting" the folks that codeUse Google Libraries to sort the jQuery out on my site meaning my jQuery include looks like this: `<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>`~~ **EDIT 1** Now not calling it at all, as when I add `wp_enque_script('jquery');` it breaks the admin pages showing nothing but a blank white page. Never the less jQuery gets called like so:               <script type="text/javascript" src="http://elitetradersgroup.com.au/wp-includes/js/jquery/jquery.js?ver=1.7.1"></script>      **END EDIT 1** **EDIT 2**   * Changed spelling to `wp_enqueue_script('jquery');`   * Changed `$` in jQuery to `jQuery`   * It has become apparent that jQuery is broken site wide, save wp-admin Still not working. The above location (edit 1) that the jQuery is called from does exist. I noticed that it calls `jQuery.noConflict()` twice. Once in the output of the page, and once at the bottom of the jQuery file. **END EDIT 2** **EDIT 3** In response to Chip Bennett here is the call found in `functions.php` of my theme.               wp_deregister_script('jquery');     wp_enqueue_script('jquery');      It also occured to me I had not posted up my website for testing, outside of the jsfiddle code. The form I am trying to get working is on the top right of this page: http://elitetradersgroup.com.au/ **END EDIT 3** **EDIT 4** Replaced the jQuery in edit 3 with the following based off of chip bennett's answer               function wpse45377_enqueue_scripts() {         wp_enqueue_script('jquery');     }     add_action( 'wp_enqueue_scripts', 'wpse45377_enqueue_scripts' );      I also thought to look at the console output in Chrome's dev tools and got this:               Uncaught ReferenceError: jQuery is not defined   Line:25         (anonymous function)      The code it is referencing is this               25: <script type='text/javascript'>jQuery.noConflict();     26: /* <![CDATA[ */     27: var tb_pathToImage='http://elitetradersgroup.com.au/wp-includes/js/thickbox/loadingAnimation.gif';     28: var tb_closeImage='http://elitetradersgroup.com.au/wp-includes/js/thickbox/tb-close.png';     29: /* ]]> */     30: </script>      **END EDIT 4** Which is the same version of jQuery that jsFiddle uses so I can't understand why this isn't working. A little help would be much appreciated.