Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #240

    I love the sorting feature you have in this theme for the portfolio. Very nice!

    But I have no use for the Date / Name sort. I would like 2 things:

    1. Default the sort by Name (not date)

    2. Remove or hide the Name/Date sort buttons without removing the category sort buttons

    #30452

    There are a couple of edits you need to make to template_portfolio.php to do this.

    1.) You need to change this (around line 16):

    $query_string .= "&post_type=portfolio";

    to this:

    $query_string .= "&post_type=portfolio";
    $query_string .= "&orderby=title";

    to order by Name.

    2.) You need to change this (around line 61):

    $output .= "<div class='sort_by_val'>";
    $output .= "<span>".__('Sort by:','avisio')."</span>";
    $output .= "<a href='#' id='date_sort' class='active_sort reversed'>".__('Date','avisio')."</a>";
    $output .= "<a href='#' id='name_sort'>".__('Name','avisio')."</a>";
    $output .= "</div></div>";

    to this:

    $output .= "</div>";

    ** Edited by James Morrison to correct error in code (see post below for details) **

    #30453

    Thanks for the reply. But when I make the change in your step1, it breaks the portfolio page so nothing appears on the page at all.

    #30454

    Whoops! I made a mistake.

    $query_string .= "&post_type=portfolio";
    $query_string .= "orderby=title";

    should be:

    $query_string .= "&post_type=portfolio";
    $query_string .= "&orderby=title";

    I was missing the & so post_type showed up as portfolioorderby which is why it didn’t work.

    Sorry about that, this should fix the problem.

    #30455

    This works except the sort by name is in reverse order.

    #30456

    Hi!

    Ok change this code:

    $query_string .= "&orderby=title";

    to this to change the order:

    $query_string .= "&orderby=title&order=ASC";

    Regards,

    James

    #30457

    Bingo.

    Thank you for the great support.

    #30458

    Hey!

    Awesome, marking this as resolved and closing the topic.

    If you have any other questions, please open a new topic.

    Regards,

    James

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘On Portfolio sorting – Remove Date/Name sort’ is closed to new replies.