Skip Navigation

[Closed] Adding premium options to listings

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 1 month, 2 weeks ago.

Assigned support staff: Christian Cox.



I recently purchased Toolset and am looking forward to diving in!

I am setting up a directory site and would like to offer premium listings that get featured at the top of their respective category and such.

I will be using MemberPress to handle payments and member levels (basic listing which is free and premium listing per above). I realize you do not directly support MemberPress but I am curious as to how I would implement this from the Toolset end of things.



Christian Cox

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Hello, I can think of a few different ways to handle this. The most straightforward approach is to create a custom post type "Listings" or something similar, and add a custom "radio" field in this post type. That field has two options: premium and standard. Depending on the User's membership, that custom field should be automatically set for each post when it is created, and should not be editable by the User. Then any View or WordPress Archive you create to display Listings should be primarily sorted by the value of that custom field. Secondary sorting could be based on the post publication date, for example. Most of this can be accomplished without custom code. The only exception is how to set the value of that custom field automatically.

So the next question is how to set that field value when posts are created. I would assume you will restrict User access to wp-admin, and force your Users to create Listings posts on the front-end of the site using Forms. In this case, you can use the Forms API to programmatically set the value of the custom field when the post is created. It's best to remove the field from the Form, so it's not visible to the end User. The support team can show you some examples and help you implement the custom code to set that field value if necessary, based on the User's current membership type. You may need to get help from the Membership plugin support team to get a code snippet or instructions on how to determine the current User's Membership type programmatically.

So that would handle displaying premium listings before non-premium listings in Views and Archives, at a very basic level. It could get complicated if you want to handle the case where premium subscribers create listings posts, then change their membership later. Do you want to adjust their existing posts to be no longer premium? If so, that could mean some manual intervention or custom code is required to query their existing posts and modify that custom field value. Our support team can provide examples showing how to change a custom field value programmatically if needed. What if they cancel their subscription - do you want to delete their listings automatically? That could also be complicated. You may need assistance from the Membership support team to trigger some custom code when a membership status changes like this.

Let me know if you have follow up questions about this, and I can provide more information.

The topic ‘[Closed] Adding premium options to listings’ is closed to new replies.