{"id":1351,"date":"2009-12-29T00:52:24","date_gmt":"2009-12-29T05:52:24","guid":{"rendered":"http:\/\/g33kinfo.com\/info\/?p=1351"},"modified":"2009-12-29T00:52:24","modified_gmt":"2009-12-29T05:52:24","slug":"stupid-wordpress-tricks","status":"publish","type":"post","link":"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/","title":{"rendered":"Stupid WordPress tricks"},"content":{"rendered":"<p>This post is published courtesy of <u><a href=\"http:\/\/perishablepress.com\/press\/2009\/12\/01\/stupid-wordpress-tricks\/\">Perishable Press<\/a><\/u>. Check out the other terrific info there as well!  <u><a href=\"http:\/\/perishablepress.com\">Perishable Press<\/a><\/u><br \/>\nBy the way, this stuff is far from stupid&#8230; very nice references here.<\/p>\n<h3>WORDPRESS SHORTCODES\u00a0<\/h3>\n<p>Save time by replacing your most commonly typed words and phrases with WordPress shortcodes. For example, if you are frequently typing your blog\u2019s\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b>, you could place the following code your theme\u2019s\u00a0<code>functions.php<\/code> file:<\/p>\n<pre><code>function shortURL() {\n\treturn 'http:\/\/perishablepress.com\/';\n}\nadd_shortcode('myurl', 'shortURL');<\/code><\/pre>\n<p>Now whenever I write a post via \u201c<b><acronym title=\"Hypertext Markup Language\">HTML<\/acronym><\/b>-mode\u201d, all I need to include my blog\u2019s\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b> is type \u201c<code>[myurl]<\/code>\u201d. Works great in WordPress 2.5 or better.<\/p>\n<p><strong>Shortcodes with Attributes<\/strong><br \/>\nTo create a shortcode for links, we need to include the\u00a0<code>href<\/code> attribute information as well as the anchor text for the link itself. We can do this by placing this function in your theme\u2019s<code>functions.php<\/code> file:<\/p>\n<pre><code>function shortLink($atts, $content = null) {\n\textract(shortcode_atts(array(\n\t\t\"href\" => 'http:\/\/' \/\/ default URL\n\t), $atts));\n\treturn '<a href=\"'.$href.'\">'.$content.'<\/a>';\n}\nadd_shortcode('link', 'shortLink');<\/code><\/pre>\n<p>Then, when creating a post, emulate the following format to include any links you wish:<\/p>\n<p><code>[link href=\"http:\/\/perishablepress.com\/\"]Perishable Press[\/link]<\/code><\/p>\n<p>..which will output the following code:<\/p>\n<p><code><a href=\"http:\/\/perishablepress.com\/\">Perishable Press<\/a><\/code><\/p>\n<p>When the\u00a0<code>href<\/code> attribute is removed from the shortcode, the default\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b> will be used. You may specify the default\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b> in the third line of the funtion (see comment).<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/digwp.com\/\">Digging into WordPress<\/a><\/p>\n<h3>DISPLAY WORDPRESS PERMALINKS OUTSIDE OF THE LOOP\u00a0<\/h3>\n<p>Normally, permalink display via\u00a0<code>the_permalink()<\/code> requires the loop. To display permalinks <em>outside<\/em> of the loop, we may use either of the following methods:<\/p>\n<pre><code><!-- external permalink via post ID -->\n<a href=\"<?php echo get_permalink(33); ?>\" >Permalink<\/a>\n\n<!-- external permalink via global $post variable -->\n<a href=\"<?php echo get_permalink($post->ID); ?>\" >Permalink<\/a><\/code><\/pre>\n<p>Source:\u00a0<a href=\"http:\/\/www.webinventif.fr\/wordpress-hors-boucle\/\">Julien Chauvin<\/a><\/p>\n<h3>DISPLAY CUSTOM MESSAGE TO RETURNING VISITORS\u00a0<\/h3>\n<p>We can greet returning commentators with a custom message by extracting their information from the comment cookie left on their machine. Place the following code into the desired location in your theme and customize the message and markup to whatever you wish:<\/p>\n<pre><code>< ?php if(isset($_COOKIE['comment_author_'.COOKIEHASH])) {\n\t$lastCommenter = $_COOKIE['comment_author_'.COOKIEHASH];\n\n\techo \"Welcome Back \". $lastCommenter .\"!\";\n\n\t} else {\n\n\techo \"Welcome, Guest!\";\n} ?><\/code><\/pre>\n<p>Source:\u00a0<a href=\"http:\/\/ifohdesigns.com\/blog\/tutorials\/wordpress-welcome-back-script\">ifohdesigns<\/a><\/p>\n<h3>DISPLAY RECENTLY UPDATED POSTS AND PAGES\u00a0<\/h3>\n<p>Easily display a list of recently updated posts by placing the following code into the desired location in your theme:<\/p>\n<pre><code>< ?php \n\n$today  = current_time('mysql', 1);\n$number = 5; \/\/ number of posts\n\nif($recentposts = $wpdb->get_results(\"SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_modified_gmt < '$today' ORDER BY post_modified_gmt DESC LIMIT $number\")):\n\n?>\n\n<h2>< ?php _e(\"Recently Updated\"); ?><\/h2>\n<ul>\n< ?php\n\nforeach($recentposts as $post) {\n\n\tif($post->post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);\n\techo '<li><a href=\"'.get_permalink($post->ID).'\">'.the_title().'<\/a><\/li>';\n\n} ?>\n<\/ul>\n\n< ?php endif; ?><\/code><\/pre>\n<p>Of course, customize the details as necessary and remember to set the number of posts via the \u201c<code>$howMany<\/code>\u201d variable.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.tacticaltechnique.com\/wordpress\/wordpress-recently-updated-pages-or-posts\/\">Corey<\/a><\/p>\n<h3>DISPLAY CUSTOM CONTENT TO SEARCH ENGINE VISITORS\u00a0<\/h3>\n<p>Display custom content to your search-engine traffic by placing the following code into your theme\u2019s\u00a0<code>functions.php<\/code> file:<\/p>\n<pre><code>< ?php function scratch99_fromasearchengine() {\n\n\t$ref = $_SERVER['HTTP_REFERER'];\n\t$SE  = array('\/search?', 'images.google.', 'web.info.com', 'search.', 'del.icio.us\/search', 'soso.com', '\/search\/', '.yahoo.');\n\n\tforeach($SE as $source) {\n\t\tif(strpos($ref, $source) !== false) return true;\n\t}\n\treturn false;\n} ?><\/code><\/pre>\n<p>After checking and editing the $SE array with the search-engine referrer information of your choice, place this next chunk of code into the desired display location in your theme file(s):<\/p>\n<pre><code>< ?php if(function_exists('scratch99_fromasearchengine')) {\n\tif (scratch99_fromasearchengine()) {\n\n\t\t\/\/ INSERT YOUR CODE HERE\n\n\t}\n} ?><\/code><\/pre>\n<p>Add whatever content or code you wish to the specified area and enjoy targeted delivery to search-engine visitors only.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.scratch99.com\/\">Stephen Cronin<\/a><\/p>\n<h3>DISPLAY LAST MODIFIED TIME AND DATE FOR POSTS\u00a0<\/h3>\n<p>Display the \u201clast-modified\u201d time for your posts by placing this code anywhere within the loop:<\/p>\n<pre><code>Posted on < ?php the_time('F jS, Y') ?>\n< ?php $u_time = get_the_time('U');\n$u_modified_time = get_the_modified_time('U');\nif($u_modified_time != $u_time) {\n\techo \"and last modified on \";\n\tthe_modified_time('F jS, Y');\n\techo \". \";\n} ?><\/code><\/pre>\n<p>Source:\u00a0<a href=\"http:\/\/wphacks.com\/how-to-show-last-modified-wordpress-post\/\">Kyle Eslick<\/a><\/p>\n<h3>DISPLAY TOTAL NUMBER OF TRACKBACKS AND PINGBACKS\u00a0<\/h3>\n<p>Display the trackback\/pingback count for each of your posts by first placing this code into your theme\u2019s\u00a0<code>functions.php<\/code> file:<\/p>\n<pre><code>function comment_count() {\n\tglobal $wpdb;\n\t$count = \"SELECT COUNT(*) FROM $wpdb->comments WHERE comment_type = 'pingback' OR comment_type = 'trackback'\";\n\techo $wpdb->get_var($count);\n}<\/code><\/pre>\n<p>And then call the number for display anywhere in your theme by adding this code to the desired location:<\/p>\n<p><code>< ?php comment_count(); ?><\/code><\/p>\n<p>Alternately, in WordPress 2.7, you may display the total number of comments by inserting this code directly into your\u00a0<code>comments.php<\/code> template:<\/p>\n<pre><code>< ?php if(!empty($comments_by_type['comment'])) :\n\t$count = count($comments_by_type['comment']);\n\t($count !== 1) ? $txt = \"Comments\" : $txt = \"Comment\";\n?>\n<h3>< ?php echo $count . \" \" . $txt; ?><\/h3><\/code><\/pre>\n<p>Edit the markup as desired. Will display \u201c\u201d or \u201c\u201d, depending on the number of comments.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/wpengineer.com\/comment-ping-count\/\">WPengineer.com<\/a><\/p>\n<h3>DISPLAY RECENTLY REGISTERED USERS\u00a0<\/h3>\n<p>Quick and easy method for displaying a list of recently registered users. Place the following code directly into your theme, wherever you would like to display the list:<\/p>\n<pre><code><ul>\n\t< ?php $usernames = $wpdb->get_results(\"SELECT user_nicename, user_url FROM $wpdb->users ORDER BY ID DESC LIMIT 5\");\n\n\t\tforeach ($usernames as $username) {\n    \t\t\techo '<li><a href=\"'.$username->user_url.'\">'.$username->user_nicename.\"<\/a><\/li>\";\n\t\t}\n\t?>\n<\/ul><\/code><\/pre>\n<p>As-is, this code will spit out the five most recent registered users. This is easily changed to whatever number you wish by simply editing the number \u201c5\u201d in the first line.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.wprecipes.com\/how-to-list-latest-registered-users\">WPRecipes.com<\/a><\/p>\n<h3>LIST ALL OF YOUR SITE\u2019S POSTS\u00a0<\/h3>\n<p>If the default\u00a0<code>wp_get_archives(type=postbypost&amp;limit=)<\/code> function doesn\u2019t provide enough flexibility to meet your needs, here is another way to list\u00a0<strong>all<\/strong> of your site\u2019s posts:<\/p>\n<pre><code>< ?php while(have_posts()) : the_post(); ?>\n<ul>\n\t< ?php $allposts = get_posts('numberposts=-1&amp;offset=0'); foreach($allposts as $post) : ?>\n\n\t<li>< ?php the_time('d\/m\/y'); ?>: <a href=\"<?php the_permalink(); ?>\">< ?php the_title(); ?><\/a><\/li>\n\n\t< ?php endforeach; ?>\n<\/ul>\n< ?php endwhile; ?><\/code><\/pre>\n<p>In place, that code will display a list of all of your blog\u2019s posts. As a bonus, you may use any of the applicable parameters available to the\u00a0<code>get_posts()<\/code> function to do just about anything you need with your posts list.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.wprecipes.com\/\">WPRecipes.com<\/a><\/p>\n<h3>LIST WORDPRESS USER INFORMATION\u00a0<\/h3>\n<p>Here is an easy way to display flexible lists of your blog\u2019s registered users\u2019 information. In this example, we will list the first and last name of each user registered in the database:<\/p>\n<pre><code><ul>\n< ?php $szSort = \"user_nicename\";\n$aUsersID = $wpdb->get_col($wpdb->prepare(\"SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY %s ASC\", $szSort));\n\tforeach($aUsersID as $iUserID) :\n\t\t$user = get_userdata($iUserID);\n\t\techo '<li>'.ucwords(strtolower($user->first_name.' '.$user->last_name)).'<\/li>';\n\tendforeach;\n?>\n<\/ul><\/code><\/pre>\n<p>The following variables may be used to display different types of user information and also to specify the sort order of the output list:<\/p>\n<ul>\n<li><code>ID<\/code> \u2014 User ID number<\/li>\n<li><code>user_login<\/code> \u2014 User Login name<\/li>\n<li><code>user_nicename<\/code> \u2014 nice version of login name<\/li>\n<li><code>user_email<\/code> \u2014 User Email Address<\/li>\n<li><code>user_url<\/code> \u2014 User Website URL<\/li>\n<li><code>user_registered<\/code> \u2014 User Registration date<\/li>\n<\/ul>\n<p>To display any of these different types of user information, call it with\u00a0<code>$user->name_of_the_column<\/code> anywhere within the function\u2019s\u00a0<code>foreach()<\/code> loop. To change the display order of the output, use any of the above as the value of the\u00a0<code>$szSort<\/code> variable in the first line of the function. Note that\u00a0<code>strtolower<\/code> and\u00a0<code>ucwords<\/code> are used to ensure proper capitalization of the user names.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.mattvarone.com\/wordpress\/list-users\/\">Matt Varone<\/a><\/p>\n<h3>DISPLAY LIST OF SCHEDULED POSTS\u00a0<\/h3>\n<p>Got scheduled posts? Cool. Here\u2019s how to display them to your readers:<\/p>\n<pre><code><ul>\n< ?php $my_query = new WP_Query('post_status=future&amp;order=DESC&amp;showposts=5');\nif ($my_query->have_posts()) {\n\twhile ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?>\n\n        <li>< ?php the_title(); ?><\/li>\n\n\t< ?php endwhile; } ?>\n<\/ul><\/code><\/pre>\n<p>Place that code in the desired location of your WordPress template and display a list of scheduled posts to your readers. To change the total number of displayed posts, edit the<code>showposts=5<\/code> parameter to any number you wish. You may also use other parameters available to the\u00a0<code>WP_Query()<\/code> function to further customize the output.<\/p>\n<p>Source:\u00a0Pascal Birchler<\/p>\n<h3>DISPLAY PRIVATE POSTS TO LOGGED-IN USERS\u00a0<\/h3>\n<p>To display private posts to your logged-in users, you will need to add a custom field called \u201c<code>private<\/code>\u201d for each private post and give it a value of \u201c<code>true<\/code>\u201d. Then, replace your default WordPress loop with the following:<\/p>\n<pre><code>< ?php if (have_posts()) : while (have_posts()) : the_post();\n\n\t$private = get_post_custom_values(\"private\");\n\tif (isset($private[0]) &amp;&amp; $private == \"true\") {\n\t\tif (is_user_logged_in()) {\n\t\t\t\/\/ Display private post to logged user\n\t\t}\n\t} else {\n\t\t\/\/ Display public post to everyone\n\t}\n\nendwhile; endif; ?><\/code><\/pre>\n<p>This custom loop will check each post for the presence of a custom-field value of\u00a0<code>true<\/code>. For each post that has this value, the loop will then check to see if the user is logged into your site. If the user is in fact logged in, the loop will display the private post(s). Public posts will be displayed as usual and regardless of whether the user is logged in or not.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/digwp.com\/2009\/08\/password-protect-more-than-the_content\/\">Digging into WordPress<\/a><\/p>\n<h3>DISPLAY POSTS FROM EXACTLY ONE YEAR AGO\u00a0<\/h3>\n<p>Use this code to display posts that are exactly one year old:<\/p>\n<pre><code>< ?php\n$current_day = date('j');\n$last_year   = date('Y')-1;\n?>\n< ?php query_posts('day='.$current_day.'&amp;year='.$last_year);\n\tif (have_posts()): while (have_posts()) : the_post(); ?>\n\n\t<h1>< ?php the_title(); ?><\/h1>\n\t< ?php the_excerpt(); ?>\n\n< ?php endwhile; endif; ?><\/code><\/pre>\n<p>To display posts from different days or different years, edit the two variables in the beginning of the method.<\/p>\n<h3>CUSTOM CSS STYLES FOR RECENT POSTS\u00a0<\/h3>\n<p>Use some custom CSS styles to highlight your recent posts. To do this, replace your existing loop with the following:<\/p>\n<pre><code>< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>\n\n\t$currentdate = date('Y-m-d',mktime(0,0,0,date('m'),date('d'),date('Y')));\n\t$postdate = get_the_time('Y-m-d');\n\tif ($postdate == $currentdate) {\n\n\t\techo '<div>';\n\n\t} else {\n\n\t\techo '<div>';\n\n\t} ?>\n\n\t\t<a href=\"<?php the_permalink(); ?>\">< ?php the_title(); ?><\/a>\n\t<\/div>\n\n< ?php endwhile; endif; ?><\/div><\/code><\/pre>\n<p>This new loop will check the date of each post and include a\u00a0<b><acronym title=\"Cascading Style Sheets\">CSS<\/acronym><\/b> class of \u201c<code>new<\/code>\u201d to any post published within the previous 24-hour time period. Once the new post class is included, you may style it with some custom\u00a0<b><acronym title=\"Cascading Style Sheets\">CSS<\/acronym><\/b> such as the following:<\/p>\n<pre><code>.post{\n\t\/* styles for all posts *\/\n\t}\n.post.new {\n\t\/* styles for new posts *\/\n\t}<\/code><\/pre>\n<p>Source: Fred jaillet [via]\u00a0<a href=\"http:\/\/www.wprecipes.com\/how-to-make-your-new-posts-stands-out\">WPRecipes.com<\/a><\/p>\n<h3>NEW WORDPRESS-2.7 COMMENTS LOOP\u00a0<\/h3>\n<p>Due to the changes made to comment-related functions in WordPress 2.7, you will need to upgrade your comments template in order accomodate for the new functionality. The major changes are the new\u00a0<code>wp_list_comments()<\/code> function and the\u00a0<code>next\/previous_comments_link()<\/code>functions. Here is an example\u00a0<code>comments.php<\/code> loop to get you started:<\/p>\n<pre><code>< ?php if (have_comments()) : ?>\n\n\t<h4>< ?php comments_number('No Comments', 'One Comment', '% Comments' );?><\/h4>\n\t<ul>\n\t\t< ?php wp_list_comments(); ?>\n\t<\/ul>\n\t<div>\n\t\t<div>< ?php previous_comments_link(); ?><\/div>\n\t\t<div>< ?php next_comments_link(); ?><\/div>\n\t<\/div>\n\n< ?php else : \/\/ if there are no comments so far ?>\n\n\t< ?php if ('open' == $post->comment_status) : ?>\n\n\t\t<p>Comments are open, but there are no comments.<\/p>\n\n\t< ?php else : ?>\n\n\t\t<p>Comments are closed, and there are no comments.<\/p>\n\n\t< ?php endif; ?>\n\n< ?php endif; ?><\/code><\/pre>\n<p>As you can see, we are now using the\u00a0<code>wp_list_comments()<\/code> function as the method by which our individual comments are displayed. This function wraps each comment with a set of\u00a0<code><\/p>\n<li><\/li>\n<p><\/code>elements, but this may be changed via customized parameters. We are also using the<code>next\/previous_comments_link()<\/code> functions to accommodate the new built-in paged comments feature.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/digwp.com\/\">Digging into WordPress<\/a><\/p>\n<h3>BACKWARDS-COMPATIBLE COMMENT TEMPLATES\u00a0<\/h3>\n<p>The easiest way to accommodate for both old (pre-2.7) and new (2.7+) WordPress comment loops is to create two different versions of the comments template and then use some conditional logic to process the correct file. Place the 2.7-compatible code from the previous section into your default\u00a0<code>comments.php<\/code> file, and then place your existing (pre-2.7) comments code into a file called\u00a0<code>legacy-comments.php<\/code>. Once you have both of these files setup and included among your theme files, place the following function in your theme\u2019s\u00a0<code>functions.php<\/code>file:<\/p>\n<pre><code>< ?php add_filter('comments_template', 'legacy_comments');\n\nfunction legacy_comments($file) {\n\tif(!function_exists('wp_list_comments')) : \/\/ WP 2.7-only check\n\t\t$file = TEMPLATEPATH.'\/legacy-comments.php';\n\tendif;\n\treturn $file;\n} ?><\/code><\/pre>\n<p>This code will then check for the presence of the new\u00a0<code>wp_list_comments()<\/code> function. If it exists, then the version of WordPress is at least 2.7, and the default\u00a0<code>comments.php<\/code> file will be used. If the new function doesn\u2019t exist, we have a dinosaur on our hands and so the legacy comments file will be used instead.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/justintadlock.com\/archives\/2008\/11\/01\/making-your-themes-comments-compatible-with-wordpress-27-and-earlier-versions\">Justin Tadlock<\/a><\/p>\n<h3>DISABLE WORDPRESS POST REVISIONS\u00a0<\/h3>\n<p>One of the new features rolled out in WordPress 2.6 involved post revisions. Revisions are a way for users to keep a working collection of each different version of a post and then revert back to it in the future if necessary. Some people think this is the greatest thing since lightsabers, others (such as myself) find it to be a royal pain in the database. It convolutes the Admin area, gobbles up disk space, and usually doesn\u2019t work as intended. Fortunately, we can disable this amazing new \u201cfeature\u201d (which should NOT have been included in the core) by adding the following line to the\u00a0<code>wp-config.php<\/code> file:<\/p>\n<pre><code>\/* disable post-revisioning nonsense *\/\ndefine('WP_POST_REVISIONS', FALSE);<\/code><\/pre>\n<p>Just place that line above the \u201cHappy\u00a0blogging\u201d comment and say goodbye to needless revisioning bloat.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/digwp.com\/2009\/07\/mastering-wordpress-post-revisioning-and-auto-save-features\/\">Digging into WordPress<\/a><\/p>\n<h3>LIMIT WORDPRESS POST REVISIONS\u00a0<\/h3>\n<p>If you like the idea of WordPress-2.6\u2019s new post-revisioning feature, but don\u2019t want thousands of extra records bloating up your database, here is an easy way to limit the total number of revisions that WordPress is allowed to keep. This code will instruct WordPress to keep only the most recent \u201cx\u201d number of revisions:<\/p>\n<pre><code>\/* limit number of post revisions *\/\ndefine('WP_POST_REVISIONS', 3);<\/code><\/pre>\n<p>Place that line above the \u201cHappy\u00a0blogging\u201d comment in the\u00a0<code>wp-config.php<\/code> file and enjoy conserved disk space and less Admin clutter. Change the number \u201c<code>3<\/code>\u201d to any number you wish. Works a treat.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/digwp.com\/2009\/07\/mastering-wordpress-post-revisioning-and-auto-save-features\/\">Digging into WordPress<\/a><\/p>\n<h3>REMOVE WORDPRESS POST REVISIONS FROM THE DATABASE\u00a0<\/h3>\n<p>In line with the previous two sections, here we will remove all existing post revisions from the WordPress database. This is useful if you have disabled the post-revisioning feature or perhaps even reduced the total number of allowed revisions. The easiest way to do this is to run the following\u00a0<b><acronym title=\"Structured Query Language\">SQL<\/acronym><\/b> command via your favorite database interface (such as my personal favorite, phpMyAdmin):<\/p>\n<pre><code>DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision';<\/code><\/pre>\n<p>Note that if you have changed the default WordPress database table prefix to something other than \u201c<code>wp_<\/code>\u201d, you will want to edit the command to reflect the correct prefix information. This information is available in your site\u2019s\u00a0<code>wp-config.php<\/code> file. Also note that you should backup your database before casting any\u00a0<b><acronym title=\"Structured Query Language\">SQL<\/acronym><\/b> spells on it.<\/p>\n<p>Upon successful execution of the above command, all data associated with post revisions will be removed the database. This includes the post revisions themselves and all the meta data associated with each revision.<\/p>\n<p>Credit:\u00a0<a href=\"hhttp:\/\/andreineculau.com\/blog\/2008\/07\/delete-wordpress-26-revisions\/\">Andrei Neculau<\/a><\/p>\n<h3>REDUCE COMMENT SPAM BY BLOCKING NO-REFERRER REQUESTS\u00a0<\/h3>\n<p>As explained in my article,\u00a0denying access to no-referrer requests, you can greatly reduce the number of spam comments by eliminating all direct requests for your blog\u2019s\u00a0<code>comments-post.php<\/code> file. This will block automated spam scripts from bypassing your comments form by hitting the comment processing script directly. Here are two ways to block no-referrer comment requests, one uses\u00a0<b><acronym title=\"Hypertext Access\">HTAccess<\/acronym><\/b> and the other uses\u00a0<b><acronym title=\"PHP: Hypertext Preprocessor\">PHP<\/acronym><\/b>. Here is the\u00a0<b><acronym title=\"Hypertext Access\">HTAccess<\/acronym><\/b> method:<\/p>\n<pre><code>RewriteEngine On\nRewriteCond %{REQUEST_METHOD} POST\nRewriteCond %{REQUEST_URI} .wp-comments-post.php\nRewriteCond %{HTTP_REFERER} !domain.tld [OR]\nRewriteCond %{HTTP_USER_AGENT} ^$\nRewriteRule (.*) http:\/\/%{REMOTE_ADDR}\/$ [R=301,L]<\/code><\/pre>\n<p>Place that code in your site\u2019s root\u00a0<b><acronym title=\"Hypertext Access\">HTAccess<\/acronym><\/b> file and edit the \u201c<code>domain.tld<\/code>\u201d to match your own domain. Once in place, this code will redirect any request for your blog\u2019s\u00a0<code>comments-post.php<\/code>file that didn\u2019t originate from your site back to the\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b> from whence it came.<\/p>\n<p>This may also be accomplished via\u00a0<b><acronym title=\"PHP: Hypertext Preprocessor\">PHP<\/acronym><\/b>. Place the following function in your theme\u2019s<code>functions.php<\/code> file:<\/p>\n<pre><code>function check_referrer() {\n\tif (!isset($_SERVER['HTTP_REFERER']) || $_SERVER['HTTP_REFERER'] == '') {\n\t\twp_die(__('Please do not access this file directly.'));\n\t}\n}\nadd_action('check_comment_flood', 'check_referrer');<\/code><\/pre>\n<p>Source:\u00a0Perishable Press<\/p>\n<h3>PREVENT GOOGLE ANALYTICS FROM TRACKING ADMIN PAGES\u00a0<\/h3>\n<p>This handy snippet will prevent Google Analytics from tracking your Admin pages or anything else that you wish. Replace your default Google Analytics code with the following:<\/p>\n<pre><code>< ?php if (!current_user_can('level_10')) { ?>\n\n\t\/* Google Analytics Code *\/\n\n< ?php } ?><\/code><\/pre>\n<p>This code will then include your Google Analytics code only on non-Admin pages. This in turn will prevent Google Analytics from gathering statistics about your Admin pages. Note that the basic functionality of this method is great for restricting just about anything \u2014 scripts, markup, content \u2014 to logged-in administrators.<\/p>\n<h3>META DESCRIPTIONS WITHOUT A PLUGIN\u00a0<\/h3>\n<p>We don\u2019t need no stinkin\u2019 plugin for custom meta descriptions. All you need is a custom field named \u201c<code>metadescription<\/code>\u201d with the desired meta description for each post. Once you have that going, include the following function to your theme\u2019s\u00a0<code>header.php<\/code> file (within the\u00a0<code><head><\/head><\/code> section:<\/p>\n<pre><code><meta name=\"description\" content=\"\n<?php if ((is_home()) || (is_front_page())) {\n\techo ('Your main description goes here');\n} elseif(is_category()) {\n\techo category_description();\n} elseif(is_tag()) {\n\techo 'Tag archive page for this blog - ' . single_tag_title();\n} elseif(is_month()) {\n\techo 'Archive page for this blog - ' . the_time('F, Y');\n} else {\n\techo get_post_meta($post-\/>ID, 'metadescription', true);\n} ?>\" \/><\/code><\/pre>\n<p>This function enables you to customize the descriptions for various types of pages, such as the home page, category pages, tag archives, and so on. For single post-view pages, this function will display the value of the\u00a0<code>metadescription<\/code> custom field.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.malcolmcoles.co.uk\/blog\/unique-meta-description-and-meta-keywords-in-your-wordpress-themes\/\">Malcolm Coles<\/a><\/p>\n<h3>DIFFERENTIATE BETWEEN POSTS DEPENDING ON PRESENCE OF EXCERPT\u00a0<\/h3>\n<p>Here is a quick conditional snippet that displays different content depending on the presence of an excerpt:<\/p>\n<pre><code>< ?php if(!empty($post->post_excerpt)) {\n\n\t\/\/ this post has an excerpt, so display it:\n\tthe_excerpt();\n\n} else {\n\n\t\/\/ this post has no excerpt, so display something else instead:\n\tthe_content();\n\n} ?><\/code><\/pre>\n<p>Placed inside the loop, this code will check each post for an excerpt. If one is found, the excerpt is displayed; otherwise, the code specified in the\u00a0<code>else<\/code> condition is displayed.<\/p>\n<h3>MODIFY THE WP_OPTIONS TABLE VIA THE WORDPRESS ADMIN\u00a0<\/h3>\n<p>As you probably know, the\u00a0<code>wp_options<\/code> table stores a great deal of useful information, including everything from custom-field values, plugin settings, blog information, and much more. If any table in the WordPress database needs its own friendly user-interface, this would be it.<\/p>\n<p>Normally, you would access the\u00a0<code>wp_options<\/code> table using a database interface such as phpMyAdmin. This certainly works, but there is a much easier way to work with the options table, especially if you are already logged into WordPress. Once logged in to the Admin area, navigate to the following\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b>:<\/p>\n<pre><code>http:\/\/domain.tld\/wp-admin\/options.php<\/code><\/pre>\n<p>This will open a \u201csecret\u201d Admin page that provides editable options fields for every record in the<code>wp_options<\/code> table. Bookmark this page, and save yourself a trip to phpMyAdmin!<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/digwp.com\/2009\/06\/edit-your-database-options-from-the-wordpress-admin\/\">Digging into WordPress<\/a><\/p>\n<h3>ALTERNATE COMMENT STYLES\u00a0<\/h3>\n<p><strong>Alternating comments for old versions of WordPress (pre-2.7)<\/strong><br \/>\nThis is one of the oldest tricks in the book, but it is still a favorite. Alternating comment styles is a great way to enhance usability and add some stylistic flair to your comments display. The trick is to add an alternating set of classes \u2014 odd or even \u2014 to the containing element of each comment. While there are many ways to do this, here is one of the\u00a0<em>easiest<\/em>. Open your<code>comments.php<\/code> and modify the comments loop as follows:<\/p>\n<pre><code><ul>\n\t< ?php $i = 0; ?>\n\t< ?php foreach ($comments as $comment) : ?>\n\t< ?php $i++; ?>\n\n\t<li id=\"comment-<?php comment_ID(); ?>\" < ?php if($i&amp;1) { echo 'class=\"odd\"'; } else { echo 'class=\"even\"'; } ?>>\n\t\t< ?php comment_text(); ?>\n\t<\/li>\n\t<php endforeach; ?>\n<\/php><\/ul><\/code><\/pre>\n<p>With that code in place, your comments will now have alternating\u00a0<b><acronym title=\"Cascading Style Sheets\">CSS<\/acronym><\/b> classes with which to apply custom styles to your oddly and evenly numbered comments:<\/p>\n<pre><code>.odd {\n\tbackground: white;\n\tcolor: black;\n\t}\n.even {\n\tbackground: black;\n\tcolor: white;\n\t}<\/code><\/pre>\n<p><strong>Alternating comments for old versions of WordPress (pre-2.7)<\/strong><br \/>\nIn WordPress 2.7 and better, comments automagically include \u201c<code>odd<\/code>\u201d and \u201c<code>even<\/code>\u201d classes for oddly and evenly numbered comments, respectively. This makes it a snap to throw down your own custom CSS styles for each of these classes.<\/p>\n<p>Credit:\u00a0<a href=\"http:\/\/wordpressgarage.com\/code-snippets\/using-php-to-alternate-background-colors-for-comments-or-posts-in-wordpress\/\">WordPress Garage<\/a><\/p>\n<h3>AUTOMATICALLY REMOVE CODE MISTAKES IN POSTS\u00a0<\/h3>\n<p>Here is a handy trick that will automatically remove basic mistakes in\u00a0<b><acronym title=\"eXtensible Hypertext Markup\">XHTML<\/acronym><\/b> markup, such as empty paragraphs, inline font styles, and more. Place this function in your\u00a0<code>functions.php<\/code> file:<\/p>\n<pre><code>function clean_bad_content($bPrint = false) {\n\tglobal $post;\n\t$szPostContent  = $post->post_content;\n\t$szRemoveFilter = array(\"~<p [^>]*>\\s?<\/p>~\", \"~<a [^>]*>\\s?<\/a>~\", \"~<font [^>]*>~\", \"~< \\\/font>~\", \"~style\\=\\\"[^\\\"]*\\\"~\", \"~<span [^>]*>\\s?<\/span>~\");\n\t$szPostContent  = preg_replace($szRemoveFilter, '', $szPostContent);\n\t$szPostContent  = apply_filters('the_content', $szPostContent);\n\tif ($bPrint == false) return $szPostContent;\n\telse echo $szPostContent;\n}<\/font><\/code><\/pre>\n<p>Once in place, use the following function call to display your \u201ccleaned\u201d content in the loop:<\/p>\n<pre><code>< ?php if (function_exists('clean_bad_content')) clean_bad_content(true); ?><\/code><\/pre>\n<p>Note that the\u00a0<code>clean_bad_content()<\/code> accepts a boolean argument (<code>true<\/code> or\u00a0<code>false<\/code>) specifying whether or not to print the function output.<\/p>\n<p>Credit:\u00a0<a href=\"http:\/\/www.mattvarone.com\/wordpress\/useful-functions-for-wordpress\/\">Matt Varone<\/a><\/p>\n<h3>AUTOMATICALLY DISABLE COMMENTS AND TRACKBACKS IN OLD POSTS\u00a0<\/h3>\n<p>Here is yet another\u00a0method for auto-disabling comments and trackbacks on old posts. This function automatically closes comments and trackbacks after the specified number of days. Add the following to your\u00a0<code>functions.php<\/code> file:<\/p>\n<pre><code>< ?php function autoclose_comments() {\n\tglobal $wpdb, $tableposts;\n\n\tif (!isset($tableposts))\n\t\t$tableposts = $wpdb->posts;\n\n\t\t$age = '21 DAY';\n\n\t\t$date = $wpdb->get_var(\"SELECT DATE_ADD(DATE_SUB(CURDATE(), INTERVAL $age), INTERVAL 1 DAY)\");\n\t\t$wpdb->query(\"UPDATE $tableposts SET comment_status = 'closed' WHERE comment_status = 'open' AND post_status = 'publish' AND post_date < '$date'\");\n}\n\nfunction autoclose_trackback() {\n\tglobal $wpdb, $tableposts;\n\n\tif (!isset($tableposts))\n\t\t$tableposts = $wpdb->posts;\n\n\t\t$age = '21 DAY';\n\n\t\t$date = $wpdb->get_var(\"SELECT DATE_ADD(DATE_SUB(CURDATE(), INTERVAL $age), INTERVAL 1 DAY)\");\n \t\t$wpdb->query(\"UPDATE $tableposts SET ping_status = 'closed' WHERE comment_status = 'open' AND post_status = 'publish' AND post_date < '$date'\");\n}\n\nadd_action('publish_post',   'autoclose_trackback', 7);\nadd_action('edit_post',      'autoclose_trackback', 7);\nadd_action('delete_post',    'autoclose_trackback', 7);\nadd_action('comment_post',   'autoclose_trackback', 7);\nadd_action('trackback_post', 'autoclose_trackback', 7);\nadd_action('pingback_post',  'autoclose_trackback', 7);\nadd_action('edit_comment',   'autoclose_trackback', 7);\nadd_action('delete_comment', 'autoclose_trackback', 7);\nadd_action('template_save',  'autoclose_trackback', 7);\n\nadd_action('publish_post',   'autoclose_comments', 7);\nadd_action('edit_post',      'autoclose_comments', 7);\nadd_action('delete_post',    'autoclose_comments', 7);\nadd_action('comment_post',   'autoclose_comments', 7);\nadd_action('trackback_post', 'autoclose_comments', 7);\nadd_action('pingback_post',  'autoclose_comments', 7);\nadd_action('edit_comment',   'autoclose_comments', 7);\nadd_action('delete_comment', 'autoclose_comments', 7);\nadd_action('template_save',  'autoclose_comments', 7);\n?><\/code><\/pre>\n<p>Once in place, you may change the number of days allowed for comments and trackbacks to stay open by editing the two instances of the\u00a0<code>$age<\/code> variable to whatever you wish. No other editing or code is required for this function to operate effectively. The function is executed automatically upon various posting actions. Note that this function is included in newer versions of WordPress (2.7 or better), and is therefore only required for older versions.<\/p>\n<p>Source:\u00a0<a title=\"WP Engineer\" href=\"http:\/\/wpengineer.com\/auto-shutoff-comments-and-trackbacks\/\">WP Engineer<\/a><br \/>\nPlugin:\u00a0<a title=\"Autoclose Plugin\" href=\"http:\/\/ajaydsouza.com\/wordpress\/plugins\/autoclose\/\">Autoclose<\/a><\/p>\n<h3>ACCESS POST DATA OUTSIDE THE LOOP\u00a0><\/h3>\n<p>The easiest way to access and display post data outside of the loop is to use the built-in WordPress core function\u00a0<a title=\"WordPress Codex: get_post()\" href=\"http:\/\/codex.wordpress.org\/Function_Reference\/get_post\">get_post()<\/a>; however, for more control over the process, check out this nifty little function from\u00a0<a href=\"http:\/\/www.wprecipes.com\/rebellion-asked-how-can-i-access-post-data-outside-the-loop\">WP Recipes<\/a>:<\/p>\n<pre><code>function get_post_data($postId) {\n\tglobal $wpdb;\n\treturn $wpdb->get_row(\"SELECT * FROM $wpdb->posts WHERE ID=$postId\");\n}<\/code><\/pre>\n<p>Place this function in your\u00a0<code>functions.php<\/code> and then add this code to the desired location outside of the loop:<\/p>\n<pre><code>< ?php $data = get_post_data(77);\n\techo $data->post_date;     \/\/ post date\n\techo $data->post_title;    \/\/ post title\n\techo $data->post_content;  \/\/ post content\n\techo $data->comment_count; \/\/ comments number\n?><\/code><\/pre>\n<p>For the argument of the function, specify the post ID for which you would like to display data. The function will return an array containing all of the available fields for the specified post (<code>post_title<\/code>,\u00a0<code>date<\/code>,\u00a0<code>content<\/code>,\u00a0<code>author_id<\/code>,\u00a0<code>post_id<\/code>, etc).<\/p>\n<h3>DISPLAY POSTS FOR A SPECIFIED TIME PERIOD\u00a0<\/h3>\n<p>Here is an easy way to create posts that will only be displayed for the duration of a specified time period. Replace your current loop with the following:<\/p>\n<pre><code>< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>\n\t$expirationtime = get_post_custom_values('expiration');\n\tif (is_array($expirationtime)) {\n\t\t$expirestring = implode($expirationtime);\n\t}\n\t$secondsbetween = strtotime($expirestring)-time();\n\tif ($secondsbetween > 0) { ?>\n\n\t\t<h1>< ?php the_title(); ?><\/h1>\n\t\t< ?php the_excerpt(); ?>\n\n< ?php } endwhile; endif; ?><\/code><\/pre>\n<p>And then add a custom field named \u201c<code>expiration<\/code>\u201d to any post that needs an expiration date. For the value of the\u00a0<code>expiration<\/code> key, specify the date\/time in the following format:<code>mm\/dd\/yyyy<\/code> <code>00:00:00<\/code>. Each post that contains such a custom field will expire after the specified date and time and will no longer appear in the loop.<\/p>\n<h3>UNIQUE SINGLE POST TEMPLATES FOR DIFFERENT CATEGORIES\u00a0<\/h3>\n<p>Here is an easy way to display custom post styles depending on the post\u2019s category. With the following code, each single-view post will be displayed according to a template that is specific to the post\u2019s category:<\/p>\n<pre><code>< ?php $post = $wp_query->post;\nif (in_category('1')) {\n\tinclude(TEMPLATEPATH.'\/single-01.php');\n} elseif (in_category('2')) {\n\tinclude(TEMPLATEPATH.'\/single-02.php');\n} else {\n\tinclude(TEMPLATEPATH.'\/single-default.php');\n} ?><\/code><\/pre>\n<p>This code should be placed in your theme\u2019s\u00a0<code>single.php<\/code> file. As written, this code will display posts from the first category with the single template, \u201c<code>single-01.php<\/code>\u201d; also, posts from the second category will be displayed with a single template named \u201c<code>single-02.php<\/code>\u201d; finally, all other posts will be displayed via the default single template, \u201c<code>single-default.php<\/code>\u201d. Of course, you will want to customize the category IDs according to your own needs, and also you will want to create the customized single files as they are called. That\u2019s all there is to it.<\/p>\n<p>Having said that, here is an alternate version of the custom-post-template script:<\/p>\n<pre><code>< ?php add_filter('single_template', create_function('$t', 'foreach((array) get_the_category() as $cat) { if (file_exists(TEMPLATEPATH . \"\/single-{$cat->term_id}.php\")) return TEMPLATEPATH . \"\/single-{$cat->term_id}.php\"; } return $t;')); ?><\/code><\/pre>\n<p>Placed in your theme\u2019s\u00a0<code>functions.php<\/code> file, this alternate script checks all categories for the presence of a custom single template. Any category with a custom single-post template will then have its posts displayed with that template. If a post\u2019s category does not feature a custom template, the default\u00a0<code>single.php<\/code> template will be used. Note that this code will use the template for the\u00a0<em>first<\/em> listed category of each post. Even so, you should only create custom post templates for categories that will always be mutually exclusive. That is, make sure that your posts aren\u2019t in more than one custom-templated category.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.ilfilosofo.com\/\">Austin Matzko<\/a><\/p>\n<h3>DISPLAY PERFORMANCE STATISTICS FOR WORDPRESS PAGES\u00a0<\/h3>\n<p>Everyone is familair with the following information:<\/p>\n<pre><code><!-- 33 queries in 0.333 seconds --><\/code><\/pre>\n<p>These statistics are usually seen in the footer area of individual pages and serve as a general indicator of performance. The \u201cqueries\u201d refer to the number of times WordPress requested information from the database, while the number of seconds indicates the amount of time required for Apache to generate the page. This information is generated by including the following code in your footer template file (or wherever you would like):<\/p>\n<pre><code><!-- <?php echo get_num_queries(); ?> queries in < ?php timer_stop(3); ?> seconds --><\/code><\/pre>\n<p>Or, if you don\u2019t like the idea of sharing this information with the entire world, you can limit its display to logged-in administrators only:<\/p>\n<pre><code>< ?php if (current_user_can('level_10')) {\n\n\techo '<!-- ' . get_num_queries() . ' queries in ' . timer_stop(3) . ' seconds -->';\n\n} ?><\/code><\/pre>\n<p>Easy breezy beautiful!<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/digwp.com\/2009\/08\/show-off-your-wordpress-database-statistics\/\">Digging into WordPress<\/a><\/p>\n<h3>CUSTOM POST THUMBNAILS IN TWO STEPS\u00a0<\/h3>\n<p>Alright, kids. Time for the \u2018ol three-step custom-field tutorial. This time we\u2019re going to implement post thumbnails. You know, representative images for each of your posts that may be displayed anywhere you wish, including outside of the flow of post content, and even outside of the loop. This is a great trick for advanced page layouts. Ready? Sharpen your keystrokes!<\/p>\n<p><strong>Step 1:<\/strong><br \/>\nOpen your write panel and create a key called \u201cthumbnail\u201d. Then, for the value of the \u201cthumbnail\u201d key, enter the\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b> of the thumbnail image for that particular post. Write the post and then publish it as normal. Wash, rinse, repeat to get a nice collection of posts with thumbnails. Or, go back to exisiting posts and add a thumbnail as we have just described.<\/p>\n<p><strong>Step 2:<\/strong><br \/>\nOpen your theme template file containing the loop and add the following code to the location where you would like the post thumbnail images to appear:<\/p>\n<pre><code>< ?php $thumbnail = get_post_meta($post->ID, 'image', true); if ($thumbnail) { ?>\n\n<img decoding=\"async\" src=\"<?php echo $thumbnail; ?\/>\" alt=\"\" width=\"100\" height=\"100\" \/>\n\n< ?php } ?><\/code><\/pre>\n<p>That\u2019s it! Don\u2019t forget to edit the\u00a0<code>width<\/code> and\u00a0<code>height<\/code> attributes of the\u00a0<code><img \/><\/code> element to account for the proper image size.<\/p>\n<p>Source:\u00a0Perishable Press<\/p>\n<h3>HIGHLIGHT AUTHOR COMMENTS\u00a0<\/h3>\n<p>Make your author comments look fabulous darling! Newer versions of WordPress come equipped with a specific \u201c<code>author<\/code>\u201d class that may be targeted with the\u00a0<b><acronym title=\"Cascading Style Sheets\">CSS<\/acronym><\/b> of your choice. For older versions of WordPress, however, you will need to add the custom class attribute with a little\u00a0<b><acronym title=\"PHP: Hypertext Preprocessor\">PHP<\/acronym><\/b>magic.<\/p>\n<p>First, open your theme\u2019s\u00a0<code>comments.php<\/code> template and add the following code snippet in the<b><acronym title=\"(eXtensible) Hypertext Markup Language\">(X)HTML<\/acronym><\/b> element that contains the comment information:<\/p>\n<pre><code><div <?php if ($comment->comment_author_email == \"email@domain.tld\") echo ''; ?> id=\"comment-< ?php comment_ID(); ?>\">\n.\n.\n.\n<\/div><\/code><\/pre>\n<p>After changing the email address to that of your own (i.e., the one used for your\u00a0<b><acronym title=\"WordPress\">WP<\/acronym><\/b> Admin user profile), style it up with a little\u00a0<b><acronym title=\"Cascading Style Sheets\">CSS<\/acronym><\/b>:<\/p>\n<pre><code>.author {\n\tbackground: red !important;\n\tcolor: yellow   !important;\n\t}<\/code><\/pre>\n<p>You probably don\u2019t want your author comments to appear with yellow text on a red background, but you get the idea. Anything is possible.<\/p>\n<p>For blogs with multiple authors, you can style each of their comments differently as well by using something like this:<\/p>\n<pre><code><div <?php if ($comment->comment_author_email == \"email-01@domain.tld\") echo ''; elseif ($comment->comment_author_email == \"email-02@domain.tld\") echo ''; elseif ($comment->comment_author_email == \"email-03@domain.tld\") echo ''; ?> id=\"comment-< ?php comment_ID(); ?>\">\n.\n.\n.\n<\/div><\/code><\/pre>\n<p>Replace each of the email addresses with those of the various authors. Style to taste.<\/p>\n<p>Credit:\u00a0Nyssa Brown<\/p>\n<h3>EASY RANDOM POSTS\u00a0<\/h3>\n<p>Newer versions of WordPress enable easy randomizing of posts by using the (relatively) new \u201c<code>orderby=rand<\/code>\u201d parameter in any\u00a0<code>query_posts<\/code> loop:<\/p>\n<p><code>< ?php query_posts('orderby=rand\"); ?><\/code><\/p>\n<p>But for older versions of WordPress, this randomizing functionality must be added manually. Here is a quick and painless plugin that will enable you to randomize post queries in older versions:<\/p>\n<pre><code>< ?php\n\/*\n\nPlugin Name: Random Posts Query\n\n*\/\n\nfunction query_random_posts($query) {\n\treturn query_posts($query . '&amp;random=true');\n}\nclass RandomPosts {\n\tfunction orderby($orderby) {\n\t\tif (get_query_var('random') == 'true')\n\t\t\treturn \"RAND()\";\n\t\telse\n\t\t\treturn $orderby;\n\t}\n\tfunction register_query_var($vars) {\n\t\t$vars[] = 'random';\n\t\treturn $vars;\n\t}\n}\nadd_filter( 'posts_orderby', array('RandomPosts', 'orderby') );\nadd_filter( 'query_vars', array('RandomPosts', 'register_query_var') );\n?><\/code><\/pre>\n<p>Once activated, invoke the randomness by adding the \u201c<code>random=true<\/code>\u201d parameter in your<code>query_posts<\/code> loop:<\/p>\n<pre><code>< ?php query_posts('cat=11&amp;showposts=11&amp;random=true'); ?><\/code><\/pre>\n<p>Here, we are specifying \u201c<code>cat=11<\/code>\u201d for the category and \u201c<code>showposts=11<\/code>\u201d for the number of posts to display. There are many other parameters available as well, so knock yourself out.<\/p>\n<p>Credit:\u00a0<a title=\"Via the WordPress Codex\" href=\"http:\/\/wordpress.org\/support\/topic\/70359#post-444323\">rembem<\/a><\/p>\n<h3>DISPLAY DATES FOR GROUPS OF POSTS\u00a0<\/h3>\n<p>In order to display the date that a post was published, you have two options:<\/p>\n<ul>\n<li><code>< ?php the_time(); ?><\/code> \u2014 displays the date for each and every post<\/li>\n<li><code>< ?php the_date(); ?><\/code> \u2014 displays the date only once for each group of posts published on a certain day<\/li>\n<\/ul>\n<p>So, if you want to list the post date next to each post, use the\u00a0<code>the_time()<\/code>. If, on the other hand, you have multiple posts on any given day, use\u00a0<code>the_date()<\/code> to list the post date only once for each days\u2019 posts. Something like this:<\/p>\n<pre><code>\/\/ the_time();\n\n\tJan 01, 2009 - Post #1\n\tJan 01, 2009 - Post #2\n\tJan 01, 2009 - Post #3\n\n\tJan 02, 2009 - Post #4\n\tJan 02, 2009 - Post #5\n\tJan 02, 2009 - Post #6\n\n\tJan 03, 2009 - Post #7\n\tJan 03, 2009 - Post #8\n\tJan 03, 2009 - Post #9\n\n\/\/ the_date();\n\n\tJan 01, 2009\n\t\tPost #1\n\t\tPost #2\n\t\tPost #3\n\n\tJan 02, 2009\n\t\tPost #4\n\t\tPost #5\n\t\tPost #6\n\n\tJan 03, 2009\n\t\tPost #7\n\t\tPost #8\n\t\tPost #9<\/code><\/pre>\n<p>See the difference? Good, because I\u2019m not going to explain the concept any further. Instead, I will move on by showing you how to use either template tag in your loop. This really doesn\u2019t need explaining either, but for the sake of completeness, here it is. First,\u00a0<code>the_time()<\/code> tag:<\/p>\n<pre><code>< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>\n\n\t<h1>< ?php the_title(); ?><\/h1>\n\t<p>< ?php the_time(); ?><\/p><p>\n\t< ?php the_content(); ?>\n\n< ?php endwhile; ?>\n< ?php else : ?>\n< ?php endif; ?><\/p><\/code><\/pre>\n<p>This loop will output the post title, date, and content for\u00a0<em>every<\/em> post. Alternately, here is how to use\u00a0<code>the_date<\/code> tag:<\/p>\n<pre><code>< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>\n\n\t< ?php the_date('','<p>','<hr \/>'); ?>\n\t<h1>< ?php the_title(); ?><\/h1>\n\t< ?php the_content(); ?>\n\n< ?php endwhile; ?>\n< ?php else : ?>\n< ?php endif; ?><\/code><\/pre>\n<p>This loop will output the post title and content for every post, and also output the date for each group of posts published on any given day, as explained above. Notice we are adding the paragraph elements for the post date based on whether or not the date is actually output. If it is, then the date will be wrapped in\u00a0<code><\/p>\n<p><\/code> elements; if it\u2019s not, no\u00a0<code><\/p>\n<p><\/code> elements will be output, thereby preventing repetitive sets of empty paragraph elements. Make sense? Good. Here are the available parameters for the nifty\u00a0<code>the_date()<\/code> template tag:<\/p>\n<p><code>< ?php the_date('date format', 'before the date', 'after the date'); ?><\/code><\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.devlounge.net\/code\/wordpress-tip-group-posts-by-date-in-listings\">Devlounge<\/a><\/p>\n<h3>DISPLAY A STICKY POST IN THE SIDEBAR\u00a0<\/h3>\n<p>Here is a juicy little nugget that displays a \u201csticky\u201d post in the sidebar of your theme:<\/p>\n<pre><code>< ?php\n\/\/ initialize new query of one post from category 11\n$my_query = new WP_Query('cat=11&amp;showposts=1');\n\n\/\/ loop through the database to find related information\nwhile ($my_query->have_posts()) : $my_query->the_post();\n\n\/\/ set expiration time of two days\n$goAwayDate = time() - (60 * 60 * 24 * 2);\n\n\/\/ get date of sticky post\n$postDate = get_the_time('U');\n\n\/\/ if post is too old, do nothing\nif ($postDate < $goAwayDate) {\n\n\/\/ else show the post\n} else { ?>\n\n\t<h1>< ?php the_title(); ?><\/h1>\n\t< ?php the_excerpt(); ?>\n\n< ?php } endwhile; ?><\/code><\/pre>\n<p>This method employs a second loop to display the sticky post, so it may be placed just about anywhere in your theme\u2019s template files. You can also change the number of days that the post will remain sticky by editing the expiration variable with a number other than\u00a0<code>\"2\"<\/code>. For example, to set a duration period of seven days, you would use this:<\/p>\n<p><code>$goAwayDate = time() - (60 * 60 * 24 * 7);<\/code><\/p>\n<p>Credit:\u00a0<a href=\"http:\/\/theclosetentrepreneur.com\/excluding-posts-and-category-specific-pages-in-wordpress\">The Closet Entrepreneur<\/a><\/p>\n<h3>DISPLAY LATEST COMMENTS WITHOUT A PLUGIN\u00a0<\/h3>\n<p>Good rule of thumb when working with WordPress: don\u2019t use a plugin if you can acheive the same functionality without one. Case in point: displaying latest comments on your blog. Sure, you could always install a plugin to do it for you, but you really don\u2019t need to. In fact, it\u2019s actually easier to display recent comments\u00a0<em>without<\/em> a plugin. SImply add the following code to the desired location within your theme\u2019s template files:<\/p>\n<pre><code>< ?php global $wpdb;\n\n$sql = \"SELECT DISTINCT ID, post_title, post_password, comment_ID,\ncomment_post_ID, comment_author, comment_date_gmt, comment_approved,\ncomment_type,comment_author_url,\nSUBSTRING(comment_content,1,50) \/\/ NUMBER OF CHARACTERS\nAS com_excerpt FROM $wpdb->comments\nLEFT OUTER JOIN $wpdb->posts\nON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID)\nWHERE comment_approved = '1'\nAND comment_type = ''\nAND post_password = ''\nORDER BY comment_date_gmt\nDESC LIMIT 5\"; \/\/ NUMBER OF COMMENTS\n\n$comments = $wpdb->get_results($sql);\n$output   = $pre_HTML;\n$output  .= \"\\n<ul>\";\n\nforeach ($comments as $comment) {\n\t$output .= \"\\n<li>\".\"<a href=\\\"\" . get_permalink($comment->ID) .\n\t\"#comment-\" . $comment->comment_ID . \"\\\" title=\\\"on \" .\n\t$comment->post_title . \"\\\">\" .strip_tags($comment->comment_author)\n\t.\":<br \/><div>\" . strip_tags($comment->com_excerpt)\n\t.\"<\/div><\/a><\/li>\";\n}\n$output .= \"\\n<\/ul>\";\n$output .= $post_HTML;\n\necho $output;\n?><\/code><\/pre>\n<p>This code will display the 5 most recent comments in the following\u00a0<b><acronym title=\"(eXtensible) Hypertext Markup Language\">(X)HTML<\/acronym><\/b> output format:<\/p>\n<pre><code><ul>\n\t<li>\n\t\t<a href=\"http:\/\/domain.tld\/post#comment-01\" title=\"on Post Title\">Comment Author:<br \/>\n\t\t<div>This is the first 50 characters of the first most recent comment<\/div><\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"http:\/\/domain.tld\/post#comment-01\" title=\"on Post Title\">Comment Author:<br \/>\n\t\t<div>This is the first 50 characters of the first most recent comment<\/div><\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"http:\/\/domain.tld\/post#comment-01\" title=\"on Post Title\">Comment Author:<br \/>\n\t\t<div>This is the first 50 characters of the first most recent comment<\/div><\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"http:\/\/domain.tld\/post#comment-01\" title=\"on Post Title\">Comment Author:<br \/>\n\t\t<div>This is the first 50 characters of the first most recent comment<\/div><\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"http:\/\/domain.tld\/post#comment-01\" title=\"on Post Title\">Comment Author:<br \/>\n\t\t<div>This is the first 50 characters of the first most recent comment<\/div><\/a>\n\t<\/li>\n<\/ul><\/code><\/pre>\n<p>By editing the commented lines in the\u00a0<b><acronym title=\"PHP: Hypertext Preprocessor\">PHP<\/acronym><\/b> script, you may specify alternate number of comments and characters.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/stylizedweb.com\/2008\/06\/20\/grab-data-from-wordpress-database\/\">StylizedWeb<\/a><\/p>\n<h3>DISPLAY MOST COMMENTED POSTS WITHOUT A PLUGIN\u00a0<\/h3>\n<p>Here is another trick that will enable you avoid yet another needless plugin. This code results in the display of your most-commented posts in list format:<\/p>\n<pre><code><ul>\n< ?php\n$result = $wpdb->get_results(\"SELECT comment_count, ID, post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 10\"); \/\/ NUMBER OF POSTS\nforeach ($result as $topten) {\n\t$postid = $topten->ID;\n\t$title = $topten->post_title;\n\t$commentcount = $topten->comment_count;\n\tif ($commentcount != 0) {\n?>\n\n<li><a href=\"<?php echo get_permalink($postid); ?>\">< ?php echo $title ?><\/a><\/li>\n\n< ?php } } ?>\n<\/ul><\/code><\/pre>\n<p>This code may be modified to display any number of posts by changing the\u00a0<code>LIMIT<\/code> from \u201c<code>10<\/code>\u201d to whatever you wish. You may also change the display order from\u00a0<code>DESC<\/code> (descending order) to\u00a0<code>ASC<\/code>(ascending order).<\/p>\n<p>Once in place, this code will display a list of the 10 most-commented posts in the following<b><acronym title=\"(eXtensible) Hypertext Markup Language\">(X)HTML<\/acronym><\/b> output format:<\/p>\n<pre><code><ul>\n<li><a href=\"http:\/\/domain.tld\/post-01\/\">Post Title 01<\/a><\/li>\n<li><a href=\"http:\/\/domain.tld\/post-02\/\">Post Title 02<\/a><\/li>\n<li><a href=\"http:\/\/domain.tld\/post-03\/\">Post Title 03<\/a><\/li>\n.\n.\n.\n<\/ul><\/code><\/pre>\n<p>Source:\u00a0<a href=\"http:\/\/stylizedweb.com\/2008\/06\/20\/grab-data-from-wordpress-database\/\">StylizedWeb<\/a><\/p>\n<h3>CHANGE PERMALINKS FROM DATE-BASED TO POST-DATE ONLY\u00a0<\/h3>\n<p>Here is an\u00a0<b><acronym title=\"Hypertext Access\">HTAccess<\/acronym><\/b> method for switching your permalinks from the lengthy date-based format (i.e.,\u00a0<code>http:\/\/domain.tld\/2009\/03\/03\/post-name\/<\/code>) to the concise post-name format (i.e.,<code>http:\/\/domain.tld\/post-name\/<\/code>).<\/p>\n<p>To do so, first login to the WordPress Admin and switch your permalink structure from this:<\/p>\n<pre><code>\/%year%\/%monthnum%\/%day%\/%postname%\/<\/code><\/pre>\n<p>..to this:<\/p>\n<pre><code>\/%postname%\/<\/code><\/pre>\n<p>This change will ensure that all\u00a0<em>future<\/em> posts are located at the new post-name-only\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b>, but we still need to redirect all requests for\u00a0<em>existing<\/em> posts via the old date-based\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b> format. This is easily accomplished with a single directive in your site\u2019s root\u00a0<b><acronym title=\"Hypertext Access\">HTAccess<\/acronym><\/b> file:<\/p>\n<pre><code>RedirectMatch 301 \/([0-9]+)\/([0-9]+)\/([0-9]+)\/(.*)$ http:\/\/domain.tld\/$4<\/code><\/pre>\n<p>And that\u2019s all there is to it! Remember to test vigorously to convince yourself that everything is working properly.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/perishablepress.com\/press\/2008\/02\/06\/permalink-evolution-customize-and-optimize-your-dated-wordpress-permalinks\/\">Perishable Press<\/a><\/p>\n<h3>TEST FOR SUB-PAGES\u00a0<\/h3>\n<p>Until WordPress includes an\u00a0<code>is_subpage()<\/code> function, here is a manual method of testing for sub-pages:<\/p>\n<pre><code>< ?php global $post;\n\nif ( is_page() &amp;&amp; $post->post_parent ) {\n\n    \/\/ subpage content goes here\n\n} else {\n\n    \/\/ non-subpage content goes here\n\n} ?><\/code><\/pre>\n<p>Further, here are some other ways to use this method to test for different combinations of pages and sub-pages:<\/p>\n<pre><code>< ?php if (is_page('about') || $post->post_parent == '1') {\n\n\t$banner = 'business.png';\n\n} elseif (is_page('archives') || $post->post_parent == '2') {\t\n\n\t$banner = 'pleasure.png';\n\n} elseif (is_page('contact') || $post->post_parent == '3') {\n\n\t$banner = 'personal.png';\n\n} else { \n\n\t$banner = 'default.png';\n\n} ?><\/code><\/pre>\n<p>Note that the numbers \u201c<code>1<\/code>\u201d, \u201c<code>2<\/code>\u201d, and \u201c<code>3<\/code>\u201d represent the\u00a0<b><acronym title=\"Identification\">ID<\/acronym><\/b>s of the target parent pages.<\/p>\n<h3>MULTIPLE WIDGETIZABLE SIDEBARS\u00a0<\/h3>\n<p>Instead of using multiple \u201c<code>if<\/code>\u201d statements to include multiple widgetizable areas, WPEngineer shows us how to do it a better way:<\/p>\n<pre><code>< ?php \/\/ multiple widgetizable sidebars\nif (function_exists('register_sidebar')) {\n\t$sidebars = array('Home Sidebar', 'Post Sidebar', 'Page Sidebar');\n\tforeach($sidebars as $name) {\n\t\tregister_sidebar(array('name'=> $name,\n\t\t\t'before_widget' => '<div id=\"%1$s\">',\n\t\t\t'after_widget' => '<\/div>',\n\t\t\t'before_title' => '<h3>',\n\t\t\t'after_title' => '<\/h3>',\n\t\t));\n\t}\n}\n?><\/code><\/pre>\n<p>Source:\u00a0<a href=\"http:\/\/wpengineer.com\/wordpress-and-register_sidebar\/\">wpengineer<\/a><\/p>\n<h3>REMOVE FANCY QUOTES FROM COMMENTS\u00a0<\/h3>\n<p>Prevent invalid markup and sloppy code by disabling WordPress\u2019 automatic generation of \u201cfancy\u201d or \u201ccurly\u201d quotes where they fail the most: your comments area.<\/p>\n<p>Only one simple line of code is required, placed into your theme\u2019s\u00a0<code>functions.php<\/code> file:<\/p>\n<p>remove_filter(\u2019comment_text\u2019, \u2018wptexturize\u2019);<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.wprecipes.com\/how-to-get-rid-of-curly-quotes-in-your-wordpress-blog\">WPRecipes.com<\/a><\/p>\n<h3>DISPLAY A LIST OF ALL UNTAGGED POSTS\u00a0<\/h3>\n<p>Here is an easy way to display a list of all untagged posts. All that\u2019s required is a custom loop and a quick check of the\u00a0<code>get_the_tags<\/code> variable. Here is the code to make it work:<\/p>\n<pre><code>< ?php query_posts('orderby=title&amp;order=asc&amp;showposts=-1'); ?>\n< ?php if (have_posts()) : ?>\n\t<ul>\n\t< ?php while (have_posts()) : the_post(); ?>\n\t< ?php $tag = get_the_tags(); if (!$tag) { ?>\n\n\t\t<li><a href=\"<?php the_permalink(); ?>\">< ?php the_title(); ?><\/a>\n\t\t< ?php edit_post_link('Edit', ' ',''); ?><\/li>\n\n\t< ?php } ?>\n\t< ?php endwhile; ?>\n\t<\/ul>\n< ?php endif; ?><\/code><\/pre>\n<p>Place that snippet into the theme file of your choice and navigate to that page in a browser to see a permlink-linked list of all posts that have not yet been tagged. Even better, next to each post title will be a an easy-access \u201cEdit\u201d link that will make it easy to quickly edit each of your untagged posts and add some tags, if necessary. Nothing on this planet could be easier. Almost.<\/p>\n<h3>EASY DISPLAY OF CUSTOM HEADERS, FOOTERS, AND SIDEBARS\u00a0<\/h3>\n<p>WordPress 2.7 includes new functionality that makes it super-easy to include custom headers, footers, and sidebars into your theme. Normally, you include the default files with the following tags:<\/p>\n<pre><code>< ?php get_header(); ?>\n\n< ?php get_sidebar(); ?>\n\n< ?php get_footer(); ?><\/code><\/pre>\n<p>These will include the files named \u201c<code>header.php<\/code>\u201d, \u201c<code>sidebar.php<\/code>\u201d, and \u201c<code>footer.php<\/code>\u201d, respectively.<\/p>\n<p>Now, to include alternate versions of these files, simply include the name of the file as a parameter in its associated tag. Here is an example that should illustrate the idea:<\/p>\n<pre><code>< ?php get_header('custom-header'); ?>\n\n< ?php get_sidebar('custom-sidebar'); ?>\n\n< ?php get_footer('custom-footer'); ?><\/code><\/pre>\n<p>These will include the files named \u201c<code>custom-header.php<\/code>\u201d, \u201c<code>custom-sidebar.php<\/code>\u201d, and \u201c<code>custom-footer.php<\/code>\u201d, respectively.<\/p>\n<p>We can now use this new functionality to\u00a0<a title=\"Getting More Fine-Grained with Includes\" href=\"http:\/\/digwp.com\/2009\/07\/getting-more-fine-grained-with-includes\/\">get fine-grained with includes<\/a>. For example, if we wanted to display a custom footer for the \u201cBananaz\u201d category, we could use the following code:<\/p>\n<pre><code>< ?php if is_category('Bananaz') {\n\tget_footer('Bananaz');\n} else {\n\tget_footer();\n} ?><\/code><\/pre>\n<p>Source:\u00a0<a href=\"http:\/\/codex.wordpress.org\/\">WordPress Codex<\/a><\/p>\n<h3>A BETTER WAY FOR USERS TO LOGOUT\u00a0<\/h3>\n<p>The old way of displaying a \u201cLogout\u201d link for your users looks like this:<\/p>\n<pre><code><a href=\"<?php echo get_option('siteurl'); ?>\/wp-login.php?action=logout\">Logout<\/a><\/code><\/pre>\n<p>Now, since WordPress 2.7, we can simplify this hodgepodge with a sleeker, cleaner, built-in template tag:<\/p>\n<pre><code><a href=\"<?php echo wp_logout_url(); ?>\">Logout<\/a><\/code><\/pre>\n<p>Sweetness.<\/p>\n<h3>DISPLAY A CUSTOM MESSAGE ON A SPECIFIC DATE\u00a0<\/h3>\n<p>Using a snippet of\u00a0<b><acronym title=\"PHP: Hypertext Preprocessor\">PHP<\/acronym><\/b>, we can display a custom message (or any code, markup, or content) on a specific date:<\/p>\n<pre><code>< ?php\nif ((date('m') == 4) &amp;&amp; (date('d') == 9)) { ?>\n\n\t<p>Today is CSS Naked Day!<\/p>\n\n< ?php } ?><\/code><\/pre>\n<p>You could even use this technique to join in on\u00a0CSS Naked Day by removing your stylesheet on that day. Simply wrap your\u00a0<b><acronym title=\"Cascading Style Sheet\">CSS<\/acronym><\/b> <code><link \/><\/code> as follows:<\/p>\n<pre><code>< ?php \/\/ strip for CSS Naked Day\nif ((date('m') !== 4) &amp;&amp; (date('d') !== 9)) { ?>\n\n<link rel=\"stylesheet\" href=\"<?php bloginfo('stylesheet_url'); ?\/>\" type=\"text\/css\" media=\"screen\" \/>\n\n< ?php } ?><\/code><\/pre>\n<p>The possibilities are endless!<\/p>\n<h3>DISPLAY THREE COLUMNS OF POSTS\u00a0<\/h3>\n<p><a title=\"Multiple Loops and Multiple=\">Displaying content in multiple columns<\/a> is a much sought-after WordPress technique. There are some good tutorials around explaining various ways of doing the job, but this one is perhaps the easiest.<\/p>\n<p>To display your posts in three columns, begin by segmenting your post with some\u00a0<b><acronym title=\"Hypertext markup Language\">HTML<\/acronym><\/b>comments:<\/p>\n<pre><code>Lorem ipsum blah blah. This content appears before the three columns.\n\n<!--column-->\n\nThis content will appear in the first column.\n\n<!--column-->\n\nThis content will appear in the second column.\n\n<!--column-->\n\nThis content will appear in the third column.<\/code><\/pre>\n<p>The next step is to create columns based on the markup comments. Open your theme file and include the following code within the loop:<\/p>\n<pre><code>< ?php \/\/ multiple columns\n\n$page_columns = explode(\"<--column-->\", $post->post_content);\n\necho $page_columns[0]; \/\/ before columns\n\necho '<div>'.$page_columns[1].'<\/div>'; \/\/ first column\n\necho '<div>'.$page_columns[2].'<\/div>'; \/\/ second column\n\necho '<div>'.$page_columns[3].'<\/div>'; \/\/ third column\n\n?><\/code><\/pre>\n<p>That\u2019s essentially all there is to it. To get the columns to actually\u00a0<em>look<\/em> like columns, add something similar to the following in your\u00a0<b><acronym title=\"Cascading Style Sheets\">CSS<\/acronym><\/b> file:<\/p>\n<pre><code>\/* column structure *\/\n.column {\n\tmargin-right: 10px;\n\tfloat: left;\n\twidth: 33%;\n\t}\n\/* column styles *\/\ncolumn.first, column.second, column.third {}<\/code><\/pre>\n<p>The cool thing about this method is that you have full control over the layout of each particular post. Each column may contain as much or as little content as desired, and adding or removing columns is straightforward. Even better is that you can easily remove the column functionality and display your content in a single column by simply removing the custom code from the loop. The post markup consists of\u00a0<b><acronym title=\"Hypertext markup Language\">HTML<\/acronym><\/b> comments, so they will be ignored if not acted upon from within the loop.<\/p>\n<p>Source: Enhanced version of\u00a0<a href=\"http:\/\/wordpress.org\/support\/topic\/260223\">krimsly\u2019s technique (via the WP Codex)<\/a><\/p>\n<h3>DISABLE WORDPRESS SEARCH FUNCTIONALITY\u00a0<\/h3>\n<p>Disabling the WordPress search functionality is as simple as adding the following code to your<code>functions.php<\/code> file:<\/p>\n<pre><code>function fb_filter_query($query, $error = true) {\n\n\tif (is_search()) {\n\t\t$query->is_search = false;\n\t\t$query->query_vars[s] = false;\n\t\t$query->query[s] = false;\n\n\t\t\/\/ to error\n\t\tif ($error == true)\n\t\t\t$query->is_404 = true;\n\t}\n}\nif (!is_admin()) {\n\tadd_action('parse_query', 'fb_filter_query');\n\tadd_filter('get_search_form', create_function('$a', \"return null;\"));\n}<\/code><\/pre>\n<p>In place, this code will disable the search form for your theme while leaving search functionality intact for the Admin area. As is, the\u00a0<code>$error<\/code> variable is set to\u00a0<code>TRUE<\/code>, which causes the function to display the theme\u2019s error page. Setting this variable to\u00a0<code>FALSE<\/code> will prevent the error message and keep the user on the same page.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/wpengineer.com\/disable-wordpress-search\/\">WPengineer<\/a><\/p>\n<h3>DISPLAY POSTS WITH SPECIFIC CUSTOM FIELDS\u00a0<\/h3>\n<p>Displaying posts that are associated with a certain custom field is as easy as adding an \u201c<code>if<\/code>\u201d condition to your loop. Here is an example that checks for the presence of a custom field called \u201cname-of-custom-field\u201d. If such a custom field is associated with the post, the entire post is displayed; otherwise, only the excerpt is displayed.<\/p>\n<pre><code>< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>\n< ?php $custom_field = get_post_custom_values(\"name-of-custom-field\"); ?>\n\n\t< ?php if (isset($custom_field[0])) { ?>\n\n\t\t<h1><a href=\"<?php the_permalink(); ?>\">< ?php the_title(); ?><\/a><\/h1>\n\t\t< ?php the_content(); ?>\n\n\t< ?php } else { ?>\n\n\t\t<h2><a href=\"<?php the_permalink(); ?>\">< ?php the_title(); ?><\/a><\/h2>\n\t\t< ?php the_excerpt(); ?>\n\n\t< ?php } ?>\n\n< ?php endwhile; endif; ?><\/code><\/pre>\n<p>To get more specific and display only posts associated with a custom-field that is set to a certain value, we simply add an additional parameter to the \u201c<code>if<\/code>\u201d condition:<\/p>\n<p><code>< ?php if ((isset($custom_field[0])) &amp;&amp; ($custom_field[0] == \"name-of-value\")) { ?><\/code><\/p>\n<p>Using that line of code, we modify our previous loop as follows:<\/p>\n<pre><code>< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>\n< ?php $custom_field = get_post_custom_values(\"name-of-custom-field\"); ?>\n\n\t< ?php if ((isset($custom_field[0])) &amp;&amp; ($custom_field[0] == \"name-of-value\")) { ?>\n\n\t\t<h1><a href=\"<?php the_permalink(); ?>\">< ?php the_title(); ?><\/a><\/h1>\n\t\t< ?php the_content(); ?>\n\n\t< ?php } else { ?>\n\n\t\t<h2><a href=\"<?php the_permalink(); ?>\">< ?php the_title(); ?><\/a><\/h2>\n\t\t< ?php the_excerpt(); ?>\n\n\t< ?php } ?>\n\n< ?php endwhile; endif; ?><\/code><\/pre>\n<p>With this code, any post with a custom-field of \u201cname-of-custom-field\u201d that has a specific value of \u201cname-of-value\u201d will be displayed in its entirety. All other posts will be displayed as an excerpt.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/perishablepress.com\/press\/2008\/12\/22\/wordpress-custom-fields-tips-tricks\/\">Perishable Press<\/a><\/p>\n<h3>HOW TO NUMBER YOUR COMMENTS, PINGBACKS, AND TRACKBACKS IN 2.7+\u00a0<\/h3>\n<p>Numbering comments, pingbacks, and trackbacks in WordPress versions 2.7 and greater requires two steps. First, you need to add a couple of parameters to your\u00a0<code>comments_template<\/code>tag, which is used to display your comments template and normally located in your\u00a0<code>single.php<\/code>file. Edit this tag so that it looks like this:<\/p>\n<p><code>< ?php comments_template('\/comments.php',true); ?><\/code><\/p>\n<p>Once this is in place, you can display the number of your comments, pingbacks, trackbacks, and both using the following tags:<\/p>\n<pre><code>echo count($wp_query->comments_by_type['comment']); \/\/ display comment count\necho count($wp_query->comments_by_type['pingback']); \/\/ display pingback count\necho count($wp_query->comments_by_type['trackback']); \/\/ display trackback count\n\necho count($wp_query->comments_by_type['pings']); \/\/ display pingback and trackback count\n\ncomments_number('No Responses', 'One Response', '% Responses' ); \/\/ display total response count<\/code><\/pre>\n<p>These tags can be placed anywhere in your comments loop. For more information on how to implement this, check out our in-depth article at\u00a0<a href=\"http:\/\/digwp.com\/\">Digging into WordPress<\/a>.<\/p>\n<h3>HOW TO NUMBER YOUR COMMENTS USING THE CLASSIC LOOP\u00a0<\/h3>\n<p>Before, WordPress added the new comments API in version 2.7, the \u201cclassic\u201d comment-loop mechanism was used. This loop still works in any version of WordPress, and is useful for extreme formatting of the comment display area. Numbering your comments in the classic loop is as easy as it is in the new-fangled loop. Here\u2019s how:<\/p>\n<p>In your\u00a0<code>comments.php<\/code> file, add a counter variable (\u00a0<code>< ?php $i = 0; ?><\/code> ) just above the loop\u2019s<code>foreach<\/code> statement, like so:<\/p>\n<pre><code>< ?php $i = 0; ?>\n< ?php foreach ($comments as $comment) : ?><\/code><\/pre>\n<p>Then, to increment the counter variable with each iteration of the loop, we add another snippet just below the\u00a0<code>foreach<\/code> line, like so:<\/p>\n<pre><code>< ?php $i = 0; ?>\n< ?php foreach ($comments as $comment) : ?>\n< ?php $i++; ?><\/code><\/pre>\n<p>Everything is now set. To display the number of comments, simply echo the value of the counter variable anywhere within your comment loop. Here is an example:<\/p>\n<h3>THERE ARE COMMENTS SO FAR!<\/h3>\n<p>Source:\u00a0<a href=\"http:\/\/digwp.com\/\">Digging into WordPress<\/a><\/p>\n<h3>INVITE READERS TO COMMENT VIA FEED\u00a0<\/h3>\n<p>Nice little snippet showing how to invite your readers to leave a comment by clicking on a link within your feed. Just add the following code to your theme\u2019s\u00a0<code>functions.php<\/code> file:<\/p>\n<pre><code>\/\/ comment invite feed link\nfunction rss_comment_footer($content) {\n\tif (is_feed()) {\n\t\tif (comments_open()) {\n\t\t\t$content .= 'Comments are open! <a href=\"'.get_permalink().'\">Add yours!<\/a>';\n\t\t}\n\t}\n\treturn $content;\n}<\/code><\/pre>\n<p>In place, this function will output a link that says, \u201cComments are open!\u00a0<a href=\"#\">Add yours!<\/a>\u201d This message will be displayed at the end of each post for which comments are open. If comments are closed, no invite message is displayed.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/blogbuildingu.com\/\">Hendry Lee<\/a><\/p>\n<h3>DISPLAY THE TOTAL NUMBER OF USERS FOR YOUR BLOG\u00a0<\/h3>\n<p>Here is a tasty little snippet from WPRecipes that will enable you to display the total number of users for your WordPress-powered blog. All you need to do is place the following code in your theme file(s) where you would like to display your total number of users:<\/p>\n<pre><code>$users = $wpdb->get_var(\"SELECT COUNT(ID) FROM $wpdb->users\");\necho $users.\" registered users.\";<\/code><\/pre>\n<p>Source:\u00a0<a href=\"http:\/\/www.wprecipes.com\/display-the-total-number-of-users-of-your-wordpress-blog\">WPRecipes.com<\/a><\/p>\n<h3>AUTOMATICALLY INSERT CONTENT INTO YOUR WORDPRESS POST EDITOR\u00a0<\/h3>\n<p>Here is a nice way to automatically insert some custom content into your post editor. This makes it easy to add repetitive content to your posts while retaining the ability to make changes before publishing. To try it out, add the following code to your\u00a0<code>functions.php<\/code> file:<\/p>\n<pre><code>< ?php \/\/ auto-insert content to post editor\nfunction my_editor_content($content) {\n\t$content = \"<h5>Thank you for your generous attention!.\";\n\treturn $content;\n}\nadd_filter('default_content', 'my_editor_content');\n?><\/code><\/pre>\n<p>This code will display a message thanking people for their generous attention, but you can easily edit the message to display whatever content (text\/markup) that you wish. After configuring your message, open your WordPress text editor to see the automatically inserted content.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/justintadlock.com\/archives\/2009\/04\/05\/how-to-preset-text-in-the-wordpress-post-editor\">Justin Tadlock<\/a><\/p>\n<h3>HOW TO PREVENT DUPLICATE CONTENT\u00a0<\/h3>\n<p>Unless you\u2019re using excerpts for non-single page views, your post content is being displayed in your single pages, date-based archives, category archive, tags archives, author archives, and so on. From an\u00a0<b><acronym title=\"Search Engine Optimization\">SEO<\/acronym><\/b> perspective, this \u201cduplicate\u201d content may be detrimental to your search-engine rankings.<\/p>\n<p>To prevent duplicate content, we can conditionally display one of two\u00a0<code><meta \/><\/code> tags depending on the type of page being displayed. Pages that we\u00a0<em>want<\/em> to have indexed in the search engines will display a \u201cmeta-index\u201d tag, while duplicate pages will display a \u201cmeta-<strong>no<\/strong>index\u201d tag.<\/p>\n<p>To do this, simply add the following code to the\u00a0<code><head><\/head><\/code> section of your theme\u2019s\u00a0<code>header.php<\/code> file:<\/p>\n<pre><code>< ?php if ((is_home() &amp;&amp; ($paged < 2 )) || is_single() || is_page() || is_category()) {\n\techo '<meta name=\"robots\" content=\"index,archive,follow\" \/>';\n} else {\n\techo '<meta name=\"robots\" content=\"noindex,noarchive,follow\" \/>';\n}<\/code><\/pre>\n<p>Once in place, this code effectively stops search engines from indexing all types of pages except for single-post, page-page, category-archive, and the first two index pages. These are considered by many to be the most effective pages to have indexed, but feel free to add or remove anything you see fit to customize the technique.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/perishablepress.com\/press\/2009\/05\/10\/seo-experiment-let-google-sort-it-out\/\">Perishable Press<\/a><\/p>\n<h3>CONDITIONALLY DISPLAY FULL POSTS OR EXCERPTS\u00a0<\/h3>\n<p>By default, you can either display full-posts or excerpts when displaying your posts. This may be fine for common blogging purposes, but specialized blogs may find it beneficial to exercise control over which type of post format is displayed. Here\u2019s how to conditionally display either full-post or excerpt based on the presence of a custom field named \u201cfull-post-display\u201d.<\/p>\n<p>To implement this technique, setup the following loop in your theme file(s):<\/p>\n<pre><code>< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>\n< ?php $customdisplay = get_post_custom_values(\"full-post-display\"); ?>\n\n\t< ?php if (isset($customdisplay[0])) { ?>\n\n\t\t<h1><a href=\"<?php the_permalink(); ?>\">< ?php the_title(); ?><\/a><\/h1>\n\t\t< ?php the_content(); ?>\n\n\t< ?php } else { ?>\n\n\t\t<h1><a href=\"<?php the_permalink(); ?>\">< ?php the_title(); ?><\/a><\/h1>\n\t\t< ?php the_excerpt(); ?>\n\n\t< ?php } ?>\n< ?php endwhile; endif; ?><\/code><\/pre>\n<p>Then, for any post that you would like to display with full-post formatting, simply add a custom-field of \u201cfull-post-display\u201d and give it a value of \u201ctrue\u201d.<\/p>\n<h3>DISPLAY RELATED POSTS WITHOUT A PLUGIN\u00a0<\/h3>\n<p>We don\u2019t need no stinking plugins to display related posts! Here\u2019s how to do the job using tags as the associative criteria.<\/p>\n<p>Place the following code in your loop and take a nap or something:<\/p>\n<pre><code>< ?php \/\/ related posts based on first tag of current post\n$tags = wp_get_post_tags($post->ID);\nif ($tags) {\n\n\techo '<h3>Related Posts<\/h3>';\n\n\t$first_tag = $tags[0]->term_id;\n\t$args = array(\n\t\t\t'tag__in' => array($first_tag),\n\t\t\t'post__not_in' => array($post->ID),\n\t\t\t'showposts' => 7, \/\/ how many posts?\n\t\t\t'caller_get_posts' => 1\n\t\t\t);\n\n\t$my_query = new WP_Query($args);\n  \tif ($my_query->have_posts()) { ?>\n\n\t\t<ul>\n\n\t\t< ?php while ($my_query->have_posts()) : $my_query->the_post(); ?>\n\n\t\t\t<li><a href=\"<?php the_permalink(); ?>\">< ?php the_title(); ?><\/a><\/li>\n\n\t\t< ?php endwhile; ?>\n\n\t\t<\/ul>\n\n\t< ?php } ?>\n< ?php } ?><\/code><\/pre>\n<p>Customize as needed. To change the number of posts, edit the line that says, \u201chow many posts?\u201d<\/p>\n<p>Source: Enhanced version of the code provided by\u00a0<a href=\"http:\/\/wordpress.org\/support\/topic\/247918\">MichaelH (via WP Codex)<\/a><\/p>\n<h3>DROP-DEAD EASY STYLES FOR AUTHOR COMMENTS\u00a0<\/h3>\n<p>This is almost\u00a0<em>too<\/em> easy. To make your Author comments stand out from the crowd in WordPress 2.7 or better, use this code to apply some custom\u00a0<b><acronym title=\"Cascading Style Sheets\">CSS<\/acronym><\/b> stylez:<\/p>\n<pre><code>li.bypostauthor {\n\tbackground: red;\n\tcolor: white;\n\t}\nli.byuser {\n\tbackground: white;\n\tcolor: black;\n\t}<\/code><\/pre>\n<h3>DISPLAY UPCOMING SCHEDULED POSTS\u00a0<\/h3>\n<p>Here\u2019s an easy way to display a list of posts that are scheduled to be published at some point in the future. Create a page called \u201cUpcoming Posts\u201d (or whatever), and use this code for the loop:<\/p>\n<pre><code>< ?php query_posts('showposts=7&amp;post_status=future'); ?>\n\n< ?php if (have_posts()) : ?>\n\n\t<h3>Upcoming Scheduled Posts<\/h3>\n\t<ul>\n\t< ?php while (have_posts()) : the_post(); ?>\n\n\t\t<li>< ?php the_title(); ?> &amp;#8212; < ?php the_time('l, F j, Y'); ?><\/li>\n\n\t< ?php endwhile; ?>\n\t<\/ul>\n\n< ?php else: ?>\n\n\t<p>Nothing new in queue!<\/p>\n\n< ?php endif; ?><\/code><\/pre>\n<p>In place, this code will output a list of all posts that exist within the database that have a<code>post_status<\/code> of \u201c<code>future<\/code>\u201d. I.e., anything that you have setup in draft mode that is set to auto-publish at a certain point in the future.<\/p>\n<h3>DISPLAY AUTOMATIC TINYURLS FOR YOUR POSTS\u00a0<\/h3>\n<p>Make it super-easy for your visitors to share the\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b> of your posts with their favorite social-media service. Providing an alternate \u201cshort\u201d version of your\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b>s is possible using the free<a href=\"http:\/\/tinyurl.com\/\">TinyURL<\/a> service and a couple snippets of code.<\/p>\n<p>To display short\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b>s at the end of your posts, place this code into your theme\u2019s<code>functions.php<\/code> file:<\/p>\n<pre><code>function getTinyUrl($url) {\n\t$tinyurl = file_get_contents(\"http:\/\/tinyurl.com\/api-create.php?url=\".$url);\n\treturn $tinyurl;\n}<\/code><\/pre>\n<p>Then, call the function and display the\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b> by placing this code into your\u00a0<code>single.php<\/code> file in the desired location within the loop:<\/p>\n<pre><code>< ?php $turl = getTinyUrl(get_permalink($post->ID));\necho 'TinyURL for this post: <a href=\"'.$turl.'\">'.$turl.'<\/a>'; ?><\/code><\/pre>\n<p>That\u2019s it! Your posts now feature super-short\u00a0<b><acronym title=\"Uniform Resource Locator\">URL<\/acronym><\/b>s for all of your tweet-hungry visitors. Tuper Tweet Tude!<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/perishablepress.com\/press\/2009\/10\/18\/stupid-twitter-tricks\/\">Perishable Press<\/a><\/p>\n<h3>IMPLEMENT A SITE-MAINTENANCE PAGE FOR YOUR BLOG\u00a0<\/h3>\n<p>Ever do maintenance on your site? Certainly, we all do. Here\u2019s an easy way to display a \u201csite-maintenance\u201d page that will display whatever content you desire. The key here is setting up your\u00a0<b><acronym title=\"Hypertext Access\">HTAccess<\/acronym><\/b> file to handle the redirect properly.<\/p>\n<p>First, you need to create your maintenance page. This can be as simple or as advanced as you would like. At minimum, you could include something like this into a file named \u201cmaintenance.html\u201d:<\/p>\n<pre><code><h1>Site Maintenance<\/h1>\n<p>Please check back in 15 minutes<\/p><\/code><\/pre>\n<p>Then, add this bit of voodoo to your site\u2019s root htaccess file:<\/p>\n<pre><code># SITE MAINTENANCE PAGE\nRewriteEngine on\nRewriteCond %{REQUEST_URI} !\/maintenance.html$\nRewriteCond %{REMOTE_ADDR} !^111\\.222\\.333\\.444\nRewriteRule $\/maintenance.html [R=302,L]<\/code><\/pre>\n<p>Once that\u2019s in place, replace the example\u00a0<b><acronym title=\"Internet Protocol\">IP<\/acronym><\/b> address with that of your own. Upload to your site and check it out. What you will see is that you have full access to your site, but all other visitors will see the maintenance page.<\/p>\n<p>Once maintenance is complete, simply comment out the code in your htaccess file to allow visitors back into the site.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.catswhocode.com\/blog\/10-awesome-htaccess-hacks-for-wordpress\">Catswhocode<\/a><\/p>\n<h3>DISPLAY THE FIRST IMAGE FROM EACH OF YOUR POSTS\u00a0<\/h3>\n<p>If your posts include an image that you would like to display as a thumbnail elsewhere on your blog, here is an easy way to do it with no custom fields required. Place the following code into your theme\u2019s\u00a0<code>functions.php<\/code> file:<\/p>\n<pre><code>function catch_that_image() {\n\tglobal $post, $posts;\n\t$first_img = '';\n\tob_start();\n\tob_end_clean();\n\t$output = preg_match_all('\/<img .+src=[\\'\"]([^\\'\"]+)[\\'\"].*\/>\/i', $post->post_content, $matches);\n\t$first_img = $matches [1] [0];\n\n\tif(empty($first_img)){\n\t\t$first_img = \"\/images\/default.jpg\"; \/\/ default image\n\t}\n\treturn $first_img;\n}<\/code><\/pre>\n<p>Then, to call the function and display the images as thumbnails, place the following code into the desired location within your loop:<\/p>\n<pre><code>< ?php echo catch_that_image(); ?><\/code><\/pre>\n<p>That\u2019s all there is to it. If you would like to display a default image for posts that may not have one, specify its path in the code (on the line that says \u201cdefault\u00a0image).<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.wprecipes.com\/how-to-get-the-first-image-from-the-post-and-display-it\">WPRecipes<\/a><\/p>\n<h3>DISPLAY MOST POPULAR POSTS WITHOUT A PLUGIN\u00a0<\/h3>\n<p>Simple but effective method of displaying your blog\u2019s most popular posts based on comment count. This code snippet may be placed anywhere within your theme\u2019s files (i.e., no loop required). Check it out:<\/p>\n<pre><code><h3>Popular Posts<\/h3>\n<ul>\n< ?php $result = $wpdb->get_results(\"\n\tSELECT comment_count, ID, post_title\n\tFROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 7\n\t\");\n\nforeach ($result as $post) {\n\tsetup_postdata($post);\n\t$postid = $post->ID;\n\t$title = $post->post_title;\n\t$commentcount = $post->comment_count;\n\tif ($commentcount != 0) { ?>\n\n\t<li><a href=\"<?php echo get_permalink($postid); ?>\">\n\t< ?php echo $title; ?><\/a> [< ?php echo $commentcount ?>]<\/li>\n\n\t< ?php } ?>\n< ?php } ?>\n<\/ul><\/code><\/pre>\n<p>Once in place, this code will display the seven most popular posts along with their associated comment count in unordered list format. Customize according to your needs.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.problogdesign.com\/wordpress\/create-your-own-popular-posts-page\/\">ProBlogDesign<\/a><\/p>\n<h3>AUTOMATICALLY HIGHLIGHT SEARCH TERMS\u00a0<\/h3>\n<p>Make things easy for people who are searching your site by applying some custom styling to the search terms that are displayed in the search results. A common way to display search terms is with a yellow background so that users can easily identify locations of the text that may apply to their query. It\u2019s all about about usability, and improving the way search results are displayed on your site. Here\u2019s how to do it:<\/p>\n<p>First, replace the\u00a0<code>the_title()<\/code> tag in your\u00a0<code>search.php<\/code> file with the following:<\/p>\n<pre><code>< ?php \/\/ highlight search terms in title\n\t$title = get_the_title();\n\t$keys  = explode(\" \", $s);\n\t$title = preg_replace('\/('.implode('|',$keys).')\/iu','<span>\\0',$title);\n\techo $title;\n?><\/code><\/pre>\n<p>This will setup styling for search terms located in the title of each result. Then, for the content, replace the\u00a0<code>the_excerpt()<\/code> tag in your\u00a0<code>search.php<\/code> file with the following:<\/p>\n<pre><code>< ?php \/\/ highlight search terms in content\n\t$excerpt = get_the_excerpt();\n\t$keys  = explode(\" \", $s);\n\t$excerpt = preg_replace('\/('.implode('|',$keys).')\/iu','<span>\\0',$excerpt);\n\techo $excerpt;\n?><\/code><\/pre>\n<p>Finally, open your theme\u2019s\u00a0<b><acronym title=\"Cascading Style Sheets\">CSS<\/acronym><\/b> file and add some custom styles for the search terms. A great way to highlight each term is to display it in bold text with yellow highlighting. Something like this:<\/p>\n<pre><code>span.search-terms {\n\tbackground: yellow;\n\tfont-weight: bold;\n\t}<\/code><\/pre>\n<p>That\u2019s all there is to it! Go run a few searches to see it in action.<\/p>\n<p>Source: Enhanced version of code provided by\u00a0<a href=\"http:\/\/yoast.com\/wordpress-search\/\">Yoast.com<\/a><\/p>\n<h3>AUTOMATICALLY DISABLE WIDGETS\u00a0<\/h3>\n<p>Quick tip to disable all widget functionality from your theme. Add the following to your<code>functions.php<\/code> file and call it done:<\/p>\n<pre><code>< ?php \/\/ disable all widgets\nfunction disable_all_widgets($sidebars_widgets) {\n\n\t$sidebars_widgets = array(false);\n\treturn $sidebars_widgets;\n\n}\nadd_filter('sidebars_widgets', 'disable_all_widgets');\n?><\/code><\/pre>\n<p>Source:\u00a0<a href=\"http:\/\/justintadlock.com\/archives\/2009\/03\/06\/disable-widget-areas-without-touching-theme-templates\">Justin Tadlock<\/a><\/p>\n<h3>DISPLAY ALL IMAGES FROM YOUR POST CONTENT\u00a0<\/h3>\n<p>Want to display all of the images from each of your posts somewhere on your blog? Easy. Check out this code snippet from Matt Varone:<\/p>\n<pre><code>< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>\n\n< ?php\n$szPostContent = $post->post_content;\n$szSearchPattern = '~<img [^\\\/>]*\\ \/>~';\n\n\/\/ Run preg_match_all to grab all the images and save the results in $aPics\npreg_match_all($szSearchPattern, $szPostContent, $aPics);\n\n\/\/ Check to see if we have at least 1 image\n$iNumberOfPics = count($aPics[0]);\n\nif ($iNumberOfPics > 0) {\n\t\/\/ now here you would do whatever you need to do with the images\n\t\/\/ for this example the images are just displayed\n\tfor ( $i=0; $i < $iNumberOfPics ; $i++ ) {\n\t\techo $aPics[0][$i];\n\t};\n};\n\nendwhile;\nendif;\n?><\/code><\/pre>\n<p>Just customize the output in the second part of the code (see code comments) and paste the function wherever you would like to display the images. Sweetness.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.mattvarone.com\/wordpress\/images-post-wordpress-regular-expressions\/\">Matt Varone<\/a><\/p>\n<h3>DISPLAY CATEGORY LIST IN TWO COLUMNS\u00a0<\/h3>\n<p>Tired of that boring, single-column category display? Spice things up with a spiffy two-column category list that will get your visitors\u2019 hearts pumping. Let\u2019s deface a WordPress tag, shall we?<\/p>\n<p>See this bad boy:<\/p>\n<p><code>< ?php wp_list_categories(); ?><\/code><\/p>\n<p>We\u2019re going to blow it up, divide its contents into two pieces, and spit it all back out as two unordered lists. Impossible, you say? Nah, just a little\u00a0<b><acronym title=\"PHP: Hypertext Preprocessor\">PHP<\/acronym><\/b> to make it all go.<\/p>\n<p>Wherever you would like to display your categories in two columns, throw down the following code snippet:<\/p>\n<pre><code>< ?php \/\/ display categories in columns\n$cats = explode(\"<br \/>\",wp_list_categories('title_li=&amp;echo=0&amp;depth=1&amp;style=none'));\n$cat_n = count($cats) - 1;\nfor ($i=0;$i< $cat_n;$i++) :\n\tif ($i<$cat_n\/2) :\n\n\t\t$cat_left = $cat_left.'<li>'.$cats[$i].'';\n\n\telseif ($i>=$cat_n\/2):\n\n\t\t$cat_right = $cat_right.'<li>'.$cats[$i].'<\/li>';\n\n\tendif;\nendfor; ?>\n\n<ul>\n\t< ?php echo $cat_left;?>\n<\/ul>\n<ul>\n\t< ?php echo $cat_right;?>\n<\/ul><\/code><\/pre>\n<p>Completely awesome. Now let\u2019s add some style to make the columns work:<\/p>\n<pre><code>.right {\n\tfloat: left;\n\twidth: 140px;\n\t}\n.left {\n\tfloat: left;\n\twidth: 140px;\n\t}<\/code><\/pre>\n<p>You are all set. You should probably fine-tune this business until it\u2019s all good. You know.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.blogohblog.com\/10-wordpress-hacks-to-make-your-life-even-easier\/\">Blog Oh Blog<\/a><\/p>\n<h3>SHOW ADS OR OTHER CONTENT ONLY IN THE FIRST THREE POSTS\u00a0<\/h3>\n<p>Advertising may require you to limit the number of advertisements on your page to three. For some, this is three too many. For others, it\u2019s far too few. Still others feel that it\u2019s just the right amount.<\/p>\n<p>Regardless of your feelings, here is a trick that will enable you to limit the number of posts that displays some specific content \u2014 ads, images, scripts, whatever you want. Check out the three indented lines in the following loop:<\/p>\n<pre><code>< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>\n\n\t< ?php if ($wp_query->current_post < 3) { ?>\n\n\t<!-- any content here will be displayed only in first three posts -->\n\n\t< ?php } ?>\n\n< ?php endwhile; else: ?>\n< ?php endif; ?><\/code><\/pre>\n<p>See what\u2019s happening here. We\u2019ve got a loop, see. In this loop, we specify a condition that says, \u201cif this is one of the first three posts, display this content.\u201d And that\u2019s the magic. Of course, you can use whatever content you would like, and there is nothing special about the number \u201c<code>3<\/code>\u201d either.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.blogohblog.com\/10-wordpress-hacks-to-make-your-life-even-easier\/\">Blog Oh Blog<\/a><\/p>\n<h3>A BETTER WAY TO DISPLAY RECENT COMMENTS WITHOUT A PLUGIN\u00a0<\/h3>\n<p>Here is a better way to display your recent comments without a plugin. Instead of slapping a bunch of gnarly code into our\u00a0<code>index.php<\/code> or\u00a0<code>sidebar.php<\/code> file, we are going to slap it right where it belongs: in your theme\u2019s\u00a0<code>functions.php<\/code> file.<\/p>\n<p>Here is the code, all exploded for your viewing and analytical pleasure (well, for mine anyway). For a more minified version of this snippet, be sure to check out the source link.<\/p>\n<pre><code>< ?php \/\/ display recent comments without a plugin\n\nfunction recent_comments($src_count=10, $src_length=60, $pre_HTML='<ul>', $post_HTML='') {\nglobal $wpdb;\n$sql = \"\n\tSELECT DISTINCT\n\t\tID,\n\t\tpost_title,\n\t\tpost_password,\n\t\tcomment_ID,\n\t\tcomment_post_ID,\n\t\tcomment_author,\n\t\tcomment_date_gmt,\n\t\tcomment_approved,\n\t\tcomment_type,\n\tSUBSTRING(\n\t\tcomment_content, 1, $src_length\n\t\t)\n\tAS com_excerpt\n\tFROM $wpdb->comments\n\tLEFT OUTER JOIN $wpdb->posts\n\tON (\n\t\t$wpdb->comments.comment_post_ID = $wpdb->posts.ID\n\t\t)\n\tWHERE comment_approved = '1'\n\tAND comment_type = ''\n\tAND post_password = ''\n\tORDER BY comment_date_gmt\n\tDESC\n\tLIMIT $src_count\n\";\n$comments = $wpdb->get_results($sql);\n$output = $pre_HTML;\n\nforeach ($comments as $comment) {\n\n\t$output .= '<li><a href=\"'.get_permalink($comment->ID).'#comment-'.$comment->comment_ID.'\" title=\"on '.$comment->post_title.'\">'.strip_tags($comment->com_excerpt).'...<\/a><\/li>';\n\n}\n$output .= $post_HTML;\necho $output;\n\n} ?><\/code><\/pre>\n<p>Ah, it\u2019s a thing of beauty. Once you have that code in place, rock it out anywhere in your theme with this charming little tag:<\/p>\n<p><code>< ?php recent_comments(); ?><\/code><\/p>\n<p>see also:\u00a0<a href=\"#swt_37\">Display Latest Comments without a Plugin<\/a><br \/>\nSource:\u00a0<a href=\"http:\/\/www.blogohblog.com\/10-wordpress-hacks-to-make-your-life-even-easier\/\">Blog Oh Blog<\/a><\/p>\n<h3>SELECTIVELY DISABLE AUTOMATIC POST FORMATTING\u00a0<\/h3>\n<p>This trick is by far my favorite \u201c<a href=\"http:\/\/perishablepress.com\/press\/2009\/12\/01\/stupid-wordpress-tricks\/\">stupid WordPress trick<\/a>.\u201d You know how WordPress likes to mangle\u00a0<b><acronym title=\"Hypertext Markup Language\">HTML<\/acronym><\/b> comments, empty elements, blockquotes, curly quotes, and other miscellaneous markup elements? Here is a tight little method that will enable you to\u00a0<em>selectively<\/em> disable WordPress\u2019 automatic post formatting.<\/p>\n<p>Do this: Place the following code into your theme\u2019s\u00a0<code>functions.php<\/code> file:<\/p>\n<pre><code>\/\/ disable auto-formatting\nfunction my_formatter($content) {\n\t$new_content = '';\n\t$pattern_full = '{(\\[raw\\].*?\\[\/raw\\])}is';\n\t$pattern_contents = '{\\[raw\\](.*?)\\[\/raw\\]}is';\n\t$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);\n\n\tforeach ($pieces as $piece) {\n\t\tif (preg_match($pattern_contents, $piece, $matches)) {\n\t\t\t$new_content .= $matches[1];\n\t\t} else {\n\t\t\t$new_content .= wptexturize(wpautop($piece));\n\t\t}\n\t}\n\treturn $new_content;\n}\nremove_filter('the_content', 'wpautop');\nremove_filter('the_content', 'wptexturize');\nadd_filter('the_content', 'my_formatter', 99);<\/code><\/pre>\n<p>Then do this: Use the\u00a0<code>[raw]<\/code> shortcode wherever you would like to disable auto-formatting in your post content. For example, if you wanted to prevent the following sentence from being formatted, you would write this:<\/p>\n<p><code>[raw]This text will not be automatically formatted.[\/raw]<\/code><\/p>\n<p>Absolutely brilliant.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.wprecipes.com\/disable-wordpress-automatic-formatting-on-posts-using-a-shortcode\">WPRecipes<\/a><\/p>\n<h3>BROWSER DETECTION VIA WORDPRESS\u2019 BODY_CLASS FUNCTION\u00a0<\/h3>\n<p>WordPress makes it possible to detect a handful of different browsers using a variety of built-in global variables. WordPress also provides a\u00a0<code>body_class<\/code> tag that outputs a variety of class attributes depending on various page properties. Why not combine these two techniques so that the user\u2019s detected browser is added to the list of output classes for the body tag? Here\u2019s the code that will do it via\u00a0<code>functions.php<\/code>:<\/p>\n<pre><code>\/\/ browser detection via body_class\nfunction browser_body_class($classes) {\n\n    global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;\n\n    if($is_lynx)       $classes[] = 'lynx';\n    elseif($is_gecko)  $classes[] = 'gecko';\n    elseif($is_opera)  $classes[] = 'opera';\n    elseif($is_NS4)    $classes[] = 'ns4';\n    elseif($is_safari) $classes[] = 'safari';\n    elseif($is_chrome) $classes[] = 'chrome';\n    elseif($is_IE)     $classes[] = 'ie';\n    else               $classes[] = 'unknown';\n\n    if($is_iphone) $classes[] = 'iphone';\n    return $classes;\n\n}\nadd_filter('body_class','browser_body_class');<\/code><\/pre>\n<p>This code will output the detected browser along with the other\u00a0<code>body_class<\/code> tags. Here is an example:<\/p>\n<p><code><body><\/body><\/code><\/p>\n<p>Hooked.<\/p>\n<p>Sources:\u00a0<a href=\"http:\/\/www.nathanrice.net\/blog\/browser-detection-and-the-body_class-function\/\">Nathan Rice<\/a><\/p>\n<h3>GET POST OR PAGE CONTENTS AS A PHP VARIABLE\u00a0<\/h3>\n<p>Here is a quick snippet for placing all post or page content into a variable. We\u2019re talking the<em>entire<\/em> page contents here, not just the content of the post. Place this code into your theme\u2019s<code>functions.php<\/code> file:<\/p>\n<pre><code>\/\/ post contents as variable\nfunction callback($buffer) {\n\treturn $buffer;\n\t}\nfunction buffer_start() {\n\tob_start(\"callback\");\n\t}\nfunction buffer_end() {\n\tob_end_flush();\n\t}\nadd_action('wp_head', 'buffer_start');\nadd_action('wp_footer', 'buffer_end');<\/code><\/pre>\n<p>Once in place, this function will capture the entire page contents into a variable called \u201c<code>$buffer<\/code>\u201d. You may then do whatever you wish to this variable. Filter it, match it, slap it around a little and show it who\u2019s boss. That sort of thing.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/www.dagondesign.com\/articles\/wordpress-hook-for-entire-page-using-output-buffering\/\">Dagon Design<\/a><br \/>\nSee also:\u00a0<a href=\"http:\/\/digwp.com\/2009\/07\/putting-the_content-into-a-php-variable\/\">Digging into WordPress<\/a><\/p>\n<h3>SIMPLE EXAMPLE OF HOW TO USE WORDPRESS CRON\u00a0<\/h3>\n<p>I have been meaning to get into WordPress\u2019\u00a0<code>wp-cron<\/code> functionality, and this looks like a good way to get started with it. This code snippet uses\u00a0<code>wp-cron<\/code> to schedule an automatic email that will be sent every hour.<\/p>\n<pre><code>\/\/ send automatic scheduled email\nif (!wp_next_scheduled('my_task_hook')) {\n\twp_schedule_event(time(), 'hourly', 'my_task_hook');\n}\nadd_action('my_task_hook', 'my_task_function'); \n\nfunction my_task_function() {\n\twp_mail('you@yoursite.com', 'Automatic email', 'Hello, this is an automatically scheduled email from WordPress.');\n}<\/code><\/pre>\n<p>Of course, this is meant only as an example. The key here is to schedule and event and then hook into it with some specific function.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/blog.slaven.net.au\/archives\/2007\/02\/01\/timing-is-everything-scheduling-in-wordpress\/\">slaven.net<\/a><\/p>\n<h3>ADD MORE DEFAULT AVATAR CHOICES TO THE WORDPRESS ADMIN\u00a0<\/h3>\n<p>Here is a quick and easy way to add more default avatars to the list of available gravatars in the Settings area of the WordPress Admin. Here is the\u00a0<code>functions.php<\/code> code to make it happen:<\/p>\n<pre><code>\/\/ add more default avatars to options\nif (!function_exists('fb_addgravatar')) {\n\tfunction fb_addgravatar($avatar_defaults) {\n\n\t\t$myavatar1 = get_bloginfo('template_directory').'\/images\/avatar-01.png';\n\t\t$avatar_defaults[$myavatar1] = 'dude';\n\n\t\t$myavatar2 = get_bloginfo('template_directory').'\/images\/avatar-02.png';\n\t\t$avatar_defaults[$myavatar2] = 'geek';\n\n\t\t$myavatar3 = get_bloginfo('template_directory').'\/images\/avatar-03.png';\n\t\t$avatar_defaults[$myavatar3] = 'cool';\n\n\t\treturn $avatar_defaults;\n\t}\n\tadd_filter('avatar_defaults', 'fb_addgravatar');\n}<\/code><\/pre>\n<p>See the innermost indented lines of code? There we are specifying three additional default avatars. To use this code, you will need to edit these lines to match your image paths and the name for each avatar. Hopefully the process of editing, adding, or removing avatars is clear. If not, don\u2019t hesistate to speak up in the comments and someone will help you out.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/wpengineer.com\/add-avatar-to-wordpress-default\/\">WPEngineer<\/a><\/p>\n<h3>ADD A PRIVATE PAGE TO YOUR NAVIGATION MENU\u00a0<\/h3>\n<p>By default, any pages that you classify as \u201cPrivate\u201d are not displayed in the menu generated by the\u00a0<a title=\"Delicious Recipes for WordPress Page Menus and Page Listings\" href=\"http:\/\/digwp.com\/2009\/07\/delicious-recipes-wordpress-page-menus\/\">wp_list_pages<\/a> function. In general this is a good idea, but it might be helpful to include the link if the logged in user is able to read private pages. Fortunately, WordPress has a function that will enable us to do exactly that:<\/p>\n<pre><code><ul>\n< ?php \/\/ add a private page to your navigation menu\nwp_list_pages('depth=1&amp;title_li=0&amp;sort_column=menu_order');\nif(current_user_can('read_private_pages')) : ?>\n\n\t<li><a href=\"<?php echo get_permalink(10); ?>\">For Authors only<\/a><\/li>\n\n< ?php endif; ?>\n<\/ul><\/code><\/pre>\n<p>Place this code where you would normally include the\u00a0<code>wp_list_pages<\/code> tag and enjoy private-page links displayed in your navigation menus only for those users who are logged in and priviledged enough to see them. The private link will not be displayed for the \u201cordinary\u201d folk.<\/p>\n<p>Make sure you replace the number \u201c<code>10<\/code>\u201d in the middle line to match the ID of the private page you would like to include.<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/wpengineer.com\/adding-a-private-page-into-the-navigation\/\">WPEngineer<\/a><\/p>\n<h3>HOW TO ADD ADDITIONAL LINKS TO WP_LIST_PAGES\u00a0<\/h3>\n<p>Here is a nice way to include additional links to the output of the\u00a0<code>wp_list_pages<\/code> tag. All that\u2019s needed is the following function in your\u00a0<code>functions.php<\/code> file:<\/p>\n<pre><code>\/\/ include additional links\nfunction add_bookmarks_to_menu($output) {\n\t$bookmarks = (array) get_bookmarks('hide_invisible=0&amp;category_name=wp_list_pages');\n\tforeach ($bookmarks as $bookmark) {\n\t\t$output .= \"<li><a href='{$bookmark->link_url}'  title='{$bookmark->link_name}'>{$bookmark->link_name}<\/a><\/li>\\n\";        \n\n\t}\n\treturn $output;\n}\nadd_filter('wp_list_pages', 'add_bookmarks_to_menu');<\/code><\/pre>\n<p>Here we are taking advantage of WordPress\u2019 built-in Links\/Bookmarks functionality to assign new links to the output of the\u00a0<code>wp_list_pages<\/code> tag. Once this code is in place, login to your WordPress Admin and follow these steps for each link that you would like to add to the page list:<\/p>\n<ol>\n<li>In the Admin, go to Links > Add New<\/li>\n<li>Enter a name and URL for your link<\/li>\n<li>Add the link to a new category called \u201cwp_list_pages\u201d<\/li>\n<li>select \u201cKeep this link private\u201d<\/li>\n<li>Click \u201cAdd Link\u201d<\/li>\n<li>Done.<\/li>\n<\/ol>\n<p>Using the \u201cwp_list_pages\u201d category for any\/all of our extra links will enable us to include only links from that category. Further, selecting the \u201cKeep this link private\u201d option will prevent the links from being displayed elsewhere in your site (for example, in the Links\/Blogroll\/Bookmark sections).<\/p>\n<p>Source:\u00a0<a href=\"http:\/\/sivel.net\/2009\/03\/adding-links-to-wp_list_pages-part-2\/\">sivel.net<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is published courtesy of Perishable Press. Check out the other terrific info there as well! Perishable Press By the way, this stuff is far from stupid&#8230; very nice references here. WORDPRESS SHORTCODES\u00a0 Save time by replacing your most commonly typed words and phrases with WordPress shortcodes. For example, if you are frequently typing&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-1351","post","type-post","status-publish","format-standard","hentry","category-info"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Stupid Wordpress tricks - Linux Shtuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Stupid Wordpress tricks - Linux Shtuff\" \/>\n<meta property=\"og:description\" content=\"This post is published courtesy of Perishable Press. Check out the other terrific info there as well! Perishable Press By the way, this stuff is far from stupid&#8230; very nice references here. WORDPRESS SHORTCODES\u00a0 Save time by replacing your most commonly typed words and phrases with WordPress shortcodes. For example, if you are frequently typing... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux Shtuff\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:author\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:published_time\" content=\"2009-12-29T05:52:24+00:00\" \/>\n<meta name=\"author\" content=\"g33kadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/drsinger1111\" \/>\n<meta name=\"twitter:site\" content=\"@drsinger1111\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/stupid-wordpress-tricks\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/stupid-wordpress-tricks\\\/\"},\"author\":{\"name\":\"g33kadmin\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"headline\":\"Stupid WordPress tricks\",\"datePublished\":\"2009-12-29T05:52:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/stupid-wordpress-tricks\\\/\"},\"wordCount\":7950,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"articleSection\":[\"General Info\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/stupid-wordpress-tricks\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/stupid-wordpress-tricks\\\/\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/stupid-wordpress-tricks\\\/\",\"name\":\"Stupid Wordpress tricks - Linux Shtuff\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\"},\"datePublished\":\"2009-12-29T05:52:24+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/stupid-wordpress-tricks\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/stupid-wordpress-tricks\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/stupid-wordpress-tricks\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Stupid WordPress tricks\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\",\"name\":\"Linux Shtuff\",\"description\":\"Because I have CRS Syndrome...\",\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\",\"name\":\"g33kadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"contentUrl\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"width\":512,\"height\":512,\"caption\":\"g33kadmin\"},\"logo\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\"},\"description\":\"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\\\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....\",\"sameAs\":[\"https:\\\/\\\/thelinuxreport.com\",\"https:\\\/\\\/fb.me\\\/g33kinf0\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/drsinger1111\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Stupid Wordpress tricks - Linux Shtuff","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/","og_locale":"en_US","og_type":"article","og_title":"Stupid Wordpress tricks - Linux Shtuff","og_description":"This post is published courtesy of Perishable Press. Check out the other terrific info there as well! Perishable Press By the way, this stuff is far from stupid&#8230; very nice references here. WORDPRESS SHORTCODES\u00a0 Save time by replacing your most commonly typed words and phrases with WordPress shortcodes. For example, if you are frequently typing... Read More","og_url":"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/","og_site_name":"Linux Shtuff","article_publisher":"https:\/\/fb.me\/g33kinf0","article_author":"https:\/\/fb.me\/g33kinf0","article_published_time":"2009-12-29T05:52:24+00:00","author":"g33kadmin","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/drsinger1111","twitter_site":"@drsinger1111","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/#article","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/"},"author":{"name":"g33kadmin","@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"headline":"Stupid WordPress tricks","datePublished":"2009-12-29T05:52:24+00:00","mainEntityOfPage":{"@id":"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/"},"wordCount":7950,"commentCount":0,"publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"articleSection":["General Info"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/","url":"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/","name":"Stupid Wordpress tricks - Linux Shtuff","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/#website"},"datePublished":"2009-12-29T05:52:24+00:00","breadcrumb":{"@id":"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/g33kinfo.com\/info\/stupid-wordpress-tricks\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/g33kinfo.com\/info\/"},{"@type":"ListItem","position":2,"name":"Stupid WordPress tricks"}]},{"@type":"WebSite","@id":"https:\/\/g33kinfo.com\/info\/#website","url":"https:\/\/g33kinfo.com\/info\/","name":"Linux Shtuff","description":"Because I have CRS Syndrome...","publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/g33kinfo.com\/info\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547","name":"g33kadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","url":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","contentUrl":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","width":512,"height":512,"caption":"g33kadmin"},"logo":{"@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif"},"description":"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....","sameAs":["https:\/\/thelinuxreport.com","https:\/\/fb.me\/g33kinf0","https:\/\/x.com\/https:\/\/twitter.com\/drsinger1111"]}]}},"_links":{"self":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/1351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/comments?post=1351"}],"version-history":[{"count":0,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/1351\/revisions"}],"wp:attachment":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/media?parent=1351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/categories?post=1351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/tags?post=1351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}