Create Google-Style Page Navigation for wordpress

March 26, 2009

It can be very tedious to navigate through a category on a WordPress blog. Your navigation options tend to be limited to “Next Page”/”Previous Page”. Not the most efficient method in the world… When you do a search on Google, you can skip to page 3, 4, 5 or anything else. And once you do, you can always click back to page 1. It makes flicking through a large number of results much, much easier. So, why don’t we recreate that in WordPress by ourself? This bit is easy. Just copy and paste the following... [Read the full story]

Display most popular content in wordpress sidebar

March 26, 2009

Highlighting the most popular posts on your site is a great way to send new visitors to your very best content and win them over. What about giving them a quick access to your most commented posts? There are a few different ways you can do this, and quite a few plugins out there to help. What we’re going to do is quite simple, we will set up a query to get an ordered list of your most commented posts from your database, and then display those any way we like. Setting this up as a sidebar widget is very easy. Just copy... [Read the full story]

Show related wordpress posts without plugin

March 24, 2009

Displaying related posts is a very great way to help visitors staying longer on your blog. You can use a plugin, but you also can use tags and a custom code to show related posts. This code will display related posts based on the current post tag(s). It must be pasted within the loop.   <?php //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;   $args=array(     'tag__in'... [Read the full story]

Exclude Certain WordPress Categories from Being Searched

March 18, 2009

You may not want all of your categories to appear in your search results. For example, if you’ve set up a sidebar asides category, you may not want those short snippets tangling up with your results. To remove a category, first open up your theme’s functions.php file (Or create a blank file with that name if your theme doesn’t have one); Then paste the following code at the end: <?php function SearchFilter($query) { if ($query->is_search) { $query->set('cat','8,16'); } return $query; } add_filter('pre_get_posts','SearchFilter'); ?> Simply... [Read the full story]

Highlight the Search Terms in WordPress Search Results

March 18, 2009

When you search on Google or any other major search engine, the words you searched for are highlighted in the results to make it easier for you to scan. We can do the same with your wordpress search results page. In your search.php, search for the following: <?php the_title ();?> This is the code for showing the title of each of the results. In the default theme, it will be wrapped up in a line like this: <h3 id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink()... [Read the full story]