Suggest a Snippet Login Register
  • LOG IN:

    Not a member? JOIN NOW!
     Username                   Password
    Remember me Recover password
DevSnippets Design Community & Snippets Gallery
  • Subscribe by RSS
>
  • Webdesign
    • Design
    • HTML5
    • lists
    • Menu
    • Navigation
    • Portfolio
    • Showcase
    • Template
    • Tooltip
    • Tutorial
    • webdesign
  • Web development
    • AJAX
    • CodeIgniter
    • CSS
    • CSS3
    • Database
    • Javascript
    • jQuery
    • Mootools
    • MySQL
    • PHP
    • PHP Framework
    • plugins
    • WordPress
    • WordPress Hacks
  • Inspiration
    • Fonts
    • Icons
    • Inspiration
    • Mac
    • Mac apps
    • Photography
    • Wallpapers
  • Snippets
In {Articles} -18th Jan- {28 Comments}

10 NEW WordPress Wanted Hacks and Powerful Techniques

by Noura Yehia


WordPress is becoming so powerful that you can use it to do whatever comes in your mind. User love it for its flexibility, you have plugins to enhance its power and you can hack your theme code to add unique functionality.
In this article, we’ll show you 10 new powerful WordPress hacks, tricks and plug-ins with a good explanation, so you understand how it works and modify it to your needs.

1. Post Image Feature (the_post_thumbnail)

the_post_thumbnail is one of my favorite additions to WordPress 2.9, a new thumbnail feature for themes where you will be able to easily upload a post thumbnail. Justin Tadlock wrote an interesting tutorial explaining various things you need to know about WordPress 2.9’s post image feature.

To add support for the post image feature in a theme, You only need one line of code to turn this feature in your theme. Add this to your theme’s functions.php file:

add_theme_support( 'post-thumbnails' );

After that, you’ll need to call the image somewhere within The Loop in your template files. You’d do this by adding this line of code:

<?php the_post_thumbnail( 'medium' ); ?>

The previous code calls for medium-sized images in your template files. Fore more information about this feature, make sure you check Justin Tadlock’s tutorial and Michael Preuss guide.

2. WordPress Threaded Comments

One of the big enhancements of the WordPress Comment’s features is the threaded comment functionality. Many bloggers search for themes has this built-in functionality. However, won’t it be easier if we just use a plugin. Below you will find an amazing WordPress plugin that will just add this feature without the need to edit any code of your theme files.
Wordpress Thread Comment:
This Plugin is an enhancement for Wordpress’s comment function. It enables users to reply on a exist comment, and the discussion will be displayed threaded or nested.

3. Contactable – Contact Form Easy with WordPress

Frank Bültge shows how easy and resource friendly it is to integrate a jQuery contact form in WordPress.
He used for the example the great form Plugin Contactable for jQuery by Philip Beel. This Plugin is designed to make contact/feedback forms simpler and more accessible.

4. Exclude A Category From Turn Off Comments Automatically

If you would like to automatically turn off comments on everything after a certain period, all you have to do is go to your discussion settings, and set to automatically turn off comments on everything after x days. However, on certain things, you want the comments to be left on forever in a certain category. All you have to do is follow the hack we found in this post, just copy the code below into your functions.php and change the $cat values.

/**
 * Close comments on an old post.  Hooked to comments_open and pings_open.
 * small modifications on the default functions of WordPress
 *
 * @param bool $open Comments open or closed
 * @param int $post_id Post ID
 * @param int $cat Category ID (cat_ID), set '' or empty for all categories
 * @param int $days_old Days to close comments, set '' for use value from settings
 * @return bool $open
 */
function wpe_close_comments_for_old_post( $open, $post_id, $cat = array(1, 4), $days_old = '' ) {
	if ( !$open )
		return $open;

	if ( in_category($cat) )
		return $open;

	if ( '' === $days_old )
		$days_old = (int) get_option('close_comments_days_old');

	if ( !$days_old )
		return $open;

	$post = get_post($post_id);

	if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) )
		return false;

	return $open;
}
add_filter( 'comments_open', 'wpe_close_comments_for_old_post', 10, 2 );
add_filter( 'pings_open',    'wpe_close_comments_for_old_post', 10, 2 );

Source : Exclude A Category From Turn Off Comments Automatically

5. How to disable HTML in WordPress comments

By default, WordPress allows certain tags in comments. Therefore commenters can add links, style text in bold and italics, add tables, and more. This can cause a lot of headache to you from spammers who can easily fill in your blog with comments linking to their websites. Fortunately there is a quick fix to this issue, whatever the commenter types will be displayed literally. No “certain tags are allowed” or “do this to code samples”. What this plugin does is it converts single quotes, double quotes, the less than symbol (<), the greater than symbol (>), and ampersands (&) to HTML entities whenever a comment is posted, so that they are displayed as-is when someone views the comment.

6. Create a Free Email Newsletter Service using WordPress

In this tutorial, we will learn the manual way to create a simple Email Newsletter Service for your WordPress blog by using WordPress and Feedburner with a few plugins to. You can track the performance of your newsletter by checking how many subscribers you have, how many clicks each link gets and much more.

Source : Create a Free Email Newsletter Service using WordPress

7. Alternate Post Styling On Your Home Page

While i was designing the current theme of Noupe.com, i wanted to display the first four posts bigger than the rest, with images and extended text, with the remaining posts shown more simply. Fortunately, Jean-Baptiste Jung sent me a smart solution where he created a custom loop that displays the first four posts different than the rest.

<?php
$postnum = 0;
while (have_posts()) : the_post(); ?>

<?php if ($postnum <= 4){ ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
  <div class="date"><span><?php the_time('M j') ?></span></div>
    <h2>(<?php echo $postnum;?>)<a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
	<div class="post-image" style="text-align:center;">
		<a href="<?php the_permalink() ?>"><img src="<?php bloginfo('template_directory' ); ?>/timthumb.php?src=<?php  echo catch_that_image(); ?>&amp;w=500&amp;h=200&amp;zc=1" alt="<?php the_title(); ?>" /></a>
	</div>
	<p><?php the_content('Read the rest of this entry &raquo;'); ?></p>
	<p class="more"><a href="#">Read More</a></p>
  </div>
</div>

<?php } else {
<div <?php post_class( 'single ' . $end ); ?> id="post-<?php the_ID(); ?>">
	<div class="post-content">
		<h3><a href="<?php the_permalink() ?>">(<?php echo $postnum; ?>)<?php the_title(); ?></a> <?php edit_post_link('_', '', ''); ?></h3>
		<p><?php the_excerpt( '' ); ?></p>
		<p class="more"><a href="#">Read More ?</a></p>
	</div>
</div><!-- End post -->

<?php }
	endwhile;
	?>

What he did was creating a PHP variable, named $postnum, which is invoked at the end of the loop. If $postnum is less than or equal to 4, the post is displayed in full. Otherwise, it is displayed in its more compact form.

Source : Alternate Post Styling On Your Home Page

8. Easy Retweet Button

John Resig created a simple script for tracking the number of people visiting a blog post from Twitter, in a completely unobtrusive manner. The script itself is completely standalone (no dependencies) and can be included in any page relatively painlessly. Additionally, since it’s just HTML, CSS, and JavaScript, it’s completely themeable and customizable to the style of your site.

To use it in your WordPress blog, you will just need to use the line of code below placed in your single.php theme file:

<a href="<?php the_permalink() ?>" class="retweet"><?php the_title(); ?></a>

9. Protect WordPress Against Malicious URL Requests

Many WordPress sites gets attacked with extremely malicious code, fortunately Jeff Starr wrote a simple script that
checks for excessively long request strings (i.e., greater than 255 characters), as well as the presence of either “eval(” or “base64” in the request URI.
How to use it:


To protect your site using this lightweight script, save the code as a plugin and activate in the WordPress Admin area. Once active, this plugin will silently and effectively close any connections for these sorts of injection-type attacks.

<?php
/*
Plugin Name: Block Bad Queries
Plugin URI: http://perishablepress.com/press/2009/12/22/protect-wordpress-against-malicious-url-requests/
Description: Protect WordPress Against Malicious URL Requests
Author URI: http://perishablepress.com/
Author: Perishable Press
Version: 1.0
*/
global $user_ID; if($user_ID) {
	if(!current_user_can('level_10')) {
		if (strlen($_SERVER['REQUEST_URI']) > 255 ||
			strpos($_SERVER['REQUEST_URI'], "eval(") ||
			strpos($_SERVER['REQUEST_URI'], "CONCAT") ||
			strpos($_SERVER['REQUEST_URI'], "UNION SELECT") ||
			strpos($_SERVER['REQUEST_URI'], "base64")) {
				@header("HTTP/1.1 414 Request-URI Too Long");
				@header("Status: 414 Request-URI Too Long");
				@header("Connection: Close");
				@exit;
		}
	}
} ?>

Source : Protect WordPress Against Malicious URL Requests

10. Curating Comments Threads: Feature Comments

Chris Coyier thought of a smart idea for a plugin. Two more buttons for comment moderation:feature and bury, handy to highlight comments that add value to your post. Utkarsh Kukreti created Feature/Bury Comments plugin for WordPress. This plugin lets the admin add “featured” or “buried” css class to selected comments.

<li id="comment-67793" class="comment even thread-even depth-1 buried">
</li>
<li id="comment-67794" class="comment odd alt thread-odd thread-alt depth-1 parent featured">

Literally all it does is giving you class names to work with. A simple Hook that you then use to apply unique styling to target with JavaScript to appropriately “feature” or “bury” them as you find necessary for your site.

Category: Article | Leave a Comment | 28 Comments

Related Posts

  • Getting Slim, Spicy, & WordPress-Ready with Top 10 jQuery Plugins Getting Slim, Spicy, & WordPress-Ready with Top 10 jQuery Plugins
  • 10 Impressive Techniques to Spice up your WordPress Theme 10 Impressive Techniques to Spice up your WordPress Theme

28 Comments, Add Comment or Ping

  1. Datzerox says:
    January 18, 2010 at 5:00 am

    Wooo, very usefull. Thanks!

  2. Satya Prakash says:
    January 18, 2010 at 6:23 am

    “Protect WordPress Against Malicious URL Requests” is it safe to use!
    How do i know it is not causing problem to real visitors? Thanks

    • Noura Yehia says:
      January 19, 2010 at 6:02 am

      This code shouldn’t affect your visitors, this plugin will silently and effectively close any connections for any sort of injection-type attacks.

      • ikram says:
        January 19, 2010 at 9:40 pm

        thanks for the explanation. I have same question as satya, I just use it on my WP without knowing how it work

  3. Chon says:
    January 18, 2010 at 7:29 am

    I have been looking for a good comment thread for a while… this one is perfect. Thanks!

    • web design kent says:
      January 22, 2010 at 4:51 am

      Very useful article, many thanks!

  4. Jim Hanifen says:
    January 18, 2010 at 9:31 am

    Nice post, the new Wordpress has so much more functionality, thanks for highlighting many of these new features.

  5. Begin with an idea says:
    January 18, 2010 at 10:03 am

    Nice round up. Been a while since I saw a few interesting WP tweeks and plugins that actually help and that are new and not a full reposts from hundreds of other sites ;)

    @satya this code is for sql injections.it’s got nothing to do with how your site will be displayed. That was a problem for 2.8.4 and it’s still a possible situation for alot of people…

  6. san says:
    January 18, 2010 at 11:57 am

    I was looking for newsletter plugin for the longest time than I gave up, thanks for the link!

  7. Jim Jones says:
    January 18, 2010 at 2:19 pm

    I love the retweet button! Thanks for the headsup on this!

  8. Laneth Sffarlenn says:
    January 18, 2010 at 2:47 pm

    This is a wonderful list! One which has inspired many ideas! Awesome, thanks so much!

  9. Ashley says:
    January 18, 2010 at 4:52 pm

    I’m just getting started in this whole Wordpress theme stuff. So this is great!

  10. Jonath Lee says:
    January 18, 2010 at 5:24 pm

    Great list of updated WPHacks. WP is getting greater.

  11. Maverick says:
    January 19, 2010 at 5:17 am

    these are very very useful plugins. thanks a ton dude.

  12. Jordan Walker says:
    January 19, 2010 at 8:06 am

    A great list to help those starting out with WordPress.

  13. goofydg1 says:
    January 19, 2010 at 11:40 am

    nice resource.

  14. Nathan Staines says:
    January 19, 2010 at 5:46 pm

    A great round up of some very useful and powerful WordPress techniques.

    One of the other great features new to WordPress 2.9 that isn’t included in the post is the addition of the wp.me shortlinks.

    I’ve just written a blog post explaining how to use them in your site if anyone is interested.

  15. Carol Logan Newbill says:
    January 20, 2010 at 8:50 am

    #9, Block Bad Queries, is built into WP 2.9. Don’t add this hack if your WP is up to date — it breaks 2.9 and 2.9.1.

  16. Tony says:
    January 20, 2010 at 11:35 am

    Thanks for all the useful tips! I really liked the free newsletter tip!

  17. Erik Ford says:
    January 20, 2010 at 12:54 pm

    Thanks for these. I have been trying to figure out how to create custom loops for some time and, not being a PHP wizard, was coming up short.

  18. Luis Rivera Colon says:
    January 24, 2010 at 1:39 pm

    The WordPress Threaded Comments its very usefull, and i use that same hack a lot in my projects.

Trackbacks/Pingbacks

  • designfloat.com
  • You are now listed on FAQPAL
  • abcphp.com
  • pligg.com
  • Anonymous
  • CSS Brigit | 10 NEW WordPress Wanted Hacks and Powerful Techniques
  • pligg.com

Sponsored Ads

ADVERTISE HERE

Sponsored Ads

DevSnippets Latest Articles

  • Using Illustrations in WebDesign: 30 Creative Examples
    Tags: Illustration, Inspiration, webdesign Jul/20/2010
  • Dark and Mysterious High Quality Desktop Wallpapers
    Tags: Dark, Wallpapers Jun/23/2010
  • 10+ Most Beautiful Island Photography on Earth
    Jun/16/2010
  • 35 High Definition iPad Wallpapers For A Great Experience
    Tags: Inpiration, Wallpapers Jun/09/2010
  • 30 Unique Logo Designs That Actually Say Something
    Tags: Branding, Inspiration, Logo Jun/02/2010
  • Creating 10 Most-Used Javascript Techniques Using Pure CSS Styling
    Tags: CSS, Tutorial May/31/2010
  • 40 Creative Advertisements With Unexpected Ideas
    Tags: Advertising, Inspiration May/27/2010
  • Getting Slim, Spicy, & WordPress-Ready with Top 10 jQuery Plugins
    Tags: jQuery, WordPress May/25/2010
  • Spicing Up Your Tumblr Experience: Beautiful Themes, Icons and Apps
    Tags: Templates, Tumblr May/19/2010
  • 20 NEW & FREE High Quality (X)HTML/CSS Templates
    Tags: CSS, Design, Template, Tutorial May/17/2010
More Articles →

Design Community News

  • Is It Worth Shifting To Photoshop CS5?

    SloDive
    Jul/04/2010
  • Free Wordpress Theme Vector Nature Template

    templates4all
    Jul/04/2010
  • Best jQuery plugins – June 2010

    Spider8411
    Jun/22/2010
  • Freebies: Vintage Mega Pack 10 Samples from Designious.com

    Doink
    Jun/22/2010
  • CSS3 Animations, the Power Back to CSS Part 1: Transitions

    Teylor Feliz
    Jun/22/2010
  • Create a Photo-Realistic Candle with Basic Photoshop Tools

    Frank
    Jun/22/2010
  • Credit cards and payment icon set

    icon sets
    Jun/22/2010
  • 40 Refreshing Nature Inspired Web Designs

    Brukhar
    Jun/22/2010
  • How to Create a Tumblr Theme (Code Structure)

    Dainis Graveris
    Jun/21/2010
  • The Simple Photoshop CS5 Cheat Sheet

    Frank
    Jun/21/2010
More News →

Our Friends

  • Graphic Design School

  • Designm.ag

Top ↑

Add a Snippet / Design News

© 2008-2010 DEVSNIPPETS | Made by Noura Yehia | Submit Snippet | About| Subscribe | Advertise
In partnership with (mt) Media Temple