Alternative templates when displaying topics

Replies
0
Voices
1
Freshness
Followers

0

Single Topics
Each topic posted will appear on its own page. By default, this uses the theme’s default single.php template. The advantage of this is that your topic pages will fit perfectly into your theme.

If you wish, you can use an alternative template. To do this, you’ll need to disable the option to use the theme templates by going to Discussion Board > Settings > Design and deselecting Use theme templates.

You can then use alternative templates as follows:

  • Create a new single-discussion-topics.php template in your theme or child theme (note that the post type is plural). The plugin will look for this template in the child theme first, then the parent theme, then the plugin folder itself.
  • Modify the plugin’s template files programmatically. The single-discussion-topics.php file uses the same mark-up as the Twenty Fifteen theme. However, this might not work for your theme. You can hook into the opening and closing wrappers and replace with your own opening and closing tags to ensure compatibility with your theme. See below for further guidance.

Topic Archives
You can override the archive template in the same ways:

  • Create a new archive-discussion-topics.php template in your theme or child theme. The plugin will look for this template in the child theme first, then the parent theme, then the plugin folder itself.
  • Modify the plugin’s template files programmatically.

Shortcode
Instead of using the archive template, the plugin creates a new page called Topics on activation and inserts the shortcode. This will display a list of all topics and is preferable to using the archive page.