Forum
Display the blog post category through variable
Hey, so iv got my blog post tags working as so:
$tag = ($post['0']['postTags']);
How do I get my categories showing also?
This code is currently in my post.php in header.
Thankyou
What's in
$post
?It's the standard blog post stuff, as in your open graph meta tutorial.
Will this help?
My post
my portfolio
What does this output?
Ok, so by that ouput I used [categories] like so:
and I get:
It spits out the URL not the name, so we're nearly there
You can get all of the fields for a category from its path using
perch_category()
How do I implement that in my code, as above?
I have this as my variables, they all work except the og_cat
then my $cat field is
Its for the meta data in my head.
What does this give you?
Do I just drop it in the post.php? it doesn't change anything.
It needs to go somewhere after you've defined and populated
$cat
.It gives me the correct category wrapped inside h4 tag and a ul
Ok, great. If you add
skip-template
?I can't work out where I would put that in the code given?
Cheers
In the options for
perch_category
.So like this?
Yes, but assign the result to something:
I've given up on this, it's not worth the effort for something not that important, its just holding me back.