Results 1 to 1 of 1

Thread: Sort search result by time

  1. #1
    Thread Starter
    rinormazreku's Avatar
    Join Date
    Dec 2013
    Location
    Sweden
    Posts
    125
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Sort search result by time

    Hi,

    I'm trying to change the order of my ads when someone makes a search but there seems to be a problem when adding the filter. I want to order the ads by time when someone makes a search but instead I get no results found. The WordPress search has a parameter, orderby, which you can set directly in the URL and then it will order by that parameter but I'm interested in making this default with a filter. Is this possible?

    This is my current filter that returns no results found:
    PHP Code:
    add_filter('posts_orderby''new_order' );
    function 
    new_order$orderby ){
        global 
    $wpdb;
        if(
    is_search()){
            
    $orderby "time";
        }
        return 
    $orderby;

    Is the parameter maybe called something else in classipress or should I not even use the posts_orderby?

    Thx in advance!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Search Result in New Window ?
    By archersoftech in forum Vantage General Discussion (Legacy)
    Replies: 1
    Last Post: September 24th, 2013, 02:37 AM
  2. when try to search get no result !!!
    By akashkash in forum ClassiPress General Discussion
    Replies: 1
    Last Post: August 9th, 2013, 03:05 AM
  3. Hide result about search
    By dario06 in forum ClassiPress General Discussion
    Replies: 9
    Last Post: April 2nd, 2012, 01:59 AM
  4. Hide result about search
    By dario06 in forum Report ClassiPress Bugs
    Replies: 4
    Last Post: March 24th, 2012, 11:11 AM