Aug 26 2009

10 WordPress ‘HOW-TO’ to Give Your Blog the Quality it Deserves


As a web developer, you can broaden your potential client base and add value for existing clients by listing ‘WordPress’ as an area of expertise. WordPress is incredibly versatile, it can be tweaked to add many non traditional features to run a more effective blog.

Throughout this article, we’ll be focus on 10 WordPress Theme ideas, tips and useful tutorials you need to have ready in hand when developing your WordPress website to enhance your blog and give it the quality it deserves.

1. How to disable scripts and styles

Many plugins and themes add JavaScript and CSS files to your site. While this alone isn’t necessarily a bad thing, using several plugins that do this can bog down your site with loads of requests for these files.

In this tutorial Justin Tadlock describes a smart solution to disable scripts and styles of your plugins by looking for wp_enqueue_script() and wp_enqueue_style() in your plugin file and then disable it in your theme’s functions.php. He chosen two popular plugins: Contact Form 7 and WP-PageNavi.

Disabling JavaScript

Doing a search for wp_enqueue_script will turn up the following bit of code:

wp_enqueue_script( 'contact-form-7', wpcf7_plugin_url( 'contact-form-7.js' ), array('jquery', 'jquery-form'), WPCF7_VERSION, $in_footer );

Now, open your theme’s functions.php file and add this PHP code:

add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );

function my_deregister_javascript() {
	wp_deregister_script( 'contact-form-7' );
Disabling Styles

Now, let’s repeat the previous step but this time we will search for wp_enqueue_style in the plugin file and the following bit of code will be returned:

wp_enqueue_style('wp-pagenavi', get_stylesheet_directory_uri().'/pagenavi-css.css', false, '2.50', 'all');

Again to disable the style of this plugin, you will open your theme’s functions.php file and add this PHP code:

add_action( 'wp_print_styles', 'my_deregister_styles', 100 );

function my_deregister_styles() {
	wp_deregister_style( 'wp-pagenavi' );

By doing the above 2 steps, you’ll disable the stylesheet and the script for this plugin. Feel free to deregister as many styles as you want within this function.

Source: How to disable scripts and styles

2. Display Thumbnails For Related Posts in WordPress

In this tutorial you’ll learn how to increase page views by adding thumbnails to related posts using the popular YARPP plugin and WordPress custom fields.

Source: Display Thumbnails For Related Posts in WordPress

3. A Custom Read More

In this post you’ll learn how to create a custom “Read More” messages on a per-post basis using custom fields in WordPress.

All you need to do is replace your usual the_content template tag with this code. Then when you write a post, create a new custom field with the key of custom_more.

<?php $custommore = get_post_meta($post->ID, 'custom_more', true); ?> 
<?php if (!$custommore) { $custommore = 'Read More &raquo;'; } ?> 
<?php the_content($custommore); ?>

Source: A Custom Read More

4. Get the first image from the post automatically and display it

Most WordPress users including me are using custom fields to display thumbs on their blog homepage but i recently stumbled across a simple php function that allows you to grab the first image from the post automatically, and display it on your home page without the need to add any custom field to the post.

All you need to do is paste the following function on your theme’s functions.php file.

function catch_that_image() {
  global $post, $posts;
  $first_img = '';
  $output = preg_match_all('/<img. src=[\'"]([^\'"] )[\'"].*>/i', $post->post_content, $matches);
  $first_img = $matches [1] [0];

  if(empty($first_img)){ //Defines a default image
    $first_img = "/images/default.jpg";
  return $first_img;

After that you need to open your theme’s index.php and paste the following code where you want to display the first image in each post.

<?php echo catch_that_image() ?>

Source: Get the first image from the post and display it

5. How to Highlight Search Terms with jQuery

Spice up your WordPress search page by highlighting search terms within your search results. The solution described in this tutorial will highlight both the title and post content and is a drop-in modification for WordPress.

Now you need to paste the following code in your theme’s functions.php file.

function hls_set_query() {
  $query  = attribute_escape(get_search_query());
  if(strlen($query) > 0){
    echo '
      <script type="text/javascript">
        var hls_query  = "'.$query.'";
function hls_init_jquery() {
add_action('init', 'hls_init_jquery');
add_action('wp_print_scripts', 'hls_set_query');

After that you need to open your theme’s header.php and paste the following code (just before the </head> tag)

<style type="text/css" media="screen">
  .hls { background: #D3E18A; } /* <- Change the CSS style of */
                                /*    highlighted texts here. */
<script type="text/javascript">
  highlight: function(search, insensitive, hls_class){
    var regex = new RegExp("(<[^>]*>)|(\\b"  search.replace(/([-.* ?^${}()|[\]\/\\])/g,"\\$1")  ")", insensitive ? "ig" : "g");
    return this.html(this.html().replace(regex, function(a, b, c){
      return (a.charAt(0) == "<") ? a : "<strong class=\""  hsl_class  "\">"   c   "</strong>";
  if(typeof(hls_query) != 'undefined'){
    $("#post-area").highlight(hls_query, 1, "hls"); // <- Change 'post-area' to ID of HTML tag you
                                                    //    want to highlight search terms in.

Source: How to Highlight Search Terms with jQuery

6. Display Latest Posts by Category Archive

This tutorial will help you build a ‘Latest Posts by Category Archive‘ easily, this can be used to set up custom blog homepages, 404 pages, landing pages or even a special archive page. If you are looking for a plugin to generate such an archive, please check out: WP Plugin: Latest Posts by Category Archive.

Source: Latest Posts by Category Archive

7. Only Show Posts With a Specific Custom Field

Sometimes you only want to show posts that you’ve added a specific custom field to. A typical post loop begins like this:

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>

Now you just add a simple query_posts function immediately above the loop code. In our scenario it would look like this:

<?php query_posts('meta_key=review_type&meta_value=movie');  ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>

Source: Only Show Posts With a Specific Custom Field

8. Find Page’s Top Level Parent ID

This post discusses the problem of displaying 2nd and 3d level of navigation in a sidebar no matter what page you are on. First thing you need to create is a new page (subnav.php) in your theme folder that you will be using for displaying side navigation from 2nd level downwards and include it in your theme’s sidebar.php

<?php include("subnav.php"); ?>

Now you just add the following code to your subnav.php:


if ($post->post_parent)	{
	$parent = $ancestors[$root];
} else {
	$parent = $post->ID;
$children = wp_list_pages("title_li=&child_of=". $parent ."&echo=0");
if ($children) { ?>
<ul id="subnav">
<?php echo $children; ?>
<?php } ?>

This code checks if the current page has a parent. If so, that means that we are at least 2 levels deep in the navigation. In that case function get_post_ancestors is called and returns an array of all the ancestors’ IDs up to the top level (root). Once we get the ID of the top level parent we can use it in wp_list_pages function to get its children.

Source: Find Page’s Top Level Parent ID

9. List latest posts from certain category

Currently i am working on Noupe’s new theme, and i wanted to display recent posts from one category. I stumbled across a smart code snippet that will get this job done.

<?php query_posts('category_name=photoshop&showposts=7'); ?>
<?php while (have_posts()) : the_post(); ?>
           <a href="<?php the_permalink(); ?>">
               <?php the_title(); ?>
<?php endwhile; ?>

The query_posts code is telling WordPress to locate the latest 7 posts in the Photoshop category. The loop then runs the code to display them.

Source: List Recent Posts from One Category

10. Add Breadcrumbs to WordPress Without a Plugin

Breadcrumbs are a great way to give people a perspective of where they are on your site. You can easily add them via several good plugins. But if you want to build breadcrumbs into a theme without using a plugin, here is what you need to do.

Create a php file called breadcrumbs.php and insert the following code:

<div class="breadcrumbs">
function breadcrumbs() {
    $theFullUrl = $_SERVER["REQUEST_URI"];
    echo %u2018You Are Here: <a href="/">Home</a>%u2019;
    while (list($j,$text) = each($urlArray)) {
        if ($j > 1) {
            while ($i < $j) {
                $dir .= %u2018/%u2019 . $urlArray[$i];
                $text = $urlArray[$i];
                $i  ;
            if($j < count($urlArray)-1) echo %u2018 &raquo; <a href="%u2019.$dir.%u2018">%u2019 . str_replace("-", " ", $text) . %u2018</a>%u2019;
    echo wp_title();

Wherever you want to add the breadcrumbs in your theme files, just add the following line…

<?php include ( TEMPLATEPATH . %u2018/breadcrumbs.php%u2019); ?>

Source: Add Breadcrumbs to WordPress Without a Plugin

About the Author

The jungle is alive: Be it a collaboration between two or more authors or an article by an author not contributing regularly. In these cases you find the Noupe Editorial Team as the ones who made it. Guest authors get their own little bio boxes below the article, so watch out for these.


Comments and Discussions
  • Rainer Bendig, 26 August 2009

    Hi ;-)

    some great hints.

    (And a wrong image in the breadcrumbs part)


  • dlv, 26 August 2009

    excellent as always !
    I’m goonna check the #1, I have to fix something around that using that snipe..

    I don’t understand the difference between #6 “Display Latest Posts by Category Archive” and #9 “List latest posts from certain category ” jejeee

  • Martin Brumana, 26 August 2009

    I like wordpress, i use wp in my blog… is fantastic, i from argentine!


  • KayRose, 26 August 2009

    I realy love 7.Query_Posts, use it alot, however there are some draw backs, since you can’t use pagination that easily with ‘showposts=’ :)

  • yasser, 26 August 2009

    Important post ..

    Thanks noupe :)

  • Nice guide, thanks.

  • Tom Karels, 26 August 2009

    The breadcrumbs code is money, thank you thank you thank you.

    I will be implementing to all my sites from now on.

    I love you

  • Shawn Hesketh, 26 August 2009

    Great list, once again. Can’t wait to share this list with my readers!

    Keep up the great work, you guys!

  • Alif Rachmawadi, 27 August 2009

    Great post as usual. Ready to implement on my blog. Thanks!

  • Skech, 27 August 2009

    Love this post. Thank you! Now i need lot of time to use all of this tips.

  • Zhu, 27 August 2009

    These are awesome tips! I’m implementing the thumbnail trick on my blog right and looking into displaying related post with images.

    Thanks! :-)

  • Brandon Cox, 27 August 2009

    Wow, just saw myself in the source for the breadcrumbs code – thanks for the inclusion, and great article!

  • Brett Widmann, 27 August 2009

    Excellent post. Wonderful code snippets and suggestions. Going to give a few of these a try and see what happens!

  • toniecw, 27 August 2009

    very good information. thank you

  • James, 27 August 2009

    Great post! Must read for any serious wordpress blogger. Gonna try out some of these tips in my blog!

  • Andrea Cima Serniotti, 27 August 2009

    Excellent post! I’m new on this site but ?I just love it.. Thanks a million.

    ID; if(count($post->ancestors) > 0) $parentId = $post->ancestors[0];
    $pages = get_pages();
    $count = 0;

    function pSort($p1,$p2){
    if($p1->menu_order == $p2->menu_order)
    return 0;

    return (($p1->menu_order > $p2->menu_order)? 1 : -1);


    foreach($pages as $p)
    // echo ”.print_r($p,true).”;

    $class = ”;
    if($p->post_parent == $parentId)

    if($count == 1)
    echo ‘In this section’;
    echo ”;

    echo ‘ID).’”>’.$p->post_title.’‘;

    if($count > 0)
    echo ”;


  • Andrea Cima Serniotti, 27 August 2009

    Ups! I’m sorry.. I didn’t finish my comment above but for some weird reason it’s been posted! Basically, I’ve used the above code to sort out the problem regarding point no. 8 – Find Page’s Top Level Parent ID

    This bit of code allows me to set an active class on the menu item and manage the order of the items too.

    I’m sure it might be rewritten in a better way though!

    • Noupe, 27 August 2009

      Thanks Andrea :) Will try it and hopefully it will save us some time.

  • Andrea Cima Serniotti, 27 August 2009

    It’s always a pleasure to give a contribution to you guys! In fact, it would be great if somebody with PHP skills (something I’m missing :-)) could merge the two codes and come up with a clean script that allows to set the active class and to manage the items order.
    Thanks again and keep posting such great and useful articles!

  • Rishi Luchun, 27 August 2009

    Thanks for these, going to try and implement some of these.

  • Aayush, 27 August 2009

    Sweet!…I am working on my blog theme update…these will come in handy…

  • Kevin Lloyd, 27 August 2009

    I have a question about #1.

    Won’t that just dequeue all JS for that plugin? How would I disable just ONE? For example, all the scripts that need jQuery and decide to package their own versions.

  • Rahul - Web Guru, 28 August 2009

    A superb wp hack for any wp developers.

  • Jamie Allsop, 28 August 2009

    Thanks for sharing these useful tips. Next time I get a chance I am going to try some of these tips and see what happens.

  • PiccoloSocrate, 28 August 2009

    Thanks for sharing about the “custom read more”. Who does know how to improve it with an image?

  • purwokerto, 29 August 2009

    it has been a long i found this one.thanks a lot.

  • Corbin, 31 August 2009

    Always love to read these posts. Great work as always.

  • Gerhard, 31 August 2009

    Hey man.. awesome collection!

    Thanks a lot :D

  • WPDITE, 31 August 2009

    That’s the perfect 10 for wordpress. Thanks for sharing.

  • cooledit, 01 September 2009

    thx man…

  • CMYK, 01 September 2009

    Thanks 4 information !!!!

    Nice BloG!

  • Wordpress Arena, 01 September 2009

    this is really gr8 and helpful

  • denbagus, 02 September 2009

    The best information i have found exactly here. Keep going Thank you

  • Ahmed, 03 September 2009

    Very nice i liked the tut about show posts using custom filed

  • jonty, 06 September 2009

    this is a useful techniques.thanks for a nice article i might be thinking to change my theme and this will be a very useful guide for me.

  • info bisnis purwokerto, 09 September 2009

    what a great post.thanks i can enjoy my wordpress now.pram from Indonesia say HELLO there..nice job Bos.

  • manSur, 01 October 2009

    Oh my god, Almost every I need for my blog…

    seriously awesome post…
    tq for this…

  • Satish Gandham, 04 October 2009

    Great post, disabling plugin styles really helped me improve my theme :)

  • Jojo, 28 October 2009

    Excellent tutorials;
    Btw, I am newbie in wp and am trying to display the first image of the post (tutorial #4) but failed. When I insert the code, the index template become mess. Any clue?

  • Peter Netz Lassen, 28 October 2009

    Hi Lads,

    Thx for sharing. Just what I was looking for!
    This is cool hacks – I will be coming back to check for some more goodies.


  • Rachelle, 10 November 2009

    hi.. good article.. but er.. do u have 1 for dummies?? hehe.. i oso wanna learn but kinda not understanding the codes and how to. pretty pretty please??? =)

    tx lots.. god bless!

  • These are really techy stuffs but you’ve delivered it in a way that it can be easily understood. Thanks for sharing this useful and important information.

  • Joey Briglio, 02 December 2009

    Great post. Thanks for the insights.

  • BeyondRandom, 17 December 2009

    some great tips here to use! thanks alot

  • Digital Products, 19 December 2009

    After disabling scripts and styles my blogs are downloading faster. Thanks for the other great tips.

  • WPExplorer, 25 December 2009

    These are some great tips. I will be adopting some of them shortly. Thank you.

  • trickyourwhip, 13 January 2010

    This is a great website to post secret messages on using Google Secret Speedtags, just go to Goole and search for ” leave a response” to find others like this to post your own secret messages…

    google register speedtag secretspeedtag apagetopostsecretmessageson

  • Roodude, 13 January 2010

    Has Noupe given up on WP posts? Seems like both Noupe and SM have scaled way back. Some of us really miss them because what you used to do was well done.

  • Kris, 24 January 2010

    I love your Archives page with the dropdown menu and the listing of posts with thumbnail and title.

    Would you be willing to share how you set that up?

    Thank you kindly. Your site is very valuable and I appreciate all the fantastic resources here!

  • wparena, 03 February 2010

    After reading now have add Related post by using An other related post plugin, its really helpful ..once again thanks for sharing

  • RodgerFox, 04 February 2010

    Thanks, nice. Many bloggers from Russia love reading your blog

  • Webtoolfeed, 06 February 2010

    Great post, nice points!

  • KARTIK, 16 February 2010


  • indir, 10 March 2010

    10 wordpress how to give your blog article is very educative.. thanks

  • You got a truly helpful blog I’ve been right here reading for about an hour. I’m a newbie and your accomplishment is incredibly a lot an inspiration for me.

  • Adam, 11 June 2010

    I don’t consider myself a techie, but found a lot of the information here very easy to follow and understand. The “Custom Read More” tip is especially helpful for a project I’m currently working on. Thanks for putting it together and sharing.

  • Hieu Martin, 08 July 2010

    Great post. Thanks for sharing

  • Vadim Bitner, 10 July 2010

    that is a good point

  • VahnDee, 13 July 2010

    wow… nice post..
    i really need it..
    thx.. :)

  • free music podcast, 23 July 2010

    Nice tips. I run my music podcast blog via wordpress and its cool to get these tips thanks for sharing them.

  • Ali, 20 August 2010

    Really a nice post and some good stuff to use. Appreciated.

  • Evgeniy, 07 September 2010

    Really nice ‘How to’ advices – i use it in my site. Thanks!

  • dori girsang, 11 October 2010

    i really like it CRTL + D

  • PTEC, 23 November 2010

    Thank you for your useful post
    a lot …

  • Beatris Mireles, 02 December 2010

    I like this concept. I visited your blog for the first time and simply been your supporter. Continue to keep writing as I am planning to come to read it everyday!!

  • Cialis, 20 January 2011

    The following time I read a weblog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to learn, but I actually thought youd have something interesting to say. All I hear is a bunch of whining about one thing that you can fix in case you werent too busy in search of attention.

  • cinnamon, 08 February 2011

    Thanks! great info

  • Ed, 19 February 2011

    absolutely useful post for intermediate WordPress users. Thanks.

  • gbsquared, 01 March 2011

    some great tips!

    i look forward to implementing them in some of my designs.

  • Awais, 29 March 2011

    wow these are awesome and cool tricks….

  • Ajay, 19 May 2011

    Awesome tutrial.
    “Add Breadcrumbs to WordPress Without a Plugin” is the one I was looking for. For some reason the breadcrumb plugin doesn’t install on one of my blog and I needed a custom code for it.

    Tx for sharing.

  • Dipesh, 26 July 2011

    Simply amazing guide. I never knew that this will be so easy.

  • Pulkit Kaushik | TheDolt, 15 October 2011

    I really liked the disabling script thing. Thanks!

  • Mary, 30 December 2011

    Wow, there are so many great tips for more advanced WordPress users. I love them. Thank you for putting them and sharing!

  • ApipCinta, 23 August 2012

    Thanks for your information and for your sharing…Great Article

  • Simon, 07 September 2012

    These tips are not something that the noob would know to do to optimize their WordPress site. So I appreciate you mentioning some of these tips. They’re great. Especially the one creating the custom “read more” button. Most people just go on .. and on… with their text.

search form
image description image description