Jump to content

Archived

This topic is now archived and is closed to further replies.

Tim

Loops & Categories in Posts

Recommended Posts

Tim

Hi,

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
Tim

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

<?php

global $pl_controller;


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

$pl_controller->content->get_loop();

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

×