Your address will show here +12 34 56 78

Home Forums WP RESIDENCE – Real Estate WordPress Theme FORUM Featured Properties Random order: solved!

This topic contains 1 reply, has 2 voices, and was last updated by  Roxana 2 years, 9 months ago.

  • Author
    Posts
  • #101198

    animone
    Participant

    Hi everyone,

    i have been able to tweak the code to get what’s in topic title.

    It’s a function i needed because i prefer automatic random order for Featured Properties, instead of chronological order (as it is now). I think it’s fair for those paying to have their listings displayed as featured.

    BEFORE PROCEEDING, REMEMBER THAT YOU ARE GOING TO MODIFY THE CODE, AND WITH NEW UPDATES, YOU HAVE TO START ALL OVER AGAIN.

    So, based on my experience, keep note of the changes in a separate text file.

    File to modify: \libs\shortcode.php

    Line 166: ‘orderby’ => ‘meta_value’, change into ‘orderby’ => ‘rand ‘,

    Line 211: add_filter( ‘posts_orderby’, ‘wpestate_my_order’ ); change into add_filter( ‘posts_orderby’ );

    Line 214: add_filter( ‘posts_orderby’, ‘wpestate_my_order’ ); change into add_filter( ‘posts_orderby’ );

    Now, every time the page is refreshed or re-loaded, Fetured Listings are randomized.

    Hope it’s clear.

    Thank you

    • This topic was modified 2 years, 9 months ago by  animone.
  • #101207

    Roxana
    Keymaster

    Hi,

    Thank you for sharing this with us.

    Roxana

  • #102957

    danhazard
    Participant

    ok, I did that – and I get a couple errors:

    Warning: Missing argument 2 for add_filter(), called in /home/content/25/3919125/html/wp/wp-content/themes/wpresidence/libs/shortcodes.php on line 211 and defined in /home/content/25/3919125/html/wp/wp-includes/plugin.php on line 81

    Warning: Missing argument 2 for remove_filter(), called in /home/content/25/3919125/html/wp/wp-content/themes/wpresidence/libs/shortcodes.php on line 214 and defined in /home/content/25/3919125/html/wp/wp-includes/plugin.php on line 296

    http://kelleysisland.com/wp/

You must be logged in to reply to this topic.