how to configure widget logic plugin with GDv2

This topic contains 8 replies, has 4 voices, and was last updated by  Alex Rollin 5 years, 7 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #446805

    Marc
    Expired Member
    Post count: 274

    I want to show widgets only on some GDv2 pages / archives. Therefore I’m using widget logic plugin. https://de.wordpress.org/plugins/widget-logic/

    I have 2 CPT: gd_place (standard) and gd_project (new added CPT)

    What are the widget logic “conditional tags” to show a widget on GDv2 pages?

    https://codex.wordpress.org/Conditional_Tags

    GD Details Page: show a widget only on details page for “places” and for “projects”.
    GD Archive Page: show a widget only on listing pages for “places” and for “projects”.

    is_post_type_archive( $post_type )

    Is it like this? But what should I put in $post_type? gd_place or gd_project (new CPT) is not working.

    Or this?
    is_page_template( ‘about.php’ )

    But what are the names of the templates for gd_place and gd_projects for detail and archive pages?

    Thanks for help.

    #446810

    Guust
    Moderator
    Post count: 29970

    For Places only: geodir_get_current_posttype()==’gd_place’

    See https://wpgeodirectory.com/docs/useful-plugins/#logic
    They seem still valid for V2.
    Let us know if they are not working as expected.

    Thanks

    #446813

    Marc
    Expired Member
    Post count: 274

    Thanks Guust, this works.

    But what is the conditional tags for GD Details Page ONLY?

    I dont want to show the widget on ALL GD Pages only on Details pages.

    Thanks

    #446815

    Guust
    Moderator
    Post count: 29970

    Place detail pages only:

    is_singular( 'gd_place' )

    Thanks

    #446816

    Marc
    Expired Member
    Post count: 274
    This reply has been marked as private.
    #446853

    Marc
    Expired Member
    Post count: 274

    Guust, please tell me the conditional tags for a widget on archive list view for a specific CPT.

    thanks!

    #446869

    Paolo
    Site Admin
    Post count: 31206

    Hi Marc,

    If you Google what you ask to Guust, you’ll find the answer in the 1st result:

    https://www.google.com/search?q=conditional+tag+for+archive+of+a+custom+post+type

    Example should be:

    is_post_type_archive('my_custom_post_type')

    so for gd_place it will be:

    is_post_type_archive('gd_place')

    Make sure you are using the right single quotes (

    '

    )

    I tested it and it works.

    Let us know

    Thanks

    #446880

    Marc
    Expired Member
    Post count: 274

    Hi Paolo

    Yes I know, I tried this tag first, but it was not working:

    is_post_type_archive( $post_type ) =
    is_post_type_archive( $gd_place )

    is_post_type_archive( gd_place ) this is working (without $)

    cheers,
    Marc

    #446931

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
Viewing 9 posts - 1 through 9 (of 9 total)

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

Open Support Ticket