Home › Forums › Gillion Theme › Is there a way to manipulate the results in the “Related Posts” widget?
Home › Forums › Gillion Theme › Is there a way to manipulate the results in the “Related Posts” widget?
Hey there,
I use the related posts widget on the post page. However, my website has 15+ years of content, and the widget seems to often pull out very old and outdated posts, instead of more recent ones.
Is there a way to manipulate the related posts widget?
Ideally,it would be best to display the latest posts from the same category as the main post. Perhaps you could optimise this in a future update to make the widget more intelligent, as I am surely not the only one facing this issue. Would be great if it would also look for matching tags to get better results.
For now, it would really help if you could point me in the right direction to customise this function myself.Is there a specific script or PHP file within the Gillion theme that handles this?
Hello,
Sorry for the delayed response.
Currently, the related posts in Gillion are selected from the same category, but they are ordered randomly. This is why older posts can sometimes appear. It was originally done this way to keep the query simple and avoid heavier selection logic for better page loading speeds.
You can adjust this in the theme file: single.php
The related posts query should be around line 451. We recommend copying this file to a child theme first, so your changes are not overwritten by future theme updates.
For a minimal change, you can replace:
'orderby' => 'rand'
with:
'orderby' => 'date', 'order' => 'DESC'
This will show the latest posts from the same category instead of random older posts.
Or if you just want to limit the results to only recent posts, for example posts from the last 2 years, you can add this to the query arguments:
'date_query' => array(
array(
'column' => 'post_date', // Or you can use post_modified
'after' => '2 years ago',
),
),
Please try these changes and let us know how it goes. If needed, we can take another look. 🙂
Best regards,
Shufflehound team
Thank you, this helped a lot!
Can you specifiy how to transfer the single.php to a child theme? My Gillion child theme folder doesn’t have the single.php, just the Gillion main folder.
Hello,
Yes, that is normal. The child theme folder does not include single.php by default.
You need to copy the single.php file from the main Gillion theme folder to the child theme folder. You can do this in a few ways:
The final file location should be:
/wp-content/themes/gillion-child/single.php
After that, you can edit the copied file in the child theme, and WordPress will use it instead of the parent theme version.
Best regards,
Shufflehound team
If you need services beyond standard support, we've got your back!
If you'd prefer not to handle the installation yourself or need help getting started, we'll set everything up for you.
We'll help you rearrange sections, adjust spacing, and modify the page structure to fit your needs.
More complex styling changes, theme option modifications, and third-party integrations.
If you need something that's not included in the theme, we can code it for you.
Web design services to create custom sections, pages, and blocks for your theme, plus graphics and visualizations.
Full website builds, custom theme development, or plugin creation from scratch.
We'll provide a clear quote based on what you need. No hidden fees.