Your address will show here +12 34 56 78

Home Forums General topics for our real estate themes Order Properties by EDIT date

This topic contains 0 replies, has 1 voice, and was last updated by  Anna 2 years, 5 months ago.

  • Author
    Posts
  • #107640

    Anna
    Keymaster

    In wordpress there are 2 order situations by date:

    – first publish date

    – edit publish date

    We use order by first publish date and edit date is not considered.

    So default order will consider the first publish date.

    The technical solution is to modify the query orderby, but it’s sensitive when working with custom order as well, so it cannot be added to core at this moment.

    But if you wish, we can guide you to look for the following function that controls this custom query – wpestate_my_order and then modify it according to WordPress query rules – http://codex.wordpress.org/Class_Reference/WP_Query

    What you need is

    orderby (string | array)

    • modified‘ – Order by last modified date.

    Query is set in WP ESTATE in functions.php

    See this code

    /////////////////////////////////////////////////////////////////////////////////
    
    // order by filter featured
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    function my_order($orderby) {
    
    global $wpdb;
    
    global $table_prefix;
    
    $orderby = $table_prefix.'postmeta.meta_value DESC, '.$table_prefix.'posts.ID DESC';
    
    return $orderby;
    
    } 


    Query is set in WP Rsidence in help_functions.php

    /////////////////////////////////////////////////////////////////////////////////
    // order by filter featured
    ///////////////////////////////////////////////////////////////////////////////////
    
    if( !function_exists('wpestate_my_order') ):
    function wpestate_my_order($orderby) { 
        global $wpdb; 
        global $table_prefix;
        $orderby = $table_prefix.'postmeta.meta_value DESC, '.$table_prefix.'posts.ID DESC';
        return $orderby;
    }    
    
    endif; // end   wpestate_my_order  


    Thank you

You must be logged in to reply to this topic.