Plugin documentation
The Monthly Subscription plugin is a WordPress plugin used for creating a monthly subscription using the WooCommerce shop.
Download and install the plugin from WordPress dashboard. You can also upload the entire “monthly_subscription” folder to the “/wp-content/plugins/” directory.
Activate the plugin through the “Plugins” menu in WordPress.
Use the plugin as follows:
Creating a subscription:
Using WooCommerce, create a new product.
Name it as intended, add information however you like, add a price.
Select „Monthly Subscription“ as a product type.
Now, you can add the subscription duration (find the input-field below the price, in the „general“ tab of the product information). The duration of the subscription is set in months and calculated from today, or added to active subscription if applicable. There can be up to one subscription per user on the WordPress site.
Save and publish the product.
Checking subscription, showing content:
To use the plugin with your content, there is a shortcode to check the subscription. It uses an opening tag and a closing tag. You will need both – the content in between the tags will be shown (or not shown respectively). There are four options to display content („active“, „ended“, „never“ and „inactive“). The options are passed in the opening tag using the subscription parameter as follows:
• Only users that have an active subscription will see the text in between those tags:[sub_show_if subscription="active"]...[/sub_show_if]
A user’s subscription is active if an end-date is set (becasue a subscription was bought) and the end-date is today or in the future (greater than today’s date).
• Only users that have (had) a subscription but it has already ended will see:[sub_show_if subscription="ended"]...[/sub_show_if]
A user’s subscription is ended if an end-date is set (becasue a subscription was bought) and the end-date is in the past (less than today’s date).
• Only users that have never had a subscription (or no account is logged in) will see:[sub_show_if subscription="never"]...[/sub_show_if]
A user’s subscription has the „never“ state if no end-date is set (becasue no subscription was bought) or if the end-date is invalid.
• Only users that have no active subscription (either because a user never had one, or had one but it has already ended, or no user is logged in) will see:[sub_show_if subscription="inactive"]...[/sub_show_if]
A user’s subscription is inactive if either no end-date is set, or if an invalid end-date is set, or if the end-date is in the past (less than today’s date).
The shortcodes can be used around all types of content, not just for a single line! You can put paragraphs, rich content, media content, and further shortcodes (essentially everything) inside the opening and closing tags. The shortcodes are supported on every post/page/content that supports shortcodes.
For further information and technical support, feel free to contact me via e-mail to wordpress [at] cookers.at
Support by creating this plugin and the idea to it came from Sabrina from Storytellerin Content Creation UG. Thank you!