-1

our developers are telling us that we must create 1 template per category to achieve this scenario:

  • we are creating dynamic product pages
  • we have a separate app that stores all the product attributes including category
  • the pages are dynamic, when they load they load the attributes from the app

this doesn't seem a big ask to us, but the developers are insistent. Should we challenge and how can we do so? (we do not have the technical knowledge).

We currently have 18 categories and the taxonomy is highly likely to change so we are worried this is not a robust or maintainable way forward.

1 Answer 1

0

There can be multiple ways to achieve this, but creating a new template for each taxonomy/category is surely not the best.

I will achieve this with a single template by using these two methods,

  1. You can pass the custom query variables while generating your dynamic pages or you can create a custom class that will loop through all categories, and adds additional variables as per the category. You can use is_tax() function with get_query_var() for this. Here you may be required to pass additional filter using add_filter( 'query_vars', 'function_name'); depending upon your post query.

  2. Build a jQuery Ajax function and send your dynamically generated post loop results via wp_send_json().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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