Being a WordPress user of many years I’ve found not much can go wrong with the open source CMS but when you have too many plug-ins it can be hard to keep them up to date. Where possible I always try to build a site which wont rely on them the main reasons for this is.

  • Better Security as plug-ins are the main source of website hacks
  • There is no guarantee plug-ins will be maintained or updated when a new version of WordPress comes out
  • They clog up the admin
  • They don’t always work exactly as you would like

Here is a bit of code I use to build custom HTML Sitemaps. You could even modify it to generate an XML sitemap too with a bit of work.

All you have to do it copy the following code into the functions.php file and it will add a HTML Sitemap short code to your site. Just put [htmlSitemap] on a page you want it to appear.

Put the following code in your themes functions.php file
    function get_html_sitemap( $atts ){

            $return = '';
            $args = array('public'=>1);
// If you would like to ignore some post types just add them to the array below
            $ignoreposttypes = array('attachment');

            $post_types = get_post_types( $args, 'objects' ); 

            foreach ( $post_types as $post_type ) {
                if( !in_array($post_type->name,$ignoreposttypes)){
                    $return .= '<h2>' . $post_type->labels->name.'</h2>';
                    $args = array(
                        'posts_per_page'   => -1,
                        'post_type'        => $post_type->name,
                        'post_status'      => 'publish'
                    $posts_array = get_posts( $args ); 
                    $return .=  '<ul>';
                    foreach($posts_array as $pst){
                        $return .=  '<li><a href="'.get_permalink($pst->ID).'">'.$pst->post_title.'</a></li>';
                    $return .=  '</ul>';

        return $return;
    add_shortcode( 'htmlSitemap', 'get_html_sitemap' );

This will be really helpful on WordPress websites which have thousands of pages. Even if they are categorised it can be hard to find a post.

This code will add a search box to the top of the archive / category pages. The search box will then only display results for that specific category.

There are a lot of plug-ins which will offer similor functionality but you really don’t need one as it’s only a few lines of code.

Firstly to add the category ID to the search form. For this we will edit the default search form which is usually in the theme template in the file searchform.php

Within the form add the following code.

if ( is_category() ) {
        echo '<input name="cat" type="hidden" value="'.get_query_var('cat')'." />';

Those few lines of code will check if the page is a category archive page and if so add a hidden field which had the category ID in.

Then to add this form to the site edit your archive.php or index.php depending on which is being used and add the search form

	if ( is_category() ) {

This will add the search form to the page if it’s a category page.

For a few lines of code it add’s a lot of functionality to category home pages.

Being a web developer for the last fifteen years it’s hard to think I got along for so long without Digital Ocean web hosting.

I’ve been using them for about two years and have been the only host in all my time of making websites I haven’t had a problem with. I’m guessing the support is good but I’ve never had to use it due to how easy it to manage even on a smart phone.

The main advantages of cloud hosting are:

  • Expandable memory and disk space withing a few seconds for when you have high traffic spikes.
  • It’s more cost efficient as you can scale up or down the hardware within a few seconds.
  • It’s easy to backup with the ability to clone a server.
  • It’s easy to restore backups.
  • You don’t have to rely on hardware of a dedicated server which probably only has a 2-3 year life.

With Digital Ocean they package a whole lot more compared to some of the bigger cloud hosts like Amazon AWS.

  • Digital Ocean lets you manage multiple servers through one simple online control panel
  • They have mobile apps which let you do everything from your smart phone
  • They have locations all over the world including New York and Singapore.
  • You can easily move your server between different locations by cloning and starting new instances which is great if you have an international audience.
  • Price wise you can’t beat Digital Ocean, I’ve looked all over but they have the cheapest and most easy to use web hosting packages.
  • You get full access to your cloud server with a dedicated IP and can even install virtual memory to boost performance.

Overall I can’t reccomend Digital Ocean enough for any web hosting as they have saved me a lot of time and money since I’ve been using them.