Forum

Thread tagged as: Question, Blog

Need assistance with a php conditional statement that refers to perch categories

Hi all,

I have a Perch blog that is working successfully. I have two categories, one for news and one for events. If someone selects 'news' or 'events' they can then look at the excerpts for the news stories or events and click on a button to 'read more' in each case. This loads the 'post.html' file, however, I'd like to add a button to the base of the post that has a conditional statement attached to it that says something like:

If the post loaded is taken from the category 'news', then change the text in the button to 'Back to News' and the url to /news... else change the text in the button to 'Back to Events' and the url to /events.

Can anyone assist?

I'm very new to Perch and my php is newb status.

Thanks

Gary Ward

Gary Ward 0 points

  • 5 years ago

Gary, I would add the category to the url then use perch_get() in the conditional, much the same as a blogs url.

Many thanks for the advice!