-
AuthorPosts
-
October 15, 2013 at 1:21 pm #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?
October 16, 2013 at 6:18 am #176228Hi 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,
IsmaelOctober 16, 2013 at 12:19 pm #176373This 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.
October 17, 2013 at 4:42 am #176833Hi!
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,
IsmaelOctober 20, 2013 at 9:02 pm #178164Hi!
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,
KriesiOctober 21, 2013 at 12:41 pm #178371That’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.
October 21, 2013 at 1:03 pm #178380Hey!
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,
PeterOctober 21, 2013 at 2:41 pm #178419Aahh, solved it. I converted the table (once again) to utf8_swedish_ci and now it works.
Thanks! -
AuthorPosts
- The topic ‘Portfolio sort special characters (å, ä, ö)’ is closed to new replies.