Home Forums General Issues Shortcode to list related posts


Shortcode to list related posts

  • I’d like to create a shortcode that will pull a list of related posts.

    I have two custom post types: Authors and Books.

    I’m thinking the idea would be something like:

    [related_posts author=”john-doe”]

    Where john-doe would be the author slug. The shortcode would then list the books related to that author.

    Does anyone know if this approach would be the best way to do this, and might someone be able to point me towards some example code or snippets to help put this together. I’m having some trouble getting a shortcode that pulls the data from the relationship field.

Viewing 1 post (of 1 total)

The topic ‘Shortcode to list related posts’ is closed to new replies.