Comments Cecdah started the conversationDecember 4, 2018 at 1:32pmHi. Love your theme, but i am missing one feature from the News and blog element.I am wondering if there is any possibility to sort the post by name or Ascendig, Descending. Now it only sort by latest post.Is there any way to do that, maybe adding a function or something.Regards 7,095Oliver repliedDecember 4, 2018 at 1:49pmHi, Small example: function order_posts_by_title( $query ) { if (is_home()) { $query-set( 'orderby', 'title' ); $query->set('order', 'ASC'); } } add_action( 'pre_get_posts', 'order_posts_by_title' );Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. Regards, OliverCecdah repliedDecember 13, 2018 at 3:01pmHiWe were able to create an option for sorting by altering the shortcodes.php file in theme-elemets.How do we make sure that our codes dont get overwriten next time we update the theme-elements plugin?Note that we are using a child theme, but we can't figure out how to get shortcodes.php to work from the child theme 7,095Oliver repliedDecember 14, 2018 at 7:39amHi,Sorry, there are no simple way to overwrite it in the child theme. Here the example of query: add_action( 'pre_get_posts', 'custom_post_type_order' ); function custom_post_type_order($query){ if( is_admin() ) { return $query; } if ($query->query_vars['post_type'] == 'thegem_pf_item'' ) { $query->set('order', 'DESC'); } } But sorry, I'm not sure that it will work correctly everywhere. Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. Regards, Oliver Sign in to reply ...
Hi. Love your theme, but i am missing one feature from the News and blog element.
I am wondering if there is any possibility to sort the post by name or Ascendig, Descending. Now it only sort by latest post.
Is there any way to do that, maybe adding a function or something.
Regards
Hi,
Small example:
Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list.
Regards, Oliver
Hi
We were able to create an option for sorting by altering the shortcodes.php file in theme-elemets.
How do we make sure that our codes dont get overwriten next time we update the theme-elements plugin?
Note that we are using a child theme, but we can't figure out how to get shortcodes.php to work from the child theme
Hi,
Sorry, there are no simple way to overwrite it in the child theme. Here the example of query:
But sorry, I'm not sure that it will work correctly everywhere.
Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list.
Regards, Oliver