I am using underscore to develop a wordpress theme.
I have a custom post type name project
, thus I have, for instance, this url: http://a.site.local/projects/a-beauty/
.
I have in my template-parts/
directory the file content-projects
.
$ cat template-parts/content-projects.php
<h1>Project</h1>
When I browse http://a.site.local/projects/a-beauty/
, I have my title but also the sidebar and the footer (even if they do not appear in my content-project.php
nor in index.php
).
Where are those widgets coming from / loaded ?
CodePudding user response:
Please share some more code from your project so we can easy to understand the real problem.
CodePudding user response:
Add conditions to the header, footer and sidebar.
For whole custom post archive:
<?php if( !is_post_type_archive( 'project' ) ) : ?>
// wrap the code you don't want to show on that archive
<?php endif; ?>
For custom post only:
<?php if( !is_singular( 'project' ) ) : ?>
// wrap the code you don't want to show on the post
<?php endif; ?>
If you want to put the code you WANT to show, remove the '!' before condition.
P.S. You can put the whole content in a condition, but keep the
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>
otherwise the page will break :)