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?

Home Forums Gillion Theme Is there a way to manipulate the results in the “Related Posts” widget?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Stahly
    Participant

    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?

    • This topic was modified 2 weeks, 6 days ago by Stahly.

    Shufflehound
    Moderator

    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

    • This reply was modified 3 days, 6 hours ago by Shufflehound.
    • This reply was modified 3 days, 6 hours ago by Shufflehound.
    • This reply was modified 3 days, 6 hours ago by Shufflehound.
Viewing 2 posts - 1 through 2 (of 2 total)

Popular choice

Professional Developers At Your Fingertips!

If you need services beyond standard support, we've got your back!

Services we offer:

Demo setup
Advanced customization
Layout adjustment
Graphic work / visualizations
Custom coding
Full WordPress development and design

Services

What we can offer

  • Demo setup +

    If you'd prefer not to handle the installation yourself or need help getting started, we'll set everything up for you.

  • Layout adjustment +

    We'll help you rearrange sections, adjust spacing, and modify the page structure to fit your needs.

  • Advanced customization +

    More complex styling changes, theme option modifications, and third-party integrations.

  • Custom coding +

    If you need something that's not included in the theme, we can code it for you.

  • Graphic work / visualizations +

    Web design services to create custom sections, pages, and blocks for your theme, plus graphics and visualizations.

  • Full WordPress development and design +

    Full website builds, custom theme development, or plugin creation from scratch.

  • About pricing +

    We'll provide a clear quote based on what you need. No hidden fees.

Professional Developers At Your Fingertips!

Custom Work Form