<?php | |
/** | |
* Rewrite Endpoint | |
* | |
*/ | |
function be_endpoint() { | |
add_rewrite_endpoint( 'section', EP_PERMALINK ); | |
} | |
add_action( 'init', 'be_endpoint' ); | |
/** | |
* Custom Templates | |
* | |
*/ | |
function be_custom_templates( $template ) { | |
if( ! is_singular( array( 'company', 'program', 'product' ) ) ) | |
return $template; | |
$post_type = get_post_type(); | |
$section = get_query_var( 'section' ) ? get_query_var( 'section' ) : 'overview'; | |
$template = get_query_template( $post_type . '-' . $section ); | |
return $template; | |
} | |
add_action( 'template_include', 'be_custom_templates' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters