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 byStephen
How did you like this article?2312

2 thoughts on “Create Custom Templates for your KB”

  1. Code is incorrect eg. category should be

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

  2. How do I change the post type to be regular posts and post categories instead of pauple_helpie custom post type articles?

Leave a Reply

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