DevSnippets
Subscribe by RSS
  • DevSnippets FEED
  • |
  • User Link Feed
  • |
  • Code Snippets
  • Home
  • Contact Us
  • About
  • Archives
  • ADVERTISE
  • Follow Us
  • CSS
  • jQuery
  • Menus
  • Layouts
  • WordPress
  • javascript
  • IE Hacks
  • Mootools
  • Prototype
  • WordPress Hacks
  • more →

Results

In {Article} -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

What others said...

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
  • Tabs (28)
  • Forms (133)
  • Menu (63)
  • Tables (9)
  • Navigation (36)
  • ToolTips (23)
  • LightBox (41)
  • Calendar (9)
  • AutoComplete (13)
  • Accordion (15)
  • Sliders (40)
  • Gallery (84)
  • Image Effects (62)
  • Date & Time (16)
  • Charts (16)
  • Carousel (12)
  • Tag Clouds (1)
  • Links (1)
  • Layouts (82)
  • IE Hacks (19)
  • Image Sprites (7)
  • Sliding Door (7)
  • Techniques (84)
  • Image Effects (17)
  • Font Styles (22)
  • Positioning (5)
  • Menus (42)
  • Rounded Corner (20)
  • Tools (1)
  • Drop Shadows (1)
  • CSSFrameworks (2)
  • Mootools (84)
  • jQuery (339)
  • Prototype (23)
  • Scriptaculous (10)
  • Javascript (126)
  • javascript Framework (1)
  • LOG IN:

    Not a member? JOIN NOW!
     Username                   Password
    Remember me Recover password

ADVERTISE HERE

Add a Snippet / Design News

Mar/22/2010

Stylize Your Own Checkboxes

hdytsgt
Checkbox is one of the most frequently used element on the forms, plain checkbox will ...
Mar/22/2010

Nivo – A new jQuery image slider

readactor
This is a new launched image slider what use jQuery. Is cross browser and have ...
Mar/22/2010

Introducing AJAX Hotel Reservation Form...

Martin Ivanov
HotelReservationForm.AJAX is a full featured AJAX solution for websites that provide online room reservations. It ...
Mar/21/2010

AJAX TabStrip

Martin Ivanov
TabStrip.XML is a powerful lightweight AJAX component providing tabbed interfaces for websites.
Mar/19/2010

How To Add Author Box On Your Wordpress...

Jaspal Singh
WordPress
Author Box is always nice to have on your Wordpress blog, not only because it ...
Mar/19/2010

Practical Uses for the Post-Thumbnail...

Onextrapixel
WordPress
Before the ability to register post thumbnails in themes was introduced in WordPress 2.9, ...
Mar/19/2010

CSS Box-Reflect – Reflection...

Webstandard-Team
With CSS and the support of webkit based browsers, there is the possibility to generate ...
Mar/18/2010

[Code Snippet] CSS : Hover and Press...

hdytsgt
You must be familiar with css button with hovered and pressed-style, we always meet them ...
Mar/18/2010

Mask Your Input Forms and Make It

hdytsgt
Text masking is an alternative for us to display information what type of content user ...
Mar/18/2010

11 Wordpress Plugins To Manage Your Ads...

dicky83
WordPress
These 11 Wordpress plugins help you effectively manage your banners so that you monetize your ...
More Code Snippets →

Design Community News

  • Interview with Allan Szacher from Zupi Magazine and Awesome Cover Showcase

  • 13 Must Have Firefox Addons to Boost the Productivity of Bloggers

  • 42 Perfect Web Design Layouts From DeviantArt

  • 185+ Very Useful and Categorized CSS Tools, Tutorials, Cheat Sheets

  • Creating Seamless Textures from Photos in Photoshop

  • Four Steps For Effective Cross-Cultural Website Design

  • Premium Quality Free Social Network Icon Pack

  • Powerful Historic War Photography

  • Sketch Fonts for WebDesigners

  • 30+ Best Apple Inspired Photoshop Tutorials

More News →

Top ↑

Add a Snippet / Design News

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