我通过以下代码使其工作:
add_action( \'template_redirect\', \'ft_job_cpt_template\' );
function ft_job_cpt_template() {
global $wp, $wp_query;
if ( isset( $wp->query_vars[\'post_type\'] ) && $wp->query_vars[\'post_type\'] == \'job\' ) {
if ( have_posts() ) {
add_filter( \'the_content\', \'ft_job_cpt_template_filter\' );
}
else {
$wp_query->is_404 = true;
}
}
}
function ft_job_cpt_template_filter( $content ) {
global $wp_query;
$jobID = $wp_query->post->ID;
$output = \'\'; // Build markup fetching info from postmeta
return $output;
}
欢迎对任何建议发表评论。