Does you web presence lack style?

The definition of Swank is: Imposingly fashionable or elegant; grand. It is our desire to offer you elegant and affordable solutions for your blog or website. Take a look around and let us know what we can do to take your site to perfection.

Posts Tagged ‘php’

How to add Related Posts with (or without) Thumbnails to your WP Blog

July 20, 2009 by   

Tutorials


Adding related posts to your blog is a great way to help your readers find other posts on your site that interest them. And if you have ads, increasing the number of pageviews on your blog can turn out to be quite lucrative. I recently had a request from a client to use a certain widget that she had seen on many other blogs that adds a list of recent posts along with a thumbnail image from that post. But after looking at the widget and researching the many other plugins that are available to add this functionality, I decided I wanted to find a way to code it directly into the template.

One reason for this is that the more plugins installed on a blog, the more that can slow down the loading time of that blog. If you can hard-code a function into the template, it’s almost always preferable to using a plugin. Plus many of the plugins or widgets I looked at gave very little control over things like styling or where the list appears in the template or even how they even figured out what was “related”. What if you want them to be related by tag instead of category or vice versa? What if you just want other posts by the same author?

After doing some more googling and modifying some of the code I found I figured out how to do everything I wanted to and more. My client was extremely pleased with the results and was amazed that I’d even been able to implement it without using a plugin or the widget she had originally wanted:

“It IS cool! A zillion people are going to see it now and want it on their WP blogs! Thanks!”

Which leads us to this post. I thought I would share my findings so that you can implement the same feature on your own WordPress blog. Below I will show you how to add related posts by category, tag or author. I will preface this by saying you should probably have some very basic knowledge about how to edit a template in WordPress, but for the most part, you can copy the code directly and paste it into your template. That’s it. For people with more advanced knowledge I’ll point out things that you can edit further and customize to your liking.

Continue Reading »





Stay Updated

RSS Get new post updates by Feed or Email

Twitter Follow Swank on Twitter

Facebook Become a Fan on Facebook

Twitter Recent Tweet




Topics



Recommended Books

Interested in Web Design or Blogging? These are the books we recommend to get you started.

  • The IT Girl's Guide to Blogging with Moxie
  • WordPress For Dummies (For Dummies (Computer/Tech))
  • Designing with Web Standards (2nd Edition)
  • CSS Mastery: Advanced Web Standards Solutions
  • Bulletproof Web Design: Improving flexibility and protecting against worst-case scenarios with XHTML and CSS (2nd Edition) (Voices That Matter)
  • HTML, XHTML, and CSS, Sixth Edition (Visual Quickstart Guide)
  • The Zen of CSS Design: Visual Enlightenment for the Web (Voices That Matter)
  • Transcending CSS: The Fine Art of Web Design (Voices That Matter)