strangerstudios / sitewide-sales

Run Black Friday, Cyber Monday, or other flash sales on your WordPress-powered eCommerce or membership site with WooCommerce, Easy Digital Downloads, and Paid Memberships Pro.
https://sitewidesales.com
GNU General Public License v3.0
3 stars 6 forks source link

Shortcode improvements #96

Closed kimcoleman closed 2 years ago

kimcoleman commented 2 years ago

All Submissions:

Changes proposed in this Pull Request:

Starting the work to support more options for the shortcode and future block implementation to allow people to build the landing page in the editor.

Moved the logic to wrap the_content into a content filter vs. wrapping the shortcode output.

Now supporting in-post content like: [sitewide_sales time_period="post-sale"]this is some content in the editor directly about the post sale[/sitewide_sales] The content within a shortcode like this will not pull in the SWS CPT's content for that period.

or

[sitewide_sales time_period="pre-sale"] The content within a shortcode like this will show the SWS CPT's content for that period.

The attribute for time_period still respects what the active sale's period is. So if you place a shortcode like: [sitewide_sales time_period="pre-sale"]

In the post, that will not show if the sale is active in the sale period or after the sale.

These changes all still support the URL attribute for admin testing (swsales_preview_time_period).

I also reworked the logic to get the active sale ID to pull from post meta on the active post in the shortcode logic. We don't need to query posts since this is a post_meta value.

Other information:

Changelog entry