How to check if a post has the Excerpt field filled manually

the_excerpt( ) displays the content filled in the Excerpt field (if filled manually) or else it will display an automatic excerpt which refers to the first 55 words of the post’s content.
To check if the Excerpt was manually filled, wordpress has a function called has_excerpt( ). So, if you dont like WP’s auto-excerpt, you can write a few lines of code like:
1 2 3 4 5 | <?php if ( has_excerpt( ) ) { the_excerpt(); } else { the_content(); } ?> |
March 23, 2011 by thinkdj in Mods Continue Reading →
Make URLs within posts clickable
Did you know that WordPress has a function ‘make_clickable’ which converts plain text URLs to HTML links? It converts URI, www, ftp, and email addresses to clickable hyperlinks and also helps by fixing links within links.
To make use of this function in the most effective manner, edit your theme’s functions.php file and add the following line:
1 | add_filter('the_content', 'make_clickable'); |
The above code will automatically make all links clickable in your post content. If you want the returned content to be used some place else,
1 2 3 | $theContent = make_clickable(get_the_content( ) ); // Then, echo it wherever you wish to display the content echo $theContent; |
Source: Codex
March 23, 2011 by thinkdj in Mods Continue Reading →
How to remove the WordPress Admin Bar
WordPress 3.1 came out with a couple of new features, with the inclusion of an “Admin Bar” being the most visible of them all. If you are unhappy with the bar and want to take it off your blog, here are a few ways:
Method 1: From the good ol’ options page

Goto Users > Your Profile and uncheck “Show Admin Bar” from the options. However, this is a per-user option and wont be feasible if you want to disable the bar for a multi-user blog.
Method 2: Edit your theme’s functions.php file
Add the following lines of code to disable the Admin Bar globally
1 | remove_action('init', 'wp_admin_bar_init'); |
Also, to disable “Show Admin Bar” option for all your users, you can add the following line too:
1 | remove_action( 'personal_options', '_admin_bar_preferences' ); |
Method 3: Using plugins
If you do not have permissions to edit your theme files, you can go with installing plugins. With the release of WP 3.1,
Global Hide/Remove Admin Bar Plugin – Add a global option in Settings Menu to hide/remove the new Admin bar in WP 3.1 and above.
Admin Bar Removal (completely disable) 3.1 only – Completely disables Frontend and Backend Menu that now appears on the WordPress 3.1 based blogs, plus helps to remove code and get more free memory.
Admin Bar Disabler – Disable the WP Admin Bar in 3.1+ completely, or only for roles and capabilities which aren’t in the ‘whitelist’/‘blacklist’. This plugin can help you disable admin bar for subscribers on your blog.
March 23, 2011 by thinkdj in Mods Continue Reading →
Fix “Is its parent directory writable by the server?” error for WordPress Image uploads
You might encounter an error saying something like:
“Unable to create directory /nfs/05/username/wp-content/uploads/2011/03. Is its parent directory writable by the server?”
Naturally, the first thing we’d try to do is change the /uploads/ directory permissions to 777. Here’s a way to fix the error without having to CHMOD directories.

Goto Settings > Media from your WP Dashboard and change” to “wp-content/uploads”
PS: NOT “/wp-content/uploads” or “/nfs/05/username/wp-content/uploads/”
Please note that there is NO forward slash before wp-content/uploads. Hope this solves the media upload problem. Else, try CHMOD’in the uploads/ directory to 777.
Source: TRLocke’s suggestion found at WP Forum
March 23, 2011 by thinkdj in Mods Continue Reading →