Tagged: ,

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

    My database and tables has utf8_swedish_ci collation, but when I set the portfolio order to sort alphabetical it still reads Ö as O and so on (should come after Z). I’m using this function to sort:

    function custom_post_grid_query( $query, $params ) {
    $query['orderby'] = 'title';
    $query['order'] = 'ASC';
    return $query;
    }

    Suggestions?

    #176228

    Hi emilottersten!

    Would you consider using the Order Page Attributes? You need to edit each Portfolio Items then add a number on “Order” attribute field. First, edit includes > admin > register-portfolio.php and find this code on line 34:

    'supports' => array('title','thumbnail','excerpt','editor','comments')

    Add the page attributes:

    'supports' => array('title','thumbnail','excerpt','editor','comments', 'page-attributes')

    You can now add order attributes number to each portfolio items. If you don’t add an Order attribute they will default to 0. Use this on functions.php:

    function custom_post_grid_query( $query, $params ) {
    $query['orderby'] = 'menu_order';
    $query['order'] = 'ASC';
    return $query;
    }
    add_filter( 'avia_post_grid_query', 'custom_post_grid_query', 10, 2);

    Best regards,
    Ismael

    #176373

    This sounds like a hassle, because the portfolio will continuously be modified. I’m expecting it to have around 100-300 items in a couple of months, so I can’t have this as a manual setting.

    #176833

    Hi!

    I’m not sure why the alphabetical order doesn’t work for the symbols. Let me ask some help from Kriesi and other support members.

    Regards,
    Ismael

    #178164

    Hi!

    I am not sure how these characters are handled in other countries but here in Austria if we got an alphabetic list of items and there is an item with Ä,Ö or Ü those are directly located after A, O and U even though they are technically appended to the alphabet, if listed separately. I guess this is also how php queries interpret it, so I am afraid I have no idea how one would change that. As far as I get it this is neither a WordPress nor Theme issue but an issue of php and mysql itself :/

    Regards,
    Kriesi

    #178371

    That’s what happening now, they are listed after A and O instead of last in the alphabet. The ordinary WP-sorting works, and it works in your older themes (at least in Choices and Eunoia). So this must something in the sorting in Enfold.

    #178380

    Hey!

    Enfold uses the default WP_Query class in /wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/portfolio.php to query the portfolio entries. You can try to output the result of the query by replacing

    
    $this->entries = new WP_Query( $query );
    

    with

    
    $this->entries = new WP_Query( $query );
    print_r($this->entries);
    

    If the $this->entries output lists the posts in the wrong order too it’s not a theme issue because then WP returns the posts in the wrong order.

    Regards,
    Peter

    #178419

    Aahh, solved it. I converted the table (once again) to utf8_swedish_ci and now it works.
    Thanks!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Portfolio sort special characters (å, ä, ö)’ is closed to new replies.