-3

This website uses WooCommerce. There is a Shop menu item that when clicked it displays the product categories of WC. I am trying to figure out how Wordpress knows what to display when visiting this page.

I see there is a page created named Shop, which is used to create the menu item. But this page is totally empty and nowhere I can find any clue that connects this page with WooCommerce or anything else.

I am searching everywhere in the admin as well, to see if there is something that sets the Shop's pages URL to be related to the WC product categories template but I don't see anything.

So what is the logic here? How is this supposed to work? How can a totally empty page be linked to a certain template?

Thanks for any insights.

  • 1
    There is a well known hierarchy of templates, but third party plugins can alter this and so you're more likely to get a good answer by asking through Woocommerce support than here, where such plugins are considered off-topic. – Andy Macaulay-Brook Aug 4 '16 at 17:06
3

The native logic of template choice is contained in file aptly named template-loader.php. It processes the current context and calls respective get_*_template() functions, until a match is found.

This process results in what is called Template Hierarchy.

However as it was pointed out this only covers native core logic. Plugins can wildly customize this process at different stages or skip it altogether.

  • Thanks for your answer. I assume I would be able to see a clue in the page in the admin that would connect it with that specific template. I mean with my perspective, I would expect something that would make that page be of a certain content type. But there is nothing in the admin of WP. Is it possible that all this is handled with hardcoded php logic in the theme or somewhere else? – tafvita Aug 4 '16 at 18:04
  • It can certainly be handled with code wherever. WP has quite weak routing abstractions so "pages as way to customize location" is common and usually quite hard to figure out. – Rarst Aug 4 '16 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.