Displaying widgets only in specific package

This topic contains 7 replies, has 4 voices, and was last updated by  Guust 4 years, 3 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #528342

    Bernward Maspohl
    Full Member
    Post count: 65

    I have tried to use this guide in combination with the plugin Widget Logic:
    https://wpgeodirectory.com/support/topic/displaying-the-advertise-widget-only-on-free-accounts/

    Unfortunately the following code does not work for me.
    geodir_get_post_package_info_on_listing(”, ”, ‘gd_place’)->pid==„1“
    Has something changed?

    Thanks!
    Bernward

    #528350

    Guust
    Moderator
    Post count: 29970

    That is a code for the old version of GD.
    I’ll get a developer to get an updated code.

    Thanks

    #528356

    Patrik
    Moderator
    Post count: 1971

    Hi,

    Have you tried another code on that conversation? See https://wpgeodirectory.com/support/topic/displaying-the-advertise-widget-only-on-free-accounts/#post-31308

    Regards,
    Patrik

    #528358

    Patrik
    Moderator
    Post count: 1971

    Hi,

    The global variable in V2 is $gd_post so the following code you have to use in the widget logic:

    global $gd_post;
    return $gd_post->package_id==1;

    Let me know if this helps or not.

    Regards,
    Patrik

    #528362

    Bernward Maspohl
    Full Member
    Post count: 65

    Hi Patrick,

    Yeah, that almost works. Exactly:
    global $gd_post, $wp_query, $geodirectory;
    return $gd_post->package_id==”1″;

    Thanks!
    Bernward

    #528369

    Bernward Maspohl
    Full Member
    Post count: 65

    Hi Patrick,

    I do have a question about filtering the packages. How can I filter a shortcode for a package?
    [adrotate group=”1″]
    The shortcode should only appear with package 1.

    Thanks!
    Bernward

    #528389

    Alex Rollin
    Moderator
    Post count: 27815

    We don’t currently have an integration with that plugin.

    If the plugin has some sort of visibility condition built into it, then you would need to use that to supply the conditional information it requires.

    Otherwise you would need to use some custom PHP or PHP with a plugin like widget logic to show that widget/shortcode on the page when a specific package value is present.

    https://wpgeodirectory.com/docs-v2/faq/common-examples/#logic

    #528396

    Guust
    Moderator
    Post count: 29970

    Each detail page is assigned a styling class depending on the package.
    So you could put the adrotate section inside a DIV that only shows on selected detail pages.

Viewing 8 posts - 1 through 8 (of 8 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket