{"id":4418,"date":"2024-06-08T11:17:16","date_gmt":"2024-06-08T09:17:16","guid":{"rendered":"https:\/\/www.knowboard.de\/?p=4418"},"modified":"2024-06-08T11:21:23","modified_gmt":"2024-06-08T09:21:23","slug":"total-theme-add-template-after-header-with-php","status":"publish","type":"post","link":"https:\/\/www.knowboard.de\/total-theme-add-template-after-header-with-php\/","title":{"rendered":"Total Theme: Add, override or insert Template after header with PHP"},"content":{"rendered":"\n
\/**\n * Insert a Templatera template after the site header.\n *\n * @link https:\/\/totalwptheme.com\/docs\/snippets\/insert-template-content-via-theme-hooks\/\n *\/\nadd_action( 'wpex_hook_header_after', function() {\n\t$template = 100; \/\/ Change this to the templatera post ID you want to grab content from.\n\techo do_shortcode( '[templatera id=\"' . $template . '\"]' );\n} );<\/code><\/pre>\n\n\n\n

Override page template<\/p>\n\n\n\n

add_filter( 'wpex_archive_template_id', function( $template_id ) {\n    if ( is_category( 'news' ) ) {\n    \/\/if ( is_singular( 'book' ) ) { etc.\n        $template_id = 2; \/\/ set a different template_id for the news category\n    }\n    return $template_id;\n} );<\/code><\/pre>\n\n\n\n
\/**\n * Override Header Builder Template ID\n *\n * @link https:\/\/totalwptheme.com\/docs\/snippets\/header-builder-id\/\n *\/\nadd_filter( 'wpex_header_builder_page_id', function( $id ) {\n\tif ( is_front_page() ) {\n\t\t$id = 'FRONT_PAGE_TEMPLATE_ID';\n\t}\n\n\treturn $id;\n} );<\/code><\/pre>\n\n\n\n

Override Header Template<\/p>\n\n\n\n

\/**\n * Override the page header with a custom template.\n *\n * @link https:\/\/totalwptheme.com\/docs\/snippets\/page-header-template\/\n *\/\nadd_filter( 'wpex_page_header_template_id', function( $id ) {\n\treturn 'YOUR_TEMPLATE_ID';\n} );\n\n\/**\n * Remove page header section from the customizer (optional if you are overriding the page header for the whole site).\n *\n * @link https:\/\/totalwptheme.com\/docs\/snippets\/page-header-template\/\n *\/\nadd_filter( 'wpex_customizer_sections', function( $sections ) {\n    unset( $sections['wpex_page_header'] );\n    return $sections;\n} );<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

Override page template Override Header Template<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"none","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"categories":[61],"tags":[],"class_list":["post-4418","post","type-post","status-publish","format-standard","hentry","category-total-theme","entry","no-media"],"_links":{"self":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/4418"}],"collection":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/comments?post=4418"}],"version-history":[{"count":3,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/4418\/revisions"}],"predecessor-version":[{"id":4424,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/4418\/revisions\/4424"}],"wp:attachment":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/media?parent=4418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/categories?post=4418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/tags?post=4418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}