Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save shaddam/27d4cd022f0d7f55b8acf2d57637cc98 to your computer and use it in GitHub Desktop.

Select an option

Save shaddam/27d4cd022f0d7f55b8acf2d57637cc98 to your computer and use it in GitHub Desktop.
Custom Post Type Single Templates from Plugin Folder
/* Draw Constructions single service template */
function draw_cons_single_template_modify($single) {
global $post;
/* Checks for single template by post type */
if ( $post->post_type == 'draw_cons_service' ) {
if ( file_exists( DRAW_CON_PL_PATH . '/single-draw_cons_service.php' ) ) {
return DRAW_CON_PL_PATH . '/single-draw_cons_service.php';
}
}
return $single;
}
add_filter('single_template', 'draw_cons_single_template_modify');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment