title: Why are some of my thumbnails not being generated?

text: I am currently developing my new theme over at testing.detailsofmylife.net and I am using a WooThemes template as my basic design. I want to try and include their WooTabs widget as graphically I think it is quite appealing for displaying post data to visitors. I know a lot of you aren't fond of TimThumb but it is the script that the theme uses to generate thumbnails so I need to try and get it working so the layout can finally work perfectly. As you can see from the widget on my site, two of the thumbnails have not been generated by the TimThumb function, but I cannot fully understand why. For example, a working thumbnail url looks like this in the widget:               http://testing.detailsofmylife.net/wp-content/themes/headlines/thumb.php?src=http://testing.detailsofmylife.net/wp-content/uploads/2010/09/Claire-Maguire-Aint-Nobody-Breakage-Remix.jpg&w=50&h=50&zc=1&q=90      but a broken thumbnail url looks like this:               http://testing.detailsofmylife.net/wp-content/themes/headlines/thumb.php?src=http://media.detailsofmylife.net/uploads/2010/04/flux+pavilion.jpg&w=50&h=50&zc=1&q=90      The problem occurs I think due to the location of the media, but I have added both domains to the list of external domains that are allowed to work with the script. And if you check the image urls by themselves (working v.s. not working) then you can see that they are both working correctly by themselves. Surely then they should both operate within the script? Any help would be much appreciated as it is driving me slightly mental. A copy of my code for TimThumb is available at the end of the post. If you need any other data/information let me know :) Thanks!               <?php     /**      * TimThumb script created by Ben Gillbanks, originally created by Tim McDaniels and Darren Hoyt      * http://code.google.com/p/timthumb/      *       * GNU General Public License, version 2      * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html      *      * Examples and documentation available on the project homepage      * http://www.binarymoon.co.uk/projects/timthumb/      */          define ('CACHE_SIZE', 1000);                // number of files to store before clearing cache     define ('CACHE_CLEAR', 20);                 // maximum number of files to delete on each cache clear     define ('CACHE_USE', TRUE);                 // use the cache files? (mostly for testing)     define ('CACHE_MAX_AGE', 864000);           // time to cache in the browser     define ('VERSION', '1.26');                 // version number (to force a cache refresh)     define ('DIRECTORY_CACHE', './cache');      // cache directory     define ('MAX_WIDTH', 1500);                 // maximum image width     define ('MAX_HEIGHT', 1500);                // maximum image height     define ('ALLOW_EXTERNAL', FALSE);           // allow external website (override security precaution - not advised!)     define ('MEMORY_LIMIT', '30M');             // set PHP memory limit     define ('MAX_FILE_SIZE', 1500000);          // file size limit to prevent possible DOS attacks (roughly 1.5 megabytes)     define ('CURL_TIMEOUT', 10);                // timeout duration. Tweak as you require (lower = better)          // external domains that are allowed to be displayed on your website     $allowedSites = array (         'photobucket.com',         'detailsofmylife.net',         'testing.detailsofmylife.net',         'detailsofmylife.net',         'img.youtube.com',         'media.detailsofmylife.net',     );          // STOP MODIFYING HERE!     // --------------------          // sort out image source     $src = get_request ('src', '');     if ($src == '' || strlen ($src) <= 3) {         display_error ('no image specified');     }          // clean params before use     $src = clean_source ($src);          // get mime type of src     $mime_type = mime_type ($src);          // used for external websites only     $external_data_string = '';          // generic file handle for reading and writing to files     $fh = '';          // check to see if this image is in the cache already     // if already cached then display the image and die     check_cache ($mime_type);          // cache doesn't exist and then process everything     // check to see if GD function exist     if (!function_exists ('imagecreatetruecolor')) {         display_error ('GD Library Error: imagecreatetruecolor does not exist - please contact your webhost and ask them to install the GD library');     }          if (function_exists ('imagefilter') && defined ('IMG_FILTER_NEGATE')) {         $imageFilters = array (             1 => array (IMG_FILTER_NEGATE, 0),             2 => array (IMG_FILTER_GRAYSCALE, 0),             3 => array (IMG_FILTER_BRIGHTNESS, 1),             4 => array (IMG_FILTER_CONTRAST, 1),             5 => array (IMG_FILTER_COLORIZE, 4),             6 => array (IMG_FILTER_EDGEDETECT, 0),             7 => array (IMG_FILTER_EMBOSS, 0),             8 => array (IMG_FILTER_GAUSSIAN_BLUR, 0),             9 => array (IMG_FILTER_SELECTIVE_BLUR, 0),             10 => array (IMG_FILTER_MEAN_REMOVAL, 0),             11 => array (IMG_FILTER_SMOOTH, 0),         );     }          // get standard input properties     $new_width =  (int) abs (get_request ('w', 0));     $new_height = (int) abs (get_request ('h', 0));     $zoom_crop = (int) get_request ('zc', 0);     $quality = (int) abs (get_request ('q', 75));     $align = get_request ('a', 'c');     $filters = get_request ('f', '');     $sharpen = (bool) get_request ('s', 0);          // set default width and height if neither are set already     if ($new_width == 0 && $new_height == 0) {         $new_width = 100;         $new_height = 100;     }          // ensure size limits can not be abused     $new_width = min ($new_width, MAX_WIDTH);     $new_height = min ($new_height, MAX_HEIGHT);          // set memory limit to be able to have enough space to resize larger images     ini_set ('memory_limit', MEMORY_LIMIT);          if (file_exists ($src)) {              // open the existing image         $image = open_image ($mime_type, $src);         if ($image === false) {             display_error ('Unable to open image : ' . $src);         }              // Get original width and height         $width = imagesx ($image);         $height = imagesy ($image);         $origin_x = 0;         $origin_y = 0;              // generate new w/h if not provided         if ($new_width && !$new_height) {             $new_height = floor ($height * ($new_width / $width));         } else if ($new_height && !$new_width) {             $new_width = floor ($width * ($new_height / $height));         }              // scale down and add borders         if ($zoom_crop == 3) {                  $final_height = $height * ($new_width / $width);                  if ($final_height > $new_height) {                 $new_width = $width * ($new_height / $height);             } else {                 $new_height = $final_height;             }              }              // create a new true color image         $canvas = imagecreatetruecolor ($new_width, $new_height);         imagealphablending ($canvas, false);              // Create a new transparent color for image         $color = imagecolorallocatealpha ($canvas, 0, 0, 0, 127);              // Completely fill the background of the new image with allocated color.         imagefill ($canvas, 0, 0, $color);              // scale down and add borders         if ($zoom_crop == 2) {                  $final_height = $height * ($new_width / $width);                  if ($final_height > $new_height) {                      $origin_x = $new_width / 2;                 $new_width = $width * ($new_height / $height);                 $origin_x = round ($origin_x - ($new_width / 2));                  } else {                      $origin_y = $new_height / 2;                 $new_height = $final_height;                 $origin_y = round ($origin_y - ($new_height / 2));                  }              }              // Restore transparency blending         imagesavealpha ($canvas, true);              if ($zoom_crop > 0) {                  $src_x = $src_y = 0;             $src_w = $width;             $src_h = $height;                  $cmp_x = $width / $new_width;             $cmp_y = $height / $new_height;                  // calculate x or y coordinate and width or height of source             if ($cmp_x > $cmp_y) {                      $src_w = round ($width / $cmp_x * $cmp_y);                 $src_x = round (($width - ($width / $cmp_x * $cmp_y)) / 2);                  } else if ($cmp_y > $cmp_x) {                      $src_h = round ($height / $cmp_y * $cmp_x);                 $src_y = round (($height - ($height / $cmp_y * $cmp_x)) / 2);                  }                  // positional cropping!             switch ($align) {                 case 't':                 case 'tl':                 case 'lt':                 case 'tr':                 case 'rt':                     $src_y = 0;                     break;                      case 'b':                 case 'bl':                 case 'lb':                 case 'br':                 case 'rb':                     $src_y = $height - $src_h;                     break;                      case 'l':                 case 'tl':                 case 'lt':                 case 'bl':                 case 'lb':                     $src_x = 0;                     break;                      case 'r':                 case 'tr':                 case 'rt':                 case 'br':                 case 'rb':                     $src_x = $width - $new_width;                     $src_x = $width - $src_w;                     break;                      default:                     break;             }                  imagecopyresampled ($canvas, $image, $origin_x, $origin_y, $src_x, $src_y, $new_width, $new_height, $src_w, $src_h);              } else {                  // copy and resize part of an image with resampling             imagecopyresampled ($canvas, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);              }              if ($filters != '' && function_exists ('imagefilter') && defined ('IMG_FILTER_NEGATE')) {             // apply filters to image             $filterList = explode ('|', $filters);             foreach ($filterList as $fl) {                      $filterSettings = explode (',', $fl);                 if (isset ($imageFilters[$filterSettings[0]])) {                          for ($i = 0; $i < 4; $i ++) {                         if (!isset ($filterSettings[$i])) {                             $filterSettings[$i] = null;                         } else {                             $filterSettings[$i] = (int) $filterSettings[$i];                         }                     }                          switch ($imageFilters[$filterSettings[0]][1]) {                              case 1:                                  imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1]);                             break;                              case 2:                                  imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2]);                             break;                              case 3:                                  imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2], $filterSettings[3]);                             break;                              case 4:                                  imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2], $filterSettings[3], $filterSettings[4]);                             break;                              default:                                  imagefilter ($canvas, $imageFilters[$filterSettings[0]][0]);                             break;                          }                 }             }         }              // sharpen image         if ($sharpen && function_exists ('imageconvolution')) {                  $sharpenMatrix = array (                 array (-1,-1,-1),                 array (-1,16,-1),                 array (-1,-1,-1),             );                  $divisor = 8;             $offset = 0;                  imageconvolution ($canvas, $sharpenMatrix, $divisor, $offset);              }              // output image to browser based on mime type         show_image ($mime_type, $canvas);              // remove image from memory         imagedestroy ($canvas);              // if not in cache then clear some space and generate a new file         clean_cache ();              die ();          } else {              if (strlen ($src)) {             display_error ('image ' . $src . ' not found');         } else {             display_error ('no source specified');         }          }               /**      *      * @global <type> $quality      * @param <type> $mime_type      * @param <type> $image_resized       */     function show_image ($mime_type, $image_resized) {              global $quality;              $cache_file = get_cache_file ($mime_type);              if (strpos ($mime_type, 'jpeg') > 1) {             imagejpeg ($image_resized, $cache_file, $quality);         } else {             imagepng ($image_resized, $cache_file, floor ($quality * 0.09));         }              show_cache_file ($mime_type);          }               /**      *      * @param <type> $property      * @param <type> $default      * @return <type>       */     function get_request ($property, $default = 0) {              if (isset ($_GET[$property])) {             return $_GET[$property];         } else {             return $default;         }          }               /**      *      * @param <type> $mime_type      * @param <type> $src      * @return <type>      */     function open_image ($mime_type, $src) {              if (strpos ($mime_type, 'jpeg') !== false) {             $image = imagecreatefromjpeg ($src);         } elseif (strpos ($mime_type, 'png') !== false) {             $image = imagecreatefrompng ($src);         } elseif (strpos ($mime_type, 'gif') !== false) {             $image = imagecreatefromgif ($src);         }              return $image;          }          /**      * clean out old files from the cache      * you can change the number of files to store and to delete per loop in the defines at the top of the code      *      * @return <type>      */     function clean_cache () {              // add an escape         // Reduces the amount of cache clearing to save some processor speed         if (rand (1, 50) > 10) {             return true;         }              flush ();              $files = glob (DIRECTORY_CACHE . '/*', GLOB_BRACE);              if (count ($files) > CACHE_SIZE) {                  $yesterday = time () - (24 * 60 * 60);                  usort ($files, 'filemtime_compare');             $i = 0;                  foreach ($files as $file) {                      $i ++;                      if ($i >= CACHE_CLEAR) {                     return;                 }                      if (@filemtime ($file) > $yesterday) {                     return;                 }                      if (file_exists ($file)) {                     unlink ($file);                 }                  }              }          }               /**      * compare the file time of two files      *      * @param <type> $a      * @param <type> $b      * @return <type>      */     function filemtime_compare ($a, $b) {              $break = explode ('/', $_SERVER['SCRIPT_FILENAME']);         $filename = $break[count ($break) - 1];         $filepath = str_replace ($filename, '', $_SERVER['SCRIPT_FILENAME']);              $file_a = realpath ($filepath . $a);         $file_b = realpath ($filepath . $b);              return filemtime ($file_a) - filemtime ($file_b);          }               /**      * determine the file mime type      *      * @param <type> $file      * @return <type>      */     function mime_type ($file) {              $file_infos = getimagesize ($file);         $mime_type = $file_infos['mime'];              // no mime type         if (empty ($mime_type)) {             display_error ('no mime type specified');         }              // use mime_type to determine mime type         if (!preg_match ("/jpg|jpeg|gif|png/i", $mime_type)) {             display_error ('Invalid src mime type: ' . $mime_type);         }              return strtolower ($mime_type);          }               /**      *      * @param <type> $mime_type      */     function check_cache ($mime_type) {              if (CACHE_USE) {                  if (!show_cache_file ($mime_type)) {                 // make sure cache dir exists                 if (!file_exists (DIRECTORY_CACHE)) {                     // give 777 permissions so that developer can overwrite                     // files created by web server user                     mkdir (DIRECTORY_CACHE);                     chmod (DIRECTORY_CACHE, 0777);                 }             }              }          }               /**      *      * @param <type> $mime_type      * @return <type>       */     function show_cache_file ($mime_type) {              // use browser cache if available to speed up page load         if (isset ($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {             if (strtotime ($_SERVER['HTTP_IF_MODIFIED_SINCE']) < strtotime('now')) {                 header ('HTTP/1.1 304 Not Modified');                 die ();             }         }              $cache_file = get_cache_file ($mime_type);              if (file_exists ($cache_file)) {                  // change the modified headers             $gmdate_expires = gmdate ('D, d M Y H:i:s', strtotime ('now +10 days')) . ' GMT';             $gmdate_modified = gmdate ('D, d M Y H:i:s') . ' GMT';                  // send content headers then display image             header ('Content-Type: ' . $mime_type);             header ('Accept-Ranges: bytes');             header ('Last-Modified: ' . $gmdate_modified);             header ('Content-Length: ' . filesize ($cache_file));             header ('Cache-Control: max-age=' . CACHE_MAX_AGE . ', must-revalidate');             header ('Expires: ' . $gmdate_expires);                  if (!@readfile ($cache_file)) {                 $content = file_get_contents ($cache_file);                 if ($content != FALSE) {                     echo $content;                 } else {                     display_error ('cache file could not be loaded');                 }             }                  die ();              }              return FALSE;          }               /**      *      * @staticvar string $cache_file      * @param <type> $mime_type      * @return string      */     function get_cache_file ($mime_type) {              static $cache_file;         global $src;              $file_type = '.png';              if (strpos ($mime_type, 'jpeg') > 1) {             $file_type = '.jpg';         }              if (!$cache_file) {             // filemtime is used to make sure updated files get recached             $cache_file = DIRECTORY_CACHE . '/' . md5 ($_SERVER ['QUERY_STRING'] . VERSION . filemtime ($src)) . $file_type;         }              return $cache_file;          }               /**      *      * @param <type> $url      * @return <type>       */     function validate_url ($url) {         $pattern = "/\b(?:(?:https?):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i";         return preg_match ($pattern, $url);     }               /**      *      * @global array $allowedSites      * @param string $src      * @return string      */     function check_external ($src) {              global $allowedSites;              // work out file details         $fileDetails = pathinfo ($src);         $filename = 'external_' . md5 ($src);         $local_filepath = DIRECTORY_CACHE . '/' . $filename . '.' . strtolower ($fileDetails['extension']);              // only do this stuff the file doesn't already exist         if (!file_exists ($local_filepath)) {                  if (strpos (strtolower ($src), 'http://') !== false || strpos (strtolower ($src), 'https://') !== false) {                      if (!validate_url ($src)) {                     display_error ('invalid url');                 }                      $url_info = parse_url ($src);                      // convert youtube video urls                 // need to tidy up the code                      if ($url_info['host'] == 'www.youtube.com' || $url_info['host'] == 'youtube.com') {                     parse_str ($url_info['query']);                          if (isset ($v)) {                         $src = 'http://img.youtube.com/vi/' . $v . '/0.jpg';                         $url_info['host'] = 'img.youtube.com';                     }                 }                      // check allowed sites (if required)                 if (ALLOW_EXTERNAL) {                          $isAllowedSite = true;                      } else {                          $isAllowedSite = false;                     foreach ($allowedSites as $site) {                         if (strpos (strtolower ($url_info['host']), $site) !== false) {                             $isAllowedSite = true;                         }                     }                      }                      // if allowed                 if ($isAllowedSite) {                          if (function_exists ('curl_init')) {                              global $fh;                              $fh = fopen ($local_filepath, 'w');                         $ch = curl_init ($src);                              curl_setopt ($ch, CURLOPT_TIMEOUT, CURL_TIMEOUT);                         curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');                         curl_setopt ($ch, CURLOPT_URL, $src);                         curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);                         curl_setopt ($ch, CURLOPT_HEADER, 0);                         curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);                         curl_setopt ($ch, CURLOPT_FILE, $fh);                         curl_setopt ($ch, CURLOPT_WRITEFUNCTION, 'curl_write');                              // error so die                         if (curl_exec ($ch) === FALSE) {                             unlink ($local_filepath);                             touch ($local_filepath);                             display_error ('error reading file ' . $src . ' from remote host: ' . curl_error ($ch));                         }                              curl_close ($ch);                         fclose ($fh);                          } else {                              if (!$img = file_get_contents ($src)) {                             display_error ('remote file for ' . $src . ' can not be accessed. It is likely that the file permissions are restricted');                         }                              if (file_put_contents ($local_filepath, $img) == FALSE) {                             display_error ('error writing temporary file');                         }                          }                          if (!file_exists ($local_filepath)) {                         display_error ('local file for ' . $src . ' can not be created');                     }                          $src = $local_filepath;                      } else {                          display_error ('remote host "' . $url_info['host'] . '" not allowed');                      }                  }              } else {                  $src = $local_filepath;              }              return $src;          }               /**      * callback for curl command to receive external images      * limit the amount of data downloaded from external servers      *       * @global <type> $data_string      * @param <type> $handle      * @param <type> $data      * @return <type>      */     function curl_write ($handle, $data) {              global $external_data_string, $fh;              fwrite ($fh, $data);         $external_data_string .= $data;              if (strlen ($external_data_string) > MAX_FILE_SIZE) {             return 0;         } else {             return strlen ($data);         }          }               /**      * tidy up the image source url      *      * @param <type> $src      * @return string      */     function clean_source ($src) {              $host = str_replace ('www.', '', $_SERVER['HTTP_HOST']);         $regex = "/^(http(s|):\/\/)(www\.|)" . $host . "\//i";              $src = preg_replace ($regex, '', $src);         $src = strip_tags ($src);         $src = check_external ($src);              // remove slash from start of string         if (strpos ($src, '/') === 0) {             $src = substr ($src, -(strlen ($src) - 1));         }              // don't allow users the ability to use '../'         // in order to gain access to files below document root         $src = preg_replace ("/\.\.+\//", "", $src);              // get path to image on file system         $src = get_document_root ($src) . '/' . $src;              if (!is_file ($src)) {             display_error ('source is not a valid file');         }              if (filesize ($src) > MAX_FILE_SIZE) {             display_error ('source file is too big (filesize > MAX_FILE_SIZE)');         }              if (filesize ($src) <= 0) {             display_error ('source file <= 0 bytes. Possible external file download error (file is too large)');         }              return realpath ($src);          }               /**      *      * @param <type> $src      * @return string      */     function get_document_root ($src) {              // check for unix servers         if (file_exists ($_SERVER['DOCUMENT_ROOT'] . '/' . $src)) {             return $_SERVER['DOCUMENT_ROOT'];         }              // check from script filename (to get all directories to timthumb location)         $parts = array_diff (explode ('/', $_SERVER['SCRIPT_FILENAME']), explode ('/', $_SERVER['DOCUMENT_ROOT']));              $path = $_SERVER['DOCUMENT_ROOT'];              foreach ($parts as $part) {             $path .= '/' . $part;             if (file_exists ($path . '/' . $src)) {                 return $path;             }         }              // special check for microsoft servers         if (!isset ($_SERVER['DOCUMENT_ROOT'])) {             $path = str_replace ("/", "\\", $_SERVER['ORIG_PATH_INFO']);             $path = str_replace ($path, '', $_SERVER['SCRIPT_FILENAME']);                  if (file_exists ($path . '/' . $src)) {                 return $path;             }         }              display_error ('file not found');          }               /**      * generic error message      *      * @param <type> $errorString      */     function display_error ($errorString = '') {              header ('HTTP/1.1 400 Bad Request');         echo '<pre>' . htmlentities ($errorString);         echo '<br />Query String : ' . htmlentities ($_SERVER['QUERY_STRING']);         echo '<br />TimThumb version : ' . VERSION . '</pre>';         die ();          }


title: All post ids are the same after this query but rewind_posts() does not seem to work here?

text:
I'm executing a query inside of header.php which is apparently resetting the $post object so that all pages are getting the $post->ID of the last element in this loop.               $mypostsheader = get_posts(array('cat' => "$cat,-$catHidden",'numberposts' => $cb2_current_count));     $current_page = get_post( $current_page );?>

<?php foreach($mypostsheader as $idx=>$post){             if ( $post->ID == $current_page->ID )//do something; }      I've tried adding a rewind_posts() at the end of this function and also at the end of header.php but my echo $post->ID inside of page.php still returns the id of the last element in the query. Any ideas?


title: Super administrator db name

text: As I cant test this(cant find any docs and dont have an multisite setup) I need to know the db name of the Super Administrator. So how is this role stored inside the wp db? It's probably something like 'super_administrator'...?


title: Showing User's Post Counts by Custom Post Type in the Admin's User List?

text: I'm trying to figure out how to hook into the `/wp-admin/users.php` manage page to create custom columns for showing the number of posts users have for the custom post types on **WPHonors.com**. I created a trac ticket for this but @nacin explained why it's a job more for a plugin to do instead. I have been unable to find a way to manipulate the output of the users table, so I can add custom columns for CPTs post counts for each user. And that may have something to do with the question @nacin asked, what would the post count numbers link to. For the current 'post' post count a user has, it links to the post manage page, showing all posts for that user (`/wp- admin/edit.php?author=%author_id%`). If I were to link it somewhere, it would be to:               /wp-admin/edit.php?post_type=%post_type%&author=%author_id%      If that were even somehow possible, I guess. But I don't even necessarily need to link it to anywhere. I mostly want to just show CPT post counts for each person, having `600` users and a combined total of `300+` posts across `4` custom post types. Admins are only one who can submit `'post'` posts, so that column in the user's page is useless.


title: User-based media gallery

text: I'm building a site that uses both WordPress and BuddyPress and I'm looking to build a custom section whereby the user can upload work and people can comment/rate it. I've browsed around at various different options but it would seem using a custom post type like and then allowing members to submit content would be the best option. Is their a better way to do this? Or do you think post types are the best option. To get an idea of the kind of functionality it will require: http://dribbble.com/ The idea will be to have images as URLs like domain.com/designs/my-awesome- work-2201/ And when viewing member profiles you will be able to view their latest work etc, so they need to be linked up with a user and not just floating randomly in the database. Not sure how easy this will be to do with normal users who are not authors/editors. Thoughts? Thanks


title: Taxonomy count per Post type

text:
Below is the code i use to output the post tag (taxonomy) count/number. I want to be able to split the count based on post type that the taxonomy features in (rather than the total number). So i have the default "post" Post type, aswell as "blogs", & "pics". I want the taxonomy count to display something like: x posts | x blogs | x Pics                           <?php                 $tags = get_tags( array('name__like' => "a", 'order' => 'ASC') );                 foreach ( (array) $tags as $tag ) { ?>
                                                     <a href="<?php echo get_tag_link( $tag->term_id ) ?>">                                       <?php echo $tag->name ?>                             <?php echo $tag->count ?>
                 <?php } ?>


title: How to make sexy bookmarks plugin work in WPMU

text: We have Wordpress 3.0 working as multi site, and we want all the blogs in the system to have the plugin "sexy bookmarks". But it seems to be working only in the main blog.   Does anyone know how to make it work in all blogs (what code to add to make it work that way)? Or is there a plugin like sexy bookmarks that adds social network icons to each post that works in a multi site version of Wordpress 3.0?


title: Get urls of images in a gallery?

text: I need to retrieve the URLs for the images inside a gallery, what's the appropriate SQL query for this, based on the post ID? I currently have something like the following which I found on via google, but I don't know how to access the global WP variable from outside Wordpress - what do I need to do?               function getGallery($id)     {      global $wpdb;           //SQL query to retrieve all attachment of mime type image/jpeg from the given post      $querystr = "          SELECT ID, post_name, guid, meta_value          FROM $wpdb->posts wposts          INNER JOIN $wpdb->postmeta meta ON meta.post_id = wposts.ID AND meta.meta_key = '_wp_attachment_metadata'          WHERE wposts.post_type = 'attachment'          AND wposts.post_parent = '".$id."'          AND wposts.post_mime_type = 'image/jpeg'       ";           //get result set from the query      $pictures = $wpdb->get_results($querystr, ARRAY_A);           //return resultset      return $pictures;     }


title: Problem duplicated shortlinks bitly

text: I've this plugin to create shortlink using the bitly API, but there's a problem!               function yoast_bitly_shortlink($url, $id, $context, $allow_slugs) {         if ( ( is_singular() && !is_preview() ) || $context == 'post' ) {             $short = get_post_meta($id, '_yoast_bitlylink', true);             if ( !$short || $short == '' ) {                 if ( !defined('BITLY_USERNAME') || !defined('BITLY_APIKEY') ) {                     $short = 'http://yoast.com/wordpress/bitly-shortlinks/configure-bitly/';                 } else {                     $url = get_permalink( $id );                     $req = 'http://api.bit.ly/v3/shorten?format=txt&longUrl='.$url.'&login='.BITLY_USERNAME.'&apiKey='.BITLY_APIKEY;                     if ( defined('BITLY_JMP') && BITLY_JMP )                         $req .= '&domain=j.mp';                     $resp = wp_remote_get( $req );                     if ( !is_wp_error( $resp ) && is_array( $resp['response'] ) && 200 == $resp['response']['code'] ) {                         $short = trim( $resp['body'] );                         update_post_meta( $id, '_yoast_bitlylink', $short);                     }                 }             }             return $short;         }         return false;     }     add_filter( 'pre_get_shortlink', 'yoast_bitly_shortlink', 99, 4 );          function yoast_bitly_admin_bar_menu() {         global $wp_admin_bar, $post;              if ( !isset($post->ID) )             return;              $short = wp_get_shortlink( $post->ID, 'query' );              if ( is_singular() && !is_preview() ) {             if ( $short != 'http://yoast.com/wordpress/bitly-shortlinks/configure-bitly/' )                 $shortstats = $short.'+';                  // Remove the old shortlink menu, because it has some weird JS issues with admin bar when giving it submenu's.             $wp_admin_bar->remove_menu('get-shortlink');             $wp_admin_bar->add_menu( array( 'id' => 'shortlink', 'title' => __( 'Bit.ly' ), 'href' => 'javascript:prompt('Short Link:', ''.$short.''); return false;' ) );             $wp_admin_bar->add_menu( array( 'parent' => 'shortlink', 'id' => 'yoast_bitly-link', 'title' => __( 'Bit.ly Link' ), 'href' => 'javascript:prompt('Short Link:', ''.$short.''); return false;' ) );             $wp_admin_bar->add_menu( array( 'parent' => 'shortlink', 'id' => 'yoast_bitly-twitterlink', 'title' => __( 'Share on Twitter' ), 'href' => 'http://twitter.com/?status='.str_replace('+','%20', urlencode( $post->post_title.' - '.$short) ) ) );             $wp_admin_bar->add_menu( array( 'parent' => 'shortlink', 'id' => 'yoast_bitly-stats', 'title' => __( 'Bit.ly Stats' ), 'href' => $shortstats, 'meta' => array('target' => '_blank') ) );         }     }     add_action( 'admin_bar_menu', 'yoast_bitly_admin_bar_menu', 95 );      It creates 2 bitly links of every post one is the `/?p=12345` and the other is `/post-name` I Schedule all my posts, so, I've noticed that `?p=12345` is created on auto saves, previews and when Scheduled and the `/post-name` is created once the post is published... And unfortunately `?p=12345` is set as default short url; `?p=12345` = `bit.ly/sdfssdfd` and the other one is ignored.. What should I do to force it to create only 1 link of `/post-name` and set it as default instead of the other one?! I've tried this:               $mypost = get_page( $id );       if ( !in_array($mypost->post_status, array('future', 'publish')) ) {         return "Post must be published to get a shortlink";       }      but as it's noted in return, post must be published to get a shortlink (it creates 1 link but the `/?p=12345` in bitly website but it's not visible back on wordpress)... I guess I need, instead of published, the url to be created once Scheduled.. so I've tried to change               $mypost = get_page( $id );       if ( !in_array($mypost->post_status, array('schedule', 'future')) ) {         return "Post must be published to get a shortlink";       }      but as you can imagine it isn't working... do you have any idea how that can be fixed? thanks!


title: Is there any plugin for course management?

text: I have wordpress site for a school or college. My requirement is I need Classes like (from one class to 8th class) and then classes will have courses/subjects(like physics, Maths etc) and then each course has a file to upload. The teacher will upload the file to a course and then the student will download the file of a course from the front end. The teacher will add classes, courses to classes and can upload the files to the courses. The student can only download the files uploaded for a course. SO Is there any plugin of wordpress to do work for me or I have to write my own? Any help and suggestion? Thanks in advance.


title: My custom plugin did not create db tables in database

text: I have created a plugin which will create a table in database on plugin activation. When I enabled the plugin and check the database, there was no new table which I want to create. Here is my plugin file code.               <?php     /*     Plugin Name: wp_course_management     Description: Wordpress plugin for course management for an education site.     Version: 1.0     Author: Ahmad Nawaz     Author URI: http://nawaz-ahmad.blogspot.com     */     ?>     <?php     global $jal_db_version;     $jal_db_version = "1.0";          function jal_install() {        global $wpdb;        global $jal_db_version;             $table_name = $wpdb->prefix . "classes";             $sql = $wpdb->prepare( "CREATE TABLE %s (           id mediumint(9) NOT NULL AUTO_INCREMENT,           time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,           name tinytext NOT NULL,           text text NOT NULL,           url VARCHAR(55) DEFAULT '' NOT NULL,           UNIQUE KEY id (id)         );", $table_name );             require_once(ABSPATH . 'wp-admin/includes/upgrade.php');        dbDelta($sql);             add_option("jal_db_version", $jal_db_version);     }          function jal_install_data() {        global $wpdb;        $welcome_name = "Mr. Wordpress";        $welcome_text = "Congratulations, you just completed the installation!";             $rows_affected = $wpdb->insert( $table_name, array( 'time' => current_time('mysql'), 'name' => $welcome_name, 'text' => $welcome_text ) );     }     register_activation_hook(__FILE__,'jal_install');     register_activation_hook(__FILE__,'jal_install_data');          ?>      What is the problem in my code. Please help.


title: How to call Wordpress First Image Post or else Attached Image or Default

text: Can anyone help me develop a wordpress script that [IF] will get first image post and if it doesn't exist it will [ELSE] get first attached (uploaded) image. **Theoretically:** [IF exists]               <img src="<?php echo catch_that_image() ?>" />      [or ELSE]               ID) . '" alt="Main Image" id="mainImage"" />      [or ELSE]               <img src="<?php bloginfo('template_url') ?>/images/default.png" />      **My current code looks like this (UPDATED.. AGAIN)**               <?php        $args = array(      'post_parent' => $post->ID,      'post_type' => 'attachment',      'post_mime_type' => 'image',      'orderby' => 'menu_order',      'order' => 'ASC',      'offset' => '0',      'numberposts' => 1       );      $attachments = get_posts($args);      $images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . $post->ID );      if ($attachments) {      foreach ($attachments as $attachment) {      if(wp_attachment_is_image( $attachment->ID )) {      echo 'ID) . '" alt="Main Image" id="mainImage"" />'; }}}             else {      echo ''; }     ?>


title: How could I write a get_categories_by_year() function?

text: I need to write **a function to get all the categories for a given year**. Since the creation date of a taxonomy isn't stored in the database, I'm not really sure what to do. My initial thought was to get all posts for a given year and somehow find all categories associated with those posts, but I'm not sure how to do that and it sounds horrifically slow. Perhaps I could just write some SQL but I'm much more well versed in PHP. So again back to the function, I imagine it would like something like:               function get_categories_by_year($year) {      // Do stuff...      return $array_of_categories_in_year;     }      This is actually for a custom taxonomy but since categories are the default hierarchical taxonomy I decided to use it as an example. I'm happy to provide more info on what the output is supposed to look like if it's relevant. Thank's for the help!


title: WordPress WYSIWYG editor on demand, responsive

text: I have created a WYSIWYG editor inside of a metabox, and I have loaded it on demand via javasacript. But the WYSIWYG is not responsive, like the default one is. How can I make it responsive? It sits inside of a table, and the table width is set to 100%. As the rows get smaller the WYSIWYG remains the same size but part of the editor becomes hidden. I've tried:               .mceToolbarTop * {     float:left;     }          .mceToolbarTop select {     width:auto!important;     }          .mceToolbarTop option {     float:none;     }      The html is really long, and difficult to format here. Or else i'd paste it. My container holding the WYSIWYG is 80% wide, and the WYSIWYG styles is set to 100%, so I don't know why its not respecting the styles I have set.


title: Use $wpdb in wordpress theme files

text: I want to use $wpdb in a theme file, but it doesn't work. My code is bellow:               <?php               $action = $_POST['action'];     $updateRecordsArray = $_POST['recordsArray'];               if ($action == "updatelist") {              $listingCounter = 1;         $column = $_GET['column'];              foreach ($updateRecordsArray as $key=>$value) {              $wpdb->update('wp_postmeta', array('meta_value'=>$column), array('post_id'=>$value, 'meta_key'=>'dbt_text') );         $wpdb->update('wp_posts', array('menu_order'=>$listingCounter), array('ID'=>$value) );              $listingCounter = $listingCounter + 1;                }     }               ?>      I think that $wpdb must be declared global or I must include certain files. Can someone please help me on this?


title: What plugins do you commonly install on a fresh WordPress install?

text: I'm looking at finding out what plugins others install most of the time on a fresh WordPress install; the plugins that add value to pretty much any website that is running WordPress. My list of commonly installed plugins on a fresh WP install, in no particular order:   * Contact Form 7 - Use whenever I need a contact form on the site   * Page.ly MultiEdit - Use whenever I need multiple editable regions   * Login LockDown - Always use on public facing website. Helps prevent account brute forcing.   * Register Plus Redux Use whenever the site allows member signup.   * WP-PageNavi Use whenever the site will be displaying pages upon pages of posts. Please answer with your commonly used installed plugins on a fresh WP install.


title: Guidance with The Loop for CMS

text: Maybe I'm going about this the wrong way but this is my scenario... I would like to use WordPress as a CMS rather than a blogging platform. I have a website that will have somewhere between 25-50 pages and will not have any posts. I'm looking to develop my own theme which should be fairly easy, however I'm getting a little confused on using The Loop functions. I understand that:               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>      is used for a page that is pulling x number of posts, however in my scenario, I only want to pull the contents of a page rather than x number of posts. Do I need to create custom SQL queries? All of the examples I keep running into are using The Loop for posts. If I'm just using static pages, do I even need to use The Loop? Can I just use the unique URL to pull a page out of the post column of the MySQL database? I hope this is making sense.


title: Subsites in Multisite installation throwing 404 error on wp-admin in IIS 7

text: Running into an issue where sub sites of a multisite (fresh installation of 3.9 and no plugins or themes) are throwing 404 error when trying to access the wp-admin section of the sub site. It is running on IIS7.   * http://www.mysite.com/subsite/wp-admin -> Throws 404   * http://www.mysite.com/subsite2/wp-admin -> Throws 404   * http://www.mysite.com/wp-admin -> Works for the main site When we login through http://www.mysite.com/wp-admin and navigate to the sub site then try to log out it also throws a 404. Was using the default web.config, for the re-write rules. But all the sub sites were throwing 404 errors on the css/js files. So, I altered the re-write rules a bit, which you can see below.               <?xml version="1.0" encoding="UTF-8"?>     <configuration>         <system.webServer>             <rewrite>                 <rules>                     <rule name="WordPress Rule 1" stopProcessing="true">                         <match url="^index\.php$" ignoreCase="false" />                         <action type="None" />                     </rule>                     <rule name="WordPress Rule 2" stopProcessing="true">                         <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />                         <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />                     </rule>                     <rule name="WordPress Rule 3" stopProcessing="true">                         <match url="^" ignoreCase="false" />                         <conditions logicalGrouping="MatchAny">                             <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />                             <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />                         </conditions>                         <action type="None" />                     </rule>                     <rule name="WordPress Rule 4" stopProcessing="true">                         <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />                         <action type="Rewrite" url=“{R:2}” />                     </rule>                     <rule name="WordPress Rule 5” stopProcessing="true">                         <match url="^([_0-9a-zA-Z-]+/)?(wp-comments-post.*)” ignoreCase="false" />                         <action type="Rewrite" url=“{R:2}” />                     </rule>                     <rule name="WordPress Rule 6” stopProcessing="true">                         <match url="^([_0-9a-zA-Z-]+/)?([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />                         <action type="Rewrite" url="{R:2}" />                     </rule>                     <rule name="WordPress Rule 7” stopProcessing="true">                         <match url="." ignoreCase="false" />                         <action type="Rewrite" url="index.php" />                     </rule>                 </rules>             </rewrite>         </system.webServer>     </configuration>      Am I missing any other re-write rules or need to change? So the subsites do not throw 404 errors when navigating to the /wp-admin page.


title: Finding actual functions added to hooks and filters

text: I'm trying to figure out how to find the actual function that's assigned to hooks and filters. I've been looking at other questions asked here and found a couple plugins that are helpful for findings the add_actions and add_filters that show me the callback function name... but I'm having a hard time finding that actual function(s) so I can see what it does. They aren't always in the same file as the add_action or add_filter. I just want to do this so I can wrap my head around the concept of hooks and filters better. So for example, here's an add_action in shortcodes.php on line 335:               add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop()      Here's the actual function on line 144, I want to be able to find these easily:               function do_shortcode($content) {         global $shortcode_tags;              if (empty($shortcode_tags) || !is_array($shortcode_tags))             return $content;              $pattern = get_shortcode_regex();         return preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );     }      Any tips?


title: Can't Display Featured Image in RSS Feed

text: I'm currently working on a test website on my local server using WordPress version 3.4.2. I've tried various different solutions. Some have included installing various plugins, such as WP RSS Images and Featured Image in RSS. Even tried some of the solutions from the following posts:   * display featured image in RSS feed   * How to grab first image attached to post and display in RSS feed?   * Add a Post Thumbnail to an RSS Feed with custom size Yet, it seems the images aren't being posted to the RSS feeds. Is there another solution that can solve this problem? The RSS feed I'm trying to include images is this link. Any help is appreciated!


title: Exclude category from get_the_category

text: I want to exclude a specific category from the loop, here's what I tried: Original code:                   // auto posts by cat         if( $bawmrp_options['auto_posts'] == 'cat' || $bawmrp_options['auto_posts'] == 'both' ):             $cat = get_the_category( $post->ID );             $cat_ids = wp_list_pluck( $cat, 'term_id' );             $args['category'] = implode( ',', $cat_ids );         endif;      My try:                   // auto posts by cat         if( $bawmrp_options['auto_posts'] == 'cat' || $bawmrp_options['auto_posts'] == 'both' ):             $cat = get_the_category( $post->ID );             if ($cat->cat_ID != '68') :                 $cat_ids = wp_list_pluck( $cat, 'term_id' );             endif;             $args['category'] = implode( ',', $cat_ids );         endif;      In my code I tried to exclude the category 68, but actually the best thing would be if the category has children, then it don't enter in the loop, only it's children


title: Error 404 on Network Admin and others

text: I have a multisite fresh install in my domain. Subfolder setup. Network Admin on the upper right menu has this link `http://example.com/wp- admin/network/` and returns a 404 error. Other links like 'Add New' have this problem too. I can manually visit `http://example.com/subfolder/wp- admin/network/` and works fine. I'm not good with .htaccess but I think the problem is there; can you check this please:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^(wp-(content|admin|includes).*) home/content/70/10156275/html/example.net/subfolder/$1 [L]     RewriteRule ^(.*\.php)$ home/content/70/10156275/html/example.com/subfolder/$1 [L]     RewriteRule . index.php [L]      Also, not sure if this helps but my `wp-config.php` has this code:               /* Multisite */     define( 'MULTISITE', true );     define( 'SUBDOMAIN_INSTALL', true );     $base = '/';     define( 'DOMAIN_CURRENT_SITE', 'example.com' );     define( 'PATH_CURRENT_SITE', '/' );     define( 'SITE_ID_CURRENT_SITE', 1 );     define( 'BLOG_ID_CURRENT_SITE', 1 );      I have been searching Google for 2 days now and can't fix this… The problem is the subfolder is somewhat omitted in Network Admin and some few…


title: Get attachments (get_posts) and WP 3.5 new uploader

text:
I'm using get_posts() to get attachments from the post and use it in the slider. The issue is new uploader doesn't have that "Gallery" tab which was perfectly suitable for this. It also seems to be breaking original code and you can't remove / reorder images from this new uploader now. Is there a way to fix this? The code is below:
                  <?php if ( have_posts() ) : while ( have_posts() ) : the_post();                       $args = array(                     'post_type' => 'attachment',                     'numberposts' => -1,                     'post_status' => null,                     'post_parent' => $post->ID,                     'order'=> 'ASC',                      'orderby' => 'menu_order'                    );                              $attachments = get_posts( $args );                       if ( $attachments ) {                          foreach ( $attachments as $attachment ) {                             echo '
';                             echo wp_get_attachment_image( $attachment->ID, 'full' );                             echo '
';                            }                       }                   endwhile; endif; ?>


title: Embed Wordpress Admin in an iframe

text: I am trying to embed the admin "new post" wordpress page into an iframe:               `<iframe height="500px" frameborder="0" width="740px" src="my_wordpress_domain/wp-admin/post-new.php"/>`      For some reason the iframe loads a blank page. The link itself works in a separate tab and so does the wordpress home page. Is this a security issue, if so, how can I circumvent it?


title: Differentiate Between Parent & Child Categories

text:
So I'm working with a non-wordpress theme called "Misty" and it uses this code to pull categories:

<?php _e('Categories','ml'); ?>

             <?php             if (function_exists('wp_list_categories'))             {                 wp_list_categories("show_count=1&include=$catID&hierarchical=1&title_li=");                 wp_list_categories("show_count=1&child_of=$catID&hierarchical=1&title_li=");             }             else             {                 wp_list_cats('optioncount=1');             }             ?>

      What sucks is that I cant style parent / child categories different, I want to indent child categories but they all go by class=category ID `$catID` is how I want to filter posts. 3 different domains are coming to this blog and I am taking where they came from and filtering posts that way. So far I've filtered the category and showed that categories sub-categories, but the subcategories have no way to be styled. What's a good work around to style the child categories? Is there somewhere I can just add another class to the child LI's?


title: How to use one git (github) repository for version control for multiple themes

text: I have built and maintain many themes for various clients. I'd like to be able to put them all in github for lovely version control. However github gets a bit expensive when you have over 20 private repositories. I'm going to have about 30+. The themes are not used together, each one is for a separate client. I know I can host my own git install, but then I lose the great diff tools and social aspects of github. It's also nice to have all your code in one place. So I'm wondering if there is another way to put all themes in one repo and separate them in some intelligent way. I thought about using gitignore, but then for each clone, you need to reconstruct the correct .gitignore. not workable. Maybe using branches is the right approach, but I'm unfamiliar with how that would work. One other aspect, I've been using deployhq.com (a great service) to deploy the changed files via ftp to the servers. And it's working great. And for site still in development I create a git service hook and after each push, the project gets deployed automatically by deployhq - awesome. Any advice about how to accomplish this via branches, or via any other method?


title: Can this site be built using wordpress?

text: I want to know if this site can be built with wordpress, I'm a programmer and I don't know anything about wordpress, how I'm just to get some good advices from you guys: The main aim of the site is to allow users to view several places of interest in a country Administrator: -create a place of interest - add,delete,edit details such as place name, address, location with google map,rating(users can vote a place),latitude, longitude -add reviews for place on interest Users: -allow users to register -contribute to site by adding a place of interest with all its details(will then be approved by the administator) -add reviews to a place of interest -up vote or downvote a place of interest


title: register_deactivation_hook argument -> pass arguments in the selected function

text: I've been looking for minutes how to pass arguments in the `register_deactivation_hook` as follow :               register_deactivation_hook( __FILE__, array( new Cpt, 'delete_cpt') ) );          class Cpt     {         /**          * Delete a custom post type          */         public function delete_cpt($name = 'test') {             /**              * delete a single data              */             require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );             $GLOBALS['wpdb']->delete(                  'cpt',                  array(                      'name'=>$name                  )              );             $GLOBALS['wpdb']->show_errors();             echo $GLOBALS['wpdb']->last_query;             echo $name;             die();         }     }      The function executes but the `$name` var remains empty. I would like to pass the `$name` directly in `register_deactivation_hook`; Is it at least possible ? Nothing seen anywhere.


title: How to post images on my blog with a pre-defined border

text: The images in this blog post: http://wordfruit.com/blog/the-hole-through-the- earth-3/ ...have borders around them -- hatched lines. But in this post: http://wordfruit.com/blog/copywriting-for-fish/ there's no border around the image. The images in the first example above I think I posted using the 'From url' function. In the second example listed, I used the 'upload' function when posting the image. Is there a way of posting images using the 'upload' function so that the border appears?


title: Pagination on custom taxonomy

text:
I'm having a tough time getting this to work. It's not the first time I run into problems with pagination, or I would say with WPs URL system. Basically I have this URL:               http://example.com/location/dc       and loads up the `taxonomy-location.php` template. Now, I'm adding the pagination feature to the theme. So I have this URL:               http://example.com/location/dc/page/2      and it won't load the `taxonomy-location.php` template, it actually loads the **404** template. This is what the debug bar shows: > ![http://cl.ly/1u0F470k062o1Q121u15](http://i.stack.imgur.com/vuhdM.png) It seems like it's getting the right values, WP is just not loading up the correct template. * * * **EDIT** (Moved over from the comment links) ## `functions.php`               /* LOCATION */     add_rewrite_rule( 'location/([^/]+)/page/([0-9]{1,})/?$', 'index.php?location=$matches[1]&paged=$matches[2]', 'top' );      ## `taxonomy-location.php`                 <?php        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;       query_posts($query_string.'&posts_per_page=2&paged='.$paged);       ?>
"<?= ucwords(get_query_var('location')); ?>" Venues
            <?php if (have_posts()) : ?>              <?php while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('venue_thumb'); ?>
            <?php endwhile; ?>              <?php wp_pagenavi(); ?>            <?php else : ?>

No posts found

          <?php endif; ?>


title: A featured page with image and excerpt instead of a featured post?

text: Is there a way to have a link with a featured image and excerpt that goes to another page in Wordpress rather than a featured post? At this moment I have a page that links of to three featured categories but I'd or rather the client would like one of those three preview boxes to link to a featured page and when that page is updated the preview image of that page and an excerpt would be updated on the front page (that holds the box links to the two featured cats and one featured page). _I don't have the site online but I can post a screen shot if I'm not explaining it very well._ Thanks


title: How to have a category not show up in query post with page panigation?

text:
Basically I have this loop that shows all post. Inside of it I want to exclude post's from categories including shirts and hoodies, also the gallery category. Here is what I have so far. the code works without the 'cat=-gallery". But with it, it does not show any post's at all.               <?php     $limit = 5;     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     query_posts( 'cat=-gallery&showposts=' . $limit . '&paged=' . $paged );     $wp_query->is_category = true; $wp_query->is_home = false;     ?>           <-----my blog stuff---->          <?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
         <?php endif; ?>         <?php next_posts_link('Older Entries »', 0); ?>


title: Load a script just to custom post type in admin

text: I have created a custom post type "portfolio" with something like this :               $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',         'rewrite' => true,         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => 4,         'taxonomies' => array('post_tag','category'),         'supports' => array('title','editor','comments','trackbacks','revisions','custom-fields','page-attributes','thumbnail', 'excerpt', 'tags')       );           register_post_type( 'portfolio' , $args );      And I have some other custom fields in there with an action :               add_action("admin_init", "admin_init");     function admin_init(){ // add_meta_box( $id, $title, $callback, $page, $context, $priority );        add_meta_box("media", "Media Type", "media", "portfolio", "side", "high");       add_meta_box("map_meta", "Mapping Info", "map_meta", "portfolio", "normal", "high");     }      Although I once had this working I can not figure out to get it to load scripts just for this page. Right now I just have them in with the rest of the `wp_enqueue_script` like this :               function my_init() {         if (!is_admin()) {                            ....             }           if (is_admin()) {             wp_register_script('Gmaps', 'http://maps.google.com/maps/api/js?sensor=false', false, '3.0', false);             wp_enqueue_script('Gmaps');                       wp_register_style('admin_js', get_bloginfo('template_directory') . '/admin.js');             wp_enqueue_script('admin_js');                  wp_register_script('Zmaps', get_bloginfo('template_directory') .'/scripts/maps.js', array('Gmaps'), '1.0', true);             wp_enqueue_script('Zmaps');             }                }     add_action('wp_enqueue_scripts', 'my_init');      But none of this is loading for me. How can I load these scripts into the admin pages? Better yet how can I load them specifically for the edit pages of the portfolio custom post type?


title: How i can manage the favorite posts which user marked

text: My site has many post and when a user is logged into the site, (s)he can mark the post as there "favorite post". So basically what I need is: > How can a user mark a post as her/his "favorite post", and after that > How can I display those "favorite posts" on a single page.


title: Do I have to use categories?

text: I don't want my blog to use "categories" is there a way to turn them off? I can just not define any but then they are still listed as "uncategorized"


title: Top Contributors Plugin with Custom Post Type

text: I am using the plugin Top Contributors. That's very helpful for all blogs. But the problem with this plugin is: it is not integrated with custom post types. How could I extend the plugin to do that?


title: Including new Javascript only after a comment is made

text: I am looking to call a new javascript function only after a new comment has been made by a user. Specifically, I want to include new javascript on the resulting page of the page reload after submitting the new comment form on a blog post. Does anyone know how to do this? My end goal is that I want to make a call using Mixpanel's (http://www.mixpanel.com) javascript API call and make an event called "Comment added" for a specific user. I know how to do the mixpanel side of things but am confused by the this specific use case of wordpress. Thanks in advance!


title: Query custom posts from custom taxonomy

text:
I'm trying to do a custo slideshow, but I have problems with query the posts. I have defined a custom post type "slider" and a custom taxonomy "slideshow":   * custom post type:              function wms_slider_init() {     $labels = array(     'name' => 'Slider',     'singular_name' => 'Slider',     'add_new' => 'Add Slider',     'add_new_item' => 'Add New Slider',     'edit_item' => 'Edit Slider',     'new_item' => 'New Slider',     'all_items' => 'All Sliders',     'view_item' => 'View Slider',     'search_items' => 'Search Sliders',     'not_found' =>  'No Slider found',     'not_found_in_trash' => 'No Slider found in Trash',      'parent_item_colon' => '',     'menu_name' => 'Sliders'       );            $args = array(     'labels' => $labels,     'description'   => 'Holds our Slider poste specific data',     'public' => true,     'publicly_queryable' => true,     'show_ui' => true,      'show_in_menu' => true,      'query_var' => true,     'rewrite' => array( 'slug' => 'slider' ),     'capability_type' => 'post',     'has_archive' => false,      'hierarchical' => true,     'menu_position' => 5,     'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes')       );             register_post_type( 'slider', $args );     }     add_action( 'init', 'wms_slider_init' );        * custom taxonomy:              add_action( 'init', 'wms_create_slider_taxonomies', 0 );          //create SlideShow Category for the post type "slider"     function wms_create_slider_taxonomies()      {     // Add new taxonomy, make it hierarchical (like categories)     $labels = array(     'name'                => _x( 'SlideShows', 'taxonomy general name' ),     'singular_name'       => _x( 'SlideShow', 'taxonomy singular name' ),     'search_items'        => __( 'Search Genres' ),     'all_items'           => __( 'All SlideShows' ),     'parent_item'         => __( 'Parent SlideShow' ),     'parent_item_colon'   => __( 'Parent SlideShow:' ),     'edit_item'           => __( 'Edit SlideShow' ),      'update_item'         => __( 'Update SlideShow' ),     'add_new_item'        => __( 'Add New SlideShow' ),     'new_item_name'       => __( 'New SlideShow Name' ),     'menu_name'           => __( 'SlideShow' )       );                $args = array(     'hierarchical'        => true,     'labels'              => $labels,     'show_ui'             => true,     'show_admin_column'   => true,     'query_var'           => true,     'rewrite'             => array( 'slug' => 'slideshow' )      );            register_taxonomy( 'slideshow', array( 'slider' ), $args );     }      I made under taxonomy "slideshow" a "category" named - "homeslide" and I put in it a "slider" named "test". I try to set up a query to retrieve all posts from "homeslide", but the query is not working. here is my query and response               function wms_output_home_slides($cat) { // $cat = 'homeslide'       $home_slides_args = array(                 'post_type' => 'slider',                 'posts_per_page'  => -1,                 'tax_query' => array(                 array(                     'taxonomy' => 'slideshow',                     'field' => 'slug',                     'terms' => $cat                        )                      )     );     $sliders_query = new WP_Query( $home_slides_args );     //$print_out = '
'.print_r($home_slides_args, true).'
';     //loop     if ($sliders_query->have_posts()) :          $print_out .= '
';         while  ($sliders_query->have_posts()) : $sliders_query->the_post();             $slider_id          = $post->ID;                  $print_out .= '
';                      $print_out .= $slider_id;                  $print_out .= '
';         endwhile;         $print_out .= '
';     endif;               return $print_out;     }      Any Ideea why didn't get the post ID?


title: New user created as Participant rather than Contributor

text: On Wordpress settings we have it set such that a new user should be created as a Contributor: ![User Settings](http://i.stack.imgur.com/0GJUG.jpg) However, any users that are created are given a role of Participant: ![New User as Participant](http://i.stack.imgur.com/VeEOn.jpg) This means that they cannot create their own blog. I am pretty certain that this hasn't always been the case. For further information we are running:   * Wordpress 3.9   * BuddyPress   * WangGuard I cannot see any setting in these that might affect the issue. Any ideas?


title: List custom post types in dropdown

text: I have three custom post types, each with around 5 taxonomies and 2 of the custom post types share two taxonomies. I've just about got everything set up for posting from the front end other than the part of a dropdown to show the post_types. As it is now front end posting works but, the urls are broken because they dont have the custom post type in them, i've searched all over and can find zero on listing custom post types... can it be done? Regards Martin edit: Just stumbled upon this **over at codex**,,


title: How to create non-unique sub-category slugs?

text: What’s the best way to make Wordpress accept non-unique sub-category slugs? By default, Wordpress ensures that every ‘slug’ portion of permalink URLs is unique, and is very savvy about using this to ensure you never see a 404 from omitting a portion of the URL. This means if my permalink structure is… http://site-root.com/category-name/sub-category-name/post-name/post-id Then….   * http://site-root.com/category-name/sub-category-name/post-name/post-id   * http://site-root.com/category-name/sub-category-name/post-name   * http://site-root.com/category-name/sub-category-name/post-id   * http://site-root.com/sub-category-name/post-name/post-id will all take me to the same post. But if that kind of fail-safe redirection is less important to someone than being able to have non-unique slugs (and nicely structured directories), I’m SOL. Let’s say I’m writing a restaurant review guide in major cities. I want my top-level categories to be city names, and the types of restaurants to be the sub-categories. So I create “Boston”, “New York”, and “Seattle”, then I add the sub-categories “Chinese Food”, “Italian Eateries”, and “Luxury Dining” to Boston. But when I try to add the same sub-categories to New York, even when I specify the URL slugs, Wordpress starts forcing slugs like “http://[site- root].com/New-York/Chinese-Food-New-York/” — unnecessary repetition, and lengthening my links. This gets even worse if I want to have sub-sub- categories. I haven’t yet been able to find a way to force Wordpress to accept non-unique slugs. How would you recommend I accomplish this?


title: Wordpress not showing custom 404 page for not found images, zip files

text: My blog all the web page not found errors shows the theme's 404.php file. But if someone click on the file link (.img, .zip), it doesn't show that themes not found page. Instead of that it shows web browser "The webpage cannot be found" error page. For an instance http://www.example.com/sample.img (if this page doesn't exist it shows web browser 404 page, not the theme page) Logged in user can see this error (if click on invalid zip or img file) "Fatal error: Call to undefined function get_option() in /home/xxxx/public_html/wp- content/themes/splash/404.php on line 1". I use hotlink protection htaccess code. Is it a htaccess issue or 404 page issue? Are there any way to correct it?


title: Adding category dropdown list to theme options page

text: I am tyring to add a category drop down list to my theme options page. I am try it this way:               <p>                 Select a style from the list                 <?php                 $amp_categories_obj = get_categories('hide_empty=0');        $amp_categories = array();        foreach ($amp_categories_obj as $amp_cat) {        $amp_categories[$amp_cat->cat_ID] = $amp_cat->category_nicename;        }        $categories_tmp = array_unshift($amp_categories, "Select a category:");              echo "<select name='amp_options[amp_cat]'>";        foreach ($amp_categories_obj as $amp_cat) {         $selected = ($options['amp_cat']==$amp_cat) ? 'selected="selected"' : '';         echo "<option value='$amp_cat' $selected>$amp_cat</option>";        }        echo "</select>";             ?>                 </p>      I am not much of a PHP coder by the way. Any help would be appreciated.


title: Page as child in custom post type slug?

text: I have the following structure:   * `/projects` (archive of cpt `projects` with template `archive-projects.php`)   * `/projects/project-1` (single view of cpt with template `single-projects.php`)   * `/projects/downloads` (this is a page) When I try to open `/projects/downloads` I get an 404 error. Is there a way to set a page in the custom post type hierarchy?


title: How to not treat categories as tags in feeds

text: Basically we're (ab)using Category to determine whether a post is a News post or a Blog post, and so it's not a category in the traditional sense to the outside world. I'd like the category to not be indexed by feed- readers/crawlers, only the tags. I found an easy way to do it with an easy change to 1 function in the core, but I'd rather avoid that if possible. Is there a way to do that without modifying core? (Specifically `get_the_category_rss` in `wp-includes/feed.php`) EDIT: What I mean specifically is to not list the category in the feed. For example, this is what part the current RSS2 feed looks like:               <category><![CDATA[blog]]></category>     <category><![CDATA[test]]></category>     <category><![CDATA[testing]]></category>     <category><![CDATA[yeah!]]></category>      "blog" is a Wordpress Category, while "test", "testing", and "yeah!" are Wordpress Tags. What I want is to exclude the entry `<category><![CDATA[blog]]></category>` entirely from the feed. The same should apply to Atom feeds and any others.


title: How can I edit the Twenty Ten Theme to remove the comments box when a page uses a specific template?

text: I'm new to Wordpress and I'm trying to edit the Twenty Ten theme so that my template for basic pages (basic-template.php) does not show the comments box. I do want the comments box to show up on other pages, such as blog posts. I'm pretty sure that changes need to be made in loop.php, but my doesn't seem to be having the right effect. For the comments box, I edited:               <?php comments_template( '', true ); ?>      to be as follows.               <?php     wp_reset_query();     if ( is_page_template(‘basic-template.php’) ) {     comments_template();     } else {     comments_template( '', true );     }     ?>      When I get rid of the else statement, the comments disappear, so I think the problem is my code for that part. Any advice would be much appreciated!


title: Ajax from various plugins not generating responses (endless spinners)

text: This isn't a problem with a specific plugin, but with all of my plugins that use Ajax on the front-end (though surprisingly, none of the Ajax requests on the back-end are experiencing any issues). I'm working with plugins such as GD Star Rating and WP Polls, that all submit the user's response via an Ajax call, display a spinner while it waits for a result, and then displays the static result afterward. All I get is the spinner, though the submission DOES WORK and the data IS being received and processed. Just the response never makes the round trip. The only thing I can think of is that the SITE URL is www.mydomain.com but the HOME URL is www.mydomain.com/wordpress to correspond with the actual install location. I use a rewrite rule to make it look like the site is www.mydomain.com. Does anyone have any suggestions about how I can fix the Ajax issue?


title: get_posts - find out if querystring was crap and fallback is used

text: If we pass a String to functions like `get_posts`, and that string is not a meaningful querystring (for Example get_posts(' ')), the function returns the results of the default query (the last five posts or such). Is it possible either to suppress this behaviour or - even better - to find out, if the string was a meaningful querystring or if the function just fell back to default hence it was not? Changing the default query-settings is not a solution because I don't want to affect the main loop, but only a function call of `get_posts` in a plugin.


title: WP_Customize->add_control Navbar Background Image

text: I'm having trouble figuring out how to properly add a setting under Navigation in the Theme Customization page in order to customize and specify a background-image to use in the navbar.. similar to the pre-existing menu option to select a background-image. This is what I've got in my code so far:               $wp_customize->add_section( 'nav', array(         'title' => __( 'Navigation', 'thetheme' ),         'theme_supports' => 'menus',         'priority' => 100,     ) );


title: Headway body classes and W3TC page cache conflict

text: I'm currently working on a website using WordPress, Headway, Modernizr and W3 Total Cache. The problem I'm having is that W3TC is caching the body tag, which means that this isn't being updated depending on the users browser by Modernizr. An example of how this is a problem is that modernizr adds the 'firefox' body class, if this is then cached then in chrome, we have that same 'firefox' body class which makes any browser specific css inaccurate. I have tried using `<!-- mfunc -->any PHP code<!-- /mfunc -->` that I got from this answer The code looks like this               <!-- mfunc -->     headway_page_top();     <!-- /mfunc -->      I have experimented with using the same mfunc wrapper inside the headway_page_top() function so that it is directly around the body tag without success. The error I get comes from W3TC and says 'Unable to execute code:' and then all the markup wrapped by the mfunc is printed out (in debug mode). This also happens with debug mode disabled. This call is happening inside wp-content/themes/headway-2012/header.php, and I have added that path to the 'Cache exception list' inside the W3TC Page Cache settings to no avail. Does anyone have any suggestions as to how I can have the page cache run side by side with modernizr and not have this problem? **EDIT** : This problem isn't to do with Modernizr at all, I jumped the gun in thinking that it was. Headway is adding the body class in on its own and isn't using modernizr to do so. The problem is using W3TC and its fragment so that the body class remains dynamic. I haven't managed to get the fragment caching working at all, or find much documentation on it. Is fragment caching a feasible solution? I seem to be running out of possible solutions.


title: Retriving array size from serialized data

text: I've a custom field in Wordpress user meta, which store data in serialized array. I want to retrieve the number of arrays. For e.g.: `a:2:{blah blah}` * * * ![enter image description here](http://i.stack.imgur.com/wJvQy.jpg) Screenshot of my table * * * I tried the following code but it doesn't works. It should print 2               $number = $wpdb->get_var("         SELECT count(*)         FROM wp_usermeta         WHERE meta_key='bookmark_posts' AND meta_value LIKE '%".get_current_user_id()."%'     ");     if ( $number !== '' ) {         echo 'Total bookmarks (' . $number . ')';     }      I've an error log. (john_newsite is the database name) > `WordPress database error Table 'john_newsite.wp_usermeta' doesn't exist for > query SELECT count(*) FROM wp_usermeta WHERE meta_key='bookmark_posts'` **edit:** I just tried the following code. It works but counts the total bookmarks from all users. How can limit the result by current logged in user?               $meta_key='bookmark_posts';     $number = $wpdb->get_var( $wpdb->prepare(          "SELECT sum(meta_value)          FROM $wpdb->postmeta          WHERE meta_key = %s",          $meta_key     ) );     echo "{$number}";


title: How can i display on front page a movie that is atached in a post type

text:
Im building a cinema site,   * In post's i store the Movies   * I have a post_type name "box-office" , this post type have 1-10 custom fields, with i can select the movies stored in post's. locul_1 - is one of that. How can i display on front page the movie atached to that custom field I want to display on front page 5 movies In post type BoxOffice i have 2 categories (box-office-sua, and another one) Custom Fields : locul_1,locul_2,locul_3,locul_4,locul_5 In addition, if somone know how to do that, i want when i add new post on Post Type Box-Office, i want in front page to automate chage with last post from Box-Office, let say categoty box-office-sua See image : http://i45.tinypic.com/a5o3k.jpg Wath is retriving the code down See - http://i47.tinypic.com/25hcvvt.jpg               <?php          $posts = get_posts(array(         'post_type' => 'box-office',         'meta_key' => 'locul_1',     ));          if( $posts ):     foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>     <?php setup_postdata($post); ?>
     <?php if(get_field('locul_1') != ""){foreach(get_field('locul_1') as $post_object): ?>
     <?php     if ( ! $img = get_field('img', $post_object->ID ) )         $img = '/wp-content/uploads/noimage1.jpg';     ?>     <a href="<?php echo get_permalink($post_object->ID); ?>">     <img src="/scripts/timthumb.php?src=<?php echo urlencode($img); ?>&h=55&w=40&zc=1" alt="<?php the_title(); ?>"  title="<?php the_title(); ?>"/>

1.     <?php $key="incasari_totale"; echo get_post_meta($post_object->ID, $key, true); ?> $     <img class="bi-u" src="/wp-content/themes/movies/images/<?php $key="box_clasament_img"; echo get_post_meta($post->ID, $key, true); ?>" alt="Tip Clasament Box Office" title="Tip Clasament Box Office"/>

<a href="<?php echo get_permalink($post_object->ID); ?>">     <?php echo get_the_title($post_object->ID) ?>

<?php $key="titluro"; echo get_post_meta($post_object->ID, $key, true); ?>
     <?php endforeach;}?>
          <?php         endforeach;         wp_reset_postdata();         endif;      ?>      Solved..


title: Is it heavyweight plugins or lots of plugins that make a site slow?

text: I've often heard that having a lot of plugins will slow down a WordPress site. This makes sense of course, as the more code that executes, the longer it will take. I'm wondering whether the slowness is mostly:   * a result of the sheer number of plugins? (because WP has to do some processing to locate and load each plugin)   * a result of having a few slow/heavy plugins? More practically, when I am writing my own, should I combine functionality into fewer files to gain speed? Or is it okay to have 10-20 plugins each doing a quick task?


title: Is Git/GitHub a good WordPress deployment solution?

text: I'm currently developing my WordPress locally, committing my code to GitHub with Git and then SSHing into my server and doing a "git pull" to update my code. Is this a good option for code deployment onto a WordPress site (I obviously have root level access to my server in this case.) I know of things like Capistrano, but would that be overkill for deployment to a WordPress site? How can I make the most of Git/GitHub in this case?


title: Add ul to its children with get_posts

text:
I want to add a ul to the list when a page have a child, Im making a foreach on all the post_types so i don't think that i can use something like wp_list_pages. I have been trying to sort this out but just ended upp with this:               // Check for children     $children = array();      foreach ( $values as $post ) {       if( $post->post_parent ) {         $children[] = $post->ID;       }     }     foreach ( $values as $post ) {       setup_postdata( $post );          if( in_array( $post->ID, $children ) ) {             $output .= '
';                $output .= '
ID .'" data-area="'. $area['area'] .'">
'. get_the_title() .'
'. __('Child', 'blocks') .'
';             $output .= '
';          } else {             $output .= '
ID .'" data-area="'. $area['area'] .'">
'. get_the_title() .'
'. __('Parent', 'blocks') .'
';          }         wp_reset_postdata();                                   }


title: working with newest post from plugin

text: I am going to write a wordpress plugin which will execute when user submits a new post. Suppose, user wrote a new post and pressed the submit button. Now, I want to save the post as a txt file in my plugin directory. How can I do this? Someone please show me the process for doing this.


title: how to change featured image path according to "alt" property

text: when a featured image is added, the path for this image is `http://domain.com/wp-content/uploads/filename` for some featured image i would like to use only "filename" in the path do you know how to change this ? thank you. EDIT: im modified a plugin in order to put an external url as featured image, but when it try to display the picture, the code look like this: `<img src="http://domain.com/http://external-url-of-the-picture.jpg >"`


title: Getting a "404 Not Found" error when "Preview Changes" is clicked

text: I'm using Wordpress 3.3.1, installed on my local machine. I've gotten everything up and running, and I'm able to add posts and pages through the admin interface, but whenever I try to click the "preview changes" button from either one of my posts or pages, I get a 404 Not Found page instead. The URL appears to be correct, I've even tried copying the permalink and pasting it into the address bar, but it still gives me a 404 page. As far as I can tell the posts and pages are being added correctly, and I can view and edit their contents from the admin interface, just not from the main site itself. What could be causing this and how do I fix it?


title: Old Website Address Still Showing

text: I had 'theshortfilm.co" before changing to my current url 'welovefilm.co'. I changed my address 6 months back, everything went fine. But now when I activated my networks, I get my old url in the code. Please see the image below. http://imgur.com/PW6oW But when I change the url manually to new address and add it to the wp-config file, I get an error saying website is on infinite redirect loop. Please help me fix this issue. Thank You.


title: How do I link to a blog not set as the homepage?

text:
I have a blog here **/www.mysite.com/section/news/** that only shows news in a specific category. When I use **wp_get_recent_posts()** and **get_permalink($recent["ID"])** the link goes here **/www.mysite.com/the- post-title/**               <?php              $args = array(             'numberposts' => 2,             'category' => 14 );                   $recent_posts = wp_get_recent_posts($args);             foreach( $recent_posts as $recent ){             echo '
' .   $recent["post_title"].'
 ';     }     ?>      How do I direct links to **/www.mysite.com/section/news/the-post-title/** thanks, any help much appreciated. Regards,


title: WP-DBManager Plugin Can't Find Mysql Path

text: I support a WordPress 3.4.2 site, lifering.org, running on a GoDaddy Virtual Server. Recently I chose to upgrade the underlying O/S from CentOS 5 to CentOS 6. The rebuild was entirely automated and I don't know what it involved. I restored my site from backup, and since then the plugin WP-DBManager no longer backs up our MySQL database because it says it can't find the mysql path. The mysql path is /usr/bin/mysql, same as it always was, but for some reason the PHP utility that finds it is failing. I posted a question in the Wordpress support forum for the plugin several weeks ago and have no reply; the original supporter has a blog post that says, basically, I have a real job now, goodbye. After much research I think I may have a problem with PHP safe mode, but I don't know enough about it to evaluate. My PHP version is 5.3.3-14.el6_3. My php.ini contains these entries, in this order but not all together:               safe_mode_allowed_env_vars = PHP_     safe_mode_protected_env_vars = LD_LIBRARY_PATH     safe_mode_exec_dir =      safe_mode_include_dir =      safe_mode = off     safe_mode_gid = off      These must have been set during the rebuild. Reading the PHP manual, I think if I set safe_mode_gid = on it may solve my problem, but: if safe_mode = off why do I have a problem at all? I have no way of knowing what the compilation switches were. Can anyone suggest anything, including an alternative plugin? As far as I can tell there is NO other plugin that does what this does.


title: How to use has_archive but disable feed per post type?

text: What is the best way to disable feeds per post type but keep has_archive enabled?


title: WordPress Blank Screen Issue

text: I'm running a WordPress website with a custom template that is showing me a blank screen when I have not viewed the site in a few days. I've cleared the browser cache and I've empited all cache using w3 total cache. Once I cleared the cache,I typed in the URL each time, and it loaded the website perfectly. I did not copy and paste the URL. The URL combinations are listed below; I've also provided a list of plugins that are currently installed on the website.   1. all in one slideshow v1.3.1   2. ckeditor for wordpress v3.6.2.1   3. contact form 7 v2.2   4. contact form to db extension v2.2.4   5. duplicate post 2.0.2   6. easy picasa v1.1   7. events calendar pro 1.3.3   8. featured image widget v0.2   9. get the image v0.6.2   10. gravity forms v1.6.2   11. gravity forms + custom post types v3   12. gravity forms css ready class selector v1.0.1   13. latest news widget 1.0.1   14. mailchimp v1.2.4   15. members list v3.5.6   16. nextgen gallery v1.7.4   17. page restrict v2.03   18. picasa express x2 v1.5.3   19. really simple captcha   20. registration form widget v1.0   21. search everything v6.7   22. shortcode exec php v1.33   23. si captcha anti-spam v2.7.5   24. sidebar login v2.2.7   25. the excerpt re-loaded v0.3.2   26. w3 total cache 0.9.2.4   27. wordpress https v2.0.4   28. wp custom login logo v1.0   29. wp fade in text news v4.0   30. wpml cms nav v1.2.4   31. wpml multilingual cms v2.3.4   32. wpml string translation v1.2.2   33. wp user registration v2.4 Just wondering if there may be a plugin conflict or maybe a conflict between a plugin and wpml 2.3.4? I've got no issues disabling and re-enabling the plugins one by one, but if I cannot replicate the blank screen issue 100% of the time, disabling/enabling plugins will not be of any use. I'm also running other websites on my server none of which are showing me this problem. The server I'm running is Ubuntu 10.04 with Apache and MySQL. Any ideas on what might be causing this issue will be very much apppreciated.


title: How to Echo Metadata Value in Currency Format

text: I have a Custom Post Type with a Metabox and an input Text field for adding "Price" to the posts. Now I would like to display the input value which can be like 49 or 59 like 49.00 or 59.00 so far I have this code to output the meta as:               $meta = get_post_custom($post->ID);     echo '<h5> $'.$meta['price'][0].'/h5';      but this just return the value as $49 or $59. Can you please let know how I can make it to be render as $49.00 ? Thanks


title: Why toolbar would not be visible in the frontend but visible in the admin?

text: I'm trying to figure out why the WP toolbar/admin bar shows up in the admin section for a non-admin user, but in the frontend it does not - only empty space. I checked user profile setting, which technically what is used to show/hide it in the front end, but checked or unchecked, it doesn't do anything. Any ideas as to what might cause this or what to try? I'm using basic functions to add new menu options to the toolbar. Any help is appreciated.


title: WordPress theme options tabs

text: It is possible to create tabs in admin panel in Theme options like in Theme? Please see this screenshot: ![http://i33.fastpic.ru/big/2012/0322/7c/a22f2c8bc821b2249fb0bc4ed328307c.png](http://i.stack.imgur.com/0YRps.png) I can't find any official documentation about adding admin tabs.


title: Two column layout in Wordpress?

text: I'm not sure if this is a general web design or Wordpress question. I have a simple demo here to illustrate my question. http://www.ttmt.org.uk/forum/wp/ It's just a simple 2 column responsive layout. My simple question is how do I spilt the content between the two columns. The page will be a page in Wordpress and not posts (I think). I wanted to create a page in Wordpress and place the text on the content area There is one content area in Wordpress, is there a way to split this content so I can say this is the left column, this is the right column. The text will all be on the same subject but I need to split it between two columns. Thanks in advance for any help.


title: Decrease RSS cache time in plugin?

text:
I'd like to decrease the default RSS cache time for a widget plugin i've made that outputs RSS feeds. I'm no php expert, I just copy and paste and understand little bits. I'm using this code to output the RSS                 function widget($args, $instance) {       // outputs the content of the widget           extract( $args );           $title = apply_filters('widget_title', $instance['title']);                   $tip_language = apply_filters('widget_title', $instance['tip_language']);                   echo $before_widget;           echo "
" . $title . "
";           include_once(ABSPATH . WPINC . '/rss.php');           $rss_feed = "http://mysite.org/feed";           $rss = fetch_rss($rss_feed);           $rss->items = array_slice($rss->items, 0, 1);           $channel = $rss->channel;                foreach ($rss->items as $item ) {               $parsed_url = parse_url(wp_filter_kses($item['link']));               echo wptexturize($item['description']);               echo "
" . wptexturize(wp_specialchars($item['author'])) . "
";           }           echo $before_after;       }


title: How to echo category_description() without stripping out html tags?

text: I'm in archive.php and attempting to write out the current category's description with full html. However, category_description() prints without the html markup. How can I force it to retrieve the full description complete with the html tags?


title: Where does Wordpress store the users customization in the theme

text: Good Day When you are inside the wordpress ctrl panel, and you edit/create posts, do theme changes etc, where does Wordpress store all that content? In which files? Thank you


title: How can I limit the amount of characters used for description in the manage categories grid?

text: My category descriptions consist of whole pages of content. When I view the manage categories screen, the grid does not truncate the text but rather, shows all of it. I realize I could turn off the description field in "screen options", however, I'd like to be able to truncate the amount of text that shows up there. How can I execute a filter that limits the amount of text used in this description field?


title: Moving an ASP Site to Wordpress - Looking for Help on Redirects

text: I am in the process of moving a site made up of asp pages to a completely redesigned Wordpress site. It has come time to create the 301 redirects for those old pages, so I don't break any links that are out there. I do have the redirection plugin installed as well. I've tried using it to do these types of redirects. I've also tried using htaccess, but everything I've tried results in getting this error. 404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable. It's my guess that the server is trying to process the page before applying the redirect. I'm sure others have done this before, so any thoughts/ideas would be greatly appreciated. Thanks, ## Jeremy               My htaccess currently looks like this:     FileETag None     Header unset ETag     Options +FollowSymLinks          Redirect 301 /customers/default.asp http://twostep2.com/customers/testimonials          <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /          # BEGIN WordPress          RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      * * *


title: When should you use WP_Query vs query_posts() vs get_posts()?

text: It seems like half the tutorials in the Codex and around the blogosphere use `query_posts()` and half use `WP_Query`. What's the deal?


title: Looping through a custom query makes WordPress assume another template

text: I am calling this code from my custom sidebar, in order to get related postings from the same category:               query_posts(array(        'cat' => get_category_id(),        'showposts' => 5,        'post__not_in' => array(get_the_ID())     ));          get_template_part('article-list'); // outputs the posts      This works. The `have_posts()`-loop inside of my article-list.php now only outputs 5 other postings from the category. But this also causes a problem: No matter on what kind of page I am (single.php, index.php, ...), WordPress always assumes that I am in the category template. So `is_category()` always returns `true` after calling `query_posts('cat=...')`. Thus `is_single()` returns `false`, although the single.php-template is used. What can I do to tell WordPress that it is still using the single-template? Or: What other function can I use to detect which (main) view is loaded?


title: Use https for img src

text: My site requires the use of https for all img src HTML. This is the WordPress function I'm using to display images:               <img src="'.get_bloginfo("template_url").'/images/thumb-default.gif" />      This outputs an http img src - how can I convert that to https?