Hey there,
I’ve added to a page the “Article” element using the Advanced Content Editor.
The page has the default template assigned.
How can I change the order of the articles shown (asc & desc) ?
Thanks in advance.
Hey HIO2014!
As far as I know blog posts within WordPress always appear in the order they are published. The element doesn’t have an ordering option in this case.
Regards,
Devin
Hi Devin,
blog posts can be ordered using this string:
<?php query_posts($query_string . "&order=ASC") ?>
Since I’ve used the AVIA Element, i don’t know where to put this code (usually placed in the archive.php file).
Any suggestion?
TY!
Hey!
Try adding this at the very end of your theme / child theme functions.php file:
function change_order_blog_element($query) {
$query = array_merge($query, array('order'=>'ASC'));
return $query;
}
add_filter('avia_blog_post_query', 'change_order_blog_element', 10, 2);
Cheers!
Josue
It seems there’s an error, it doesn’t work.
May I send you my functions.php file?
Otherwise, here’s the code…
Hey!
What error did you get? make sure you are using the latest version of Enfold and put the custom code at the very end of the functions.php file.
Best regards,
Josue
I have Theme Version Number: 2.9.1
Now it works… but I had to edit functions-enfold.php file, not functions.php .
Ty Josue!
You are welcome. Also, you could put it on the functions.php of the child theme (if you use one), or use a plugin like Functionality to abstract custom functions from the theme files.
Cheers!
Josue