Jump to content

Loops & Categories in Posts

Recommended Posts



I am trying to use a loops section at the bottom of my post pages to show excerpts of posts in the same category.

If I edit the loop and select a specific category to display the change affects all posts. 

Is there any way of getting the loop to inherit the category of post it displays based on the currently displayed post category or use category specific post templates?

- Tim

Share this post

Link to post
Share on other sites

To try to answer my own question....I have created a custom single.php (thanks for the suggestion Simon)  containing :


global $pl_controller;

pl_add_static_settings( $pl_controller->content->section_opts() );


foreach(get_the_category() as $cat) {
        echo do_shortcode ('[pl_section section="loops" id="'.$cat->slug.'"]');

What's the best way to administer all the sections the short codes create? 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now