Quantcast
Viewing all articles
Browse latest Browse all 20145

Select CRED Edit form based on Post Type and Custom field

I have 4 custom post types:
Consultants
Trades and Services
Product Suppliers
Real Estate Agents

For each of these, there are 2 CRED forms:
1. Premium Listing – shows all fields
2. Free listing – shows limited fields AND sets a custom field to 1 to indicate a free listing e.g. [cred_field field="consultant-free-listing" post="consultant" value="1" urlparam=""]

And there are 2 CRED edit forms for each custom post:
1. Premium
2. Free

I have created an Edit Listing View to display the listing title and an Edit Listing button based on the filter: Select posts with the author the same as the current logged in user. I can show one form here using a shortcode: [cred_link_form form="Edit Listing - Consultant Free" class="button" text="Edit Listing" target="_self"] but I need the form to be selected based on a conditional statement as below.

I need the Edit Listing button to be selected based on the post type and free listing checkbox value before choosing the correct Edit Listing form. e.g.

if post type="Consultants" AND "wpcf-consultant-free-listing" = 0 > go to edit listing form ID 3126
OR (else?)
if post type="Consultants" AND "wpcf-consultant-free-listing" = 1 > go to edit listing form ID 3529
OR
if post type="Trades and Services" AND "wpcf-trades-free-listing" = 0 > go to edit listing form ID 3161
OR (else?)
if post type="Consultants" AND "wpcf-trades-free-listing" = 1 > go to edit listing form ID 3794
etc etc

Can you please help me with the format of this conditional statement?

Many thanks.


Viewing all articles
Browse latest Browse all 20145

Trending Articles