I am trying to: insert a view or post body in header content template
I visited this URL: local development
I expected to see: screenshot UK2.jpg
Instead, I got: no page content, just duplicate header. Same happens if I insert post body via shortcode.
My content template code
<div class="bblue">
<div class="container pt-2">
<div class="row">
<label for="show-menu" class="show-menu"><div class="mmenu acenter"><img src="/wp-content/uploads/Mobile-menu.jpg" alt="Mobile menu" width="44" height="40" class="size-full" /></div></label>
<input type="checkbox" id="show-menu" role="button">
[listmenu menu=shopmenu]
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-3 col-md-3 acenter">left-menu</div>
<div class="col-xs-12 col-sm-9 col-md-9">[wpv-view name="banner"]</div>
</div>
</div>
It doesn't depend on view code as it happens with empty view as well. Same with post body. In example if I will put code below it results in screenshot uk3.jpg
<div class="bblue">
<div class="container pt-2">
<div class="row">
<label for="show-menu" class="show-menu"><div class="mmenu acenter"><img src="hidden link" alt="Mobile menu" width="44" height="40" class="size-full" /></div></label>
<input type="checkbox" id="show-menu" role="button">
[listmenu menu=shopmenu]
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-3 col-md-3 acenter">left-menu</div>
<div class="col-xs-12 col-sm-9 col-md-9">[wpv-post-body view_template='None' id='13']</div>
</div>
</div>
Content Templates replace the_content() part of your Templates, and headers are usually a separate File, called way previously to the_content() in a WordPress theme.
You can not create a whole page template with a Content Template.
Your theme has to deliver the header, body and footer.
In the Body, it will call the_content() and that is the part that usually displays your Post Content.
This can be styled and altered with Content Templates.
To achieve what you need you either need to use PHP can call the View/Content Template in your header.php file with PHP, or integrate Layouts in your Theme and construct the Page templates with that Plugin.
https://toolset.com/documentation/user-guides/layouts-theme-integration/
https://toolset.com/documentation/user-guides/views-api/
Please let me know if you need help with this.
Thank you ! You saved my day! I was inserting content template with shortcode
<?php do_shortcode('[wpv-post-body view_template="header"]'); ?>
Now everything works perfectly!
The answer/solution at the top of this page has an extra right bracket ")" on the right hand side.