Forum

Thread tagged as: Question, Problem, Addons

Blog Tags Value To Filter By

What value should I use to display posts by tags?

I have this but its wrong:

<?php perch_blog_custom(array(
'template' => 'post_in_list.html',
'paginate'=> true,
'count' => 8,
'filter' => 'postTags',
'match' => 'eq',
'value' => 'postTags',
'sort' => 'postDateTime',
'sort-order' => 'DESC'
));

?>
Nigel Coath

Nigel Coath 1 points

  • 7 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

The information is detailed in the documentation: https://docs.grabaperch.com/addons/blog/page-functions/custom/

Under the heading "perch_blog_custom options".

"tag: A single tag or array of tags to return content for. To exclude a tag, prefix its name with an exclamation point."

I have read that and I am still not understanding it.

To get a display of the tags used in a post I had to use perch:blog id=postTags as the link text and href to get it to display anything even thought the docs say to use tagSlug, which did not display anything (maybe the docs are out of date or incorrect?).

But I just cannot work out what to filter by, I tried this:

'template' => 'post_in_list.html',
'paginate'=> true,
'count' => 8,
'filter' => 'postTags',
'match' => 'eq',
'value' => 'postTags',
'sort' => 'postDateTime',
'sort-order' => 'ASC'

But I think the error is in the value, but what should this be as surely this is dynamically selected?

Solved this one.

This seemed to work:

'template' => 'post_in_list.html',
'paginate'=> true,
'count' => 8,
'tag' => perch_get('tag'),