Forum
Page Title for Category name
How can I make the head 'page title' for a Category page show just the Category title?
My current method is to use:
'title' => 'Websitename - ' . perch_get('cat'), true,
However this just returns the "Websitename - setname/categoryname"
I want it to only show "Websitename - Categoryname" (without the setname)
The URL for the page is:
hosting.co.uk/products/category.php?cat=setname/categoryname/
You can get the category title with
perch_category()
https://docs.grabaperch.com/functions/categories/perch-category/
I am not getting any luck with this. I have tried replicating how the Blog Post works with now luck. This returns nothing:
The second parameter of
perch_category()
needs to be an array (where you have'catTitle'
)You probably want to use
skip-template
, pick outcatTitle
from the resulting array and concatenate that to your string.Sorry I don't really understand this :-(
Any chance for a Copy/Paste method for a simpleton?
As Duncan has explained, the second parameter needs to be an array.
The array contains any options you want to set, this is exactly the same as perch_content_custom and other functions in Perch and is just PHP.
I've written up some basic PHP information here: https://docs.grabaperch.com/perch/building/servers/how-do-i-get-started-with-php/