• Resolved dumboxp

    (@dumboxp)


    Dear Greg,

    Thanks for adding thumbnail images to the “WPAdverts Ads”-widget, which is very useful and nice looking now!

    As we also use your plugin “WP Adverts – Mark As Sold”, it would be great to have an option to hide “sold”-ads in the ads-list of the “WPAdverts Ads”-widget.

    Would it be possible to ad an e.g. checkbox to the “WPAdverts Ads”-widget settings, to hide sold ads in the widget list?

    All the best,
    Roland

    ps: Maybe it would be good to have an option for [adverts_list] as well, to hide “sold” entries there too (if mark-as-sold is installed).

    • This topic was modified 6 years, 6 months ago by dumboxp.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi, you can add the code below in your theme functions.php file it should hide the “Sold” ads in the Recent Ads widget and in the [adverts_list] shortcode.

    
    add_filter( "adverts_widget_list_query", "hide_marked_as_sold" );
    add_filter( "adverts_list_query", "hide_marked_as_sold" );
    function hide_marked_as_sold( $args ) {
        $args["meta_query"][] = array(
            "key" => "marked_as_sold",
            "value" => "1",
            "compare" => "NOT EXISTS"
        );
        return $args;
    }
    
    Thread Starter dumboxp

    (@dumboxp)

    Hi Greg, you are the best! Thank you very much – it works great!
    marked topic as solved.
    br, Roland

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘“WPAdverts Ads”-Widgets: hide sold ads’ is closed to new replies.