1,178 views

Categorized | MattNutts Stuff

See All Posts By crkian

0

Showing Related Posts

Posted on 18 October 2007 by crkian

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Now you have your theme and the rest its time to build in some functionality that will enable visitors to browse deeper into your site than just the post they come to see.

One way to do this is to show the related posts somewhere on the site for this I am going to add them at the end of the post so before a visitor gets to the comments they will see these.

For this I am going to use Similar Posts most of these sort of plugins use the tags to check for related posts, this depends on you actually adding tags and them being relevant ones to the post.

Default settings for this plugin checks the 20 most frequent words and uses that for its output. This can be altered for your needs.

Uploading and Installing

If you are new here its easy to just skip this box, otherwise please read the contents

Simply download the plugin and unzip it to a folder on your desktop. Ive created a folder called ‘MattNutts’ everything I will use for this site will be kept in that folder so its easy to get to and I know where everything is.

For this you will need an ftp transfer programme so you can upload the unzipped files to your webserver I use CuteFTP but there is plenty of others out there.

Simple steps to add the plugin and get it working.

1 Click on the link to download the file then extract the files to the folder you have created for the files.To create a folder right click the desktop and select new and then folder.

2 Start up your ftp software and enter the details for your server, these will most likely be Username, Host, Password and Site Name.

3 You need to upload the files to /wp-content/plugins if you have installed wordpress into a subfolder other than the Site Root (the first area your ftp will find) you will need to browse to it, it could be something like - wordpress/wp-content/plugins. The easiest way to tell if you are using a subfolder is to browse to your wordpress homepage for mine I just type in http://mattnutts.com yours could be the same but your site name or it could have extras after it like .com/wordpress or .com/myblog

4 When you see the folder open it so you are inside your plugins folder on your server then select the Similar_Posts folder and drag it over to the plugin folder, the upload should start and everything will transfer over.

Once it is uploading goto ‘Plugins’ in the admin area of wordpress and activate Similar Posts. To find the options for the plugin you need to use the ‘Options’ menu item in wordpress admin.

You will be greated by a long list of options which is what makes this stand out from the crowd, everything can be altered and changed to suit your needs.

What you see

Number of posts to show:

This one explains itself. Choose the amount of relevant posts you want to include default is 5

Number of posts to skip:

If for any reason you want to skip any posts you can using this option, it may send them a little deeper into your site but it may also skip anything that might be important to the post. Default is 1

Show password-protected posts?

Explains itself, why make a post Private if you are just going to show it in here, so you may as well keep it off.

Show static pages?

This is if you want to show pages as well as posts, pages normally include, about me, contact me. I would suggest keeping this off.

Limit matches to same category?

This one is hit and miss, while it will show related posts in the category it wont help visitors find other categorys, Im going to keep mine off.

Maximum number of words to use for match:

How many words should it check for the counting that it does, 10 should be fine

Relative weight of post title vs. content:

You should have your post set up so the title contains most of the keywords you want to use, so I set mine to high, it should pull up more keywords from the title than the post itself

Handle extended characters?

It slows it down if it has to handle characters so keep it off

Default display if no matches:

This by default shows ‘None Found’ but you could change it to your needs or even add a link to your RSS Feed or About Me page.

Text and codes before the list:

Lets you specify text and HTML before the list of items. By default

is used but you can make it blank and specify the code in the template if you wish.

Text and codes after the list:

Same as Above


Output template:

I will let them explain this one

The output template specifies what gets displayed for each item in the output. For example, the default output template for Recent Posts is

  • {link}
  • . Read from left to right it governs how what gets displayed for each item in the list of recent posts. In this case it is a beginning and ending HTML list tag with something in between. The code, {link}, gets evaluated for each item — and displays the post’s permalink with the post title as the text and the date of posting as the ‘tooltip’.

    The output template treats anything between ‘{’ and ‘}’ as a special instructions or tag. A full list of tags is given below. The tag system allows you to customise the plugin’s output to a high degree, for example,

    {link} by {author} ({commentcount} comments)
    {snippet:50} …

    outputs each item as part of a definition list showing the permalink, the author, and the number comments the post has, followed by a 50-character snippet of the content and a trailing ellipsis.

    The exact way these elements are displayed depends on your theme’s CSS. Applies to each plugin

    Text to trim at start:

    Most frequently the plugin output will be some kind of list with each element sandwiched between matching tags. Sometimes, though, you might want to have the output separated rather than wrapped: a comma-separated sequence of items would be an example. The output template ‘, {link}’ would basically do the trick but would

    produce an unwanted ‘, ‘ at the front of the first item. This option lets you enter ‘, ‘ and have the offending comma and space trimmed neatly out of existence.

    Find tagged posts (a,b matches posts with

    either tag, a+b matches posts with both tags):

    This option only works for WP 2.3+. By specifying a tag or list of tags you can select posts which match. For example, TAG A selects any post with that tag; TAG A, TAG B selects any post with either tag; and TAG A + TAG B selects any post with both tags.

    Posts to exclude:

    Enter the post IDs if you don’t want them to appear in the results

    Authors to exclude/include:

    Easy to use checkbox, simply include the authors you want to include

    Categories to exclude/include:

    The same sort of checkbox where you can include and exclude for your own needs

    Other plugins’ tags to remove from snippet:

    If {snippet} is present in the output template the plugin tries to produce a simple glimpse of the post’s content without HTML or markup. However, many plugins insert pseudo-tags of their own which can mess up the snippet. If you want these tags to be fully expanded you can use the {excerpt} output tag instead but if you simply want them cut out from your post you can specify a set of opening and closing pseudo-tags to be removed.

    For example, ‘[tag]’ and ‘[/tag]’ will cut out the whole of ‘[tag]embedded stuff[/tag]’ while ‘[’ and ‘]’ will remove ‘[insert stuff here]’. In these examples it would be very important to place ‘[tag]’ above ‘[’ so they are removed in the right order.

    Once you have set the settings click update in the bottom right of the page.

    How to Include It In The Post

    This is the part that can be a bit tricky, to include it in a post you need to add <?php similar_posts(); ?> to the html within the post php file

    So from the wordpress admin goto ‘Presentation’ then ‘Theme Editor’

    On the right under theme files you should see ’single post’ or ’single’

    Click on it and the html opens to the left of where you clicked.

    If you look through you should see something like

    <?php the_content(’<p class=”serif”>Read the rest of this entry »</p>’); ?>

    Just drop in <?php similar_posts(); ?> after that line and then save, check your blog from the frontend and it should have worked. Have a look after my digg button here, as you can see it has related posts to this one.

    If you have any questions leave a comment and I will try to help.

    [?]
    Share This

    Popularity: 4% [?]

    If you enjoyed this post, make sure you subscribe to my RSS feed!

    Leave a Reply

    $1 Per Day Advertising