public function templates( $template ) {
  // Provide single template.
  if (is_single() && get_post_type() === 'doc') {
  $template = SABER_DOCS_PATH . '/templates/single-doc.php';
  return $template;

This snippet shows how to provide a callback for a template_include where we check the current context of the page (if it’s a single post with type = “doc”), and then if the conditions match we provide a template from the plugin.

View All