• Resolved tanjimayesmin

    (@tanjimayesmin)


    Hello,

    I’m trying have separate layout for premium listing (single) page. How can I check if a listing is premium?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    Hi @tanjimayesmin,

    Thanks for your patience here. I’ve been out of town for several days.

    I presume you’re asking this question about template overrides, yes? I can get the code snippet for it, but I’ll need to ask my developer first.

    Thank you for the response.
    You’ve rightly presumed.

    Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    Hi @tanjimayesmin,

    OK, here you go!

    Basic detection:

    $listing = wpbdp_get_listing( $listing_id );
    $plan    = null;
    
    if( $listing ) {
        $plan = $listing->get_fee_plan();
    }
    
    if( $plan && 0 < $plan->fee_price ) {
        // do your magic
    }

    to search within a group of fees:

    $listing = wpbdp_get_listing( $listing_id );
    $plan    = null;
    
    if( $listing ) {
        $plan = $listing->get_fee_plan();
    }
    
    if( $plan && in_array( $plan->fee_id, array( 1, 4, 9 ) ) ) {
        // do your magic
    }

    or a specific fee:

    $listing = wpbdp_get_listing( $listing_id );
    $plan    = null;
    
    if( $listing ) {
        $plan = $listing->get_fee_plan();
    }
    
    if( $plan && 9 === $plan->fee_id ) {
        // do your magic
    }

    This works both in single.tpl.php and single_content.tpl.php.

    Try that and let me know if you run into more issues.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to check if paid listing?’ is closed to new replies.