WordPress 404 on Custom Post Types

I came across a nightmare of a problem today. Everytime I viewed my custom post types I kept getting a 404 error.  I just couldnt understand what was going on.  Thanks to this article I finally solved the problem.

When setting up custom post types and a custom permalink structure add the below code to the function used to create custom posts.

1
flush_rewrite_rules( false );

I just wanted to write a quick post to highlight the problem but an explanation of why this is needed can be found on the wordpress codex.

Stitch and Craft Show

This weekend I visited the Stitch and Craft show at Olympia. I was hoping to find some wool for a throw and cushion I intend on making for my bedroom but the show seemed to be heavily dominated by cross stitching stools and there wasn’t a very wide selection of wools to pick from. It was worth attending and I quite liked the decopage stool pictured above,  but I would have liked to see more stools like this.

WordPress Tips, Tutorials and Plugins

I thought I would put together a quick list of tips, tutorials and plugins that I have found useful recently.

1. Getting Thumbnail Images working in WordPress Multisite:

Something that really baffled me over the last week is missing post thumbnails in my WordPress Multisite Install. After searching high and low I finally found the solution. To enable post thumbnails simply navigate to Network Admin (top right hand corner) and then to Settings.  Within Settings tick the check box for Image Uploads. You may then need to navigate to Screen Options (top right hand corner again) and tick the check box for Featured Image. This will also enable the small image icon above the WYSIWYG used for adding images into the post itself. Video etc can also be enabled in the same place.

2. Mixing together custom post types in listing

So you’ve created several post types, one for portfolio items, one for products etc etc but instead of displaying them on their own individual listing pages you need to mix them together in the same loop and order by date… Here is the answer. Place the below code before your loop to query the custom post types you require.

1
2
3
4
5
6
7
query_posts( array(
'post_type' => array(
'custom-post-type-portfolio',
'custom-post-type-products',
),
'paged' => $paged ) // for paging
);

3. How to use a plugin in your template if only a shortcode is provided

As soon as I download a plugin I search through the documentation to find the template tag. Maybe its a bit old school but I prefer to add plugins into my templates so that I can place them exactly where I want, configure them as I need and style around them. But sometimes all your provided with is a shortcode. These can be turned into template tags by following these instructions.

Functions.php

1
<span>add_<span>shortcode</span>('<span>shortcode</span>_name', 'template_tag');</span>

Your template

1
<span>echo do_<span>shortcode</span>("[<span>plugin</span>_<span>shortcode</span>_here]");</span>

4. Multiple Content Blocks
Something that has always bugged me about WordPress is the inability to split page content into manageable CMS chunks. Yes you can create custom fields and custom sidebars but what happens when there is a whole block of content that you would like the user to have WYSIWYG editing control over? The answer is this plugin Multiple Content Blocks It does exactly what it says on the tin and transforms WordPress into a functional CMS much along the lines of Drupal and CMS Made Simple. Love it!

5. Popular posts & Related Posts
Its pretty popular these days to have a section on a site displaying the most popular post or related posts. My all time favourite plugins for this are by Rob Marsh. Simple and easy to configure Robs plugins although slightly old these days still provide the best configuration options and are easy to template and style.

Ideal Home Show 2011

This Sunday we visited the Ideal Home Show to get some inspiration for our new house. Having never been before I wasn’t sure what to expect. Maybe I set my expectations a little to high but I was hoping for lots of stools selling interior accessories that I wouldn’t be able to resist. I guess I wanted to go there and come home with my arms full as if having been to Ikea or John Lewis for the afternoon, or at least with a wish list.
Continue reading

How to use Post Formats in WordPress 3.1

WordPress 3.1 has seen the introduction of Post Formats. They provide the ability to target posts within templates using get_post_format() and through css using the extra classes wordpress now adds automatically to posts. This will save on creating extra categories or tags just for targeting and styling these types of content.

So how does it work…

Functions.php
Add this to the functions.php file in your theme. You only need to list the formats you wish to use.

1
2
// This theme uses post formats<br/>
add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link','image', 'quote', 'status', 'video', 'audio', 'chat' ));



You will then see a list of radio buttons in your edit post right hand column.

Styling
Once a type is selected you can style using the following class added to your post on listing pages

and using the following class added to your tag on single pages.

Templates
Within your templates you can target posts by format using the following code

1
2
3
 if ( has_post_format( 'image' )) {
  echo 'this is an image format';
}

WordPress 3.1

Yesterday saw the release of WordPress 3.1 and it has some pretty nice features for both general users and developers like myself.

New Admin Bar
An admin bar has been added when logged in. Its a nice little touch for the not so experienced wordpress user. It makes the admin section and the front end appear more seamless by allowing you to click through to create a new post, manage your personal details, appearance, comments and updates whilst browsing the front end of your site. For multisite users it makes switching between sites quick and easy.

Continue reading

Xmas Decoration Fabric!


Last week I went to Columbia Road “Christmas Wednesdays” to have a look around with a friend. Its a beautiful little street with a variety of quaint shops selling sweets and cakes, artwork, fabric, plants and various international crafts. On Wednesdays in December, the street gets into the Christmas spirit and the shops stay open late to greet you with mince pies and mulled wine. Its a perfect way to start December and Christmas shopping.
Continue reading