Hello,
I would like to sort my posts two different ways on two different pages, and I’m wondering if there is an easy way to do it.
On my songs page, I post the songs I write in chronological order. Each song is a blog post, and I organized them on my songs page by posting excerpts in order. The oldest song is at the bottom, the newest at the top.
On my blog page, however, I would like to present a different order, because I tend to write about each song out of chronological order. So if I decide to write about the fifth song I ever posted, for example, I would like its blog post to appear as the first blog post, whereas on the song page, it would be remain in order. But if I update the date on the blog post, it reorders it in both places. Is there a way, maybe using page IDs, to keep the order the same on the Songs page but fluid on the Blog page? T
Hoping this makes sense lol. Thank you!
Hey tonyska,
Thank you for the inquiry.
Which blog layout (Grid, Small, Multi-author, List etc.) did you select? If it’s set to Grid Layout, you should be able to use the avia_post_slide_query filter to adjust the sorting of the items and utilize conditional functions to apply different sorting for specific pages or templates.
Example:
add_filter('avia_post_slide_query', 'avia_post_slide_query_mod');
function avia_post_slide_query_mod($query) {
if (is_page(123)) {
$query['orderby'] = 'menu_order';
$query['order'] = 'ASC';
}
elseif (is_home()) {
$query['orderby'] = 'date';
$query['order'] = 'DESC';
}
return $query;
}
Replace 123 with the actual ID of the song page.
Each song is a blog post, and I organized them on my songs page by posting excerpts in order.
How do you post excerpts in a specific order?
Best regards,
Ismael