2 Templates 1 custom post type according url

Use the query_vars filter to add a new query variable to store the template version (minimal / complete). add_filter( ‘query_vars’, ‘se385568_query_vars’ ); function se385568_query_vars( $vars ) { $vars[] = ‘tpl’; return $vars; } Add a rewrite rule (codex) to recognize the new link format and set the newly created query variable add_action( ‘init’, ‘se385568_rewrite_rules’ ); … Read more

Advanced templating / WordPress as a CMS questions

You can actually achieve anything with wordpress. But by design, wordpress is not a CMS with a built-in feature that it offers multiple editable areas of which you can classify and manage the content for while being able to configure those in layouts that are understand by the theme. Not even the default one. As … Read more

How can I detect hierarchal relationships beyond children (grandchild, great-grandchild, etc)?

Turns out there is an excellent function that has been passed around the WordPress forums is_tree() function is_tree($pid) { // $pid = The ID of the page we’re looking for pages underneath global $post; // load details about this page $anc = get_post_ancestors( $post->ID ); foreach($anc as $ancestor) { if(is_page() && $ancestor == $pid) { … Read more