Create Custom Templates for your KB

You can create custom templates to replace the Knowledge Base templates from Helpie WP plugin. There are current 4 main templates:

1. Main Page Template :

This is the archive page template of Helpie’s Custom Post Type. You can register a custom template for KB archive / main page by using the following code. You can use this code in your theme / child theme’s functions.php

function set_custom_helpie_mp_template($template)
{
  if ( is_post_type_archive( 'pauple_helpie') ) {
    $template = get_stylesheet_directory().'/mainpage-helpie.php';
  }
  return $template;
}

add_filter('template_include','set_custom_helpie_mp_template');

Here ‘mainpage-helpie.php’ is the name of the new template you are creating for the Main Page.

2. Category Page Template :

This is the category page template of Helpie’s Custom Post Type.

function set_custom_helpie_cat_template($template)
{
  if ( is_tax( 'helpdesk_category') ) {
    $template = get_stylesheet_directory().'/catpage-helpie.php';
  }
  return $template;
}
add_filter('template_include','set_custom_helpie_cat_template');

Here ‘catpage-helpie.php’ is the name of the new template you are creating for the Category Page.

3. Single Page Template:

This is the template used for the single article page in Helpie’s Knowledge Base.

function set_custom_helpie_single_template($template)
{
  if ( is_singular('pauple_helpie') ) 
  { 
    $template = get_stylesheet_directory().'/single-helpie.php';   
  }
    return $template;
}
add_filter('template_include','set_custom_helpie_single_template');


This condition checks for single template of ‘pauple_helpie’ post type.
Here ‘single-pauple.php’ is the name of the new template you are creating for the Single Page.

Last updated bysanthosh on October 3, 2018
How did you like this article?1312

Leave a Reply

Your email address will not be published. Required fields are marked *