WordPress post related hacks to improve your template

Posted in Development by Alex | Tags: hacks, post, Wordpress
WP Greet Box icon
Hello there! If you are new here, you might want to subscribe to the RSS feed for updates on this topic.

In this article you will find various ways of improving your theme by adding various wordpress post hacks like showing related posts, setting up and showing scheduled posts or showing a featured post. All of these hacks can optimize your wordpress blog by increasing time on site, bounce rate and other SEO issues.

How to show related posts based on keywords

First up Download, install, and activate the “Ultimate Tag Warrior fin” plugin. After this open up your single.php and before the comments template:

<?php comments_template(); ?>

insert this code snippet:

<div class="relatedposts">
<h2>Related Posts</h2>
<?php UTW_ShowRelatedPostsForCurrentPost("posthtmllist", "", "4"); ?>
</div></php>

You can set up the number of related posts by increasing the number “4″. Save the single.php and refresh your website. The posts will be shown based on the related keywords other posts have. You can also further stylize your snippet by creating a class entry “relatedposts” inside your style.css file.

How to list scheduled posts

Sometimes, you schedule posts instead of stuffing them all together at one time. This can be useful if you have much to write about and if you want to let your readers know what to expect for the future. This encourages the reader to visit you again and read that great post you scheduled for another day.

Ok, this snippet is easy to install, just paste the following code anywhere inside your theme files that you want the scheduled post to appear:

<?php
$my_query = new WP_Query('post_status=future&order=DESC&showposts=5');
if ($my_query->have_posts()) {
    while ($my_query->have_posts()) : $my_query->the_post();
        $do_not_duplicate = $post->ID; ?>
        <li><?php the_title(); ?></li>
    <?php endwhile;
}
?>

How to show a random featured post

This hack is useful for a number of reasons like SEO optimization, reader engagement, low bounce rate or having something to show-off. And here is how you can do it:

First you need to download this plugin, install and activate it.

Next thing is to open up your index.php file, and right after this tag

 <?php if (have_posts()) : ?>

insert this tag

 <?php show_featured_post(); ?>

You can customize this further by wrapping the tag within a css style like this:

 <div style="padding:10px; border:5px solid #ccc; margin-top:10px;">
<?php show_featured_post(); ?>
</div>

You may be interested in these also:

One Comment to “WordPress post related hacks to improve your template”

Post comment

CommentLuv Enabled