New book on WordPress Theme Development: WordPress Themes In Depth
tips
Tag Archive

Display the Total Number of WordPress Posts, Comments, and Categories

Would you like to display the total number of posts, comments, and categories for your WordPress-powered website? Here is the code that can make it happen 1! Update: The count posts part of this method should only be used for WordPress versions less than 2.5. For WordPress versions 2.5 and better, there is a built-in function for displaying the total number of posts. See The WordPress Codex for more information. <?php $numposts = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = ‘publish'”); if (0 < $numposts) $numposts = number_format($numposts); $numcomms = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = ‘1’”); if (0 […] Read more »

Crazy CSS Underline Effects

Check out these crazy CSS underline effects: u.double { /* — double underline — */ border-bottom: 1px solid; } .altdouble { /* alternate double */ border-bottom: 3px double; line-height: 1.7em; } u.triple { /* — triple threat — */ border-bottom: 3px double; line-height: 1.9em; } Double Underline Effects! (via u.double class) Alternate Double Underline! (via .altdouble class) Triple Underline Effects! (via u.triple class) Note: if these examples do not display correctly with the current theme, click here to see them in action! Read more »

Conditionally Load WordPress Pages

Need to load a WordPress page conditionally? For example, perhaps you need a “special” page to appear for search results? Yes? This simple PHP/JavaScript solution may be just what the doctor ordered! Simply replace “condition” with the required condition (or delete the if (condition) {} qualifier entirely), and then change the path and file names to suit your specific needs: <?php if (condition) { echo (” <script type=\”text/javascript\”> <!–//–><![CDATA[//><!-- parent.location=\"http://www.domain.com/path/to/file.html\" //--><!]]> </script> “); } else { echo (” <script type=\”text/javascript\”> <!–//–><![CDATA[//><!-- parent.location=\"http://www.domain.com/path/to/other-file.html\" //--><!]]> </script> “); } ?> Specifically, I employ the following trickery in my Killer WordPress theme: <?php endwhile; […] Read more »

Associate Extensionless Files with Notepad in WinXP

There are several files that appear not to have extensions in Windows XP. Perhaps the best known example is the HOSTS file. Files such as the HOSTS file that appear to be "extensionless" actually contain an invisible period "." — or dot — at the end the file name. It is this invisible dot that will enable us to select a specific program with which to open files with no extensions. As web developers, we are constantly checking and consulting server-generated error_log files. Like the HOSTS file, the error_log files appear to have no associated extension. In Windows XP, opening […] Read more »

Backup Block Senders List in Outlook Express

Follow these steps to backup the “Block Senders” list in Outlook Express: From the Desktop, click Start then Run. In the Open box, type regedit then OK. Locate and click the following registry subkey: HKEY CURRENT USER\Identities\(Identity Number)\Software\Microsoft\Outlook Express\5.0\Block Senders Go to the Registry menu and select Export Registry File. From the Save In box, change the location to your desktop. At the File Name box, type “Blocked Senders[date].reg” then Save. Go to the Registry menu and chose exit. To restore a backup, simply right-click on the “Blocked Senders[date].reg” file that you wish to restore and select “merge.” Read more »

Amazing Keyboard Shortcuts

Well, they aren’t really that amazing, but for Windows and Linux users, they sure save time. Ctrl+A: select all Ctrl+C: copy Ctrl+F: find Ctrl+G: find again or find next Ctrl+P: print Ctrl+S: save web page as Ctrl+T: open new tab Ctrl+U: view source code Ctrl+V: paste Ctrl+X: cut Ctrl+Y: redo Ctrl+Z: undo Alt+Tab: cycle through open programs Ctrl+Page Up: navigate forward through open tabs Ctrl+Page Down: navigate backward through open tabs Esc: stops the current tab’s web page from loading Ctrl+Shift+R: total refresh of the current web page — clears out the cache Ctrl+- and Ctrl++: adjust font size — […] Read more »

Get Real

Enjoy these crucial blogging tips from the 0racle: Embrace reality: Popularity contest make very one sickening — save it. Not imitationary: Focusing on unique ideas and are so inspiring. Eat me, sellout: Advertise for business, creating for pleasure. Be true yourself: Write yourself, because you want to like it. Mind the business: You can just eat me, smiling. I laugh you. Read more »

Latest Tweets Book update! New version of WordPress Themes In Depth now available: wp-tao.com/wordpress-themes-bo…