Create Post tabs in single-{content-type}.php with Custom Field values

You can use rewrite endpoints to achieve this.

First, register your endpoints:

function wpa_movie_endpoints() {
    add_rewrite_endpoint( 'synopsis', EP_PERMALINK );
    add_rewrite_endpoint( 'screens', EP_PERMALINK );
    add_rewrite_endpoint( 'trailer', EP_PERMALINK );
}
add_action( 'init', 'wpa_movie_endpoints' );

So now in addition to http://domain.com/post-name/ (or whatever your particular permalink structure is), you’ll have:

http://domain.com/post-name/synopsis/
http://domain.com/post-name/screens/
http://domain.com/post-name/trailer/

You can then check for the existence of these query vars in a template action, or in the template itself, and show the appropriate content:

global $wp_query; // may be necessary, depending on where you're using this
if( array_key_exists( 'synopsis', $wp_query->query_vars ) ){
    echo 'show synopsis!';
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)