11 Powerful WordPress Scripts That Will Improve Your WordPress Website


In this post you will get 11 WordPress scripts that will help improve your blog’s performance and that may or may not stop North Korea from terrorizing us.

Either way, you will find these little WordPress hacks very useful for your daily blogging needs, which can help you save lots of precious time!

If you’re eager to enhance or improve the functionality of your WordPress site, then below are powerful WordPress scripts that will definitely give you a great head start.

Okay, these probably won’t stop North Korea from wreaking havoc, but you can’t blame a man for trying!

11 WordPress Scripts to Improve Your Blog…Right Now

On a serious note, these WordPress scripts will help you work smoothly on the back-end and will make your front-end more comfortable for your readers.

1. Add Post Meta Descriptions

WordPress does not support the use of meta description tags by default. Though metas have lost their significance in SEO, they can still influence the ranking of your blog in the search engines. To make your site search engine friendly, you should open the header.php file of your theme and copy and paste the code below to the space between the opening <head> and closing </head> tags.

<meta name="description" content="
 <?php if ( (is_home()) || (is_front_page()) ) {
 echo ('Your main description goes here');
 } elseif(is_category()) {
 echo category_description();
 } elseif(is_tag()) {
 echo '-tag archive page for this blog' . single_tag_title();
 } elseif(is_month()) {
 echo 'archive page for this blog' . the_time('F, Y');
 } else {
 echo get_post_meta($post->ID, "Metadescription", true);

As simple as it seems, this hack can help you enhance the SEO performance of your site today.

2. Split WordPress Content into Multiple Columns

Sometimes, you may want to create additional columns in your pages, but as we know, WP does not support this from the back-end. The best way of doing this is to use snippets to split page content. Locate your theme folder and add the following block of code within the opening and closing php tags.

// split content at the more tag and return an array
 function split_content() {
 global $more;
 $more = true;
 $content = preg_split('/<span id="more-\d+"><\/span>/i', get_the_content('more'));
 for($c = 0, $csize = count($content); $c < $csize; $c++) {
 $content[$c] = apply_filters('the_conte
 t', $content[$c]);
 return $content;

Once you do this and save the edited file, you will need to locate the specific theme files and comment out both the_content() and call split_content() function.

3. Redirect 404 Pages to Home Page

Although 404 Error Pages are an integral aspect of WordPress, they lower your page rankings significantly, thus making your blog or site ineffective. To help you out of your predicament, I suggest you copy the following snippet code to the .htacess file to redirect the 404 error pages to your home page.

< IfModule mod_alias.c >
RedirectMatch 301 ^/search/$ http://your-site.com/
RedirectMatch 301 ^/tag/$ http://your-site.com/
RedirectMatch 301 ^/category/$ http://your-site.com/
< /IfModule >

This hack will redirect search engine spiders way from the 404 error page to the home page and in the process, improve your rankings and site’s reputation online.

4. Define Posts Displayed in Home Page

Majority of bloggers display posts in more or less them same way on the home pages of their blogs. This is understandable since WordPress does not feature a default option to define how posts should be displayed. Fortunately, you can surmount this problem by using custom fields. To define posts in your home page, you can use either the full post or post excerpt only. You will need to access your index.php file and replace the default loop with the following custom code:

<?php if (have_posts()) :
 while (have_posts()) : the_post();
 $customField = get_post_custom_values("full");
 if (isset($customField[0])) {
 //Custom field is set, display a full post
 } else {
 // No custom field set, let's display an excerpt

5. Insert Google Maps into Pages

Have you been using iframes to embed Google maps in your contact page or sidebars? If so, chances are high that it will be rendered poorly because of the interference of the visual editor. To save yourself the trouble of using iframes, I recommend that you copy and paste the following short codes into the function.php page.

//Google Maps Shortcode
 function fn_googleMaps($atts, $content = null) {
 extract (shortcode_atts (array (
 "width" => '640',
 "height" => '480',
 "src" => ''
 ), $atts));
return '<iframe width="'.$width.'" height="'.$height.'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$src.'"></iframe>';

Once you copy and paste the above code to your function.php, you will need to copy the short code below into the exact place where you want Google Maps to be displayed.

[googlemap width="200" height="200" src="[url]"]

6. Display Page Categories in a Drop Down Menu

Sometimes, you may want to add a cool drop down menu that will show all existing categories in your WordPress site. Here is a simple way of doing it. Copy and paste the code below into the index.php or sidebar.php file.

<form action="<?php bloginfo('url'); ?>/" method="get">
 $select = wp_dropdown_categories('show_option_none=Select category&show_count=1&orderby=name&echo=0');
 $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
 echo $select;
 <noscript><input type="submit" value="View" /></noscript>

7. Display Similar Posts without Plugins

It’s also possible to display similar posts in your blog so as to draw the attention of visitors and engage them. I know you will be tempted to use a plugin to display similar posts, but there is no need to overload your WordPress blog with plug ins when you can use tags and custom codes. Here is a powerful code to do display related posts quickly. Copy and paste it to the functions.php file.

 //for use in the loop, list 5 post titles related to first tag on
 //current post
 $tags = wp_get_post_tags($post->ID);
 if ($tags) {
 echo 'Related Posts';
 $first_tag = $tags[0]->term_id;
 'tag__in' => array($first_tag),
 'post__not_in' => array($post->ID),
 $my_query = new WP_Query($args);
 if( $my_query->have_posts() ) {
 while ($my_query->have_posts()) : $my_query->the_post(); ?>
 <p><a href="<?php the_permalink() ?>" rel="bookmark" title="
 Permanent Link to <?php the_title_attribute(); ?>">
 <?php the_title(); ?></a></p>

8. Change WP Login Logo

If you are tired of seeing the same old default “log in” logo, then you can change that to display a logo of your choice. To change the logo, you need to create and copy the new custom logo.png image into the image file in your root folder then copy and paste the following code into your functions.php file.

// login page logo
 function custom_login_logo() {
 echo '<style type="text/css">h1 a { background: url('.get_bloginfo('template_directory').'/companylogo.png) 50% 50% no-repeat !important; }</style>';
 add_action('login_head', 'custom_login_logo');

9. Display Number of Facebook Fans

If you have a Facebook fan page then chances are high that you are thinking of displaying the total number of Facebook likes to visitors who access your WordPress site.

 $page_id = "YOUR PAGE-ID";
 $xml = @simplexml_load_file("http://api.facebook.com/restserver.php?method=facebook.fql.query&query=SELECT%20fan_count%20FROM%20page%20WHERE%20page_id=".$page_id."") or die ("a lot");
 $fans = $xml->page->fan_count;
 echo $fans;

In order for this code to work, you only need to replace your current page ID with your personal Facebook page id.

10. Create Custom Widgets

As much as WordPress themes come with various widgets, some users may want to add custom widgets that meets the needs of their blogs. If you are one of them, then here is a handy snippet for this purpose. Copy and paste the following code into your functions.php file.

class My_Widget extends WP_Widget {
 function My_Widget() {
 parent::WP_Widget(false, 'Our Test Widget');
 function form($instance) {
 // outputs the options form on admin
 function update($new_instance, $old_instance) {
 // processes widget options to be saved
 return $new_instance;
 function widget($args, $instance) {
 // outputs the content of the widget

11. Display Google Users’ Search Terms

Have you been trying to monitor and understand the search patterns of prospects and visitors who access your website from Google Search?If so, then you need a script that will display all terms that were searched by clients who came across your site. Paste the following code outside the header section.

 $refer = $_SERVER["HTTP_REFERER"];
 if (strpos($refer, "google")) {
 $refer_string = parse_url($refer, PHP_URL_QUERY);
 parse_str($refer_string, $vars);
 $search_terms = $vars['q'];
 echo 'Welcome Google visitor! You searched for the following terms to get here: ';
 echo $search_terms;


Though these codes appear simple, they are powerful code snippets that you can use to customize WordPress websites. You can use these codes to change the layout and functionality of your theme instantaneously and save yourself the trouble of line-by-line coding.

Do you know any WordPress scripts I have missed?



  1. 1st web fan

    Thanks for respecting the thought of others. ( Respect + )

    and hey i thought online privacy was a big deal and much advocated , a few years back. I am old school… :)

    By the way it was a nice article. Thanks.

  2. A few nice little snippets there, on point 1 id suggest using all in one seo pack or yoast plugins to manually add unique title and meta data on every page (without going into any depth of SEO).

  3. I’ve been looking for a way to show experts on homepage and still show full articles when users open the Blog page. A quick google search brought me to this page; I’ve never feel so lucky :D

    The snippets for adding meta descriptions and showing the site’s homepage instead of the usual WP 404 error page are indeed very useful. I might give the other snippets a try as well. Wish me luck!

    • Hey Kev

      Thanks for your kind words mate :)
      I’m so glad you find this article and 1WD all together useful.

      In your pinion Is there any important script snipped I should’ve included here?

  4. 1st web fan

    I thought this website was supposed to be for any one with love of webdesign, if so the author should respect every region or country without his personal preferences.

    I undertand thought to use it in fun way but it is hurtfull for any patriotic person, I am not from Korea but it felt offensive to me. And keep the world murky politics and your personal views out of this community.

    • Hey Mate :)

      First of all thank you for your comment.
      Secondly I did not say anything bad about the country itself, just mentioned the fact of reality.

      And in no way was my intention to offend anyone.
      You felt offended – My apologies.

      P.s. Can we agree you will use your real name when having a conversation with someone next time, instead of hiding?

    • Andrew

      Good point, I think it’s not the best idea(and place) to mix dirty political stuff with web development things and design. IMHO if you take a closer and unprejudiced look at what you call ‘us’ you may come to surprising conclusions.
      The rest of the article may be pretty useful for average blogger :)

  5. Sam

    These look great. I’m having trouble getting the redirect #3 to work. I keep getting a 500 internal error when the code is in place. I changed the url addresses to mine. Was I supposed to change any of the other code? Any suggestions?

    • Hi Sam
      Thanks a lot for your comment and question mate :)

      Sorry to hear you’re experiencing some problems with the code.
      Because to be honest with you you didn’t have to change anything else in the code

      Can you show my your final script snipped what you have in your .htaccess file?

  6. Dave

    The Custom Login Logo (#8) won’t work if using a child theme because get_bloginfo(‘theme directory’) will return the parent theme location.

    For child themes, use get_bloginfo(‘stylesheet_url’) instead.

    Then your function would be:

    function custom_login_logo() {
    echo ‘h1 a { background: url(‘.get_bloginfo(‘stylesheet_url’).’/custom-logo.png) 50% 50% no-repeat !important; } ‘;

    add_action(‘login_head’, ‘custom_login_logo’);

    Note: This assumes that the logo is in the child theme folder.

    • Hey Dave
      You’re totally right mate :)
      Thanks a lot for your comment.

      I always love it when I can find some useful additions in comments to my articles
      And this is one of the cases.

      I gave your comment a big fat thumb up.

      Thanks once again Dave.

  7. Hi James, love your title, although after reading your article I am wondering what a redirect to avoid a 404 has to do with our “friends” in North Corea! :-) Anyway, I pasted in the code into the .htaccess file, but I do have a question about this redirect to avoid 404s. I see other people using the 404 to tell people to go somewhere else (they have a custom 404 page with links to other content). I was just wondering if you could tell me why you think directing the 404 to the homepage with your code above is better for your blog. Can you compare these two for me and explain why you think the redirect to the homepage is better. This is not fully clear to me really.

    • Hey Jacobus
      Thanks a lot for your comment and question.
      And I’m glad to answer to you :)

      There isn’t any technical reason for it, rather “just” for SEO purposes and your rankings.

      You can read this great article by Rand Fishkin to find out more.

      I hope I helped Jacobus.

  8. Anonymous

    I’m not sure whether it’s stating the obvious, but Authorship Markup is a good feature to implement on a WordPress blog. I’m sure there’s plugins to do it, although I’m currently the only one who updates our blog so I just have the authorship information hardcoded in!

    • Hi Mate
      Ouh, that’s a nice one.
      I sure know of a plugin that does it.

      But I personally try to use as little plugins as possible (and recommend it to others too)

      So hardcoding this script in your WordPress is definitely useful idea.
      Thanks once again :)

  9. I am really inspired by this post. I am a web developer and really this stuff mean a lot to me. I am a regular reader of 1st web designer and thankful to admin for providing such good information.

    • Hey Rajasthan

      Glad to see our regular readers commenting.
      I highly appreciate it mate :)

      Which one of these scripts in your opinion is the most useful?

  10. Frondend is beautiful look but backend not smoothly support that the readers don’t like to spend on that page. You prove the 11 WP script list will help to smooth work on the backend at the time to reduce the working period.

    • Hey Arunshory
      Thanks a lot for you comment.
      I’m glad you enjoyed the article.

      I’d love to hear if you have tried any of these scripts before?