0

I have created a Custom Post Type called Products.

Now I need a functionality that will allow me to select or check a product as featured.
There can be only one featured product.
When one product is selected the others are deselected automatically.
This featured product will be displayed on homepage.

Question:

What is the best way to store the featured_product_id to identify the one that is featured?

0

There is no need to store product setting product wise as there will be only one featured product. You can store the featured_product_id in options table. And whenever a product is featured you just override the record in the options table, that why you can avoid the deselecting hassle of previously selected featured product.

|improve this answer|||||
0

I create an options page and then have a list of all products there where I can choose the product to be featured.

|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.