TinyMCE is broken

After switching hosting server, the tinyMCE in the post editing screen does not fire up. Here is the message of the console. ![chrome console printout](http://i.stack.imgur.com/6Xv2F.png) As you can see, wp-tinymce.php seems to fail. So far, I've tried :   * chmoding 777 (just to be sure) all the js/tinymce content   * reuploading the entire wp-include, forcing file replacement changing   * the header from javascript to json (here are the 3 tries i did): try1:               header('Content-Type: application/x-javascript; charset=UTF-8');      try2:               header('Content-Type: application/json; charset=UTF-8');      try3:               header('Content-type: application/json');      In Firefox 's firebug extension, the message is "illegal character" and when i open the file from within firebug, instead of seeing the code, all chars are messed up. But in my IDE, the php code looks correct. Any other idea? Would it be a server misconfiguration?


How can I add the featured image functionality to a custom taxonomy?

I would like to be able to use the 'featured image' functionality, found on post types, for a custom taxonomy. I have a taxonomy called 'collections' and I would like each collection to have a featured image. I will then use the featured image in a custom template that will show all of the collection, their titles and featured images. I need the uploaded image to be resized into the custom image sizes that I have set in my theme. There is a similar question here: Can I set a default featured image for a category? However, the top answer won't work for me, and I can't rely on a plugin. Can anyone help? Many thanks, Keith


get_post_meta() retrieves meta from a specific post on pages, not the page currently viewed

I am making a simple sidebar functionality to display embed video in the sidebar. I've created a meta field where admin should paste the embed video. It works as it should on posts, but on pages, `get_the_ID()` is always returning the same ID, 145, ID of one of the posts. Here is the code I am using:               <?php          $id = get_the_ID();         $video_value = get_post_meta($id, '_post_video', true);         if (! empty($video_value)) {             echo $video_value;             echo get_the_ID();         } else {             echo 'no video to show';             echo get_the_ID();         }     ?>       I am a bit confused, so if anyone could shad some light on this... Thanks!


How do I create custom fields for multiple post types?

I have created multiple post types and now want to create multiple custom fields for each post type. I am not entirely how to but more specifically I believe I am doing something wrong when trying to save the meta field data. I've based my project form this tutorial: http://wefunction.com/2008/10/tutorial-creating-custom-write-panels-in- wordpress/ So far the custom fields save properly for one of the post types - Project post type. The meta data does not work for the other post types. My code is below however it may easier to look at the tutorial and decipher how to set it up for multiple post types.               <?php               //Meta boxes with upload fields                if ( is_admin() ) {          function add_post_enctype() {              echo "";          }          add_action('admin_head', 'add_post_enctype');      }                     //Project Meta Box Variable Array           $project_meta_boxes =          array(              "start" => array(              "name" => "start",              "type" => "start"          ),               "image" => array(              "name" => "mainimage",              "std" => "",              "type" => "image",              "title" => "Main Image"          ),            //END Project Meta Box Variable Array                     //Product Meta Box Variable Array           $product_meta_boxes =          array(              "start" => array(              "name" => "start",              "type" => "start"          ),                "google_checkout" => array(              "name" => "google_checkout",              "std" => "",              "type" => "text",              "title" => "Google Checkout Link",              "description" => "Purchase Link"          ),                   "end" => array(              "name" => "end",              "type" => "end"          ),      );           //END Product Meta Box Variable Array                               //Feature Meta Box Variable Array           $feature_meta_boxes =          array(              "start" => array(                  "name" => "start",                  "type" => "start"              ),                "url" => array(              "name" => "url",              "std" => "",              "type" => "text",              "title" => "URL for featured item",              "description" => "URL"          ),               "feature_post_id" => array(              "name" => "feature_post_id",              "std" => "",              "type" => "text",              "title" => "Post ID for featured item",              "description" => "Post ID"          ),               "tagline" => array(              "name" => "tagline",              "std" => "",              "type" => "text",              "title" => "Tagline",              "description" => "Tagline to your post"          ),               "featureimage" => array(              "name" => "bannerimage",              "std" => "",              "type" => "image",              "title" => "Feature Image"          ),                "end" => array(              "name" => "end",              "type" => "end"          ),      );           //END Feature Meta Box Variable Array                               //Product Meta Boxes =========================      //============================================           function product_meta_boxes() {          global $post, $product_meta_boxes;               foreach($product_meta_boxes as $meta_box) {              $meta_box_value = get_post_meta($post->ID, $meta_box['name'].'', true);                   if($meta_box_value == "")              $meta_box_value = $meta_box['std'];                   echo'<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';              if($meta_box['type'] == "start") {                   echo "
";                   } else if($meta_box['type'] == "end") {                   echo '
';              } else if($meta_box['type'] == "image") {                   echo $meta_box['before'];                  echo '
';                       if($meta_box_value) {                       echo '';                   }                       echo'
'.$meta_box['title'].'';                  echo'<input type="file" name="'.$meta_box['name'].'_upload" size="55" />
';                  echo'Upload image here
';                       echo'
 ';                  echo'<input type="text" name="'.$meta_box['name'].'" value="'.$meta_box_value.'" size="55" />
';                  echo'or add a URL to the image here
';                       echo '
';                   } else if($meta_box['type'] == "text") {                   echo $meta_box['before'];                       echo'
'.$meta_box['title'].'';                  echo'<input style="color:#666;" type="text" name="'.$meta_box['name'].'" value="'.$meta_box_value.'" size="55" />
';                  echo''.$meta_box['description'].'
';                   } else if($meta_box['type'] == "checkbox") {                        echo $meta_box['before'];                  echo'
'.$meta_box['title'].'';                  if($meta_box_value) {                       $checked = "checked=\"checked\"";                   } else {                       $checked = "";                   }                  echo '<input style="display:block;float:left;width:20px;margin:5px 0 0 0;" '.$checked.' type="checkbox" name="'.$meta_box['name'].'" />
';                  echo''.$meta_box['description'].'
';                   } else if($meta_box['type'] == "textarea") {                        echo $meta_box['before'];                  echo'
'.$meta_box['title'].'';                  echo'<textarea style="color:#666;" name="'.$meta_box['name'].'" cols="50" rows="4">'.stripslashes($meta_box_value).'</textarea>
';                  echo''.$meta_box['description'].'
';                   }                }      }                                              //Project Meta Boxes =========================      //============================================           function project_meta_boxes() {          global $post, $project_meta_boxes;               foreach($project_meta_boxes as $meta_box) {              $meta_box_value = get_post_meta($post->ID, $meta_box['name'].'', true);                   if($meta_box_value == "")              $meta_box_value = $meta_box['std'];                   echo'<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';              if($meta_box['type'] == "start") {                   echo "
";                   } else if($meta_box['type'] == "end") {                   echo '
';              } else if($meta_box['type'] == "image") {                   echo $meta_box['before'];                  echo '
';                       if($meta_box_value) {                       echo '';                   }                       echo'
'.$meta_box['title'].'';                  echo'<input type="file" name="'.$meta_box['name'].'_upload" size="55" />
';                  echo'Upload image here
';                       echo'
 ';                  echo'<input type="text" name="'.$meta_box['name'].'" value="'.$meta_box_value.'" size="55" />
';                  echo'or add a URL to the image here
';                       echo '
';                   } else if($meta_box['type'] == "text") {                   echo $meta_box['before'];                       echo'
'.$meta_box['title'].'';                  echo'<input style="color:#666;" type="text" name="'.$meta_box['name'].'" value="'.$meta_box_value.'" size="55" />
';                  echo''.$meta_box['description'].'
';                   } else if($meta_box['type'] == "checkbox") {                        echo $meta_box['before'];                  echo'
'.$meta_box['title'].'';                  if($meta_box_value) {                       $checked = "checked=\"checked\"";                   } else {                       $checked = "";                   }                  echo '<input style="display:block;float:left;width:20px;margin:5px 0 0 0;" '.$checked.' type="checkbox" name="'.$meta_box['name'].'" />
';                  echo''.$meta_box['description'].'
';                   } else if($meta_box['type'] == "textarea") {                        echo $meta_box['before'];                  echo'
'.$meta_box['title'].'';                  echo'<textarea style="color:#666;" name="'.$meta_box['name'].'" cols="50" rows="4">'.stripslashes($meta_box_value).'</textarea>
';                  echo''.$meta_box['description'].'
';                   }                }      }                          //Feature Meta Boxes =========================      //============================================           function feature_meta_boxes() {          global $post, $feature_meta_boxes;               foreach($feature_meta_boxes as $meta_box) {              $meta_box_value = get_post_meta($post->ID, $meta_box['name'].'', true);                   if($meta_box_value == "")              $meta_box_value = $meta_box['std'];                   echo'<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';              if($meta_box['type'] == "start") {                   echo "
";                   } else if($meta_box['type'] == "end") {                   echo '
';              } else if($meta_box['type'] == "image") {                   echo $meta_box['before'];                  echo '
';                       if($meta_box_value) {                       echo '';                   }                       echo'
'.$meta_box['title'].'';                  echo'<input type="file" name="'.$meta_box['name'].'_upload" size="55" />
';                  echo'Upload image here
';                       echo'
 ';                  echo'<input type="text" name="'.$meta_box['name'].'" value="'.$meta_box_value.'" size="55" />
';                  echo'or add a URL to the image here
';                       echo '
';                   } else if($meta_box['type'] == "text") {                   echo $meta_box['before'];                       echo'
'.$meta_box['title'].'';                  echo'<input style="color:#666;" type="text" name="'.$meta_box['name'].'" value="'.$meta_box_value.'" size="55" />
';                  echo''.$meta_box['description'].'
';                   } else if($meta_box['type'] == "checkbox") {                        echo $meta_box['before'];                  echo'
'.$meta_box['title'].'';                  if($meta_box_value) {                       $checked = "checked=\"checked\"";                   } else {                       $checked = "";                   }                  echo '<input style="display:block;float:left;width:20px;margin:5px 0 0 0;" '.$checked.' type="checkbox" name="'.$meta_box['name'].'" />
';                  echo''.$meta_box['description'].'
';                   } else if($meta_box['type'] == "textarea") {                        echo $meta_box['before'];                  echo'
'.$meta_box['title'].'';                  echo'<textarea style="color:#666;" name="'.$meta_box['name'].'" cols="50" rows="4">'.stripslashes($meta_box_value).'</textarea>
';                  echo''.$meta_box['description'].'
';                   }                }      }                                              //Create Meta Boxes           function create_meta_box() {          global $theme_name;               // Create Meta boxes for Project Post Type          if ( function_exists('add_meta_box') ) {              foreach ( array('projects') as $type ) {                  add_meta_box( 'project-meta-boxes', 'Project Options', 'project_meta_boxes', $type, 'normal', 'high' );              }          }               // Create Meta boxes for Product Post Type          if ( function_exists('add_meta_box') ) {              foreach ( array('products') as $type ) {                  add_meta_box( 'product-meta-boxes', 'Product Options', 'product_meta_boxes', $type, 'normal', 'high' );              }          }               // Create Meta boxes for Feature Post Type          if ( function_exists('add_meta_box') ) {              foreach ( array('features') as $type ) {                  add_meta_box( 'feature-meta-boxes', 'Feature Options', 'feature_meta_boxes', $type, 'normal', 'high' );              }          }                }                function save_postdata( $post_id ) {          global $post, $project_meta_boxes, $product_meta_boxes, $feature_meta_boxes;          $post_id = wp_is_post_revision($post_id);                    //Project          foreach($project_meta_boxes as $meta_box) {                   if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) {                  return $post_id;              }                   if ( 'page' == $_POST['post_type'] ) {                  if ( !current_user_can( 'edit_page', $post_id ))                  return $post_id;              } else {                  if ( !current_user_can( 'edit_post', $post_id ))                  return $post_id;              }               $imageuploadlocation = "";          $metaboxname = "";          $metaboxname_upload = "";               if($meta_box['type'] == 'image') {                   $metaboxname = $meta_box['name'];              $metaboxname_upload = $metaboxname.'_upload';               if($_FILES[$metaboxname_upload]['name'] != "") {              $overrides = array( 'test_form' => false);              $imagefile=wp_handle_upload($_FILES[$metaboxname_upload], $overrides);              $imageuploadlocation = $imagefile['url'];              delete_post_meta($post_id, $metaboxname, get_post_meta($post_id, $metaboxname, true));              add_post_meta($post_id, $metaboxname, $imageuploadlocation, true);          } else {              $imageuploadlocation = get_post_meta($post_id, $metaboxname, true);              delete_post_meta($post_id, $metaboxname, get_post_meta($post_id, $metaboxname, true));              add_post_meta($post_id, $metaboxname, $_POST[$metaboxname], true);          }                } else {              $data = $_POST[$meta_box['name'].''];              if(get_post_meta($post_id, $meta_box['name'].'') == "")              add_post_meta($post_id, $meta_box['name'].'', $data, true);              elseif($data != get_post_meta($post_id, $meta_box['name'].'', true))              update_post_meta($post_id, $meta_box['name'].'', $data);              elseif($data == "")              delete_post_meta($post_id, $meta_box['name'].'', get_post_meta($post_id, $meta_box['name'].'', true));          }               }                              //Product          foreach($product_meta_boxes as $meta_box) {                   if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) {                  return $post_id;              }                   if ( 'page' == $_POST['post_type'] ) {                  if ( !current_user_can( 'edit_page', $post_id ))                  return $post_id;              } else {                  if ( !current_user_can( 'edit_post', $post_id ))                  return $post_id;              }               $imageuploadlocation = "";          $metaboxname = "";          $metaboxname_upload = "";               if($meta_box['type'] == 'image') {                   $metaboxname = $meta_box['name'];              $metaboxname_upload = $metaboxname.'_upload';               if($_FILES[$metaboxname_upload]['name'] != "") {              $overrides = array( 'test_form' => false);              $imagefile=wp_handle_upload($_FILES[$metaboxname_upload], $overrides);              $imageuploadlocation = $imagefile['url'];              delete_post_meta($post_id, $metaboxname, get_post_meta($post_id, $metaboxname, true));              add_post_meta($post_id, $metaboxname, $imageuploadlocation, true);          } else {              $imageuploadlocation = get_post_meta($post_id, $metaboxname, true);              delete_post_meta($post_id, $metaboxname, get_post_meta($post_id, $metaboxname, true));              add_post_meta($post_id, $metaboxname, $_POST[$metaboxname], true);          }                } else {              $data = $_POST[$meta_box['name'].''];              if(get_post_meta($post_id, $meta_box['name'].'') == "")              add_post_meta($post_id, $meta_box['name'].'', $data, true);              elseif($data != get_post_meta($post_id, $meta_box['name'].'', true))              update_post_meta($post_id, $meta_box['name'].'', $data);              elseif($data == "")              delete_post_meta($post_id, $meta_box['name'].'', get_post_meta($post_id, $meta_box['name'].'', true));          }               }                                   //Feature          foreach($feature_meta_boxes as $meta_box) {                   if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) {                  return $post_id;              }                   if ( 'page' == $_POST['post_type'] ) {                  if ( !current_user_can( 'edit_page', $post_id ))                  return $post_id;              } else {                  if ( !current_user_can( 'edit_post', $post_id ))                  return $post_id;              }               $imageuploadlocation = "";          $metaboxname = "";          $metaboxname_upload = "";               if($meta_box['type'] == 'image') {                   $metaboxname = $meta_box['name'];              $metaboxname_upload = $metaboxname.'_upload';               if($_FILES[$metaboxname_upload]['name'] != "") {              $overrides = array( 'test_form' => false);              $imagefile=wp_handle_upload($_FILES[$metaboxname_upload], $overrides);              $imageuploadlocation = $imagefile['url'];              delete_post_meta($post_id, $metaboxname, get_post_meta($post_id, $metaboxname, true));              add_post_meta($post_id, $metaboxname, $imageuploadlocation, true);          } else {              $imageuploadlocation = get_post_meta($post_id, $metaboxname, true);              delete_post_meta($post_id, $metaboxname, get_post_meta($post_id, $metaboxname, true));              add_post_meta($post_id, $metaboxname, $_POST[$metaboxname], true);          }                } else {              $data = $_POST[$meta_box['name'].''];              if(get_post_meta($post_id, $meta_box['name'].'') == "")              add_post_meta($post_id, $meta_box['name'].'', $data, true);              elseif($data != get_post_meta($post_id, $meta_box['name'].'', true))              update_post_meta($post_id, $meta_box['name'].'', $data);              elseif($data == "")              delete_post_meta($post_id, $meta_box['name'].'', get_post_meta($post_id, $meta_box['name'].'', true));          }               }      }      add_action('admin_menu', 'create_meta_box');      add_action('save_post', 'save_postdata', 12);      ?>


Should I use custom post types for a front page video feature (vimeo)?

I'd like to create a front page video feature that embeds a vimeo video of the users choosing. I'd like the user to only have to input the video code. For instance, for http://vimeo.com/24474320 \- I'd like them only to have to input "24474320". Should I use custom post types for this? If so, how do I set this up so that it limits the field size? I'm just getting started, and I'm relatively new at wordpress, so I don't need to get into specific code necessarily - it's more of a strategic question. How would you tackle this? Thanks, Tim \-----------------------EDIT (Monday, June 6) It would be awesome if all the user (backend) saw was this:         **FRONT PAGE VIDEO FEATURE**      **Vimeo URL:** [ ** ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___** ]      [Save] [Cancel]         Then I would call that video into the front page feature.


How do I regenerate thumbnails?

I just got a new theme and am trying to regenerate thumbnails. I'm having trouble though. I tried using the AJAX Thumbnail Rebuilder but for 5 hours it just said reading attachments. Then I tried the normal rebuilder but the vast majority of images came back as undefined. Any ideas?


How to check plugin compatibility before upgrading Wordpress

When you're upgrading a plugin you can quickly check if the plugin version you are about to upgrade to works with your current version of Wordpress. Is there a way of checking that your current plugins will work with the version of Wordpress you are about it upgrade to without searching for each one in the directory?


Does wordpress have an error log?

I accidentally removed a bunch of plugin folders. I restored them all directly after, but since then my site is completely blank. Can't see anything, it's just white. I'm not sure what to do, but looking at a log file seems like a good start. Is there one?


How to tell if plugin has been network activated

I have the following lines of code that add the settings link and setup for my plugin:               add_action('admin_menu', array(&$this, 'admin_settings_menu')); // Add menu to options     add_action('admin_init', array(&$this, 'admin_settings_init')); // Add admin init functions      Now because of the nature of my plugin if the plugin is _Network Installed_ then the settings should only be available to the network admin not the individual site admins. Is there a way to check if the plugin is Network Installed so I can wrap an if statement round it?


Custom header tiling?

I've been playing with the wp custom header and background options. I like the way you can tile a small image for the background, and looking for a way to add that option to the custom header image as well. My theme has a div for the header and I've added the wp custom header like so:
     <img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>"    width="<?php echo get_custom_header()->width; ?>" alt="" '/>       I can sort of understand that the script is calling for the image src, width & height values entered in the add custom header dialogue, but could use some help to persuade the chosen image to tile. I tried something like this, but didn't work...                <div class="art-header" style="background-image:url('<img src=<?php header_image(); ?>');> background-repeat:repeat;">      I don't really need the "tile" dialogue when setting the header in wp backend, but just want it to tile automatically if the uploaded image is less than the size of the div Thanks


Domain name in a WordPress Network

I have a domain-based network. Blogs are like:               blog1.domain.com     blog2.domain.com      One of these blogs needs to be migrated to a domain _blog1.com_ , but without leave the network. I know I have to poing _blog1.com_ DNS to _blog1.domain.com_ with a CNAME register (do it), but I don't know what to do now (in other case, not a wordpress network, I'll simply add a _ServerAlias_ to Apache directive, but now I don't have any Apache directive for _blog1.domain.com_ , just for _domain.com_ )


Using $_GET variables in the URL?

I need to generate a simple error message on a page by passing a variable through the URL. The URL is structured as follows: http://site.com/parent-category/category/?error=pause I'm sure it's the permalinks rewrite interfering, but I'm not sure how to resolve it.


Post Pagination Showing Same Posts Every Page

So I have this blog that filters by category Then by city. Somewhere while creating the filtration I broke the pagination which seemed to work fine earlier. It doesn't work on my homepage where it should show all posts and goes to 404 in my archives. I'm using a custom link structure of `/%category%/%postname%/` and in my index page I have :
     <?php posts_nav_link(' - ',__('« Newer Posts','ml'),__('Older Posts »','ml')) ?>
      It is the same thing on my Archives page. I created a function to filter everything by and this is where the paging should happen: **From.php** http://pastebin.com/d9jikfPq                   $testParent = $wp_query->get_queried_object();          function cust_query($city, $cat)// Filter and page everything by city/cat     {         $setCity = false;         $setCat = false;              $paged = get_query_var('paged') ? get_query_var('paged') : 3;               // Seperates Posts into Pages         $citySlug = get_category_by_slug($city);                                    // Used to get City && Category CatID         $categorySlug = get_category_by_slug($cat);                                 // ^^^              if(isset($cat) && $cat != null)                                             // Check if $cat is set         {             $category = $categorySlug->cat_ID;                                      // Setting Category CatID             $setCat = true;         }         if(isset($city) && $city != null)                                           // Check if $city is set         {             $city = $citySlug->cat_ID;                                              // Setting City CatID                $setCity = true;         }              if($setCity && $setCat && !$testParent->parent)                             // If both cat and city are set filter by both         {             /*                 http://wordpress.stackexchange.com/questions/40815/custom-queries-child-categories-not-showing-up                For more information.             */             if(!$testParent->parent)             {                 $args = array(                     'tax_query' => array(                         'relation' => 'AND',                         array(                             'taxonomy' => 'category',                             'field'    => 'id',                             'terms'    => $city,                         ),                         array(                             'taxonomy' => 'category',                              'field'    => 'id',                             'terms'    => $category,                         )                     )                 );                 $args = array_merge( $args, array( 'paged' => $paged ) );                 return query_posts($args);                                          // Return Query             }             return query_posts(array(category__and => array($category, $city), 'paged' => $paged)); // Return Query         }         if($setCity)                                                                // Filter by City Only             return query_posts('cat='.$city.'&paged='.$paged);                      // Return Query         else if($setCat)                                                            // Filter by Category Only             return query_posts('cat='.$category.'&paged='.$paged);                  // Return Query         else                                                                                return query_posts('paged='.$paged);                                    // Return all posts     }      **Header.php** http://pastebin.com/vzm08E40               <?php require_once('from.php'); ?>     <?php         $path = $_SERVER['REQUEST_URI'];                        // Get URL and Set it to $path         $dir = explode(DIRECTORY_SEPARATOR, $path);             // Seperate URL by Directory '/'              if(isset($_SESSION['city']))                            // City Reset, Remove if statement if you don't want to reset it.                            unset($_SESSION['city']);                           // add && is_home() to reset on banner click. Useful              if($dir[4] == 'city')             $_SESSION['city'] = $dir[5];                        // If sub-Directory is City, get Final Directory as City         else             $_SESSION['cat'] = end($dir);                       // Get Category              $navCity = catName($_SESSION['city']);                  // Get formatted City Name for Navigation         $navSlug = get_category_by_slug($_SESSION['city']);     // Get Category by Slug         $cityNavID = $navSlug->cat_ID;                          // Get Category ID by Category     ?>     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">               <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />         <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>         <link rel="profile" href="http://gmpg.org/xfn/11" />         <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />         <link rel="stylesheet" type="text/css" media="print" href="<?php bloginfo( 'stylesheet_directory' ); ?>/print.css" />         <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> <?php _e('RSS Feed','ml');?>" href="<?php bloginfo('rss2_url'); ?>" />         <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>         <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />         <?php wp_head(); ?>          <body id="section-index"  <?php body_class(); ?>>
     <?php          //echo $_SESSION['cat'] . " " . $_SESSION['city'];     ?>
     <a href="<?php bloginfo('siteurl');?>" title="<?php bloginfo('name');?>">         <img src="<?php echo get_template_directory_uri() . "/img/logo.jpg" ?>" title="" alt="" />

              About Us |             Contact Us |             Get Listed

                                                                                Share This!

                     Filter By: <a href="<?php get_category_link($cityNavID); ?>"><?php isset($_SESSION['city']) ? print($navCity) : print("Home") ?>
                         <?php if(isset($_SESSION['city'])) : ?>
                                 <?php $cat = get_category_by_slug($_SESSION['cat']); ?>                                 <a href="<?php echo esc_url(get_category_link($cat->cat_ID)) ?>" title="">All
                         <?php endif ?>                         <?php wp_list_categories('orderby=id&child_of=1&title_li='); ?>

                 <?php wp_list_categories("orderby=slug&exclude=1&hide_empty=0&title_li="); ?>

         <?php if(!is_single()) : ?>
                 <?php include('breadcrumbs.php'); ?>
         <?php endif; ?>
      The function above gets passed city / category that needs to be filtered and then depending on if both are set or only one it will filter and page. Except it doesn't page... Any suggestions on what this could be? I also want to point out that my index file does not have a loop it just uses query_posts() and **changing the number inside`$paged = get_query_var('paged') ? get_query_var('paged') : 3;` to anything except `1` puts all my pages to 404. If I make it 1 then it shows all posts and pages index fine...** Why is this and what can I do to prevent this from happening?


Is Wordpress API visible from PHP file called in htaccess

I'm trying to add some rewriterules in the .htaccess file to deal with hotlinked images - specifically I want to add the URL from the post where the image appeared to the header location information of the hotlinked image request. I've got working htaccess & PHP code to add the header info, but in order to make it work, I need to be able to somehow look up the URL for the post from the image URL (this blog has a unique post for each image). I've got working code to do this, but it uses the Wordpress API, and when I try to call it none of the functions are recognized. I'm thinking that maybe calling the API from htaccess isn't possible... like it's out of scope, or I'm calling from a place that can't see Wordpress or something? I'm wondering if there's a way to make Wordpress API calls accessible from htaccess - or if anybody has any suggestions for a workaround. The only thing I can think of would be to try to query the database directly through MySQL, but I'm a bit nervous about doing that, and I'm not quite sure I understand the data structure fully. Any suggestions would be welcomed!


Dynamically generate category id and store in variable

I was able to get this working just fine with this code with advanced custom fields:               <?php $value = get_field('extended_store_descriptions', stores_47);     echo $value;     ?>      Now how can I make that number 47 dynamic and automatically generate based on the category id. I tried doing this               <?php $storenum = get_the_category(); ?>     <?php $value = get_field('extended_store_descriptions', stores_$storenum);     echo $value;     ?>      To no avail, I'm sure this is any easy fix if someone can jump in. Thanks a lot!


Why may one avoid Jetpack plugin?

I've been looking around the web at reviews and analyses of Jetpack, and I haven't been able to find any coherent discussion surrounding why not to use the Jetpack other than avoiding Wordpress.com's Terms of Services (which is unfortunately mandatory, even though Jetpack contains some plugin code that does not require Wordpress.com services or an API key). A secondary question is: what is business motivation behind Jetpack? Is the idea to bring more WP usage data into wp.com's usage, giving more data to shape the product? Is it merely the delivery of freemium services like VaultPress? Thanks for any answers!


Import data from file larger than 15 MB

I have my blog on wordpress.com, I want it to be moved on self hosted server. I have exported data from my wordpress.com blog to XML file, However, When I went to import the data to my self hosted wordpress installation it says file must not be greater than 15MB and my file is of `2257 MB` How do I go to import such a large file?


Display articles related to a custom field on a page

I have a little problem to display some articles related to a parent page. I explain. On the first hand I have a page with a model template. On the wordpress editor part, I create a custom meta field call "cat_page". This meta must be the same as the article related (view more below). This template has a classic loop to display to content of the page :               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <?php the_content(); ?>      and below I need to display the articles who have the same category name as the page.               if ( get_post_meta($post->ID, "cat_page", true) == the_category() ) : ( have_posts() ) : while ( have_posts() ) : the_post();      It's only what I think it should look, because I have tried several things but I don't know how to proceed. Image (if it can help) http://i.imgur.com/SlpQh9v.jpg?1 Thanks in advance.


Include user defined styles without including wp-load

I've looked through the answers on here and none quite match my situation. I have custom CSS that a user can edit and it is saved in the options. I use `wp_enqueue_style` to include a PHP file with a CSS content header and then load the CSS from the options. However, in order to load from the options I must include wp-load.php. I know this isn't the best way of doing things. How exactly should I achieve this instead? Plugin main file:               add_action('wp_print_styles', 'wp123_load_css');     function wp123_load_css()     {             wp_register_style('wp123-custom-css', plugins_url('/include/wp-123-style.php', __FILE__));         wp_enqueue_style('wp123-custom-css');     }      wp-123-style.php:               <?php     header('Content-type: text/css');     require_once('../../../../wp-load.php');     $options = get_option('wp123_options');     ?>          <?php echo $options['custom_css']; ?>      What is the correct way of outputting the CSS file without having to include wp-load.php? Any help and suggestions are much appreciated!


add slug beside name in Admin Category Checklists

im creating a lot of Categories with the same Name and different slugs, but im having problems identifying which is which in the admin panel, so i came up with the idea of inserting the slug besides the Name in the meta box...im using a taxonomy "portfolio-type"...anyway to do this i need to edit this file: wp-admin/includes/template.php in line 48: Replace this:               esc_html( apply_filters('the_category', $category->name ))      With this:               esc_html( apply_filters('the_category', $category->name.' - '.$category->slug ))      anyway of doing this without editing the core file, lets say a function in my functions.php theme...and to add the slug only to the box containing taxonomy "portfolio-type"..


Page full of widgets?

Is it possible to create a page which is just lots of widgets? most WP sites I see the widgets are in the sidebars, but I want a page which is just widgets and nothing else. The theme I'm currently using allows me to add columns or a table to a page but I don't know if it's possible (in any theme) to then add widgets to those columns or table cells?


Next and/or previous post content

How can I show the content in next or previous post? For example, I use this to display the next post link with title:
         <?php next_post_link('%link', '%title'); ?>

         <?php previous_post_link('%link', '%title'); ?>
      Is it possible to show the content of that post (100 Words)?


Pagination on WP_User_Query not updating current page

I have the following code which queries for all users (excluding admin) and sort them by the meta value user_business. When there are more than 10 users I have pagination which is currently working perfectly except no matter what 'userp' equals the pagination has page 1 always set as the current page. Can someone help me correct this issue?                   <?php     /**      * @package WordPress      * @subpackage themename      * Template Name: Vendors Page      */          get_header(); ?>     <?php          $url = $_SERVER['REQUEST_URI'];         $tokens = explode('/', $url);         $usernameCheck = $tokens[sizeof($tokens)-2];         if ($usernameCheck != 'vendors') {             $username = $usernameCheck;             $username = str_replace("-", " ", $username);         }     ?>     <?php          $currentUserID = get_current_user_id();          $page = (!empty($_GET['userp'])) ? $_GET['userp'] : 1;         $per_page = 10;         $offset = ( ($page -1) * $per_page);     ?>

                          <?php the_post(); ?>
                          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> role="article">
<?php if (!empty($username)) {echo str_replace("%27", "'", $username); ?>                          <?php                                 // WP_User_Query arguments                                 $args = array (                                     'exclude'        => array( 1 ),                                     'count_total'    => true,                                     'fields'         => 'all_with_meta',                                     'meta_query'     => array(                                         array(                                             'key'       => 'user_business',                                             'value'     => str_replace("%27", "'", $username),                                             'compare'   => 'LIKE',                                         ),                                     ),                                      );                                      // The User Query                                 $user_query = new WP_User_Query( $args );                                      // The User Loop                                 if ( ! empty( $user_query->results ) ) {                                     foreach ( $user_query->results as $user ) { ?>                                          <?php if ( $currentUserID == $user->ID ): ?><a href="<?php bloginfo('url'); ?>/update-your-profile/" class="profileEdit">Click Here To Edit Your Profile<?php endif; } } } ?>
                              <?php if (!empty($username)) { ?>                           <?php wp_reset_query(); ?>                          <?php                                 // WP_User_Query arguments                                 $args = array (                                     'exclude'        => array( 1 ),                                     'count_total'    => true,                                     'fields'         => 'all_with_meta',                                     'meta_query'     => array(                                         array(                                             'key'       => 'user_business',                                             'value'     => str_replace("%27", "'", $username),                                             'compare'   => 'LIKE',                                         ),                                     ),                                      );                                      // The User Query                                 $user_query = new WP_User_Query( $args );                                      // The User Loop                                 if ( ! empty( $user_query->results ) ) {                                     foreach ( $user_query->results as $user ) { ?>
                                     <?php if (isset($user->user_profile_pic)) { ?>                                                     <img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_profile_pic; ?>&w=235&h=147" title="<?php echo $user->user_business; ?>" alt="<?php echo $user->user_business; ?>" class="profilePic" />                                     <?php } else { $imgURL = get_template_directory_uri() . "/images/vendor_placeholder.jpg"; ?>                                                     <img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $imgURL; ?>&w=235&h=147&zc=2" title="<?php echo $user->user_business; ?>" alt="<?php echo $user->user_business; ?>" class="profilePic" />                                     <?php } ?>
Owner Name:
                                     <?php echo $user->first_name; ?> <?php echo $user->last_name; ?>

                                          <?php if ($user->user_address_show == 'yes') { ?>
Address:
                                         <?php echo $user->user_address_street; ?>
<?php echo $user->user_address_city; ?>, KS <?php echo $user->user_address_zip; ?>

                                     <?php } ?>                                          <?php if (isset($user->user_phone)){ ?>
Phone:
                                         <?php echo $user->user_phone; ?>                                     <?php } ?>                                          <?php if (isset($user->user_booth)){ ?>
Booth #:
                                         <?php echo $user->user_booth; ?>                                     <?php } ?>                                          <?php if (isset($user->website)){ ?>                                         <a href="<?php echo $user->website; ?>" class="profileWebsite" target="_blank">View Our Website                                         <?php echo $user->website; ?>                                     <?php } ?>                                          <a href="mailto:<?php echo $user->user_email; ?>" class="contactVendor">Contact Us Via Email
Markets We Attend:
                                     <?php if (isset($user->we_attend_east)) { ?>
East Wichita
Green Acres Market
<?php } ?>                                     <?php if (isset($user->we_attend_west)) { ?>
West Wichita
Sedgwick County Ext. Office
<?php } ?>                                     <?php if (isset($user->we_attend_delano)) { ?>
Delano in Wichita
Lawrence Dumont Parking lot
<?php } ?>                                     <?php if (isset($user->we_attend_derby)) { ?>
Derby, Kansas
<?php } ?>                                          <?php if (isset($user->attend_this_week_east) || isset($user->attend_this_week_wast) || isset($user->attend_this_week_delano) || isset($user->attend_this_week_derby)) { ?>
We will be at the                                      <?php if (isset($user->attend_this_week_east)): ?>East Wichita Market<?php if (isset($user->attend_this_week_west) || isset($user->attend_this_week_delano) || isset($user->attend_this_week_derby)): ?>,<?php endif; ?><?php endif; ?>                                     <?php if (isset($user->attend_this_week_west)): ?>West Wichita Market<?php if (isset($user->attend_this_week_delano) || isset($user->attend_this_week_derby)): ?>,<?php endif; ?><?php endif; ?>                                     <?php if (isset($user->attend_this_week_delano)): ?>Delano in Wichita Market<?php if (isset($user->attend_this_week_derby)): ?><?php endif; ?><?php if (isset($user->attend_this_week_derby)): ?> and<?php endif; ?><?php endif; ?>                                     <?php if (isset($user->attend_this_week_derby)): ?>Derby, Kansas Market<?php endif; ?>                                     this week!
                                     <?php } ?>
Items sold at market:

                                         <?php if (isset($user->product_1)){ ?>
<?php echo $user->product_1; ?>
<?php } ?>                                         <?php if (isset($user->product_2)){ ?>
<?php echo $user->product_2; ?>
<?php } ?>                                         <?php if (isset($user->product_3)){ ?>
<?php echo $user->product_3; ?>
<?php } ?>                                         <?php if (isset($user->product_4)){ ?>
<?php echo $user->product_4; ?>
<?php } ?>
                                          <?php if ($user->user_organic == 'yes'){ ?>
Organic | Chemical Free
                                     <?php } ?>                                          <?php if ($user->user_producer == 'yes'){ ?>
100% Producer
                                     <?php } ?>

About Us:

<?php echo $user->user_about; ?>

                                     <?php if (isset($user->user_profile_pic)){ ?>
View Our Photos
<?php } ?>                                          <?php if (isset($user->user_profile_pic)){ ?>
                                             <img src="<?php bloginfo('template_url'); ?>/images/user_pics_prev.png" class="prev"/>                                             <img src="<?php bloginfo('template_url'); ?>/images/user_pics_next.png" class="next"/>

<a href="<?php echo $user->user_profile_pic; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_profile_pic_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_profile_pic; ?>&h=134&w=119" alt="<?php echo $user->user_profile_pic_c; ?>" title="<?php echo $user->user_profile_pic_c; ?>" />
                                                          <?php if (isset($user->user_pic_1)){ ?>
<a href="<?php echo $user->user_pic_1; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_1_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_1; ?>&h=134&w=119" alt="<?php echo $user->user_pic_1_c; ?>" title="<?php echo $user->user_pic_1_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_2)){ ?>
<a href="<?php echo $user->user_pic_2; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_2_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_2; ?>&h=134&w=119" alt="<?php echo $user->user_pic_2_c; ?>" title="<?php echo $user->user_pic_2_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_3)){ ?>
<a href="<?php echo $user->user_pic_3; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_3_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_3; ?>&h=134&w=119" alt="<?php echo $user->user_pic_3_c; ?>" title="<?php echo $user->user_pic_3_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_4)){ ?>
<a href="<?php echo $user->user_pic_4; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_4_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_4; ?>&h=134&w=119" alt="<?php echo $user->user_pic_4_c; ?>" title="<?php echo $user->user_pic_4_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_5)){ ?>
<a href="<?php echo $user->user_pic_5; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_5_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_5; ?>&h=134&w=119" alt="<?php echo $user->user_pic_5_c; ?>" title="<?php echo $user->user_pic_5_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_6)){ ?>
<a href="<?php echo $user->user_pic_6; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_6_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_6; ?>&h=134&w=119" alt="<?php echo $user->user_pic_6_c; ?>" title="<?php echo $user->user_pic_6_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_7)){ ?>
<a href="<?php echo $user->user_pic_7; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_7_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_7; ?>&h=134&w=119" alt="<?php echo $user->user_pic_7_c; ?>" title="<?php echo $user->user_pic_7_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_8)){ ?>
<a href="<?php echo $user->user_pic_8; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_8_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_8; ?>&h=134&w=119" alt="<?php echo $user->user_pic_8_c; ?>" title="<?php echo $user->user_pic_8_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_9)){ ?>
<a href="<?php echo $user->user_pic_9; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_9_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_9; ?>&h=134&w=119" alt="<?php echo $user->user_pic_9_c; ?>" title="<?php echo $user->user_pic_9_c; ?>" />
<?php } ?>

                                     <?php } ?>                                          <?php if (isset($user->user_twitter) || isset($user->user_facebook)){ ?>
Socialize With Us
<?php } ?>                                          <?php if (isset($user->user_twitter)){ ?>
                                             <img src="<?php bloginfo('template_url'); ?>/images/twitter_prev.png" class="prev"/>                                             <img src="<?php bloginfo('template_url'); ?>/images/twitter_next.png" class="next"/>
                                                 <?php echo do_shortcode('[twitter-user]'); ?>

                                     <?php } ?>                                          <?php if (isset($user->user_facebook)){ ?>                                         <iframe src="//www.facebook.com/plugins/likebox.php?href=<?php echo urlencode($user->user_facebook); ?>&width=588&height=590&show_faces=true&colorscheme=light&stream=true&show_border=true&header=true&appId=172839226207438" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:588px; height:590px;" allowTransparency="true">                                     <?php } ?>
                                      <?php } } ?>                                                                                <?php } else { ?>                                                           <?php                                 // WP_User_Query arguments                                 $args = array (                                     'exclude'        => array( 1 ),                                     'count_total'    => true,                                     'fields'         => 'all_with_meta',                                     'number'         => $per_page,                                     'offset'         => $offset,                                     'meta_key'       => 'user_business',                                     'query_id'       => 'wps_users',                                 );                                           // The User Query                                 $user_query = new WP_User_Query( $args );                                      // The User Loop                                 if ( ! empty( $user_query->results ) ) {                                     foreach ( $user_query->results as $user ) { ?>
                                             <a href="<?php bloginfo('url'); ?>/vendors/<?php echo str_replace(" ", "-", strtolower($user->user_business)); ?>">                                                 <?php if (isset($user->user_pic)) { ?>                                                     <img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic; ?>&w=235&h=147" title="<?php echo $user->user_business; ?>" alt="<?php echo $user->user_business; ?>" />                                                 <?php } else { $imgURL = get_template_directory_uri() . "/images/vendor_placeholder.jpg"; ?>                                                          <img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $imgURL; ?>&w=235&h=147&zc=2" title="<?php echo $user->user_business; ?>" alt="<?php echo $user->user_business; ?>" />                                                 <?php } ?>

<?php echo $user->user_business; ?><a href="<?php bloginfo('url'); ?>/vendors/<?php echo str_replace(" ", "-", strtolower($user->user_business)); ?>" class="viewProfile">View Profile
                                                     Item(s) sold at market:
<?php $productCounter = 0; ?>                                                         <?php if (isset($user->product_1) && $productCounter == 0) { $productCounter = 1; ?>
<?php echo $user->product_1; ?>
<?php } ?>                                                         <?php if (isset($user->product_2) && $productCounter == 0) { $productCounter = 1; ?>
<?php echo $user->product_2; ?>
<?php } ?>                                                         <?php if (isset($user->product_3) && $productCounter == 0) { $productCounter = 1; ?>
<?php echo $user->product_3; ?>
<?php } ?>                                                         <?php if (isset($user->product_4) && $productCounter == 0) { $productCounter = 1; ?>
<?php echo $user->product_4; ?>
<?php } ?>                                                         <?php if (isset($user->product_5) && $productCounter == 0) { $productCounter = 1; ?>
<?php echo $user->product_5; ?>
<?php } ?>
                                                     Market(s) we attend:<?php $marketCounter = 0; ?>                                                     <?php if (isset($user->we_attend_east) && $marketCounter != 2) { $marketCounter++ ?>
East Wichita
Green Acres Market
<?php } ?>                                                     <?php if (isset($user->we_attend_west) && $marketCounter != 2) { $marketCounter++ ?>
West Wichita
Sedgwick County Ext. Office
<?php } ?>                                                     <?php if (isset($user->we_attend_delano) && $marketCounter != 2) { $marketCounter++ ?>
Delano in Wichita
Lawrence Dumont Parking lot
<?php } ?>                                                     <?php if (isset($user->we_attend_derby) && $marketCounter != 2) { $marketCounter++ ?>
Derby, Kansas
<?php } ?>

                                      <?php } } ?>                                                            <?php } ?>
                                     <?php                     $page_args = array(         'base'         => '%_%',         'format'       => add_query_arg(array('userp' => '%#%')),         'total'        => ceil($user_query->total_users / $per_page),         'current'      => $page,         'end_size'     => 2,         'mid_size'     => 2,         'prev_next'    => True,         'prev_text'    => __('« Previous'),         'next_text'    => __('Next »'),         'type'         => 'plain',     );          echo paginate_links($page_args);     ?>

                     <?php if (!empty($username)) { ?>
<?php if ( dynamic_sidebar('profile-sidebar') ) : else : ?><?php endif; ?>
<?php } else { ?><?php get_sidebar(); ?><?php } ?>

     <?php get_footer(); ?>


Using Wordpress behind a CloudFront Custom Distribution

I have just managed to get my site running behind a Cloudfront distribution using the custom distribution API, but now i cannot login to the site using the standard old address (since i screwed around with DNS). The way i have it hooked up is as follows: backendblog - real server blog - cloud front distribution told to get data from backendblog visiting blog results in the page being returned (and quite fast too!) but none of the dynamic stuff (search, login, etc) work. comments work grand since they are managed by Disqus. So, i have 2 questions around this: 1: how do i set it so that backendblog will allow me to login without redirecting to blog (if i set the config, it changes all the URLs... want the URLs to be what ever site the page loads on...) 2: how do i configure pages to have higher expire times so they stay in CloudFront longer? Any ever try this? the site, for reference, is blog.lotas-smartman.net (clodfront) or backendblog.lotas-smartman.net (dedicated box in Germany). have seen Pingdom avg response times drop massively in the last week with cloudfront...


Can i attach a post specific tag to a comment?

I would like to be able to have the comment "waiting for approval" mailings display the blog they came from. I.e, if a comment is left for approval from "eating fish" the mail message ought to reflect it's origin post...   perhaps a tag associated with the COMMENTS button much like the HTML "mailto= Subject=" would be helpful in tracking visitors. sadly, I am not a guru with coding,   can someone shed some lumens here? Thanks


How to change default post type / post to media or attachments

Im using wordpress 3.1.1, in frontpage i need to display only the media uploads, now im using this acction:               add_action( 'parse_query', 'custom_query' );          function custom_query( &$query ) {            $query->set( 'post_type', array('attachment') );          }      add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( &$query ) {                 if ( is_home() || is_frontpage() ) {              $query->set( 'post_status', 'inherit' );         $query->set( 'post_type', 'attachment' );            }                 return $query;          }      But doesnt work. Any help is working.


switch a theme different per user role

I plan to use the member plugin by Justin Tadlock I wish to know if how could I, on the front side, auto switch to a theme according to a role status.. for example authors would have the site presented using theme 1 while editor would have the site presenter using theme 2 I would rather have 2 different theme rather than conditionals within one theme structure Thank you in advance


WordPress MySQL & PHP Performance

have a website (www.americanbankingnews.com) that gets 40,000-50,000 page views today. It's currently sitting on a dedicated quad-core Xeon server with 8GB of ram. The site is powered by WordPress and MySQL (sitting on the same server) and I'm currently using W3 Total Cache for page and MySQL query Caching. Unfortunately, that doesn't seem to be enough. During peak traffic times, my servers are getting a few HTTP 500 errors and pages that aren't cached load slowly. I'm currently not using Xcache or any other PHP cache/acceleration tools. Are there additional steps that I should take to try to optimize MySQL and PHP performance? Or should I fork over for an additional server. Specifically, I'd be interested in additional suggestions to improve MySQL performance and whether or not tools like xcache might help in this situation


Long Waiting Times on GoDaddy?

I prefer not to use GoDaddy because I always encounter performance issues. However, one of my clients is rather insistent on using them... so we are. I've tested this with a vanilla Wordpress 3.0+ install with no active plugins, but it always seems to happen for me: Whenever a new page/post is called by the browser, we encounter 3-10 second "waiting" times. ![enter image description here](http://i.stack.imgur.com/pFz28.png) I don't have this problem on any non-godaddy wordpress installs (they nearly always get their pages in queue in under 2 seconds). But all my Godaddy installs exhibit this behavior. Is anyone familiar with this issue?


defining a folder location in order to recall it

I'm creating a child theme off of wp-framework and in it's header it uses               <?php echo IMAGES . '/favicon.ico'; ?>      to recall the folder where images are kept. How do I define or create the location in order to recall it using echo IMAGES? and if I can save the image folder location as IMAGES (If I recall it's a string?) can I do the same with other information?


Allowed Memory Size Error in WordPress

My WordPress is always down. I contacted my host and they said that the server is fine. My WordPress site has some basic plugins which are   1. all in one seo   2. seo search tagging   3. google xml   4. robots.txt   5. related post I can't find what is my problem. I have some HTML files which are working fine, but my Wordpress site is not working. I think the issue is with Wordpress. Do I need to reinstall Wordpress to fix the issue? Thanks. I have this error in error_log. I think it is a memory problem. > `[28-Apr-2011 13:32:20] PHP Fatal error: Allowed memory size of 33554432 > bytes exhausted (tried to allocate 82 bytes`


Remove classes from body_class

I don't need this whole mess of classes like this... `<body class="page page-id-829 page-template page-template-page-template- portfolio-php portfolio">` I'd like something like this... `<body class="portfolio">` Is there a filter snippet somewhere that has a list of all the classes and I can then just uncomment the stuff I don't want to see in the body class. Thanks.


Custom Post Type pagination when CPT 'rewrite' rule and a page have the same slug

I would like to achive the following link structure on my site:   1. /properties/ -> a `properties` page with `properties` CPT, page 1.   2. /properties/page/2 -> a `properties` page with `properties` CPT, page 2.   3. /properties/property-name -> a single `properties` page with a property details.       I have a Custom Post Type (CPT) called `property`. It's registered as following with the `rewrite` rule specified as `'rewrite' => array('slug' => 'properties', 'with_front' => false)`:               function property_post_type_init() {       $labels = array(         'name' => _x('Properties', 'post type general name'),         'singular_name' => _x('Property', 'post type singular name'),         'add_new' => _x('Add New', 'property')       );       $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'rewrite' => array('slug' => 'properties', 'with_front' => false),         'query_var' => true,         'capability_type' => 'post',         'hierarchical' => false,         'show_in_nav_menus' => false,         'menu_position' => 5,         'supports' => array(           'title',           'editor',           'revisions'         )       );       register_post_type('property',$args);      I also have a page with the slug `properties` and the permalink structure is set as `/%category%/%postname%/` On the `Properties` page I construct a new `WP_Query` object with the following arguments:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args = array(         'post_type' => 'property',         'orderby' => 'date',         'order' => 'DESC',         'paged' => $paged     );     return $args;      I use a custom pagination code (in functions.php) which generates pagination correctly with the correct urls:               <my-site>/properties/     <my-site>/properties/page/2/     <my-site>/properties/page/3/      However, when I click on any page in the pagination I get redirected to 404 page. I've expected the query params and they are the following:               [page] => 2     [property] => page     [post_type] => property     [name] => page      Which is not correct! I don't understand where these parameters are coming from:               [page] => 2     [property] => page     [name] => page      I'm sure it's something to do with the `rewrite` rule when registering a CPT. How can I achive the following set up to work correctly:   1. A `properties` page that displays all `properties` custom post types posts with pagination.   2. A `properties` custom post type with `'rewrite' => array('slug' => 'properties', 'with_front' => false)` rule.   3. Permalink of `/%category%/%postname%/` structure So that I have the following link structure:   1. /properties/ -> a `properties` page with `properties` CPT, page 1.   2. /properties/page/2 -> a `properties` page with `properties` CPT, page 2.   3. /properties/property-name -> a single `properties` page with a property details. Hope that makes sense. Thanks, Dasha


Can my hooked uninstall class function access a global var declared in main plugin file?

My current setup is as follows... In the main plugin file, these two hooks are set (not inside any class):               register_activation_hook(__FILE__, array('DG_Setup', 'activation'));     register_uninstall_hook(__FILE__, array('DG_Setup', 'uninstall'));      This same main file includes the file containing `DG_Setup`:               include_once DG_PATH . 'inc/class-setup.php';      And declares `$dg_options`:               define('DG_OPTION_NAME', 'document_gallery');     $dg_options = get_option(DG_OPTION_NAME);      I assumed that by referencing the main plugin file for the hook, all the setup within would run before my uninstall hook was executed, but this doesn't appear to be the case. In this same file, a number of declarations and variables are setup. When the uninstall hook fires, it doesn't seem to have access to any of the declared values or to the variable. I have tried explicitly including the main plugin file within the uninstall hook, but that doesn't change anything.               class DG_Setup {        public static function uninstall() {           if (!current_user_can('activate_plugins')) return;           check_admin_referer('bulk-plugins');                include_once plugin_dir_path(__FILE__) . 'class-thumber.php';                $options = DG_Thumber::getOptions();           var_dump($options); // null                foreach ($options['thumbs'] as $val) {              if (false !== $val) {                 @unlink($val['thumb_path']);              }           }                delete_option(DG_OPTION_NAME);        }     }          class DG_Thumber {        public static function getOptions() {           include_once plugin_dir_path(dirname(__FILE__)) . 'document-gallery.php';                global $dg_options;           return $dg_options['thumber'];        }     }      Obviously I could just re-declare all of theses values, but then I'm declaring the same value in multiple places which is very un-DRY. So my question is, how can I handle this _cleanly_?


meta_query keys and sticky posts

The problem is that the code works but when i make a post sticky it doesn't appear at first. The function of the code: It only shows posts that have a thumbnail or a slideshow image.               <?php          $args = array(  'numberposts'  => 5,                     'meta_query'   => array(                         'relation' => 'OR',                         array(                             'key'     => '_thumbnail_id',                             'compare' => '!=',                             'value'   => ''                         ),                         array(                             'key'     => 'slideshow_image',                             'compare' => '!=',                             'value'   => ''                         )                     )                 );               $my_posts = get_posts( $args );     global $post;     foreach( $my_posts as $post ) : setup_postdata($post);          ?>          <?php the_post_thumbnail('thumb-small'); ?>     <a href="<?php the_permalink(); ?>">         <?php the_title(); ?>     </a>          <?php     endforeach;     wp_reset_postdata();     ?>


Bulk delete WordPress posts with phpMyAdmin

I have over 8,000 posts generated by wp-o-matic and I want to get rid of all of them. I want to execute this query in phpMyAdmin. I just want to make sure this is safe to run and it's not wiping out my pages. This is the query:               DELETE FROM 'wp_posts' WHERE 'post_type' = 'post'      Thanks


Is it possible to allow a user to only edit categories of posts and nothing else?

I have a site with a lot of articles that aren't categorized. I'd like to hire someone to go through the articles and assign categories to them, then submit them for review and approval. However, if they can also edit the text of the articles the whole review/approval process by me would take up a lot of time as I'll have to check the text on a lot of articles. So is there a way to set permissions in such a way that the specified user can only tweak the categories of a post and **NOTHING** else? Any alternative ideas are also welcome.


transition_comment_status called when untrashing comments

The author gets two mail when I untrash a comment. I only want to send the "untrash_answer_notification"-mail when untrashing comments. Any ideas?                // Send mail to user when their comment has been restored     function untrash_answer_notification($comment_id) {     $comment = get_comment($comment_id);     if ( $comment->comment_parent != 0 ) return;     $author = get_userdata($comment->user_id);     $headers = "MIME-Version: 1.0" . "\r\n";     $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";     $headers .= "From: Blabla.com <bla@bla.com>" . "\r\n";     $subject = "Your comment was restored";     $message = "blabla";          wp_mail($author->user_email, $subject, $message, $headers);     }     add_action( 'untrash_comment', 'untrash_answer_notification' );          // Mail author if/when they're comment is approved     function approve_comment_callback($new_status, $old_status, $comment) {     if($old_status != $new_status) {     if($new_status == 'approved' || $new_status==1) {     if($comment->comment_author_email!=''){     $author = get_userdata($comment->user_id);     $headers = "MIME-Version: 1.0" . "\r\n";     $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";     $headers .= "From: Blabla.com <bla@bla.com>" . "\r\n";     $subject = "Your comment was approved";     $message = "blabla";          wp_mail($author->user_email, $subject, $message, $headers);         }         }             }     }     add_action('transition_comment_status', 'approve_comment_callback', 10,3);


Check if post title already exists

I'm using the plugin "User Submitted Posts" which allows my users to create posts frontend. So I basically have a frontend post form. I'm trying to find a way for my users to be informed if a post with the same posttitle/link already exists. So when they write an already existing postname in the input field called "usp-title" I want a message to pop up saying "Post name already exists blabla...". I've been searching around a lot for a solution. The closest thing I found was this code:               $page_check = get_page_by_title($content['title'],OBJECT,'post');      if(!$page_check->ID){      //do something when post not exits      }else{      // give a error or something      }      But I don't know how to implement it. I guess I'm asking for pretty much, but I'm stuck so I decided to give it a try.


Checking whether template part is loaded in a page

I have a template part like this:               <nav id="subpagemenu" class="sidebar">         <?php get_template_part( 'nav', 'subset' ); ?>         <?php get_sidebar(); ?>     </nav>      Both of these are conditional, I mean, nothing will load if there's no content. if there is content, they both load boxes like:                <div class="widget">       Now I would like to be able to know if there are any widgets (sidebar, or my template_part), so that in my functions.php, I can set a variable $mywidgets=true or false. I know that I can use '_is_active_sidebar' for the one part, but how can I check the other part? I don't want to register that part as a sidebar... All I need is a 'true/false'. I tried 'is_page_template' and 'set_theme_mod'. I also looked at these threads: http://stackoverflow.com/questions/6366351/getting-dom-elements-by-class-name Is there a way to check which template file is being loaded, if it is not a page template file? Am I thinking of this in the wrong way? Need to construct the theme differently? Thanks!


Using OR in WP_Query negates the "NOT EXISTS" compare

I'm attempting to filter posts by a custom field that either are equal to 'new' or have not been set yet. I'm able to get either of those meta_queries to work on their own but when I use them in an 'OR' query, the 'NOT EXISTS" portion is ignored and the query returns every post that has ANY value set. Here is the sample 'meta_query' that is causing the strange behavior:               array(       'relation' => 'OR',       array(         'key' => 'status',         'compare' => 'NOT EXISTS',       ),       array(         'key' => 'status',         'value' => 'new',         'compare' => '=',       ),     );


When querying a combination of posts and other meta fields, is there a better solution than directly modifying the WHERE value?

This question is a follow up to a question I recently asked. I've implemented what seemed to be the only solution, and it seems to work (YAY!). I just need to verify that:   1. This is really the only way to modify the query to match with a match to the (`post_title OR post_content` _OR_ any one of the other meta fields desired.   2. That this won't mess with other queries not related to searches. The regex used below, I think, would generally only be used for search, but what chance is there of it matching some other functionality in the core or a plugin. I realize with plugins anything could happen, but I'm especially concerned about conflicts in the WP Core.   3. I considered doing all the work in the `posts_where` filter, but thought it was best to rely on modifying `$query` as much as possible and limit direct modification of `WHERE`. Is that a reasonable choice? In any event, here is the function used to modify the `WHERE`:               function st_posts_where( $where ){         if( !is_admin() ){             global $wpdb;             $ptn = "/(\s*AND \(\(\({$wpdb->prefix}posts.post_title LIKE '%.*%'\)\s+OR\s+\(".                    "{$wpdb->prefix}posts.post_content LIKE '%.*%'\)\)\)\s+)AND(.*)/";             $where = preg_replace( $ptn, "$1OR$2", $where );         }         return $where;     }     add_filter( 'posts_where' , 'st_posts_where' );      Additionally, here is the function that the original question was addressing, which is still being used alongside the above one.               function st_search_all( $query ) {         if( !is_admin() && $query->is_search ) {             $query->set( 'post_type', array( 'page', 'attachment' ) );             $query->set( 'post_status', 'inherit' );             $query->set( 'meta_query', array(                 'relation' => 'OR',                 array(                      'key'       => '_st_plaintext',                     'value'     => $query->get('s'),                     'compare'   => 'LIKE'                 ),                 array(                     'key'       => 'Training Classes',                     'value'     => $query->get('s'),                     'compare'   => 'LIKE'                 ),                 array(                     'key'       => 'External Content',                     'value'     => $query->get('s'),                     'compare'   => 'LIKE'                 )             ) );         }         return $query;     }     add_filter( 'pre_get_posts', 'st_search_all' );      All of this in combination results in the following query result which achieves the desired result:               AND (((dev_posts.post_title LIKE '%sbir%')        OR (dev_posts.post_content LIKE '%sbir%')))       OR dev_posts.post_type IN ('page', 'attachment')      AND (dev_posts.post_status = 'inherit')      AND (      (dev_postmeta.meta_key = '_st_plaintext'        AND CAST(dev_postmeta.meta_value AS CHAR) LIKE '%sbir%')     OR  (mt1.meta_key = 'Training Classes'        AND CAST(mt1.meta_value AS CHAR) LIKE '%sbir%')     OR  (mt2.meta_key = 'External Content'        AND CAST(mt2.meta_value AS CHAR) LIKE '%sbir%'))


Show wp_nav_menu() based on URL with no fallback

I have specific wp menus for each url.   When I encounter a url that has no matching wp menu I dont want any nav. So far it seems if none is found it will show a default nav or pick one of the existing navs to show. use case http://domainnameA.com show wp_nav_menu('domainnameA') http://domainnameB.com no menu exists - dont show a nav instead I am getting Nav on Domain B that has a link to the only page that exists. If I delete the page I get no navigation but that is not a great solution.


@file_get_contents and wp_remote_get

`$content = json_decode(@file_get_contents($query));` what correctly replacement for @file_get_contents in this string? if i just replace @file_get_contents for @wp_remote_get i get error > Warning: json_decode() expects parameter 1 to be string, array given in > example.php on line 88


Redirect deleted page URL ?p=xxxx

Google Webmaster Tools shows a bad URL of /?p=xxxx This page id does not exist. I don't use this form of permalink at all. If I try using a 301 redirect or RewriteRule in .htaccess nothing happens. All my other redirects work fine, but none of them include the format /?p=xxxx Is there a method to redirect this specific URL type in .htaccess? Is there a Wordpress admin specific method to redirect this URL? Thanks.


Class variables not correct on page

I'm trying to make some of the variables from my plugin available for an instance of the class on my page. But it's not showing up the correct values. Here's the relevant part of the plugin:               class opi{         // version         public $opi_version = "1.0";              public $mg = 0;              //constructor         public function opi(){             $this->__construct();         }              public function __construct(){             add_action('init', array(&$this, 'o_check'));             // ...         }              function o_check(){             if (is_user_logged_in()){                 $this->mg = 4;             }         }     }     $opi = new opi;      If I put `echo $this->mg;` just before the closing brace in the `o_check()` function, then it shows `4`. Fine. Now if I put the following in page.php, and I'm logged into WordPress, I get the result `0`.               <?php $pageopi = new opi; ?>     <?php echo $pageopi->mg; ?>      Any ideas where I'm going wrong please?


Taxonomy, Terms, and Template Files

I have post type 'product' and hierarchical taxonomy 'types' attached to it. In this taxonomy, I have terms: 'dry-clean', 'washer', etc. With several sub terms on each terms. In my situation, I need to display, eg:   1. http://example.com/types/washer -> display all sub terms on it   2. http://example.com/types/washer/{subterm} -> display all posts on it **My questions is:**   1. How do I get permalink URL for parent terms? I try URL above, but it result in 404.   2. How the template files work for that kind of problem?      1. is `taxonomy-types-washer.php` enough for case #1? or should I create `taxonomy-types.php` and create the logic there?     2. in my mind, after scanning template hierarchy, I might need `taxonomy-types-{term_parent}.php` to list all sub terms and `taxonomy-types.php` to list all product in sub terms.     3. ultimately, to display each product, I will have to create `single-product.php`   3. On a slightly unrelated problem. I find that `archive-{posttype}.php` doesn't work when I don't have any post on it. Is there any solution for this? ( _should I create different question, or stick with this one_ )? **UPDATE** I checked my `rewrite_rules` options and it doesn't list [types] at all. I don't know why. To test it, I change my slug into `product-types`, flush permalink and it list this:               [product-types/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?types=$matches[1]&feed=$matches[2]     [product-types/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?types=$matches[1]&feed=$matches[2]     [product-types/([^/]+)/page/?([0-9]{1,})/?$] => index.php?types=$matches[1]&paged=$matches[2]     [product-types/([^/]+)/?$] => index.php?types=$matches[1]      So I guess it's registered now. I try to load URL `product-types/washer` it goes to 404. I try to load URL `index.php?types=washer`. It too, goes 404. Right now, I have this files:   * taxonomy-types-washer.php   * taxonomy-types.php So, I don't know what's wrong with this one :(. **UPDATE #2** I find the problem. It's because I missed `'rewrite'=>array('hierarchical'=>true)` Here's the new `rewrite_rules`:               [product-types/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?types=$matches[1]&feed=$matches[2]     [product-types/(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?types=$matches[1]&feed=$matches[2]     [product-types/(.+?)/page/?([0-9]{1,})/?$] => index.php?types=$matches[1]&paged=$matches[2]     [product-types/(.+?)/?$] => index.php?types=$matches[1]


How can I use AJAX to save/update a widget form?

My custom widget's form will have two pull-down menus: the content of the second menu is dependent on the user's selection in the first menu (think of the way Country and State/Province works). I think the easiest implementation (though perhaps not the most user-friendly) would simply be to have the form automatically submit itself when the first pulldown is changed (ie: `<select onchange="submit_the_page_via_ajax()">`). I tried `onchange="this.form.submit();"` but that didn't leverage the Ajax call to my surprise (I would have thought that the sophisticated WordPress developers would have hiJaxed the form's submit event). They must be hijaxing the submit _button_ however, since all my view source shows me is a standard html input type for the button. Anyway, I would appreciate a little insight into a best practice for submitting a widget's form leveraging ajax. This is a great post but only addresses the widget's display, not the back-end form.


How can I insert default widgets when my theme is activated (similar to what twenty eleven does)?

When Twenty Eleven theme is activated, it inserts several default widgets into its sidebars. How can I code my theme to do the same?


register multiple post types on one menu entry

### Case: I `register_post_type()` 3 different CPTs1) Example: 3 post types named _party, event, location_. The other needed arguments in the array are left out.               register_post_type(          'party'         ,array(              'show_in_menu' // true (for main) or "edit.php?post_type=party (for subentries)          )     );        * Then I set the `'show_in_menu'` argument for the _first_ CPT item (a.k.a "party") to `true`   * The other items get set `'show_in_menu'` to `'edit.php?post_type=party` ### Result: ![enter image description here](http://i.stack.imgur.com/xcHMu.png) What's the point with this? What I expected was that I get "`Add New`" menu items for all of them, not only for the main CPT. How would I do set the arguments to not only get list views, but single new/edit screens as well? ### Notes: I know, that I got an `Add New` button in the list view on top next to the title, but I want to know how I could add these links to the admin menu items. I also know that I can work around with               add_submenu_page(          "edit.php?post_type=party"         ,"Add New"         ,"Add New"         ,"post-new.php?post_type=party"     );      but I'm not interested in the work around. I want to know how this is thought to work out of the box. 1) CPT = short for custom post type


How would I make a function to dynamically determine if user is logged to change navigation menu text?

I would like to create a function to determine if a user is logged in or logged out. If the user is logged in I would like the navigation menu text to say "My Account" (this is what it currently displays because 'My Account' is the page name.) If the user is logged out, I would like the navigation menu text to read "Login". This is my idea so far....               if (is_user_logged_in()) {         $my_account = "My Account";         return is_page($my_account);     } else {         $login = "Login/Sign Up";         return is_page($my_account) = "$login";          }


Change language of comments template

I have a Wordpress installation in italian, I need to keep italian for the admin section but the frontend needs to be in english. The theme is custom so that's ok, but in single posts I'm using `comments_template()` which prints its output in italian. I have read this question but adding that filter seems to have no effect. Is there anything else I need to do to change `comments_template()` language?


thumbnails are getting clipped down, want to resize instead

I am working on a pre-built theme, and it is clipping the thumbs off. It looks like it is happening in functions.php. I already checked the media and it is not checked. I want to achieve a resizing instead. The site is the- carstore.info


Wordpress will not operate correctly

My website is ImASpy.com. If you click on the link, Findings, this takes you to my first Wordpress page. It appears to work fine until you click on comments, or you try to go to the about page, which is another Wordpress page. it stops working and usually gives a database error. Even worse, I cannot get into my Wordpress administration. Any idea what's going on? If you need details please let me know what you need. I can give you the entire Sql file or the wp-config.php if you need it. Thanks!


Add Admin User via SQL

I gave my client the admin account to his wordpress install and I forgot to add an administrator user for myself. Now, I can no longer access the admin panel because they have changed their password. I have direct access to the database and was wondering if I could inject a new admin user via SQL?


Auto add pages to category menu

I have created a custom post type called Products, on the product pages i have a menu in the left sidebar. This menu is made up of categories for the products. Is it possible to have my products automatically added to the category menu based the category of the product? For example, i make a product, i give it a category of blue. Where blue appears in the menu the product will automatically be added underneath blue. Is this possible? Thanks Update: To be more clear i'm using a plugin called Jquery Accordion Menu and the menu uses a widget. It still uses the built-in wordpress menu system. The Jquery Accordion Widget effectively just styles the menu, in the widget settings you pick what menu you want it to show. I've found this code inside the plugin file after the comments below. I don't know if it's any help.                       function widget($args, $instance) {                 extract( $args );                 // Get menu                      if(! isset($instance['speed']) ){ $instance['speed'] = 'slow'; }                      $widget_options = wp_parse_args( $instance, $this->defaults );                 extract( $widget_options, EXTR_SKIP );                      $nav_menu = wp_get_nav_menu_object( $instance['nav_menu'] );                      if (!$nav_menu)                         return;                      $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);                      $classMenu = ($instance['classMenu'] != '') ? $instance['classMenu'] : 'menu';                      echo $args['before_widget'];                      if ( !empty($instance['title']) )                         echo $args['before_title'] . $instance['title'] . $args['after_title'];                      ?>                      <div class="dcjq-accordion" id="<?php echo $this->id.'-item'; ?>">                              <?php                                 wp_nav_menu(                                         array(                                                 'fallback_cb' => '',                                                 'menu' => $nav_menu,                                                 'container' => false,                                                 'menu_class' => $classMenu                                                 )                                         );                         ?>                      </div>                 <?php                      echo $args['after_widget'];         }      EDIT 2: If i can get this working without the plugin then that's great. I just need some sort of menu that displays categories and the pages for that category automatically.


CSS/JS files in WordPress

In web development, I get used to place css/js files under separate folders (css folder, js folder ..etc). What I am experiencing in WordPress is that I cannot access these folders in WordPress Admin Editor Page, the editor only displays the files under the main theme folder, not the nested folders. Is there an option to enable showing nested folders? is there a plugin to accomplish that? If not, then what is the best practice to follow for placing files and folders under WordPress folder?


How to display the most popular posts of all the blogs in a mu setup?

When you visit wordpress.com, they have a list of the most popular posts right on the front page. I was wondering if there was a way to do the same thing on my multisite installation. Is it possible, and if it is, how would I go about doing it (plugin? theme?)?


Different page content for default pages on Wordpress Multisite

I've got this code which sets up 4 default pages on every new site install on Wordpress MU. I was wondering how I could set up different 'post_content' for each of the four pages? * * *               function default_pages( $blog_id )     {     $default_pages = array(         'Contact',         'Information',         'About',         'Home',     );          switch_to_blog( $blog_id );          if ( $current_pages = get_pages() )         $default_pages = array_diff( $default_pages, wp_list_pluck( $current_pages, 'post_title' ) );          foreach ( $default_pages as $page_title ) {                 $data = array(             'post_title'   => $page_title,             'post_content' => "This is your '$page_title' page. Enter in your content here.",             'post_status'  => 'publish',             'post_type'    => 'page',         );              wp_insert_post( add_magic_quotes( $data ) );     }          restore_current_blog();     }          add_action( 'wpmu_new_blog', 'default_pages' );


is there a quick way to hide category from everywhere?

I want to get rid of some posts, old ones, that I don't really want to keep. I was thinking to create a category named 'old' and use it as a garbage can to trash everything I don't like from old posts. Reason I don't simply delete them is the google traffic. Some of those pages receive 1-2 visits a day, so why not leave them? just as adsense traffic :) Anyhow. Now I need a way to hide category 'old' from everywhere. I need a quick and dirty way to do this, preferably through functions.php - don't want to change every menu listing and add -old. I also want to exclude posts inside this category from being displayed in 'related posts' section. But for this I guess I will have to take a look in the plugin itself... any help? Thanks!


The correct way of adding TinyMCE editor to custom meta box textarea?

Since Wp 3.2 a lot of changed to TinyMCE and Wordpress and ow I can not find out how to add the Tiny MCE to meta box in Page. This is how it looks when I am not firing up the MCE http://screencast.com/t/ECQeyvJYC And this is when I fire up the Tiny MCE               if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {     tinyMCE.execCommand("mceAddControl", false, "templatetext");     }      http://screencast.com/t/muvuD0esJW So everything is messed up somewhow. Do you know the solution?


extra text in Vimeo Embedded videos

For a WordPress site I am working on, there is a jquery slider (based on the coda slider) where videos are presented. All of the videos are from Vimeo. If a video is playing and someone slides to the next video, the other video continues to play. I have found some API code from Vimeo that allows me to control the video, so i could possibly add a "pause" class to the slider buttons that will pause videos when someone slides to the next video. However; in order for this to work, I need an id added to the iframe tag, and this line of code to the end of the video player url: `?api=1&player_id=player_1` (except player_1 should be a unique id) So the final output should look like this (except player_id number will be unique on each video):               <iframe id="player_1" src="http://player.vimeo.com/video/27421766?api=1&player_id=player_1" width="670" height="377" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>          I wonder if there is a function I can create that will do this. I know there are some core files in WordPress where the embed code lives, but am hestitant to mess with that.


Why does WordPress append numbers to page slugs sometimes? How to reliably style based on page

Why isit that WordPress sometimes add a number to my slug even if I explicitly set it. Like if I set slug to be 'about' I get 'about-2'. I want the slug to be correct so I can style using CSS easily. Or is there a better way?


Custom markup with wp_nav_menu based on pages

How might I have custom markup for my menus, like I want to give menu items something like `id="menuitem-postname"` how might I do that?


How to get only ONE category of “Portfolio” posts to display on main page rather than ALL categories?

I have a section on my main page that displays a new “Portfolio” post each time I write one no matter what category I assign them to. What I want to do is make the main page only display **one** specific category (`events`) from these Portfolio posts. I’m just wondering what I need to change in the below code to do that?               $args_for_latest = array(         'numberposts'     => 5,         'offset'          => 0,         'orderby'         => 'port_date',         'order'           => 'DESC',         'post_type'       => 'port',         'tax_query'       => array(                                   'taxonomy' => 'portcat',                                   'field' => 'slug'                             ),         'post_status'     => 'publish'      );                $temp_latest = $wp_query;     $wp_query_latest= null;     $wp_query_latest = new WP_Query();     $wp_query_latest->query($args_for_latest);     while ($wp_query_latest->have_posts()) : $wp_query_latest->the_post();     $featured_image_latest = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );          $terms = get_the_terms($post->ID, 'portcat');     $array_keys = array_keys($terms);          ?>
<?php if ($featured_image_latest[0]!=="") {             echo "";              } else { ?>             <img src="<?php echo IMGURL; ?>/pic_article1.jpg" alt="" />             <?php } ?>             <?php  echo $terms[$array_keys[0]]->name;  ?>
<?php the_title(); ?>
             <?php echo substr(get_the_excerpt(), 0, 70)."..."; ?>             <a href="<?php echo get_permalink($post->ID); ?>" class="read">Read more
     <?php endwhile; wp_reset_query(); ?>


How to limit the posts

I have a new question, how can I limit the amount of posts coming out of this query? I only need 7               <?php     $newsposts = new WP_Query('cat=restaurant');     if ( is_front_page()) {          echo '
Latest Restaurants

';         if ($newsposts->have_posts()) : while ($newsposts->have_posts()) : $newsposts->the_post();             echo '

';         endwhile; endif;          echo '
';         }      ?>      I tried to put: `('cat=restaurants'.'limit=7')` but she no work. How did i go wrong? any help would be appreciated