Turn "Recent Posts" element into a "Related Posts" element (Based on a category)

Hi Guys!

This is a bit out-of-scope, so I rather post in this forum.

I have noticed that shrotcodes are working inside element option text boxes.

Recent posts element will show posts based on the category slug we enter.

So I have figured, When on a certain Blog posts, why wouldn’t I pick up the slug of the post Category dynamically, and turn it into the shortcode. Then use this shortcode inside the Recent posts element to display Related posts based on Category, dynamically. This is useful for example if a single Global block element is made to be placed inside Blog posts.

I have played around, but since I am not really a Dev, I wasn’t able to create a shortcode that would output the Category slug. Googling didn’t help in this case. (I’m also not sure what happens if the post has more than one category).

This function would effectively eliminate the need for a “Related Posts” plugin. At least the ones that are based on Categories.
Does anybody have an idea how to pull it off?

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.