• Resolved deborah73

    (@deborah73)


    Hi there,

    I have bought the WP Advert with full ad ons, but i am not sure if it can do what i want on my website.
    I have a few questions.
    My ads are on the 2 and 3 page in my menu and i would like to have 2 blocks on my homepage, one with the latest ad and one with random choosen ad. So that visitors see on my homepage what my website is about. Can i realise that with a shortcode? Do you have that?

    I really hope so, if not , then my other questions are not relevant, then i would need to choose an other plugin. Thanks, best regards, Deborah

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

    (@gwin)

    Hi,
    to have on the homepage two blocks with ads list one with for example 5 latest ads and one with 5 random ads you would need to add to the page 2 shortcode blocks and use the following shortcodes

    Latest Ads

    
    [adverts_list search_bar="disabled" show_pagination="0" posts_per_page="5" order_by="date-desc"]
    

    Random Ads

    
    [adverts_list search_bar="disabled" show_pagination="0" posts_per_page="5" order_by="rand"]
    

    By default the [adverts_list] does not support random order, so you would additionally need to add in your theme functions.php the code below to allow sorting by random order

    
    add_filter( "adverts_list_query", function( $args, $params ) {
        if( isset( $params["order_by"] ) && $params["order_by"] == "rand" ) {
            $args["orderby"] = "rand";
        }
        return $args;
    }, 10, 2 );
    
    Thread Starter deborah73

    (@deborah73)

    Thank you so much for your answer!
    Now i know that it is possible to realise it, that is very important for me, i am not sure i can do the job, but then i can ask my developer to do it.
    Thanks again, great!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘random and latest ad’ is closed to new replies.