Warning: Invalid argument supplied for foreach() in /home/jared/jaredquinn.info/public_html/wordpress/wp-content/plugins/head-meta-desc.php on line 56
Jared Quinn :: Wordpress
Jared Quinn

IT Consulting :: Design :: Events Management

Wordpress


sublist v2.3 Released


The latest version of subList, version 2.3, the recursive page lister for WordPress has been released.

Whats New?

  • More flexible formatting
  • No longer incompatible with “List Subpages” plugin.
  • Uses more standard tags (no longer uses HTML comments)
  • Fully backward compatible.

It can be downloaded from the SubList page.

Recent Posts


This is how I got my “Recent Posts” list appearing on my front page and sidebar for various pages.

I run the SEM Static Front Page plugin to provide the non-blog front page to this website, this website wasn’t originally planned as a blog, but as I’ve developed it, i’ve found the blog functionality to be better for some parts of the site and began using it more. It is certainly better then managing too many WordPress pages.

The code I used for generating the list I found in the old WordPress wiki, thanks to at http://wiki.wordpress.org/Recent Posts thanks to Nick Momrik.

Here it is:

function get_recent_posts($no_posts = 5, $before = ‘<li>’, $after = ‘</li>’, $show_pass_post = false, $skip_posts = 0) {
    global $wpdb, $tableposts;
    $request = “SELECT ID, post_title FROM $tableposts WHERE post_status = ‘publish’ “;
        if(!$show_pass_post) { $request .= “AND post_password ='’ “; }
    $request .= “ORDER BY post_date DESC LIMIT $skip_posts, $no_posts”;
    $posts = $wpdb->get_results($request);
    $output = ‘’;
    foreach ($posts as $post) {
        $post_title = stripslashes($post->post_title);
        $permalink = get_permalink($post->ID);
        $output .= $before . ‘<a href="’ . $permalink . ‘" rel="bookmark" title="Permanent Link: ‘ . $post_title . ‘">’ . $post_title . ‘</a>’ . $after;
    }
    echo $output;
}

Nick suggests adding it to the my-hacks.php file for older versions of WordPress, I use a plugin called “My Extras” which I stick functions like this one into. This makes it nice and easy to enable/disable the entire plugin when things go a little wierd on me (yes, it does happen!)

Creating a plugin like that is relatively easy, and there is plenty of documentation on it in the Codex

Next, I added some code to my Home page in WordPress’s Manage Pages.

<div style=“float: left; margin: 5px; border: 1px solid #973131;”>
<ul style=“list-style: none; font-size: .80em; color: #973131;”>
<h5 style=“font-size: 1.5em; margin-bottom: 5px; color: #973131;”>Recent Posts</h5>
<?php get_recent_posts(10, ‘<li style="margin-bottom: 5px;">‘, ‘<br />‘, 0); ?>
</ul>
</div>

This should be stylised and put in my style sheet, I will get to that another time, for just getting it working I tend to throw styles into the documents. Bad practice. Guilty as charged.

Next to the sidebar.php file.

I decided my front page should have the links in the content, but other pages will have the list in the sidebar. Instead of the list on the front page, I’m going to display a list of Categories and the number of posts in each.

<?php if($post->post_name == ‘home’) { ?>
        <ul><li id=“pagenav”><h2>Categories</h2></li>
        </ul><ul style=“line-height: 1.25em;”>
        <?php wp_list_cats(‘list=1&children=1&optioncount=1&hideempty=1′); ?>
        </ul>
       
   <?php } else { ?>
        <ul style=“font-size: .80em;”><li id=“pagenav”><h2>Recent Posts</h2></li>
        </ul><ul>
        <?php get_recent_posts(10, ‘<li style="margin-bottom: 5px;">‘, ‘<br />‘, 0); ?>
        </ul>
       
    <?php } ?>

I had all sorts of trouble using is_home() with the SEM Static Front Page plugin, so I decided to check for the post_name being home, which seems to work very well.

There you have it. A Simple easy way to get your recent posts list displayed on a page.

WordPress Blogging Essentials


While performing WordPress installations for several clients lately, they have asked me “what are the essentials?”, there are a few good lists of essential plugins out there and loads of information on WordPress SEO.

This article is the list of what was done with JaredQuinn.info and on Bob Mutch’s SEO Company blogs for Plugin Installations and SEO.

Plugins

Search Engine Optimisation

Search Engine Optimising a WordPress blog is a relatively easy task thanks to the excellent construction and ease of customisation of WordPress.

Permalinks

The single most important thing to do with WordPress for SEO is Permalinks. In the WordPress administration panel ensure you set your permalink structure, it can be found under Options. Pick a structure to use and stick to it, changing it will cause you problems with any inbound links.

The permalink setting I use for JaredQuinn.info is:

/%category%/%year%.%monthnum%.%day%/%postname%/

Titles

Next, some modifications to your theme are necessary. Most search engines display the meta title tag in the search results, it is important to have something meaningful in there.

To produce the titles on this site I use:

<title><?php bloginfo(’name’); ?><?php if ( is_single() ) { ?> :: Blog Archive <?php } ? <?php wp_title(); ?></title>

There is no use setting a neat title in your theme and then using useless titles in your posts and pages; put some thought into each and every one.

Keywords

Using keywords is useful for SEO; to do this use the Keywords plugin mentioned in the previous section. It adds a keywords() function to WordPress. In each of your posts/pages you can add a Custom Field named Keywords. Set this to the comma seperated list of Keywords to use.

<meta name=”keywords” content=”jared,quinn,it,consulting,consultant,design….,<?php echo keywords(); ?> />

Description

The Meta Head Description plugin extends the wp_head(); function to include a description tag. Description META tags are used by search engines such as Google as the text displayed in the results instead of whatever the crawler happen to find.

Make sure your theme calls wp_head(); in header.php.

Standards Compliance

Crawlers and other robots will understand your page better if it is standards compliant. I prefer all my pages to strictly adhere to XHTML 1.1; however this is not always entirely possible. You can use the Validator at validator.w3.org to validate your code. I personally prefer pages with NO errors and NO warnings. If you are going to the effort to ensure compliance it’s worth making sure you have a valid DOCType , Content-type and Character set.

While on the subject of WordPress themes, the theme you pick is important. JaredQuinn.info uses a fully XHTML 1.1 compliant theme, which is loaded content first followed by navigation. This means that crawlers and spiders see the important parts of the page first!

Content… Content… Content!!

Getting higher rankings on Google and other search engines is all about links. The best way to get links is having content that is worth linking to. If you don’t have content worth linking to, it’s pretty pointless getting a #1 ranking, not to mention annoying to the rest of the world.

Google Sitemaps

Google sitemaps are a useful way of providing the full structure of your site to Google in a single easy to use format, which is even easier to accomplish using the WordPress Google Sitemap Generator plugin.

References

The first time I considered SEO for a WordPress blog, I found the following pages invaluable:

WordPress In-Line Editing


Firstly, I’m not sure if it works with WP 2.0, nor much about it as I haven’t had a chance to play with it myself yet.

But i’ve stumbled across a WordPress plugin that allows in-line editing of posts without heading over to the admin interface… something i’ve had on my ‘maybe i should do a plugin for something like that’ list for a while.

You can find it at http://twilightuniverse.com/2005/03/wordpress-touched/.

I’ll install it sometime soon on WP2.0 and let you know how it goes.

Update

I’ve installed the plugin and it appears to work on WP2.0 without any problems. It is rather neat and saves the overhead of loading the full admin interface for quick updates to posts (i’m making this update to this post using it right now).