Forum
Finding what section a specific blog post is in?
I have some working code that checks if a blog post is in a specific category so I can then do something extra within the page, like this:
post.php
:
$var = trim(perch_blog_post_categories(perch_get('s'), '_category_check1.html', true));
_category_check1.html
:
<perch:if id="categoryTitle" match="eq" value="Specific Heading">true</perch:if>
I want to do something similar, but instead I need to check if a blog post is in a specific section.
I've created _section_check1.html
...
<perch:if id="sectionTitle" match="eq" value="Specific Heading">true</perch:if>
I can't seem to get the right working code for 'post.php' so I can set the variable if that heading's found. Anyone advise please? ... Graham
I'm unable to get this working and have emailed info to hello@ - because the date/code I need to supply was quite lengthy and contained info I didn't really want public. Hope you can tie up my email with this and put me straight. I must be missing something really obvious I think.
I've now set this up in a local hosting setup so I can get better diagnostics.
This code ...
... generates this error ...
What does this give you?
The posting I was looking at was huge so set up a test/short one instead ...
Looking at that output, picking up the 'sectionID' would probably be all I need as its now not likely to change. So, is it ...
Yes, that should work. Not working?
Yes, that got it. Many thanks. The blog is now switched over to sections, leaving categories for the use intended.