Forum

Thread tagged as: Problem, Blog

How to get blog post with 2 categories

Im having trouble making a blog post appear in a 'featured posts' section.

I need only the latest post that has 2 categories, to appear. Currently a post will appear if it has only one of the 2 categories. I need it to meet both conditions.

My current setup is this:

<?php  
                perch_blog_custom(array(
                'sort'  =>'postDateTime', // most recent
                'count'  => 1,
                'template' => 'sidebar-post-in-list.html',
                'category' => array('meeting' , 'featured-sidebar'),
 ));?>

and the template:

<div class="sidebar-img-wrap">

    <!-- Featured post image -->
    <perch:if exists="image"><img src="<perch:blog id="image" type="image" width="50" height="400" crop="true" />"       alt="<perch:blog id="postTitle" />" /></perch:if>

    <!-- Title of feature block (e.g. 'Next Meeting') -->
    <p><span><perch:blog id="feature-title" type="textarea" label="Feature title" editor="markitup" 
    html="true" size="m" /></span></p>

</div>

<!-- Blog post title -->
<h2 class="sidebar-featured-heading"><a href="<perch:blog id="postURL" type="hidden" />" rel="bookmark" class="p-name">
<perch:blog id="postTitle" type="text" label="Title" required="true" size="xl autowidth" order="1" /></a></h2> 


<!-- Description (Blog post excerpt) -->
<div class="sidebar-featured-description entry-summary">
    <perch:blog id="excerpt" type="textarea" textile="true" />
</div>

Thanks

Chris James

Chris James 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Use:

'category-match' => 'all',