• Hello

    I’m trying to reproduce an edited version of this page on my website:
    https://readingaustralia.com.au/books/

    However this custom taxonomy does not appear as a ‘Page’ on my website (in the WP menubar it says ‘Customise’ instead of edit).

    I worked out that the page is calling some php files to run the loop but I can’t work out where or how it is being called since I can’t find the ‘Page’ itself.

    I found another file in the theme directory that appeared to call the the function, but then I can’t find that file referenced anywhere….

    Any help would be greatly appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello pstockley,

    This looks like they have written a custom page on the site you linked to and have a ‘custom post type’ running for the books.

    If you have a custom post type on your stie, then the WordPress system will look for a php file called archive-[postype].php where you can code up the loop as you want.

    For instance a custom post type of type ‘books’ would looks for archive-books.php before falling back to archive.php and then index.php see for details.

    If you have both on your site, it might be worth visiting the Dashboard > Settings > Permalinks and just clicking Save Changes there to make sure your permalinks are up to date.

    Let me know if I have the wrong end of the stick.
    Drew

    Thread Starter pstockley

    (@pstockley)

    Hi Drew,

    Thanks for your response.

    You are completely right, books is a custom post type and it is being pulled from archive-books.php.

    Trouble is I don’t understand how that page knows to load that php file.

    Does it just default to call the file since it knows ‘books’ is a custom post type/archive page?

    The Permalinks appear to be set to default.

    Thanks again!

    Hi pstockley,

    Yes, that’s it exactly. The WordPress system will just default to that file because it knows it’s an archive page for a custom post type.

    Drew

    Thread Starter pstockley

    (@pstockley)

    Very interesting – so intuitive!

    So then if I wanted to replicate that page on the same website I would have to create a new template file with the same loop because it’s already designated archive-books.php to that page.

    Does that sound right? Or do you think there is a better way?

    Thanks again!

    Can you explain a little more what you are trying to do. When you say replicate the page on the same site, do you mean for a different post type?

    I do not think you can have two copies of the same page for the same type of post running on one site.

    Let me know a little more about your thinking.

    Drew

    Thread Starter pstockley

    (@pstockley)

    Yes of course!

    I’ve received some feedback from my users that they would like to be able to view all all the books on our site in a single page instead of having to scroll through a dozen pages of this book grid layout.

    I could draw up a page and list everything manually, but as I’m sure you can appreciate, it would be much better to have the page dynamically linked to that content type so it can update automatically when we add more books.

    I would like to create a view option or a separate page that lists our ~200 books.

    So when I say replicate the page, I mean that I want to have an additional archive page (or view option) that lists the same info in a different format.

    Thanks again for your help!

    Oh, I see.

    Good idea. I think the simplest way to achieve that would be to create a ‘Page’ for the new view, but then have a new template in your theme that basically replicates the books-archive.php behaviour. That ‘page’ could easily be added to the menus that way.

    To add a specific template for a page you would call it page-[id].php you would need to copy and paste the current code, and then amending it to show all.

    Let me know how you get on.
    Drew

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Cannot locate page displayed for custom taxonomy in WP’ is closed to new replies.