All new plugins generating 311 chars of unexpected output?

At some point, I started getting a message about 311 characters of unexpected output at every plugin activation. The number is always the same, and it happens for every plugin activation, including reactivating plugins that were temporarily deactivated. The exact message: > The plugin generated 311 characters of **unexpected output** during > activation. If you notice “headers already sent” messages, problems with > syndication feeds or other issues, try deactivating or removing this plugin. Is this likely to be a problem with a plugin that has extra whitespace in its files or something? I haven't yet gotten any problems with headers already having been sent. Possibly it's related to the weird 404 errors I get in wp- admin, but that problem was around long before this unexpected output issue.


Plugin that provides the [edit] shortcode?

Several months ago, I was browsing around the Internet and came across a WordPress site that had updates on the posts enclosed in `[edit]...[/edit]`. Obviously this was a function provided by a plugin that was no longer active. I searched Google and the WordPress plugin directory for a plugin that provided this shortcode, but found nothing. Presumably the content within `[edit]...[/edit]` (or `[edit date="yyyy-mm-dd"]...[/edit]`) was displayed in a special way, like a revision list below the post or something. Are there any plugins that do this? I immediately wanted to add the functionality a plugin that would use a shortcode set up in that way to my site, but couldn't find the plugin.


How to create a static player top or bottom of wordpress?

I'm creating two websites, one radio station and one bands website. I want to add a player (already have a php with the player in it) to the top of the page, like a frame. The main point is to have the player playing music while people can navigate to other pages without interrupting the player. I've created the following:               <frameset framespacing="0" border="0" frameborder="0" rows="*,65">         <frame name="main" target="_self" src="http://www.website.com/index.php" scrolling="auto">         <frame name="footer" scrolling="no" noresize="noresize" src="http://www.website.com/player">         <noframes>      However this creates a loop.


Where are the options "template" and "current_theme" derived from

My theme is in a folder called "mytheme" and the "Theme Name" in the style.css is "My Theme". From that, I'm guessing that the option "template" in the options table is a reference to the folder, not the "Theme Name". I'm asking because I want to be sure that the value I should pass to switch_theme() is a reference to the foldername mytheme, not the theme name "My Theme" ?               switch_theme('mytheme', 'style.css')


Define menu_order on Creation of New Custom Post?

I've created a custom post type called `video` and I'm using a plugin called `Playlist_Order` (which changes the `menu_order` field) to allow the user to use a drag and drop interface to order their videos in a playlist. However, when adding a new post the video appears at the top of the playlist because it's given a default `menu_order` value of `0`. On creation of a new video post I would like it to appear last in the playlist - i.e. query all `video` post types, find the largest `menu_order` value and then set this `+1` for the new post. How can I implement this?


How can I make an Ajax login form work with FORCE_SSL_ADMIN enabled?

I'm working on a site that requires an https secured admin area and a secure front-end area as well where private information will be shown. My preference for user login is an Ajax-enabled widget that can be shown on every page of the site, but I'm not able to make it work when passing submitted form data from the non-secured pages to the login page. I started by using the Login With Ajax plugin, which with a few modifications, plays well with SSL for the most part, and it works fine when logging in from a page that's being accessed by https... and it also works fine when FORCE_SSL_ADMIN is turned off. But when trying to log in from the widget on a non-secured page with FORCE_SSL_ADMIN on, I can't get an response from the server. Are there any existing plugins which solve this problem? And if not, anyone have any solutions? Maybe a secured form embedded in an iframe is my best idea so far... just thinking that there must be an easier way. ### *Edit: Offering Bounty* I'm adding a bounty to this question because I'm still curious. I worked around this in my project by just giving up on the widget and displaying a link to the wp-login page. But being able to embed a secure login form on a non secure page would be a much better solution. I'll award the bounty to anyone who can show code that would work to make that happen, or point me to a plugin that already does this.


Headers already sent - Wordpress core

I'm getting an error on my site regarding "headers already sent": > Warning: Cannot modify header information - headers already sent by (output > started at ........./wp-admin/menu-header.php:161) in ....../wp- > includes/pluggable.php on line 881 I read the Wordpress FAQ that discusses this, but - as you can see - this error is caused by the Wordpress core (and not even at the end of a file). Interestingly, I don't get this error on my local machine. Only on my server. What can I do about this? I'm running Wordpress 3.4.2


Loop after page content

I just upgraded to 3.4.2 from 2.9 (i know, i know, but if it ain't broke...) I have page templates that are (or at least were) set up to display the page content first, then start a loop of posts, like so:

ABOUT THE SITE

             <img src="<?php bloginfo('template_url'); ?>/images/headline.gif" />
<?php the_content(); ?>

POSTS BY DATE

                 <?php                     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                     $args= array(                         'cat' => 8,                         'paged' => $paged                     );                     query_posts($args);                 ?>                 <?php if (have_posts()) : ?>                 <?php while (have_posts()) : the_post(); ?>                 <?php                     $key="main img";                     $my_main_img = get_post_meta($post->ID, $key, true);                     $key="thumb img";                     $my_thumb_img = get_post_meta($post->ID, $key, true);                 ?>                 <div <?php post_class() ?>>

                 <?php endwhile; ?>                 <?php else : endif; ?>

<?php previous_posts_link(' ') ?>

<?php next_posts_link(' ') ?>

      This worked great in 2.9 but in this new upgrade it isn't displaying the page content. I have multiple page templates and was able to fix it on the pages that ran simple queries (like list of the blog contributors) by putting               <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>      before `<div id="content">`, but as you can imagine on the main blog archive page this isn't an option. (I tried just to be sure). So how does one get the contents of the page outside the main loop? Do I have to run two loops? It seems this would be a simple enough thing but I can't work out how. I can't run a simple query in this page because there's all sorts of crazy stuff going on in there. Or can I?


How to disable core and plugin updates

Is there any way to disable core and plugin updates? I am modifying a plugin and bit of **WordPress Core** (I know its a sin to do so), but can't help it.


How to get post meta in functions?

I set an email button in functions php. The email is sent when clicking on a front-end update post button. The problem is: the email is sent but I can't get the post title to appear in the post. I guess I didn't correctly set the post_title variable... Anyway, here's the code (taken and partially edited from a old wp answers thread). For the button               function show_publish_button2(){     Global $post;         echo '<form name="front_end_publish" method="POST" action="">                 <input type="hidden" name="pid" id="pid" value="'.$post->ID.'">                 <input type="hidden" name="FE_PUBLISH" id="FE_PUBLISH" value="FE_PUBLISH">                 <input type="submit" name="submit" id="submitp2" value="" onClick="return confirm(\'are you sure?\')">             </form>';     }      for updating the post and emailing               if (isset($_POST['FE_PUBLISH']) && $_POST['FE_PUBLISH'] == 'FE_PUBLISH'){     if (isset($_POST['pid']) && !empty($_POST['pid'])){     update_post_meta((int)$_POST['pid'], 'rivedi_check', 'false');     $ogg = $post->post_title;         $to = 'email@adress.com';     $subject = 'Post updated';     $message = 'Post title '.$ogg;             wp_mail(                 $to,                 $subject,                 $message             );      }     }      I also tried with:               $ogg = get_post($post->ID, post_title);      But it's the same, it doesn't work. The only thing that is written in the email body I receive is: "Title of the post: ".


wordpress page is broken when trying to connect to facebook php SDK

I have a strange issue when trying to connect to Facebook php SDK from my WordPress site. I have followed all instructions as shown on Facebook developers and other sites - I have an app on Facebook and I have downloaded the latest Facebook SDK.               session_start();     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookSession.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookRequest.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookResponse.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookSDKException.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookRequestException.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/GraphObject.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookRedirectLoginHelper.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookAuthorizationException.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookJavaScriptLoginHelper.php');          use Facebook\FacebookSession;     use Facebook\FacebookJavaScriptLoginHelper;     use Facebook\FacebookRedirectLoginHelper;     use Facebook\FacebookRequest;     use Facebook\FacebookResponse;     use Facebook\FacebookSDKException;     use Facebook\FacebookRequestException;     use Facebook\FacebookAuthorizationException;     use Facebook\GraphObject;          FacebookSession::setDefaultApplication('172357792955421', 'b0a5bc2aeb8b2a8712c0af6f01e45c1a');          $helper = new FacebookJavaScriptLoginHelper();     try {       $session = $helper->getSession();     } catch(FacebookRequestException $ex) {       echo 'Facebook returns an error';     } catch(\Exception $ex) {       echo 'When validation fails or other local issues';     }     if ($session)       echo 'logged in';     else       echo 'not logged in';      I have also tried:               require_once( ABSPATH . 'facebook-php-sdk-v4-4.0-dev/autoload.php' );      instead of requiring each single php. The problem is that the page is broken - cut off, with no header and side tab. I dont see any errors or warnings. **if I make some of the require_once as comments (with //), then the page is not cut** (but then of course this doesn't work). ![screenshot of how the page looks like](http://i.stack.imgur.com/3Q5jI.png) I guess something in WordPress is doing the problem, but I can't figure out what it is. Appreciate any help with this. Thanks


Get style and script file versions and use them while writing a cache manifest file

Earlier I've learned how to remove file versions from wordpress style and script file source links inside the `wp_head` function. From here: How to remove file versions from the file source links in wp_head? I had a good reason needing that action. Why? While writing a cache manifest file, inside that file I managed to write also absolute source links, but without `?ver=` parameter. `wp_head` has generated the used theme with `?ver=` parameter the syle and script file inclusions. So there was smooth differences between the cache data and theme data. I don't know if that was the reason not getting the styles while being offline my test site. **Question:** Now what I'd like to know, is the way how can I add `?ver=` parameter to the cache manifest file entries. I'm writing this way the cache file's lines:               $hashes = "";     $network = array("\n\nNETWORK:");     $cache = array("\n\nCACHE:");     $path = get_stylesheet_directory()."/";     $dir = new RecursiveDirectoryIterator( $path );          foreach(new RecursiveIteratorIterator($dir) as $file) {         if ($file->IsFile() && $file != "./manifest.php" && substr($file->getFilename(), 0, 1) != ".") {             if(preg_match('/.php$/', $file)) {                 if (isAllowedExtension($file))                     array_push($network,"\n" . str_replace($path, './', $file));             } else {                 if (isAllowedExtension($file))                     array_push($cache,"\n" . str_replace($path, './', $file));             }                  $hashes .= md5_file($file);         }     }      Hence this aren't absolute url's, I'm just curious how could be possible adding the `?ver=` parameter to this file url's? :) === Update:               if( !strpos( $file, '?ver=' ) ) {         $file = add_query_arg( 'ver', $file );         return $file;     }      This is only a try... Not complete code. First I think we should check if the file has any version, then add the version parameter after the source url.


Combining multiple conditional statements

I need a 3 part conditional statement with all negatives but I can't get it to work. I need to say that the post isnt in category 'videos' or its child categories and isn't from the author with the id of 3. This is what I had but obviously doesn't do the trick.               if (!in_category('videos') || !post_is_in_descendant_category(9) && !is_author('3'))


Posting to most pages throws 404

I have a problem with a Wordpress installation where POST requests to any page apart from a couple in the root fail with a 404. POSTing to wp-atom.php succeeds, but POSTing to another custom page in the root fails with a 404. Wordpress is processing the request as its the Wordpress 404 page that is being returned. Is there some filter that could be intercepting the request and denying all but a few POST requests?


What is the major difference between child theme and normal theme

What is the exact difference between child theme and normal theme? And what are the advantages of using child theme.?


Get comments after specific date

I don't think this is a parameter in get_comments( $args ); so I'm using a SQL statement. First I obtain a comment date from a separate table I created. Afterwards, I want to retrieve all comments made after that date.               $last_updated_comment = "         SELECT comment_date FROM wp_last_comment         ORDER BY comment_date DESC LIMIT 1";     $last_updated_comment = $wpdb->get_results( $wpdb->prepare($last_updated_comment));     print_r( $last_updated_comment );      This produces:               Array ( [0] => stdClass Object ( [comment_date] => 2012-03-09 09:03:00 ) )       Therefore, I add the foreach statement to access the object within the array:               foreach($last_updated_comment as $key => $object){     print_r( $object);     echo "

";     }      @Stephen Harris, Thanks for the syntax help. Next, foreach object, get the date:               foreach($object as $key => $date_lookup){         echo $date_lookup . '

';     }      With output:               $date_lookup = 2012-03-09 09:03:00      * * * Part 2: Comparing dates in SQL statement Now that I've obtained the reference date, I want to get all comments from wp_comments after $date_lookup:               global $wpdb;     $sql = "         SELECT comment_post_ID, comment_author, comment_author_email, comment_date, comment_content, comment_approved, comment_type, comment_parent         FROM wp_comments WHERE comment_date > '%$date_lookup%' ";     $new_comments = $wpdb->get_results($sql);     print_r( $new_comments );      Now it seems that the > operator is looking at the time and ignoring the year because my output includes an array of comments with dates from 2011. Is the > operator the correct tool to use?


Filter posts under multiple categories?

How do I filter the posts by multiple categories? For example, if some of my posts are categorized under just apples and some as just oranges and some both, how would I filter the results to show only posts marked under both apples and oranges? In other words, I don't want the results to list all posts under apples and all posts under oranges. I only want to show posts listed under both apples and oranges. Is there a way to do this?


Auto embeding Vimeo/Youtube in custom fields (tinyMCE editor)

I'm using 2 extra TinyMCE editors on my pages to add extra textfiels in my theme pages. I now realize that the auto-embed feature is not supported on content delivered thought custom fields. So i need to tell WordPress to enable this on these two extra custom fields. Here is an example of the back-end part included in my functions.php file:                   function monster_meta_options() {         global $post;         $custom = get_post_custom($post->ID);         $monster_tiny_1 = (isset($custom['monster_tiny_1'][0]) ? $custom['monster_tiny_1'][0] : '');         //Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'myplugin_noncename' );              //TinyMCE field! :)         $args = array('wpautop' => true, 'media_buttons' => true, 'quicktags' => true,'textarea_name' => 'monster_tiny_1');         wp_editor( html_entity_decode($monster_tiny_1), 'lower-left', $args);        }      This is an example of how i output my custom field on the front end. A custom page named om-monster.php                                       <div class="entry-content-left">                             <?php                                  $custom_field = get_post_meta($post->ID, 'monster_tiny_1', true);                                 $monster_tiny_1 = (isset($custom_field) ? $custom_field : '');                                  if ($monster_tiny_1 != '') {                                      echo wpautop(html_entity_decode($monster_tiny_1));                                  } ?>                         </div><!-- .entry-content-left -->      So how can i enable autoembed on the content written in the custom TinyMCE editor (should be the same as a normal text field).


wp_redirect() function is not working how to solve this

wp_redirect($post->guid) is not working,how to solve this. this is my code:                    if(isset($_REQUEST['vid']) ){           $id=$_REQUEST['vid'];               $post_title = 'sasa';          $post_content ='zxczxczxc';          $new_post = array(           'ID' => '',           'post_author' => $user->ID,            'post_content' => $post_content,           'post_title' => $post_title,           'post_status' => 'publish',           // NOW IT'S ALREADY AN ARRAY              );          $post_id = wp_insert_post($new_post);          // This will redirect you to the newly created post     $post = get_post($post_id);     $url=$post->guid;           wp_redirect($post->guid);             }


Attach form output as TXT-file in notification email

(How) Is it possible to attach the form output (contact form 7 or similar) in a TXT-file with the notification email to the admin? Is it possible to make a template for this TXT-file with only some of the data in the form?


How can I just show portfolio items from 1 category on portfolio page?

I have a website I am setting up for a client of mine which has a portfolio page which you can see here... http://lenhamsportscars.com/cars-for-sale You will notice that there is an option at the time to filter by category (Cars For Sale OR Cars Sold). I need to amend the code so it automatically just shows the portfolio items from the category I choose, rather than showing both on the same page. Here is the current code that will need amending...                   <?php     /*     Template Name: Portfolio Template          */     ?>     <?php get_header(); ?>

<?php the_title(); ?>
              <?php              $categories=get_categories('taxonomy=section');            if ( !empty( $categories ) ){               ?>

view by:

All
              <?php  wp_list_categories('taxonomy=section&title_li=');    ?>
             <?php  } else {    $categories = array(); } ?>                      <?php                      $count = 0;                 //   custom_query_posts(array('post_type' => 'portfolioitems','posts_per_page'  => 50))         global $wp_query;         wp_reset_query();         $paged = get_query_var('paged') ? get_query_var('paged') : 1;         $wp_query = new WP_Query(array('post_type' => 'portfolioitems','posts_per_page' => 50,'paged'=> $paged));                      ?>
                       <?php while (have_posts() ) : the_post(); ?>                      <?php                            $custom = get_post_custom($post->ID);                         $bimg = $custom["bimg"][0];                         $shortxt = $custom["shortxt"][0];                              $terms = get_the_terms( get_the_ID(), 'section' );                             ?>                                    <li class="portfolio-item2" data-id="id-<?php echo $count; ?>" data-type="cat-item-<?php foreach ($terms as $term) { echo $term->term_id; } ?>">
                                                 <a class="image-zoom" href="<?php the_permalink() ?>" rel="" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('portfolio-img', array('alt' => ''.get_the_title().'', 'title' => ''.get_the_title().'')); ?>
                         <h2 class="post-title-portfolio" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

<?php echo $shortxt; ?>

                                         <?php $count++;  ?>                  <?php endwhile; ?>                       <?php wp_reset_query(); ?>

             <?php if(function_exists('pagenavi')) :pagenavi();  ?>                      <?php else : ?>

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

<?php next_posts_link('Next »') ?>

          <?php endif; ?>

         <?php get_footer(); ?>      I have researched this for days and played around but am not great with code and can't get it to work. Any help would be much appreciated as the client wants this site finished a.s.a.p. Thanks! Here is the code for the functions.php file:               <?php     /**      * @package WordPress      * @subpackage Granit      */               // Add custom post type     include("include/portfolio-custom-post-type.php");          // Add latest tweets custom widget     include("include/widget-twitter.php");          // Disable WordPress’s auto-formating filters     include("include/disable-autoformat.php");          if ( !function_exists( 'optionsframework_init' ) ) {          /*-----------------------------------------------------------------------------------*/     /* Options Framework Theme     /*-----------------------------------------------------------------------------------*/          /* Set the file path based on whether the Options Framework Theme is a parent theme or child theme */          if ( STYLESHEETPATH == TEMPLATEPATH ) {         define('OPTIONS_FRAMEWORK_URL', TEMPLATEPATH . '/admin/');         define('OPTIONS_FRAMEWORK_DIRECTORY', get_bloginfo('template_directory') . '/admin/');     } else {         define('OPTIONS_FRAMEWORK_URL', STYLESHEETPATH . '/admin/');         define('OPTIONS_FRAMEWORK_DIRECTORY', get_bloginfo('stylesheet_directory') . '/admin/');     }          require_once (OPTIONS_FRAMEWORK_URL . 'options-framework.php');          }          if ( function_exists('register_sidebar') ) {         register_sidebar(array(             'name' => 'Sidebar',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));         register_sidebar(array(             'name' => 'Footer1',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));     }          // Register Post Thumbnail     add_theme_support( 'post-thumbnails' );      set_post_thumbnail_size(605,200,true);     add_image_size( 'blog-img', 605, 200, true );     add_image_size( 'portfolio-img', 225, 140, true );          // Register Custom Menus     add_action('init', 'register_my_menu');     function register_my_menu() {     register_nav_menu('menu-1', __('Menu 1'));     }               function custom_blog_posts(array $query = array())     {         global $wp_query;         wp_reset_query();              $paged = get_query_var('paged') ? get_query_var('paged') : 1;              $defaults = array(             'paged'             => $paged,             );         $query += $defaults;              $wp_query = new WP_Query($query);     }                    function custom_query_posts(array $query = array())     {         global $wp_query;         wp_reset_query();              $paged = get_query_var('paged') ? get_query_var('paged') : 1;              $defaults = array(             'paged'             => $paged         );         $query += $defaults;              $wp_query = new WP_Query($query);     }          /*-----------------------------------------------------------------------------------*/     /*  Get related posts by taxonomy     /*-----------------------------------------------------------------------------------*/          function related_projects_taxonomy($post_id, $taxonomy, $args=array()) {       $query = new WP_Query();       $terms = wp_get_object_terms($post_id, $taxonomy);       if (count($terms)) {         // Assumes only one term for per post in this taxonomy         $post_ids = get_objects_in_term($terms[0]->term_id,$taxonomy);         $post = get_post($post_id);         $args = wp_parse_args($args,array(           'post_type' => $post->post_type, // The assumes the post types match           'post__in' => $post_ids,           'taxonomy' => $taxonomy,           'term' => $terms[0]->slug,           'posts_per_page' => 4         ));         $query = new WP_Query($args);       }       return $query;     }          function wpe_excerptlength_blog($length) { return 60; }     function wpe_excerptlength_index($length) { return 25;  }     function wpe_excerptmore($more) { return '...'; }     function wpe_excerpt($length_callback='', $more_callback='') {         global $post;         if(function_exists($length_callback)){         add_filter('excerpt_length', $length_callback);         }         if(function_exists($more_callback)){         add_filter('excerpt_more', $more_callback);         }         $output = get_the_excerpt();         $output = apply_filters('wptexturize', $output);         $output = apply_filters('convert_chars', $output);         $output = '
'.$output.'
';         echo $output;         }          function mytheme_comment($comment, $args, $depth) {        $GLOBALS['comment'] = $comment; ?>        <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">          <div id="comment-<?php comment_ID(); ?>">
              <?php echo get_avatar($comment,$size='30',$default=''); ?>

              <?php printf(__('%s'), get_comment_author_link()) ?>                <?php if ($comment->comment_approved == '0') : ?>              <?php _e('Your comment is awaiting moderation.') ?>
           <?php endif; ?>
<?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?> <?php edit_comment_link(__('(Edit)'),'  ','') ?>
                <?php comment_text() ?>

              <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

     <?php }           function pagenavi( $p = 2 ) { // pages will be show before and after current page       if ( is_singular() ) return; // don't show in single page       global $wp_query, $paged;       $max_page = $wp_query->max_num_pages;       if ( $max_page == 1 ) return; // don't show when only one page       if ( empty( $paged ) ) $paged = 1;       echo 'Page: ' . $paged . ' of ' . $max_page . '  '; // pages       if ( $paged > $p + 1 ) p_link( 1, 'First' );       if ( $paged > $p + 2 ) echo '... ';       for( $i = $paged - $p; $i <= $paged + $p; $i++ ) { // Middle pages         if ( $i > 0 && $i <= $max_page ) $i == $paged ? print "{$i} " : p_link( $i );       }       if ( $paged < $max_page - $p - 1 ) echo '... ';       if ( $paged < $max_page - $p ) p_link( $max_page, 'Last' );     }     function p_link( $i, $title = '' ) {       if ( $title == '' ) $title = "Page {$i}";       echo "{$i} ";     }     ?>      This is the code for includes/portfolio-custom-post-type.php...               <?php     add_action('init', 'buildPortfolio');     function buildPortfolio() {                  $labels = array(             'name' => _x('Our Portfolio', 'post type general name'),             'singular_name' => _x('Portfolio Item', 'post type singular name'),             'add_new' => _x('Add New Item', 'portfolio item'),             'add_new_item' => __('Add New Portfolio Item'),             'edit_item' => __('Edit Portfolio Item'),             'new_item' => __('New Portfolio Item'),             'view_item' => __('View Portfolio Item'),             'search_items' => __('Search Portfolio'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''             );                  $portfolio_args = array(                 'labels' => $labels,                 'label' => __('Portfolio2'),                 'singular_label' => __('Portfolio3'),                 'public' => true,                 'show_ui' => true,                 'capability_type' => 'post',                 'hierarchical' => false,                 'rewrite' => true,                 'supports' => array('title', 'editor', 'thumbnail', 'excerpt')             );             register_post_type('portfolioitems',$portfolio_args);                   $labelsPortfolioSection = array(         'name' => _x( 'Sections', 'taxonomy general name' ),         'singular_name' => _x( 'Section', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Sections' ),         'all_items' => __( 'All Sections' ),         'parent_item' => __( 'Parent Section' ),         'parent_item_colon' => __( 'Parent Section:' ),         'edit_item' => __( 'Edit Section' ),         'update_item' => __( 'Update Section' ),         'add_new_item' => __( 'Add New Section' ),         'new_item_name' => __( 'New Section Name' ),       );                register_taxonomy('section','portfolioitems',array(         'hierarchical' => true,         'labels' => $labelsPortfolioSection       ));          }          add_action("admin_init", "addPortfolio");     add_action('save_post', 'updateDetails');          function addPortfolio(){         add_meta_box("portfolio_details", "Portfolio Options", "portfolioOptions", "portfolioitems", "normal", "low");     }          function portfolioOptions(){         global $post;         $custom = get_post_custom($post->ID);         $shortxt = $custom["shortxt"][0];         $bimg = $custom["bimg"][0];         $year = $custom["year"][0];         $client = $custom["client"][0];         $performance = $custom["performance"][0];         $lnk = $custom["lnk"][0];               ?>

Short Text:<input name="shortxt" value="<?php echo $shortxt; ?>" />

Big Image URL:<input name="bimg" value="<?php echo $bimg; ?>" />

Project Year:<input name="year" value="<?php echo $year; ?>" />

Client Name:<input name="client" value="<?php echo $client; ?>" />

Performance:<input name="performance" value="<?php echo $performance; ?>" />

Site Link:<input name="lnk" value="<?php echo $lnk; ?>" />

             <?php          }     function updateDetails(){         global $post;         update_post_meta($post->ID, "shortxt", $_POST["shortxt"]);         update_post_meta($post->ID, "bimg", $_POST["bimg"]);         update_post_meta($post->ID, "year", $_POST["year"]);         update_post_meta($post->ID, "client", $_POST["client"]);         update_post_meta($post->ID, "performance", $_POST["performance"]);         update_post_meta($post->ID, "lnk", $_POST["lnk"]);          }           add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");          function portfolio_edit_columns($portfolio_columns){         $portfolio_columns = array(             "cb" => "<input type=\"checkbox\" />",             "title" => "Project Title",         );         return $portfolio_columns;     }     ?>


Certain BuddyPress Member Profile Data Getting Hyperlinked

Very odd behavior in BuddyPress. When we enter various pieces of information in the About Me textbox on the members profile data in BP, some content is getting hyperlinked as `../members/?s=my content` Has anyone seen that? How can I correct it or shut off the hyper-linking? Thanks.


How to add a element with walker menu right after begin of the navigation tags?

I was trying to add a element right after begin of the navigation tags and before the ul will start. So add a element directly after opening nav tag. I tried this, but this will add a list item after all li's. Maybe we can use it to solve my problem:               add_filter('wp_nav_menu_items', 'add_li_to_nav', 10, 2);          function add_li_to_nav($items, $args)     {         $items .= '
SEARCH
';         return $items;     }      What my goal is, is to add a link `<a href="#" "mobile">` right after `primary-navwrapper`. Like the following markup:

         Fotografie


How to hide some categories in category list under post in wordpress?

In My wodpress Blog there are some categories use for the internal work. I want to hide that categories in blog homepage category list show under each post. I print category list as `print(the_category($postID));` How to hide or make filter for that category list print under each post?


How to export a Wordpress blog with no export function?

So I have this blog on a polish blog hosting service (blox.pl) that's incompatible with pretty much everything. There's two tools I can use to get data off it; one is to use a program that just simply won't work, and the other is to use another polish blog service (blog.pl), which is just wordpress, but it has a script that can import from blox. Here's the kicker; now that I have the content on wordpress, blog.pl doesn't allow exports. I can't use the script either, since it's not available anywhere. My question is this: does anyone have a script that parses a whole Wordpress blog and creates an useful .xml import file from it?


Slideshow/Gallery plugin based on WP Core Gallery

Looking for a plugin that I can hardcode into my custom post type template that pulls the images from gallery images added into the standard WP gallery. Thoughts?


buddypress edit profile

I have installed buddypress, I don't see any errors or success message when a person updates their profile details. Also for some reason it only seems to update admins details, a normal user/subscriber, cannot update its on profile. has anyone come across this? help please.


How to add code to Header.php in a child theme?

I'm creating a child theme for the first time and I had a few questions regarding code added to header. In a non child theme there is certain code I add to my header.php file such as google analytics, google webmaster tools, buy sell ads, Facebook open graph, etc.... How do you do this in a child theme? Do you create a header.php file in your child theme? If so how is this done? Is it the same as the @import as I used on the css? Thanks.


featured posts order

I'm trying to build a featured posts with a "tabbed" interface in my homepage. I'm using the "sticky" option of the posts in order to get them out of the main loop and in the "featured tabs". No problem here. The problem is I can't control the stickies order. Is there a way to set the order of sticky posts? A plugin, custom field... Is this stickies approach completely wrong? Thanks


I have geocoded posts with latitude longitude - How to search by radius?

I have posts which are geocoded with latitude and longitude from Google. I basically can enter an address in a post custom field and the latitude and longitude are placed into two separate meta fields. I'd like to create a custom search letting visitors search their zip/postal code and find the nearest locations. I've found this plugin which does all that bundled in one with custom post types then a search page http://wordpress.org/extend/plugins/wp-find-your- nearest/ I was thinking to try and modify it to work with my custom meta fields and only use the search page/function. Does anyone know of any other plugins or methods to create a custom search using postal codes and radiuses from lat / long meta fields Thanks


Archives and Categories in Custom Menu

What is the easiest way to place the Archives and Categories lists within my menu under a parent tab. I'd like both of the lists, such as "Archives" leading to the "archives" sub-menu, and the same for Categories. I'm looking for a non-programmatic (admin-panel only) solution for this.


Why use widgets?

I am very new to using WordPress and I was wondering what the benefits of using widgets is? Looking here it sounds like they are for people who are not programmers that want to add plugins to their site. Is that correct? or do widgets allow the site to be more robust in some way?


MIssing feature image link function

I need to be able to add a feature image to a post as a link. The link is good, it's green check. And no i cannot upload the file and insert into post dont do anything good. I have the link to the image i just whant feature image to use it. Why i dont what ti upload it, it's because my gallery is completely OUTSIDE awfull WP gallery system ! and work great as this SO the question is. If my link is : http://www.notreaventure.com/photo-0007/images/_MG_2133.jpg and i like WP to use it as feature image, can i put this link in a custom files, let's say featureimg : http://www.notreaventure.com/photo-0007/images/_MG_2133.jpg, and add a funtion that tell the WP system to get this field and get it to feature image, so nothing will be broken. I just cannot seem to know how to hack wp to get the funtion feature image to get it's image from custom field... can you help, thanks in advnace


How to use the WP Plugin List Category Post widget (!) with more than one category?

The Plugin List Category Post used as shortcode in a post/page allows to display a number of random posts from several categories. But when I use the plugin's widget I can choose only one category. Is there a way to use the widget and allow to choose several categories?


Using a loop to build and update widgets

So I have a widget Im making which allows users to update 4 switches. Each switch has the same fields, name, description, price, amount so I decided to build the widget using a for loop instead of hard coding each field to avoid repeating myself. I cant figure out how to save the values tho, because from teh tuts I've looked at for building widgets, the name field has to be $this->get_field_name which produces something like widget-switches-widget[4][name] So my form() function looks like               for($i =0; $i<4;$i++){         $name = $instance[$i]['name'];           $description = $instance[$i]['description'];             $amount = $instance[$i]['amount'];           $price = $instance[$i]['price'];     ?>              <div id="<?php echo $i; ?>" class="switch_form" style="background-color:<?php echo $i%2 == 0 ? '': '#DFDFDF' ;?>; border-radius:4px; padding:5px;">
Switch # <?php echo $i+1;?>

                 <label for="<?php echo $this->get_field_id( 'name' ); ?>"><?php _e('Name:', 'Name'); ?>                 <input style ="width:90%;" name="<?php echo $this->get_field_name($i); ?>['name']" value="<?php echo $name; ?>" />

                 <label for="<?php echo $this->get_field_id( 'description' ); ?>"><?php _e('Description:', 'Description'); ?>                 <input style ="width:90%;" name="<?php echo $this->get_field_name($i); ?>['description']" value="<?php echo $description; ?>" />

                 <label for="<?php echo $this->get_field_id( 'amount' ); ?>"><?php _e('Amount:', 'Amount'); ?>                 <input style ="width:90%;" name="<?php echo $this->get_field_name($i); ?>['amount']" value="<?php echo $amount; ?>" />

                 <label for="<?php echo $this->get_field_id( 'price' ); ?>"><?php _e('Price:', 'Price'); ?>                 <input style ="width:90%;" name="<?php echo $this->get_field_name($i); ?>['price']" value="<?php echo $price; ?>" />

     <?php     }      and my update() function looks like:               function update( $new_instance, $old_instance )     {         $instance = $old_instance;              for($i =0; $i<4;$i++){             $instance[$i]['name'] = strip_tags( $new_instance[$i]['name'] );             $instance[$i]['description'] = strip_tags( $new_instance[$i]['description'] );                   $instance[$i]['amount'] = strip_tags( $new_instance[$i]['lights_fill'] );             $instance[$i]['price'] = strip_tags( $new_instance[$i]['price'] );         }         return $instance;          }      How would I save these values into an array?


Setting a permalink for the home page?

I have a static default wordpress home page. As you know if you have a homepage on wordpress you can not set a permalink through the admin options, you can only set permalinks for non homepages. Does anyone know of a way that I can set a permalink for my homepage? So that when I visit my site at example.com, it automatically turns to example.com/examplelink when the site loads? Thank you!!


Put multiple custom loops on same page

I want multiple loops on my homepage, however only the first loop shows up. My homepage looks like this:               <?php     /*     Template Name: Home     */     get_header(); ?>

                     <?php get_template_part('loop', 'land'); ?>

                     <?php get_template_part('loop', 'home'); ?>

“Simplicity is the ultimate sophistication.”

Leonardo da Vinci

     <?php get_footer(); ?>      Here is loop-land:               $grids = 3; //Grids per row          global $query_string; //Need this to make pagination work               /*Setting up our custom query (In here we are setting it to show 12 posts per page and eliminate all sticky posts) */     query_posts($query_string . '&caller_get_posts=1&posts_per_page=9');               if(have_posts()) :  while(have_posts()) :  the_post();      ?>     <?php     //Show the left hand side column     if($counter == 1) :     ?>

                         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('home-thumb'); ?>

<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

<?php the_excerpt(); ?>

     <?php     endif;     ?>          <?php     endwhile;     //Pagination can go here if you want it.     endif;     ?>      Here is loop-home               <?php /* Start loop */ ?>     <?php while (have_posts()) : the_post(); ?>                  <?php the_content(); ?>         <?php wp_link_pages(array('before' => '
' . __('Pages:', 'reverie'), 'after' => '
' )); ?>     <?php endwhile; // End the loop ?>      Any ideas on how to fix this?


Splitting the main query in multiple loops with query_posts and/or pre_get_posts?

I have a custom post type 'events', to which I have associated a custom taxonomy 'calendar'. The calendar has 12 fixed terms, for each month of the year ( 'august', 'october', 'november, etc.). I'm in the process to make the archive page for the 'events' post type. I was thinking to display 12 different lists of max 10 posts each, for each month of the year == terms in the 'calendar' taxonomy. Since this would be an archive page, Wordpress would have already queried the database for 'events' post type. I was about to use `query_posts` to alter the main query, but I suddenly wondered if there was a better way to make a more optimized use of the default query. `query_posts` would essentially throw away the main query and with 12 lists to generate, it would cause more hits to the database. Which is the best practice for this case? Would you just run 12 instances of query_posts, one for each list, or you'd rather do something else, ie with `pre_get_post`s or something? thanks for sharing your ideas


Adding (image) caching to my Tumblr widget

I've hacked together a simple plugin to show the latest image from a Tumblr blog. To avoid upsetting the Tumblr API (v1), I want to cache that image within Wordpress... I think perhaps I can do this somehow using the Transients API, but have no idea where to start with this... or is there a simple way to do it with straight up PHP? Thanks :)               <?php     /*     Plugin Name: Topshop Tumblr Widget     Plugin URI:       Description: Displays images from the Topshop Tumblr using their v1 API     Author: James Greig     Version: 0.1     Author URI: http://greig.cc     */          /*     Based on the Tumblr plugin by V.J.Catkick - http://www.vjcatkick.com/     Data source: http://topshop.tumblr.com/api/read?start=0&num=1&type=photo          */               function widget_topshop_tumblr() {         if ( !function_exists('register_sidebar_widget') )             return;              function widget_topshop_tumblr_photos( $args ) {             extract($args);                  $options = get_option('widget_topshop_tumblr_photos');             $tuid = $options['tumblr_recents_src_uid'];                  $output = '
';             $output .= '';             // $output .= '';             // $output .= '';               if ( function_exists('simplexml_load_file') ) {              $tumblr_userid = $tuid;         $tumblr_num = '1';         $img_style = $tumblr_recents_img_style;         $tumblr_size = '250';         $pagecounter = 0;              $_tumblrurl = 'http://' . $tumblr_userid . '.tumblr.com/api/read?start=' . $pagecounter . '&num=' . $tumblr_num . '&type=photo';         $_tumblrurl  = urlencode( $_tumblrurl );         $_tumblr_xml = @simplexml_load_file( $_tumblrurl );          if( $_tumblr_xml && $_tumblr_xml->posts[0] ) {              // 0.1.2         if( $tumblr_recents_additional_html ) {             $output .= str_replace( "\\","", $tumblr_recents_additional_html );         }              foreach( $_tumblr_xml->posts[0]->post as $p ) {             $photourl = $p->{"photo-url"}[3];             $linkurl = $p[url];             $output .= "
";             // $output .= '';             $output .= '';             $output .= '';             $output .= '';             $output .= '
';         }     }          } else {         $output .= 'Requires PHP 5.1';     }                  $output .= '
';                  // These lines generate the output             echo $before_widget . $before_title . $title . $after_title;             echo $output;             echo $after_widget;         }              function widget_topshop_tumblr_photos_control() {             $options = $newoptions = get_option('widget_topshop_tumblr_photos');             if ( $_POST["tumblr_recents_src_submit"] ) {                 $newoptions['tumblr_recents_src_uid'] = strip_tags(stripslashes($_POST["tumblr_recents_src_uid"]));             } /* if */             if ( $options != $newoptions ) {                 $options = $newoptions;                 update_option('widget_topshop_tumblr_photos', $options);             } /* if */                  // those are default value             if ( !$options['tumblr_recents_src_uid'] ) $options['tumblr_recents_src_uid'] = 'topshop';             $tuid = htmlspecialchars($options['tumblr_recents_src_uid'], ENT_QUOTES);     ?>                  <?php _e('Tumblr ID:'); ?> <input style="width: 100px;" id="tumblr_recents_src_uid" name="tumblr_recents_src_uid" type="text" value="<?php echo $tuid; ?>" />.tumblr.com
                  <input type="hidden" id="tumblr_recents_src_submit" name="tumblr_recents_src_submit" value="1" />          <?php         } /* widget_topshop_tumblr_photos_control() */              register_sidebar_widget('Topshop Tumblr Widget', 'widget_topshop_tumblr_photos');         register_widget_control('Topshop Tumblr Widget', 'widget_topshop_tumblr_photos_control' );     } /* widget_topshop_tumblr() */          add_action('plugins_loaded', 'widget_topshop_tumblr');          ?>


How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?

I would like to create a condition that checks to see if a post has a thumbail and if it does display it, otherwise display the first image in a post. I tried something like this in my loop.php but it didn't seem to work:               <?php if (has_post_thumbnail()) { ?>     <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(640,320)); ?>     <?php } else { ?>     <a href="<?php the_permalink(); ?>"><img src="<?php echo catch_that_image(); ?>" />     <?php } ?>      This goes in my functions.php file:               <?php         function catch_that_image() {             global $post, $posts;             $first_img = '';             ob_start();             ob_end_clean();             $output = preg_match_all('//i', $post->post_content, $matches);             $first_img = $matches [1] [0];                  // no image found display default image instead             if(empty($first_img)){                  $first_img = get_bloginfo('template_url')."/images/no_image.gif";             }                 return $first_img;         }              $imgURL = catch_that_image();     ?>


Taxonomy Rewrite Rules Redirecting Instead of Masking

I have a custom post type of **_items_** set up. I also have a taxonomy set up with **_items_** called _categories_. functions.php code:                   regsiter_post_type('items',                     array('labels' => array                         (                             'name' => 'Items',                             'singular_name' => 'Item'                         ),                         'public' => true,                         'rewrite' => array                         (                              'slug' => 'items'                         ),                         'supports' => array                         (                             'title',                             'excerpt',                             'editor',                             'comments',                             'revisions',                             'thumbnail'                         ),                         'taxonomies' => array                         (                             'categories',                             'tags'                         )                     ));        register_taxonomy ( 'categories', 'items', array('hierarchical' => true,                         'label' => 'Item Categories',                         'rewrite' => array                         (                             'slug' => 'categories',                             'hierarchical' => ture                         )));          require 'rewrites.php'; // load rewrite class         Rewrites::init(); // call init function in rewrite class      rewrites.php code:               class Rewrites         {             // Start class methods                  public static function init()             {                 // Rewrite urls                 add_action ( 'generate_rewrite_rules', array( __CLASS__, 'rules' ) );                      add_filter ( 'query_vars', array( __CLASS__, 'vars' ) );             }                  public static function rules ( $wp_rewrite )             {                 $new_rules = array();                 $new_rules['categories/(.+?)/view/(.+)/?'] = 'index.php?categories=$matches[1]&view=$matches[2]';                      return $new_rules + $wp_rewrite->rules;             }                  // End class methods         }      So when looking at posts in the taxonomy of categories the url would be: /categories/%name_of_taxonomy%/ I need to also append to the url to add in query_vars /categories/%name_of_taxonomy%/view/%type_of_view%/ %type_of_view% would be a couple different options. list, grid etc. Here is my rewrite rule:               [categories/(.+?)/view/(.+)/?] => index.php?categories=$matches[1]&view=$matches[2]      But when I go to the url /categories/%name_of_taxonomy%/view/grid/ it redirects back to /categories/%name_of_taxonomy%/


Remove all nav menu classes except those which begin with certain letters

I'm currently using a function which strips out all the unwanted classes from my nav menus, leaving only the classes I want to keep (the ones listed in the array inside the function). It looks like this:               function remove_menu_classes($var) {     return is_array($var) ? array_intersect($var, array (         // List of allowed menu classes         'current-menu-item',         'current-menu-ancestor',         'menu-item-has-children',         'current-post-ancestor',         'first',         'last',         'vertical',         'horizontal'         )     ) : '';     }     add_filter( 'nav_menu_css_class', 'remove_menu_classes' );     add_filter( 'nav_menu_item_id', 'remove_menu_classes' );     add_filter( 'page_css_class', 'remove_menu_classes' );      Now, I want to add some additional classes to some of my menu items, using the "CSS Classes" field of each menu item, in order to add Font Awesome icons next to the menus. This is accomplished using a plugin. All I need to do is add (for example) "fa-home" into the CSS Classes field, or whatever Font Awesome class I want to use. The plugin checks for any CSS class starting with `fa-` that exists within the nav `<li>` tags, and if they exist, the plugin adds the appropriate `<i class="fa-whatever">` tag inside the `<li>` tag for me, which displays the icon. Very handy. The problem is that my function above strips these `fa-` classes out before the plugin is able to see them and act on them. I've tried changing the priorities of the "add_filter" lines in the function (to both '1' and '999') but that didn't help. So I'm wondering if there's any way to modify my function above, so that it will not strip out any classes that begin with `fa-`. I don't think I can use wildcards in an array like that, but my knowledge of PHP is not advanced enough to know if there are any other ways of writing this function that will achieve this goal (maybe using a completely different method for example). I'd prefer to keep it as simple as possible though, preferably without using a walker. :) Any ideas?!


How to include custom code on a page that's set to act as homepage?

I have a page called 'home' which is set to be the front of my site, but I'd like it to show the most recent blog post or two at the bottom. I have some PHP that will do this from another site               <?php      query_posts('showposts=1');     while (have_posts()): the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php the_content('Read the rest of this entry »'); ?>
<a href="<?php echo $siteroot .'/blog/' ?>">Go to the Blog...
     <?php endwhile; ?>      But I'm not sure where to put it in order to make it so it only shows on this one particular page since `is_home()` returns false for the page.


Hooks for trashing, deleting, saving, restoring custom post type

I need some hooks especially for trashing and untrashing custom post types. However the hooks are not so clear in this case. For example, to run a function on trash, I can use                    add_action('wp_trash_post','my_function');      However there doesn't seem to be any other action specific to custom post types. So how would I execute my function on trashing of a custom post type?


How to change "attachment_id" in attachment permarlink?

I changed attachment permalink by `add_filter('attachment_link','my_media_url');` from               http://domain.com/?attachment_id=123      to:               http://domain.com/?media=123      **The change is successful. But, with the new URL, the page is not found**. Some suggest rewrite rules like: this               'media/(.+)' => 'index.php?attachment=' . $wp_rewrite->preg_index(1)      I tried, it doesn't work in my case. Instead of modify patterns before or after "attachment_id", I want to **replace "attatchment_id" with "media" and keep all the other stuffs unchanged.** Is this a question of rewrite, or should I study something else? I tried this, not working either:               function attachment_rewrite( $wp_rewrite ) {          $rule = array(              '/?media=' => 'index.php?attachment_id=' . $wp_rewrite->preg_index(1)          );              $wp_rewrite->rules = $rule + $wp_rewrite->rules; } add_filter( 'generate_rewrite_rules', 'attachment_rewrite' );


Heavy SQL queries

I have got rid of one of SQL problems but the story isn't over. Now hoster has detected another problematic SQL query and again threatens to disable the account. Can anyone advise on what's going on here and if there is anything that can be done to fix it?               Executed 107 min ago for 2 sec on Database --> my_db_name.      SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 25 AND wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 0, 20          Executed 98 min ago for 1 sec on Database --> my_db_name.      SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 26 AND wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 0, 20      Those users mentioned are just typical registered users with 'subscriber' level without any privileges (no installed `user roles/capabilities plugins` whatsoever). I've got 24 hrs to solve this stuff and I'm nearly desperate.


Customize multisite site creation with user data

No, I've never made a plugin. But I would like to, or find someone who can work with me on it. What I'm hoping to accomplish is setup presets on site creation. I need my multisite to do this:   1. When creating a site, require information from the user creating it that is not normally requested.   2. Upon obtaining this information, create the site with a preset path (using the information previously provided)   3. Then, when logging in for the first time, redirect the site owner to a setup page where they can choose a theme, a layout, and other options. I know of the `wpmu_create_blog` function, but am unsure of where to "include.php" it. Also I don't know what function to use for editing the site creation page or how to use this information in the `wpmu_create_blog` function.


Using wp_redirect and .htaccess to re-route searches (and pass along the remaining GET vars)

I'm trying to use `wp_redirect()` to redirect searches to a format that I have established in `.htaccess`. Unfortunately, I'm running into some problems doing this. I need to redirect search to a series of folders, and then append the remaining parameters to then end of the URL, the end result would look like this:               http://www.xxxxxxx.com/search/Used/MT/Billings/?s=BMW&z=59105&r=150&m=150000&pmin=1000&pmax=30000&submit=Refine      I've written this function so far:               function redirect_search() {         $var_status = var_status();         $var_ci = var_ci();         $var_st = var_st();         if (is_search() && !empty($_GET['s'])) {             wp_redirect(home_url("/search/".$var_status.'/'.$var_ci.'/'.$var_st));             exit();         }     }     add_action('template_redirect', 'redirect_search' );      This function results in the url looking like this: `http://www.xxxxxxx.com/search/New/Billings/MT` I've added the parameters into it, and the function looks like this:               function redirect_search() {         $var_status = var_status();         $var_ci = var_ci();         $var_st = var_st();         $zip = var_z();         $radius = var_r();         if (is_search() && !empty($_GET['s'])) {             wp_redirect(home_url("/search/".$var_status.'/'.$var_ci.'/'.$var_st.'/?s='.get_search_query().'&z='.$zip.'&r='.$radius.'etc... etc...'));             exit();         }     }     add_action('template_redirect', 'redirect_search' );      Unfortunately, this approach seems to cancel out the folders that were created, and the resulting url looks like this:               http://www.xxxxxxx.com/search/?s=BMW&z=59101      Any ideas on how to get both the folders and the parameters in there? Thanks!


Bigger images when sharing a link with facebook

please help here, i am struggling to find a way to share a larger image on my pages when new post is made on my blog.. i am using a wordpress site unfortunately when i share the link of my post on facebook wall it shows v small image with some description in it. it is not nice for me. i want to share only a very big image form the post with the link to the post. like https://www.facebook.com/mvbay I want to know how that page posts bigger images without description Can anyone please help me .. :(


Multiple Loops On Custom Post Type Template?

I'm having some issues adding multiple loops. I have a custom post type (locations) that uses a single page template (single-locations.php). I'm trying to add additional loops to this template that will display (x) number of posts from different categories (regular post categories) depending on what custom post type id a user is on. The issue that is occurring is that, based on the code below, all the different custom post type id's defined are loading the same 5 posts (shown in the first query) but not from the specific categories defined. Additionally the queries under each custom post type id's are not being honored. I'm not sure if I've got the if/elseif statements messed up or if the main custom post type loop is interfering. Any advice on how to get this working would be great. :)

                          <?php                               global $post;                         $meta_history = get_post_meta($post->ID, 'bb-history', true );                         $meta_message = get_post_meta($post->ID, 'bb-mayors-message', true );                         $meta_news = get_post_meta($post->ID, 'bb-current-news', true );                          ?>
<?php the_title(); ?>
                          <?php echo $meta_history; ?>
Mayor's Message
                          <?php echo $meta_message; ?>
Current News
                          <?php echo $meta_news; ?>                          <?php                          // get_post_type (44)                     if ( 'locations' == get_post_type( 44 ) ){                              // Display 5 Posts From Category 5                         $args = array(                                  'posts_per_page'  => 5,                             'category'        => '5',                             'orderby'         => 'post_date',                             'order'           => 'DESC');                              $loc1 = new WP_Query($args);                              while ( $loc1->have_posts() ) : $loc1->the_post(); global $post;                                  ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
                                  <?php                             the_excerpt();                               endwhile; wp_reset_postdata();                               // get_post_type (46)                     } else if ( 'locations' == get_post_type( 46 ) ) {                              // Display 3 Posts From Category 10                         $args = array(                                  'posts_per_page'  => 3,                             'category'        => '10',                             'orderby'         => 'post_date',                             'order'           => 'DESC');                              $loc2 = new WP_Query($args);                              while ( $loc2->have_posts() ) : $loc2->the_post(); global $post;                                  ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
                                  <?php                             the_excerpt();                               endwhile; wp_reset_postdata();                               // get_post_type (52)                     } else if ( 'locations' == get_post_type( 52 ) ) {                              // Display 3 Posts From Category 7                         $args = array(                                  'posts_per_page'  => 3,                             'category'        => '7',                             'orderby'         => 'post_date',                             'order'           => 'DESC');                              $loc3 = new WP_Query($args);                              while ( $loc3->have_posts() ) : $loc3->the_post(); global $post;                                  ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
                                  <?php                             the_excerpt();                               endwhile; wp_reset_postdata();                               // get_post_type (55)                     } else if ( 'locations' == get_post_type( 55 ) ) {                              // Display 3 Posts From Category                         $args = array(                                  'posts_per_page'  => 3,                             'category'        => '8',                             'orderby'         => 'post_date',                             'order'           => 'DESC');                              $loc4 = new WP_Query($args);                              while ( $loc4->have_posts() ) : $loc4->the_post(); global $post;                                  ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
                                  <?php                             the_excerpt();                               endwhile; wp_reset_postdata();                          }                          // get_post_type (57)                     else if ( 'locations' == get_post_type( 57 ) ) {                              // Display 3 Posts From Category 9                         $args = array(                                  'posts_per_page'  => 3,                             'category'        => '9',                             'orderby'         => 'post_date',                             'order'           => 'DESC');                              $loc5 = new WP_Query($args);                              while ( $loc5->have_posts() ) : $loc5->the_post(); global $post;                                  ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
                                  <?php                             the_excerpt();                               endwhile; wp_reset_postdata();                          }                          ?>

                                                    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                          <article <?php post_class(); ?> role="article">
                                  <?php the_content(); ?>                                  <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:' ), 'after' => '
' ) ); ?>

                          <?php endwhile; //End WhILE Loop ?>                          <?php else : ?>                          <article <?php post_class(); ?>>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>

                          <?php endif; //End IF Statement ?>
                                       <?php get_sidebar(); ?>


How to change name of tinyMCE toolbar button?

I want to change the tinyMCE pop-up from "Blockquote" to "Indented Quote" Lots of posts about customizing tinyMCE but none explain to how change just the titles.


Sidebar not showing up on homepage

I am using the Nameless Child Theme for Wordpress. My sidebar is showing up on all other pages except for the home (blog posts) page which is the most important page for it to show up on. My site is http://mayziesdogblog.com. Any help would be GREATLY appreciated!


pre_get_posts on a page

Is it possible to edit the main query on a _page_ using the `pre_get_posts` filter? I tried but it doesn't seem to work.               function pre_wp_queries( $query ) {         // only trigger on main qyery         if ( !$query->is_main_query() )             return;              if (is_page_template('TEMPLATE_NAME.php')) {             $query->query_vars['pagename'] = null;             $query->query_vars['post_type'] = 'post';             $query->query_vars['posts_per_page'] = 3;             $query->query_vars['cat'] = 13;         }     }     add_action('pre_get_posts', 'pre_wp_queries', 9001);      On the header.php I use this line to check if it worked:               var_dump($GLOBALS['wp_query']->request);      It displays:               SELECT wp_posts.*     FROM wp_posts     WHERE 1=1       AND wp_posts.post_type = 'post'     ORDER BY wp_posts.post_date DESC       So it changed the posttype but not the rest. Also it goes to the 404 page. In fact dumping the `$GLOBALS['wp_query']->queried_object` gives back the original page. I tried this on 2 WP installs same behaviour on both. Is this correct behaviour, or am I missing something?


get last post's link with SQL query

I have installed a WP on website A and I want the last post's links in site B. I haven't in site B any WP and I want to get the link of last post from website A. so I can't use WP API like WP_Query and so on.. Is there possible I do this with remote connection to MuSql and get the last post link? How do this?


When is the {$new_status}_{$post->post_type} transition hook fired?

Is it fired after a post has been published? Say I have a CPT and want to perform some automated actions based on the post that gets saved, can I do:                   add_action('publish_myt_cpt', 'myfunction');


When someone likes an article on my blog, they are prompted to log in on Wordpress.com

I've set up a blog (not a wordpress.com one) on a regular hosting service. I've installed a free theme and jetpack. The problem is, when someone attempts to like a post, they are prompted to log in to WordPress.com. Any clue on how to solve this? I don't get why users should be prompted to login to wordpress when they want to like an article. **Later edit:** I am interested in the regular facebook 'like' and if this comes with JetPack. If not, are there any popular and easy-to-use plugins?


Converting Attachment to Images?

I've had no problem using lightboxes before with attachment images, but I've switched to a new theme called Quicknote and it seems that attachment images now instead link to the attachment page. However, if I change the url to the file's URL directly, any lightbox plugin works just fine. Is there an easy way to mass convert all of my posts images to the image URL instead of the attachment URL? Even better, does anyone have any idea why I might be linking to the attachment page instead of Lightbox? Could it be a setting left ticked somewhere?


Get something out from taxonomy

I like to use the new taxonomy to make a little CRM, really simple               contact     - name     - tel     - email     - company      Fine, the secretary will enter all the name in the database of the cms (WordPress), and i will have all those in, able to display it like a list or whatever i like 1) first question, do i reinvent the wheel, is it already done... Now, with all those nice contact... i have a page, or a list of really good product.. and all those contact can benefit to see it in there mail, much like a newsletter, but simpler... 2) question, how can i get all those email, and have wp to send the wp page/link to those email... plugin, code ? thanks in advance for the light on that


How to custom crop each image size?

I have over 6 image sizes, Therefore WP cannot satisfy every size with proper cropping as some images get their head cut off and some don't. Is there a plugin that lets me choose the cropping area of each size (including custom sizes)? To further explain this, I imagine it'd just let me move the crop selection for every single size. Is there such solution?


How to display posts from a single category within a custom taxonomy

I am trying to list only the posts from a single category of my custom taxonomy. I have created a custom post type called "Inventory" and a custom taxonomy called "Inventory Category". I then created a number of categories using the "Inventory Category" taxonomy. I would now like to display the posts from only a single category. fyi, this is not for display on the taxonomy.php page, that is all set up and working fine. This loop will be called on other pages. This is the code I have so far, it returns ALL posts from the "Inventory Category" taxonomy rather than just those in the category "bulk racks".               query_posts( array( 'post_type' => 'inventory', 'inventory-category' => 'bulk-racks' ) );       Any help would be greatly appreciated! Here is how i created the custom post type & taxonomy:               /* --- Create Inventory Custom Post Type --- */     add_action('init', 'inventory_register');          function inventory_register() {     $args = array(         'label' => __('Inventory'),         'singular_label' => __('Inventory'),         'public' => true,         'show_ui' => true,         'capability_type' => 'post',         'hierarchical' => true,         'rewrite' => true,         'supports' => array('title', 'thumbnail', 'revisions','custom-fields')     );          register_post_type( 'inventory' , $args );     }          /* --- Register Custom Taxonomy for Inventory Lists --- */      add_action( 'init', 'register_my_taxonomies', 0 );          function register_my_taxonomies() {          register_taxonomy(         'division',         array( 'inventory' ),         array(             'hierarchical' => true,             'public' => true,             'labels' => array(                 'name' => __( 'Inventory Category' ),                 'singular_name' => __( 'Inventory Categories' ),                 'show_ui' => true,                 'show_in_nav_menus' => true,             ),         )     );     }


W3 Total Cache Minify + cforms II = POST /wp-content/plugins/cforms/lib_ajax.php 500 (Internal Server Error)

Enabling minify is causing cforms (ajax enabled forms) to produce the following error on submit, whereby it hangs: **POST dearearth.net/wp- content/plugins/cforms/lib_ajax.php 500 (Internal Server Error)** Current minify settings: http://loomn.it/baK Form page: http://dearearth.net/contact Any suggestions on how to get past this (aside from disabling minify altogether)? Thanks!


How to build dynamic pages?

I'm new to WordPress so please bear with me. I have a requirement where I need to create a page that contains a lot of static and dynamic content coming from the db. What is the best approach to do this:   1. have 'n' shortcodes for 'n' dynamic regions?   2. have only one shortcode that builds the entire page?   3. any other solution?


prevent wordpress from rendering line breaks as br tags

I am tired of WordPress's horrible HTML editor and have decided to write all my html in Notepad++ and then just copy it over. However, simple line breaks `"\n"` that would be normally ignored in html are converted to `<br />` tags. I have disabled the visual editor, so everything I save should be the exact html that is presented. But it's not. how do I stop wordpress from converting my html?


A Blog's changelog

I'm looking for a plugin that would keep track of a all the structural "changes" journal. For instance, the date+time of each wordpress upgrade, or plugin install/update/activation/desactivation or desinstallation, along with the plugin version. Do you know of anything related?


It's okay if I do not write add_action()

I downloaded various themes on net and I found on `functions.php` they write something like this Example to remove inline comment style.               function demo_remove_recent_comments_style() {         add_filter( 'show_recent_comments_widget_style', '__return_false' );     }     add_action( 'widgets_init', 'demo_remove_recent_comments_style' );      Question Why we not write only this without a `function()`               add_filter( 'show_recent_comments_widget_style', '__return_false' );      Let me know


Table not getting created upon activation of WP Theme

This is the code I am using to create a custom table named "prefix" + zillow--> where prefix is the wp table prefix for the site.               register_activation_hook(__FILE__,'CreateTable');      The actual function is given below-- it checks if such a table already exists along with assigned version number for that table(so that I can update /alter that table in a later version of this theme)--               function CreateTable() {       //Database table versions       $zillow_db_table_version= "1.0";       $table_name = $wpdb->prefix . "zillow";            $installed_ver = get_option( "zillow_db_table_version" );       //Check if the table already exists and if the table is up to date, if not create it       if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name || $installed_ver != $zillow_db_table_version ) {         $sql = "CREATE TABLE " . $table_name .         " (propertyid varchar(20) NOT NULL ,         inserted_on date,         UNIQUE KEY id (id) );";         require_once(ABSPATH . 'wp-admin/includes/upgrade.php');         dbDelta($sql);         update_option( "zillow_db_table_version", $zillow_db_table_version );       }       //Add database table versions to options       add_option("zillow_db_table_version", $zillow_db_table_version);          }      But the table is not getting created at all. What is wrong with the above code? I tried activating the theme using above code multiple times(after first activating a different theme and then activating this one) but no table is getting created (I check directly in the WP database list of tables ).


Setting multiple image urls using Wordpress' Media Uploader

I have set up a meta box to hold additional information that my client can put in, and it will appear in a different section of the page. The page shows up at `http://96.125.170.106/~prestonp/?project=360` The data shows on the right hand side of the page, but also in this data, I would like to include photos that would show on the top and right top of the page, as in the image below ![enter image description here](http://i.stack.imgur.com/lBPM9.jpg) So far I have added the select image system in, and it works... kind of... If I only have one set up that one works perfectly, if I have two set up, the second works like expected, but the first, when I hit "Upload Image" and select my image, it puts the image url in the `Thumb 1` instead of `Main Image`. ![enter image description here](http://i.stack.imgur.com/RupY2.png) ![enter image description here](http://i.stack.imgur.com/blsWR.png) I am pretty sure my problem is in the jQuery, but I am not very knowledgeable in jQuery. Can someone help me figure out where my problem is? My code is below.               <?php          function wp_gear_manager_admin_scripts() {     wp_enqueue_script('media-upload');     wp_enqueue_script('thickbox');     wp_enqueue_script('jquery');     }          function wp_gear_manager_admin_styles() {     wp_enqueue_style('thickbox');     }          add_action('admin_print_scripts', 'wp_gear_manager_admin_scripts');     add_action('admin_print_styles', 'wp_gear_manager_admin_styles');          ?>

Fill out this box to complete the project data section of the project page.
         Project Name
<input type="text" name="_my_meta[name]" value="<?php if(!empty($meta['name'])) echo $meta['name']; ?>"/>
         Project Location
<input type="text" name="_my_meta[location]" value="<?php if(!empty($meta['location'])) echo $meta['location']; ?>"/>
         Project Client
<input type="text" name="_my_meta[client]" value="<?php if(!empty($meta['client'])) echo $meta['client']; ?>"/>
         Project Data
<input type="text" name="_my_meta[stories]" value="<?php if(!empty($meta['stories'])) echo $meta['stories']; ?>"/> Stories
         <input type="text" name="_my_meta[units]" value="<?php if(!empty($meta['units'])) echo $meta['units']; ?>"/> Units
         <input type="text" name="_my_meta[acres]" value="<?php if(!empty($meta['acres'])) echo $meta['acres']; ?>"/> Acres
         <input type="text" name="_my_meta[unitsPerAcres]" value="<?php if(!empty($meta['unitsPerAcres'])) echo $meta['unitsPerAcres']; ?>"/> Units/Acres
         <input type="text" name="_my_meta[website]" value="<?php if(!empty($meta['website'])) echo $meta['website']; ?>"/> Website

         <input id="_my_meta_upload_image_main" type="text" size="36" name="_my_meta[upload_image_main]" value="<?php if(!empty($meta['upload_image_main'])) echo $meta['upload_image_main']; ?>" /><input id="upload_image_button_main" type="button" value="Upload Image" /> Main Image
              <input id="_my_meta_upload_image_1" type="text" size="36" name="_my_meta[upload_image_1]" value="<?php if(!empty($meta['upload_image_1'])) echo $meta['upload_image_1']; ?>" /><input id="upload_image_button_1" type="button" value="Upload Image" /> Thumb 1
         <input id="_my_meta_upload_image_2" type="text" size="36" name="_my_meta[upload_image_2]" value="<?php if(!empty($meta['upload_image_2'])) echo $meta['upload_image_2']; ?>" /><input id="upload_image_button_2" type="button" value="Upload Image" /> Thumb 2
         <input id="_my_meta_upload_image_3" type="text" size="36" name="_my_meta[upload_image_3]" value="<?php if(!empty($meta['upload_image_3'])) echo $meta['upload_image_3']; ?>" /><input id="upload_image_button_3" type="button" value="Upload Image" /> Thumb 3
         <input id="_my_meta_upload_image_4" type="text" size="36" name="_my_meta[upload_image_4]" value="<?php if(!empty($meta['upload_image_4'])) echo $meta['upload_image_4']; ?>" /><input id="upload_image_button_4" type="button" value="Upload Image" /> Thumb 4
         <input id="_my_meta_upload_image_5" type="text" size="36" name="_my_meta[upload_image_5]" value="<?php if(!empty($meta['upload_image_5'])) echo $meta['upload_image_5']; ?>" /><input id="upload_image_button_5" type="button" value="Upload Image" /> Thumb 5
         <input id="_my_meta_upload_image_6" type="text" size="36" name="_my_meta[upload_image_6]" value="<?php if(!empty($meta['upload_image_6'])) echo $meta['upload_image_6']; ?>" /><input id="upload_image_button_6" type="button" value="Upload Image" /> Thumb 6
         <input id="_my_meta_upload_image_7" type="text" size="36" name="_my_meta[upload_image_7]" value="<?php if(!empty($meta['upload_image_7'])) echo $meta['upload_image_7']; ?>" /><input id="upload_image_button_7" type="button" value="Upload Image" /> Thumb 7
         <input id="_my_meta_upload_image_8" type="text" size="36" name="_my_meta[upload_image_8]" value="<?php if(!empty($meta['upload_image_8'])) echo $meta['upload_image_8']; ?>" /><input id="upload_image_button_8" type="button" value="Upload Image" /> Thumb 8
         <input id="_my_meta_upload_image_9" type="text" size="36" name="_my_meta[upload_image_9]" value="<?php if(!empty($meta['upload_image_9'])) echo $meta['upload_image_9']; ?>" /><input id="upload_image_button_9" type="button" value="Upload Image" /> Thumb 9


Author can only see own post comment and can moderate

I am trying to make things work like where author can see only them post comment in admin comment section and they can moderate as well. While admin should have all permission. I am having one code and working fine in all terms like showing only author's post comment but it's not allowing to moderate. Can anyone help me to find solution where author can moderate own post comment. Code I have:               function my_plugin_get_comment_list_by_user($clauses) {     if (is_admin()) {         global $user_ID, $wpdb;         $clauses['join'] = ", wp_posts";         $clauses['where'] .= " AND wp_posts.post_author = ".$user_ID." AND wp_comments.comment_post_ID = wp_posts.ID";     };     return $clauses;     };     // Ensure that editors and admins can moderate all comments     if(!current_user_can('edit_others_posts')) {     add_filter('comments_clauses', 'my_plugin_get_comment_list_by_user');     }


Custom taxonomies to define versions of a product

I have a custom post type that describes components of a product. As the product is developed new components are added. I'd like to define what version of the product the component was added, and then be able to browse products by that version. I tried making a custom taxonomy as the version, but my problem is when I browse that version. I only see the components added for that version. I need to include all components for that version and previous versions. Is taxonomies that right approach or is there another way to handle this in WP?


Prevent widgets removal

I'm building a site with a lot of widgets. They have been highly customized. Several admins/editors will have to edit these widgets when the site is live. Right now I'm scared to see a widget (and its configuration) can be fully erased in a single mouse move (dropping it off the side bar). Is there any way to prevent widgets removal while keeping the ability to edit its content ? Additionally, the widget management page in the Administration gives in my opinion too much space to the "add widget" module and not enough to the "activated widget" module. This is helpful while building a site but useless when the site is done. Is there any way to switch the size of these modules ? Thanks a lot


Show list of posts only on category site

I used the following code to create a list of my custom categories and custom post types:
                            <?php                     $custom_terms = get_terms('project_category', 'hide_empty=0');                     foreach($custom_terms as $custom_term) {                         wp_reset_query();                             $args = array('post_type' => 'project',                                 'tax_query' => array(                                     array(                                         'taxonomy' => 'project_category',                                         'field' => 'slug',                                         'terms' => $custom_term->slug,                                     ),                                 ),                             );                         $loop = new WP_Query($args);                         if($loop->have_posts()) {                             echo ''.$custom_term->name.'';                                     while($loop->have_posts()) : $loop->the_post();                             echo '
'.get_the_title().'
';                         endwhile;                         }                     }                 ?>
      What I want to do is to hide the created anchors inside the list and only show them if the parent category is chosen. So I guess I should display them on the category site, and link the list items to the category site. Can anyone give me a hint please?


How should I troubleshoot a database serialization issue with a WordPress migration

I'm migrating a WordPress site from one server to another, and the entire migration seems fine, except the sidebars aren't moving over properly. The obvious thing that comes to mind is a serialization issue with the MySQL migration, but I'm not making any changes to the database because the domain name isn't changing (or even the server paths for that matter). I'm literally just moving it from one box to another.


List latest posts with least comments in WP-Admin

I want to encourage my authors to provide feedback to new posts that have not received enough exposure. To do this, I want to add a box to WP-Admin that lists the top 3 latest posts (from the past two days) with least comments. In terms of table structure, I'm thinking something like this answer for listing latest posts. > All you need is a table with `class='widefat'` and `get_posts()`. Then you > run through the results (if there are any) and print the table rows. The code works great but his was for listing the latest 10 posts, my question is how to list the **latest posts with least comments**?


Problem uploading different files as custom fields with front end post form

I have a front end post form that I'm having some problems getting the right path for the media to save as custom fields. The path to the file gets saved as mysite.com/home/betauser/public_html/betatheme/wp_content/....file path. How do I get the path to save correctly?               <?php if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {     if ( ! function_exists( 'wp_handle_upload' )) {                  require_once(ABSPATH . "wp-admin" . '/includes/image.php');                 require_once(ABSPATH . "wp-admin" . '/includes/file.php');                 require_once(ABSPATH . "wp-admin" . '/includes/media.php');     }     $file=$_FILES;     // Do some minor form validation to make sure there is content     if (isset ($_POST['title'])) {         $title =  $_POST['title'];     } else {         echo 'Please enter a game  title';     }     if (isset ($_POST['description'])) {         $description = $_POST['description'];     } else {         echo 'Please enter the content';     }     $tags = $_POST['post_tags'];          // Add the content of the form to $post as an array     $new_post = array(         'post_title'    => $title,         'post_content'  => $description,         'post_category' => 11,         'tags_input'    => array($tags),         'post_status'   => 'publish',           // Choose: publish, preview, future, draft, etc.         'post_type' => fod_music  // Use a custom post type if you want to     );     $overrides = array( 'test_form' => false);     $uploaded_music = wp_handle_upload( $file['music_file'], $overrides );     $uploaded_music_art = wp_handle_upload( $file['music_image'], $overrides );      //save the new post and return its ID     $pid = wp_insert_post($new_post);     update_post_meta($pid,'music_code',$uploaded_music['file']);     update_post_meta($pid,'music_art',$uploaded_music_art['file']);     wp_redirect( get_permalink($pid));      exit();          }      do_action('wp_insert_post', 'wp_insert_post');     ?>
      <form id="new_post" name="new_post" method="post" action="" enctype="multipart/form-data">
Song Title
        <input type="text" id="title" value="" tabindex="1" size="20" name="title" />

Upload a song
        <input type="file" name="music_file" id="music_file"/>

Description
        <textarea id="description" tabindex="3" name="description" cols="50" rows="6"></textarea>

Upload a music art
        <input type="file" name="music_image" id="music_image"/>

Tags        <input type="text" value="" tabindex="5" size="16" name="post_tags" id="post_tags" />

<input type="submit" value="Publish" tabindex="6" id="submit" name="submit" />
       <input type="hidden" name="action" value="new_post" />       <?php wp_nonce_field( 'new-post' ); ?>      </form>


Load posts dynamically

I am looking for a solution/guidance on how I might have links of posts listed in a hierarchical manner in a left column of a template and when a link is chosen it loads a post in the right column but the whole page does not refresh? Thanks, Deon **Update for Marfarma's help below** Thank you for the response. After reading many pages and posts I was able to get it to work. My one caveat now is that links that are in the right hand column have an href value of #. I have the home page setup for a user to choose a training path which takes them to the page discussed above. But I also have the individual links on the home page in case a user wants to jump to a specific topic. So now my issue is I can code them individually and have them go to the single post template, but I would rather a user go to the page discussed above with the correct link topic chosen from the list. Do you know how this might be accomplished? I assume first step somehow instead of having the # as the href I have to pass along the correct id/post slug as the href? Then somehow I can link to that all done through javascript? Thanks for any help. The code I used is below.               <?php     wp_enqueue_script( 'my-ajax-request', get_stylesheet_directory_uri( __FILE__ ) . '/js/ajax.js' );     wp_localize_script( 'my-ajax-request', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );     ?>              <?php         global $wpdb;         global $post;         $querystr = "         SELECT * FROM $wpdb->posts         LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id)         LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)         LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)         LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id)         WHERE $wpdb->terms.name = 'pathologist'         AND $wpdb->term_taxonomy.taxonomy = 'category'         AND $wpdb->posts.post_status = 'publish'         AND $wpdb->posts.post_type = 'post'         AND $wpdb->postmeta.meta_key = 'order'         ORDER BY $wpdb->postmeta.meta_value ASC         ";         $pageposts = $wpdb->get_results($querystr, OBJECT);         ?>                    <?php if ($pageposts): ?>          <?php global $post; ?>

Navigating your Workspace
      <?php foreach ($pageposts as $post): ?>     <?php setup_postdata($post); ?>        <li class="post" id="<?php the_ID(); ?>">       <a href="#" class="ajax-click" rel="bookmark" title="<?php the_title(); ?>">       <?php the_title(); ?>
     <?php endforeach; ?>

      And the ajax.js for above.                jQuery(document).ready(function() {               jQuery(".ajax-click").click(function() {             jQuery("#loading-animation").show();             var post_id = $(this).parent("li").attr("id");             var ajaxURL = MyAjax.ajaxurl;                  jQuery.ajax({             type: 'POST',             url: ajaxURL,             data: {"action": "load-content", post_id: post_id },             success: function(response) {                  jQuery("#container-help-page").html(response);                  jQuery("#loading-animation").hide();             return false;         }     });     });     });


Help with Wordpress custom url rewriting?

I have 3 problems. First,I would like something like this to do :               www.example.com/myblog => myblog.example.com      myblog is template page. and then when open one post from that page(post are custom post type) url will look like this `myblog.example.com/my-custom-post- type-post` Second :               www.example.com/mycar => mycar.example.com      my car is also template page,and then when open post from that page(posta are also custom post type,but this time post will be in subcategory) url will look something like this               mycar.example.com/my-subcategory/my-car-custom-post-type      Dont know how to do this in wp. Third,can someone help me to figure it out why is this not working. I would like to rewrite this url http://www.example.com/data-page/?data_id=123456789 to http://www.example.com/data-page/data_id/123456789 add_filter('query_vars', 'add_my_var');               function add_my_var($public_query_vars) {         $public_query_vars[] = 'data_id';         return $public_query_vars;     }          function add_rewrite_rules($rules) {         $newrules['data-page/data_id/([0-9]{1,})/?$'] = 'index.php?data_id=$matches[1]';         $rules = $newrules + $rules;         return $rules;     }          function flushRules() {         global $wp_rewrite;         $wp_rewrite->flush_rules();     }          add_filter('rewrite_rules_array', 'add_rewrite_rules');     add_filter('init', 'flushRules');      This is the way I send data to another page.               <a href="<?= add_query_arg(array('data_id'=>32),get_permalink(get_page_by_path('data-page'))); ?>">Data page test link      Thanx in advance.


paragraph format in WYSIWYG on a custom theme?

How can i present the same content/paragraph format on my WYSIWYG on my custom wordpress theme? i never put much thought on how my content shall be presented while im busy doing all the site overall layout, and now im facing this difficulty on trying to reflect the same format paragraph on the post editor in my custom theme. on WYSIWYG, i have spaces in between my paragraphs, but when i display it on my custom theme, the paragraphs are not separated. is there a plugin, hooks i can use to use the default wordpress content layout on a custom theme?