0

I managed to create a custom post type (I called it stores) to work in the loop, I plan to create a template with bootstrap to have all the stores the same design and have the capacity to modify all of them with the editor...

What I need is a way to add extra elements to the_post (elements like the_title, the_content or the_time, but custom made, like "the_type" or "the_storetype", etc)

  • You can add either custom taxonomies or postmeta. It really depends on how you want to use the data. If you ever want to be able to query for posts that have a certain piece of data, you'll want to set it up as custom taxonomies, as taxonomy queries are much more performant than meta queries. Once you add the data, you will also need to set up or update your theme template to display it however you like. – WebElaine Feb 19 at 17:39
  • the_post() is not a template tag. It's not something that produces output that you can add it. It's used for setting up the query properly in your template so that you can output stuff. The things you're describing need to be added to the template. – Jacob Peattie Feb 19 at 23:39
  • But my goal is to repeat certain parameters like $storeName or $OpeningHours to all stores in the site, and it's extremely unconvenient to do it 1 by 1... I want something like Woocommerce that you only fill some data and it automatically creates a page with all the data arranged inside of it – Cheo Molina Feb 20 at 7:46
0

-RESOLVED

I was able to do it by copying the template functions that wordpress gives and modifying them to fetch what I needed to in the DB instead of what they were supposed to get.

| improve this answer | |

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.