• Anna
    August 6, 2014 at 12:27 pm #59003

    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 2 years, 9 months ago by  Anna.
    • This topic was modified 2 years, 1 month ago by  Anna.
    xorbal
    April 3, 2015 at 12:08 pm #105579

    Hi Anna,

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

    Thanks,

    Orlando

    Anna
    July 24, 2015 at 8:44 am #116827

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

    Thank you
    Anna

    ysalim
    December 16, 2015 at 7:33 am #123481

    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.

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.