I was reading a lot of posts about it, but I can’t find what I’m missing.
I have a CPT called “book”:
register_post_type( 'book', $args_books );
I have a default single.php
file:
<?php get_template_part('templates/content-single', get_post_type()); ?>
I have a templates/content-single-book.php
file:
<?php
$clases = array(
'col-sm-10',
'col-md-8',
'col-lg-6',
'col-sm-offset-1',
'white-bg',
);
?>
<?php while (have_posts()) : the_post(); ?>
<article <?php post_class($clases); ?>>
<header>
<h1 class="entry-title"><?php the_title(); ?></h1>
</header>
<?php the_content(); ?>
</div>
<footer>
<?php wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']); ?>
</footer>
<?php comments_template('/templates/comments.php'); ?>
</article>
<?php endwhile; ?>
I have a page books
created and its page-books.php
template to show a list of books (it works).
But, when I try to show the single page of a book, I get a 404. Roots wrapper toolbar shows me Main: 404.php
and Base: base.php
Why I can’t reach my templates/content-single-book.php
? Thank you in advance.
Just for trying, but not strictly necessary, I tryed a base-book.php
and single-book.php
. None of them was used by WP.