Blog

The caffeine fuelled writings of a web developer


toolset-types-review

Toolset Types WordPress Plugin

Posted on April 12th 2016  //  Filed under: Web Development

For anyone who works with WordPress, we all know how essential custom post types are to building an effective, client-friendly WordPress system. They offer further opportunities to publish engaging, dynamic content beyond that of the standard “Post”.

As developers, we are always trying to improve work-flow (i.e. the way we do things!) and I firmly believe that Toolset is an amazing resource. It is built by the good folk at OnTheGoSystems and is one of their flagship solutions.

What is Toolset Types?

Toolset Types is a WordPress plugin that allows you to create and define custom post types through the WordPress back-end rather than having to create them through create_post_type() method. It provides an innovative user interface to allow to build custom post types very quickly.

You are able to define custom fields and taxonomies for these post types through the interface as well.

Creation-1

You can add standard fields to the post type and choose to omit some.

Creation-2

In the “Post fields” interface you can then add a variety of fields to the post type. This is useful for post types such as Events as you can add a date (datepicker), time and so on.

Add-Field

Now, we have the post types created and defined but how do we get that information?

Writing the code

In the theme file you can write a query for a for each loop like this:

<?php
   $type = "event"; // SLUG OF POST TYPE
   $args = array(
    'post_type' => $type,
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'orderby' => 'meta_value_num',
    'meta_key' => 'wpcf-date',
    'order' => 'ASC'
   );
 $posts = get_posts($args);
 foreach ($posts as $post) : setup_postdata($post);
?>

 <h1><?php the_title(); ?></h1>
 <?php the_content(); ?>

<?php endforeach; ?>

You can then use standard WordPress API methods to get the additional custom fields. I find this is really neat as I don’t have to depend on third party functions and it allows me for a tidier implementation. Below is part of a script I wrote for a client wanting to pull through information on an event.

$d = get_post_meta(get_the_ID(), 'wpcf-date', true);
if($d != null) {
  $date = DateTime::createFromFormat('U', $d);
  $date = $date->format('jS F');
}
// META DATA
$location = get_post_meta($post->ID, 'wpcf-location', true);
$guest = get_post_meta($post->ID, 'wpcf-special-guest', true);

You can see that I can use get_post_meta() to return the custom fields as a single line and process accordingly. The second parameter is the ‘wpcf’ prefix plus the slug of the custom field name.

Toolset Types. An awesome plugin.

Toolset Types is one of my favourite WordPress plugins to use. Its quick, easy and allows you to provide a user-friendly interface for your clients to create custom post type content that is separate from their everyday news section. It results in a more organised CMS, better opportunities to render a variety of content types on the front-end and improves developer workflow.

date-picker

Above is an example of providing a custom field with a user-friendly interface. This is what client’s / users will be used to around the internet and promises a consistent data type return rather than an single text field. You can see an explanation of the DatePicker field on a previous blog post.

I cannot recommend this plugin highly enough. It instantly at home as part of the CMS. It provides developers with flexibility and control over custom content and integrates with the existing WordPress API functionality. So far, I haven’t encountered any conflict with other plugins.

Finally, Toolset Types is fully supported by the team at OnTheGoSystems and they are always publishing new updates to improve functionality. Thanks again to the good folk at OnTheGoSystems for a great plugin.

Get in touch

Please get in touch via email or twitter if you’d like to discuss!