- Posts: 69
COMMUNITY FORUM
How to display specific extra field in a Tag Page
- Steven Johnson
-
Topic Author
- Offline
- Senior Member
Less
More
12 years 2 months ago #110640
by Steven Johnson
How to display specific extra field in a Tag Page was created by Steven Johnson
I am able to display specific fields in my item and category page but it is not working for the Tag Page.
Here is what I am using
At top of page:
Here is what I am using
At top of page:
onlinebackupsearch.com/tag/howto.html
Thanks! -- Steven
Please Log in or Create an account to join the conversation.
- Andrey Miasoedov
-
- Offline
- Senior Member
12 years 2 months ago #110641
by Andrey Miasoedov
Replied by Andrey Miasoedov on topic Re: How to display specific extra field in a Tag Page
Hello, Steven.
You need to use your extra code not at top of page but after <?php foreach($this->items as $item): ?> code in tag.php template file. And also you need to replace $this->item with $item and use another variable name for extrafield, e.g.:
You need to use your extra code not at top of page but after <?php foreach($this->items as $item): ?> code in tag.php template file. And also you need to replace $this->item with $item and use another variable name for extrafield, e.g.:
Log in or Create an account to join the conversation.
- Steven Johnson
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 69
12 years 1 month ago #110642
by Steven Johnson
Replied by Steven Johnson on topic Re: How to display specific extra field in a Tag Page
Thanks so much for the reply and info.
I was able to get and extra field to display using this extra code
I was able to get and extra field to display using this extra code
Log in or Create an account to join the conversation.
- Steven Johnson
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 69
12 years 1 month ago - 12 years 1 month ago #110643
by Steven Johnson
Replied by Steven Johnson on topic Re: How to display specific extra field in a Tag Page
For those who are interested in using the newer method to display an extrafield on the tag page, a hack to one of the core files (as of K2 2.6.6) Here is what I did:
Add some extra code to components\com_k2\models\item.php
Add || $task == "tag" to extrafields condition (line ~181):
//Extra fields
if (($view == 'item' && $item->params->get('itemExtraFields')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemExtraFields')) || ($view == 'itemlist' && $task == 'tag' && $item->params->get('tagItemExtraFields')) || ($view == 'itemlist' && ($task == 'search' || $task == 'date') && $item->params->get('genericItemExtraFields')) || $task == "tag")
Use the following syntax to display the extra field
<?php echo $item->extraFields->fieldAlias->name; ?>
<?php echo $item->extraFields->fieldAlias->value; ?>
Add some extra code to components\com_k2\models\item.php
Add || $task == "tag" to extrafields condition (line ~181):
//Extra fields
if (($view == 'item' && $item->params->get('itemExtraFields')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemExtraFields')) || ($view == 'itemlist' && $task == 'tag' && $item->params->get('tagItemExtraFields')) || ($view == 'itemlist' && ($task == 'search' || $task == 'date') && $item->params->get('genericItemExtraFields')) || $task == "tag")
Use the following syntax to display the extra field
<?php echo $item->extraFields->fieldAlias->name; ?>
<?php echo $item->extraFields->fieldAlias->value; ?>
Please Log in or Create an account to join the conversation.
- ATHANASIOS ILIOPOULOS
-
- Offline
- Senior Member
Less
More
- Posts: 46
12 years 1 month ago #110644
by ATHANASIOS ILIOPOULOS
Replied by ATHANASIOS ILIOPOULOS on topic Re: How to display specific extra field in a Tag Page
Thanks Steven for this really useful hack..
I am wondering if there is any way of adding intro text per tag listing (menu item - k2 tags) ... I think this is not possible, eh? :)
I am wondering if there is any way of adding intro text per tag listing (menu item - k2 tags) ... I think this is not possible, eh? :)
Please Log in or Create an account to join the conversation.