• Resolved andrebazaglia

    (@andrebazaglia)


    Hello,

    I would like to display related posts twice: one time in the top of my posts and one time at the bottom. I’d like to make the related posts show as a list in the top of my posts (only displaying post names with links) and as a full widget in the bottom, including thumbnails and categories.

    My initial idea was to enable manually positioning using this function and then use do_shortcode( '[jetpack-related-posts]' ) twice: one time at the beginning of my posts and another time at the end. The related posts at the beginning would be inside a div that would use some display: none; to make only the links appear (hidding images, categories, etc).

    However, I’ve just noticied do_shortcode( '[jetpack-related-posts]' ) only works once: if I call it at the top, it won’t be called at the bottom.

    Any suggestions?

    Thank you.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter andrebazaglia

    (@andrebazaglia)

    I end up studying how related posts works and created my own shortcode function, that only gets the post’s name and link (it’s even better than my previous idea of hidding things).

    At the bottom of the post I use the native plugin shortcode, and at the top I’m using the function I created.

    Thank you.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    I end up studying how related posts works and created my own shortcode function, that only gets the post’s name and link

    Yes, that’s probably the best solution. Jetpack_RelatedPosts::init_raw() seems like the best solution here:
    https://jetpack.me/support/related-posts/customize-related-posts/#raw

    [jetpack-related-posts] was built to display Related Posts in the post content, instead of the default location. That’s why you experienced issues when trying to use the shortcode.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display related posts twice’ is closed to new replies.