Forum

Thread tagged as: Problem, Blog

Blog Sections - Filter by Categories

Hello,

I am trying to out put a list of blog posts from within a section.

The idea is to only show/list the blog posts that are from within a specific section that fall under a category name. At the moment it either shows all posts from within a category and seems to ignore the section.

help appreciated.

 <?php

                $posts_per_page = 10;
                $template       = 'post_in_list.html';
                $sort_order     = 'DESC';
                $sort_by        = 'postDateTime';



                if (perch_get('cat')) {
                    echo '<h1>Archive of: '.perch_blog_category(perch_get('cat'), true).'</h1>';

                    perch_blog_categories(array(
                            'category'   => perch_get('cat'),
                            'section'   => perch_get('s'),
                            'template'   => $template,
                            'count'      => $posts_per_page,
                            'sort'       => $sort_by,
                            'sort-order' => $sort_order,
                            ));

                    $posts_displayed = true;
                }



            ?>
Gary Thompson

Gary Thompson 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

perch_blog_categories() will list categories. Are you trying to list posts?

Hello,

My aim is to show within a specific blog section all of the categories associated within it, but without having other posts from other sections appear as well when a category is clicked on.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Categories themselves don't belong to a section, so I'm not sure that's going to be possible.

Would tags be a better option for me? thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think tags work in that way either.