Your address will show here +12 34 56 78

Home Forums WP RESIDENCE – Real Estate WordPress Theme FORUM Order Properties List by Publish Date

This topic contains 3 replies, has 3 voices, and was last updated by  ysalim 1 year, 10 months ago.

  • Author
    Posts
  • #59003

    Anna
    Keymaster

    When you try to order by publishing date you need to edit the property_list.php

    around line 197 you have
     $args = array(
                        ‘post_type’         => ‘estate_property’,
                        ‘post_status’       => ‘publish’,
                        ‘paged’             => $paged,
                        ‘posts_per_page’    => $prop_no,
                        ‘orderby’           => ‘meta_value_num’,
                        ‘meta_key’          => $meta_order,
                        ‘order’             => $meta_directions,
                        ‘meta_query’        => $meta_query,
                        ‘tax_query’         => array(
                                                    ‘relation’ => ‘AND’,
                                                    $categ_array,
                                                    $action_array,
                                                    $city_array,
                                                    $area_array
                                                )
                    );
    you need to change this to:
     $args = array(
                        ‘post_type’         => ‘estate_property’,
                        ‘post_status’       => ‘publish’,
                        ‘paged’             => $paged,
                        ‘posts_per_page’    => $prop_no,
                        ‘orderby’           => ‘date’,
                        ‘order‘             => ‘DESC’,
                        ‘meta_key’          => $meta_order,
                        ‘meta_query’        => $meta_query,
                        ‘tax_query’         => array(
                                                    ‘relation’ => ‘AND’,
                                                    $categ_array,
                                                    $action_array,
                                                    $city_array,
                                                    $area_array
                                                )
                    );

    and remove the lines

    add_filter( ‘posts_orderby’, ‘my_order’ );
    remove_filter( ‘posts_orderby’, ‘my_order’ );

    Make sure you make the changes manually in PHP. If you copy/paste you may copy some formatting that breaks the php code.
    Thank you
    Anna
    • This topic was modified 3 years, 2 months ago by  Anna.
    • This topic was modified 2 years, 6 months ago by  Anna.
  • #105579

    xorbal
    Participant

    Hi Anna,

    Is it possible to also have the advanced search results ordered by publishing date by default?

    Thanks,

    Orlando

  • #116827

    Anna
    Keymaster

    Yes. But you need to change the order in advanced-search-results.php

    Thank you
    Anna

  • #123481

    ysalim
    Participant

    How to change the order of the advanced search result? I looked at the code but it didn’t have anything like

    ‘orderby’ => ‘date’,
    ‘order‘ => ‘DESC’,
    ‘meta_key’ => $meta_order,

    Please help
    Thanks

You must be logged in to reply to this topic.