I currently have a new custom post type– “Books.” I have a custom rewrite url that I set when registering my post type:
'rewrite' => array( 'slug' => 'books', 'with_front' => false )
It works great when I visit a specific post, but how do I take control of the /books url for displaying a list of ALL of the books by date posted?
Once way of doing it – I am sure there are other ways too – is to make a page template for books: books.php
You can make a copy of page.php and rename it.
In the top of the file you place the usual Page Template code as in:
Below the normal loop, you then place the code for a new loop:
Don’t forget to close it with the call for
<?php endwhile; ?>
at the end.With this method you can within WordPress add a Page called Books and assign this particular Template to it. This way you can still add general text to the page too and below display the list of all books.