is_single() / is_singular not working instead of content-single.php
-
Hello,
I have a question about is__single() / is_singular():
I created some Custom Post Type (Portfolio) an loop this in page-portfolio.php. In the page-portfolio.php it gets the template-part
<?php get_template_part( 'content', 'portfolio' ); ?>
.In the content-portfolio.php I tried to code something like this:
<?php if ( is_singular('portfolio') ) : ?> <!-- some stuff for displaying single CPT-post --> <?php else : ?> <!-- some stuff for displaying all CPT-posts (Portfolio)--> <?php endif; // is_singular() ?>
Displaying all the posts is working, but not displaying the single post. WordPress uses the content-single.php to show the single portfolio post.
In the Twentytwelve Template it works this way with post types (like posty type “image” etc.)… But in my own Template, the post type “image” wont work like this, when I use is_single()…
Where is the mistake?
- The topic ‘is_single() / is_singular not working instead of content-single.php’ is closed to new replies.