Get Tag Value from within a page.
Posted: Sun Aug 05, 2018 4:28 am
Hi, I am sure this is going to be easy for you guys... But i am only just beginning to learn PHP so please bear with me. I am customizing a theme for my site and want to show the tags associated to this 'page'.
I currently have :
which gives me:
How do I just get the 'key' part, or the 'permalink' part? I thought this was an instance of the class 'tag' with the accessible properties of 'key,permalink,name...' But I cannot get to the permalink, through the permalink() method.
Or, is this an array? Of strings?
Cheers for any help. Rob.
I currently have :
Code: Select all
<?php
$tags = $page->tags(true);
foreach ($tags as $tag) {
echo 'Tag name: ' . $tag;
// echo 'Tag key: ' . $tag->key();
// echo 'Tag link: ' . $tag->permalink();
// echo 'Tag amount of pages: ' . count($tag->pages());
}
?>
Code: Select all
Tag name: Flower Tag name: Course
Or, is this an array? Of strings?
Cheers for any help. Rob.