Custom Post Type Support

Available on: Newsmag V2.2+

If you want to experiment with our Custom Post Type support, you can download our testing plugin. The plugin registers a ‘td_books’ post type and it adds two taxonomies to it ‘td_writers’ and ‘td_genre’.

Theme panel settings for custom post types and taxonomy:

The theme detects all the installed Custom Post Types and it will generate a drop-down with options for each one. Please note that the custom post types of WooCommerce are not present here because we plan to add a better way to manage the shop. Some plugins may register some strange stuff, like post types that are not used on the front end at all. If you see post types that you don’t recognize as your own, we recommend that you leave the default settings for them.

The settings are located in the Theme Panel > CPT & Taxonomy, and they include:

Custom post types:

  • Breadcrumbs taxonomy – select what taxonomy will show up in the breadcrumbs
  • Category spot taxonomy – choose the taxonomy that appears in the category spot. It will replace the default “Category” taxonomy
  • Tag spot taxonomy – select the taxonomy that is displayed in the tag spot (after the post content)
  • Tag spot text – replace the default “Tags” label text with the name of your taxonomy
  • Custom sidebar + position – choose the post sidebar and its position. This will apply globally to all the post which are part of the CPT for which you are setting this. You can override this option from the post individual settings that can be found on the post editing section.

custom post type settings

 

In the following screenshots, you can see The Custom Post Type single page and where the settings from the above panel are applied.

td_cpt_frontend_taxonomy

td_cpt_frontend_tags

Custom taxonomies:

  • Article display view – select the module used to display the custom post types on the taxonomy page
  • Custom sidebar + position – chose the sidebar displayed on the taxonomy page and its position

The theme creates a section for each taxonomy, and at the same time providing some insights about the taxonomy ID and on what post types the taxonomy is assigned to. The settings from this drop-down panel affect the taxonomy archives page.

NOTE: Recently we added the taxonomy.php template. If you require custom modifications on taxonomy pages, taxonomy.php should be the starting point for them.

td_custom_taxonomies_settings1

Individual post settings for custom post type

On each post that belongs to a registered post type, you can control the sidebar position(left, right or none) and what sidebar is loaded.

td_custom_post_sidebar_settings

How to create a custom single template for your post type

  1. pick one of your favorite single templates (check the next image)
  2. copy it in the root of your child theme folder
  3. rename it to single-your_post_type.php (replace your_post_type with the WordPress ID of your post type. In our sample plugin, the ID is td_book, so the file should be called single-td_book.php)

2015-07-14_17-30-47

How to create a custom taxonomy list

Copy the taxonomy.php file from the root of the theme to the root of the child theme, and rename it to taxonomy-YourTaxonomy.php