Listing Widget – Exclude Current

This topic contains 8 replies, has 3 voices, and was last updated by  Joy 4 years ago.

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

Open Support Ticket
  • Author
    Posts
  • #536200

    Joy
    Buyer
    Post count: 1076

    Hello! I am using the widget: GD > Listings, on the listing detail page.

    It also shows the current listing that is being viewed. Is there a way to exclude the current listing from this widget? It doesn’t make much sense to to have it here. Thank you.

    #536221

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    can you share the GD listings shortcode you are using?

    Thanks

    #536222

    Joy
    Buyer
    Post count: 1076

    It’s the one that’s found in the widgets section of wordpress. It’s labeled: GD > Listings

    The shortcode is generated based on the settings you input into the widget settings. It’s not a shortcode that I am generated from a regular WP page.

    #536256

    Alex Rollin
    Moderator
    Post count: 27815

    Please share WP Admin credentials if we need to check the settings.

    #536260

    Joy
    Buyer
    Post count: 1076
    This reply has been marked as private.
    #536439

    Naveen Giri
    Moderator
    Post count: 1559

    Hi Joy,

    can you please share the post URL, where you had noticed the issue.

    Thanks

    #536440

    Joy
    Buyer
    Post count: 1076
    This reply has been marked as private.
    #536480

    Naveen Giri
    Moderator
    Post count: 1559

    Hi Joy,

    Please try this snippet.

    
    add_filter('geodir_widget_listings_query_args', 'custom_geodir_widget_listings_query_args_callback', 10, 2);
    function custom_geodir_widget_listings_query_args_callback( $query_args, $instance ){
        global $gd_post;
        $query_args['post__not_in'] = $gd_post->ID;
    	return $query_args;
    }

    meanwhile, I will make sure to push the code on the plugin branch. It seems a meaningful point to me.

    Regards
    Naveen

    #536574

    Joy
    Buyer
    Post count: 1076

    It works. Thanks so much.

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