Plugin Author
myCred
(@designbymerovingi)
Hi.
Here is a code snippet that will do this using a shortcode.
Install
- Copy the code into your theme’s functions.php file.
- Create a new page that you set to be “Private” to restrict regular users from seeing it.
- Insert the
[sell_all_posts]
shortcode into this page and save.
- View this page and select the post type you want to set for sale.
- Enter the price or leave the field empty to use your default settings.
- Enter the button label or leave the field empty to use your default settings.
- Enter an expiration or leave the field empty to use your default settings.
- Click Run
- Done!
Now your default settings you can find on your myCRED > Settings page under “Sell Content”. Any field that is left empty will be populated by these settings.
Once you click run, depending on the number of posts to set for sale this process may take a few seconds so please be patient.
Once completed, ALL posts of the particular type will be immediately set for sale.
Remember that post author will always see their own content and admins will see ALL content.
Finally the shortcode will only set posts for sale that are “Published” so private posts or trashed posts will not be set for sale. Once you have run the shortcode and you are finished please delete the page and shortcode to prevent abuse.
Works great Gabriel!
A total of 2115 posts were successfull set for sale.
Last request, I hope you can have a selection per “category” as well.
But this will do for now.
Cheers! 🙂
Plugin Author
myCred
(@designbymerovingi)
Hey.
That would require a new code since we would need to take into account categories.
Here is a new custom shortcode. Works just like the previous one but the shortcode is called sell_posts_of_category
(to avoid confusion) and will only work for Posts.
Same install as before but now you will see a dropdown for your categories.