reply

Home Forums Responsive Themes Coupon Theme Sort by featured Reply To: Sort by featured

  • JamesD
    JamesD
    Super Guru 1,719 points
    April 3, 2019 at 10:53 pm

    @Chris

    Any way to just target expired listings like is done to add “expired” class?

    You’ll need to loop through all the results in the page you want to add the classname (within what ever template file you’re referring to).

    Do you know how to isolate the per page to only main content listings?

    To change per-post on front page only:
    add_action( 'pre_get_posts', '_custom_front_perpage');
    function _custom_front_perpage($wp_obj){
    if( is_front_page() && !is_admin() && !$wp_obj->is_feed() && $wp_obj->is_main_query()) {
    $wp_obj->set('posts_per_page', -1);
    }
    }

    Note: -1 = all listings
    (I’ve added a couple more conditions above)
    Here’s a list of conditions that may help for various scenarios:
    https://codex.wordpress.org/Conditional_Tags

  • New Business Themes for WordPress 2020

    Start your new website today!

    View Business Themes