This code uses a custom loop to display specific products for a set length of time by date range. The code :
- Adds a checkbox on the edit product data tab to include the product as a featured product.
- Adds 2 date pickers on the single product data screen for start and end dates.
- Displays the products in a custom loop before the main content on the archive page for the taxonomy the product is assigned to. Example : If the product is assigned to the category 1 category, the product will only be featured before the content on that specific category archive. As seen in the demo video.
Enables you to advertise specific products between set dates like the 1st of May to the 31st May. After the expiry date, the products are no longer included in the custom loop.
Demo Video
Shows product in a custom loop displaying before the main content area on the same taxonomy they are assigned to if the include checkbox is checked and dates are set for the start and end dates of the advertisement period.
Installation
There’s 2 steps :
- Copy and paste the PHP code ( without the opening PHP tag ) to the end of your child themes functions.php file or custom functionality/code snippets plugin.
- Copy and paste the CSS to the end of your style.css file and clear caching.
Reviews
There are no reviews yet.