• Resolved stesvis

    (@stesvis)


    I love how the related posts can be customized with actions and filters (like showing related posts at the top, or changing how many related posts to show).

    But what is missing in my opinion…is a sidebar widget to show them in the sidebar as well.

    I have to use YARPP for that purpose, but it eats a lot of CPU and I would rather have a JetPack widget!

    Please..!!

    https://www.ads-software.com/plugins/jetpack/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    You’d have 2 ways to go around this:

    • You could use the [jetpack-related-posts] shortcode to display Related Posts in a text widget (reference). Shortcodes are disabled in widgets by default, but you can enable them by adding the following to your theme’s functions.php:
      add_filter('widget_text', 'do_shortcode');
    • You can use the Jetpack_RelatedPosts_Raw raw object to call Related Posts anywhere you want in your theme. You can learn more about it by looking at the code here, or by checking this video (discussion about the raw object start at 30:32)

    I hope this helps.

    Thread Starter stesvis

    (@stesvis)

    Thank you for your answer.
    I implemented solution 1. How come would it not work?

    • I created functions.php in my child theme (didn’t have one)
    • Added add_filter('widget_text', 'do_shortcode');
    • Added a text widget like you said

    And still nothing shows. I am sure it’s just my specific case, but what could be wrong?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    The shortcode will only work in a loop, so you’d have to add a loop around your sidebar elements. You can read more about multiple loops here:
    https://codex.www.ads-software.com/The_Loop#Multiple_Loops_Example_1

    Yeah but they really should make this easier.

    nathaniel-the-greatest

    (@nathaniel-the-greatest)

    So basically you’re saying that it can’t be done, that we can’t put the Jetpack related post widget in the sidebar?

    Why couldn’t you just tell us that in the first place? Or better yet, add this feature?

    I don’t know about anyone else, but I would much rather have this feature in the sidebar, and not at the end of the post. More people will see it there.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    @nathaniel It can be done through one of the 2 methods I outlined above, but you’ll need to make changes in your theme.

    If you don’t feel comfortable doing so, I’d suggest contacting your theme author for help, or hiring a WordPress professional via this job board:
    https://jobs.wordpress.net/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Related posts sidebar widget’ is closed to new replies.