Keyword

K2 tag subtemplate not working as expected

  • Andrea
  • Andrea's Avatar Topic Author
  • Offline
  • Senior Member
More
3 years 7 months ago #176902 by Andrea
Hi, i've just noticed that for some reason the item titles get displayed above the item image in the tag view:
verticalife.it/it/blog/tag/piemonte

While all i want to do is having the items look just like on the main blog page:
verticalife.it/it/blog

So i went to public_html/templates/mytemplate/html/com_k2/templates/myblogtemplate and edited tag.php which not surprisingly had the item title blog ABOVE the item image. I then invered it, just like below:

Warning: Spoiler!


However this didn't solve anything. I'm really confused lol, looking forward to your reply!
Have a nice day

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #176908 by JoomlaWorks
Replied by JoomlaWorks on topic K2 tag subtemplate not working as expected
You need to edit /templates/mytemplate/html/com_k2/default/tag.php. Also move the files from /templates/mytemplate/html/com_k2/templates/myblogtemplate to /templates/mytemplate/html/com_k2/myblogtemplate. The additional "templates" folder inside com_k2 is no longer needed.

Why change default/tag.php? Because this is the template file loaded for tags that are not linked to a menu item and as such cannot have a different sub-template assigned to them. If the file does not exist, copy if from K2's source template files.

More on overriding K2 here: getk2.org/documentation/tutorials/templating-with-k2-and-the-concepts-of-sub-templates

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Andrea
  • Andrea's Avatar Topic Author
  • Offline
  • Senior Member
More
3 years 7 months ago #176909 by Andrea
Replied by Andrea on topic K2 tag subtemplate not working as expected
Hi Fotis, i've got no "default" folder in this path /templates/mytemplate/html/com_k2/
Shall i create it?

Please Log in or Create an account to join the conversation.

  • Andrea
  • Andrea's Avatar Topic Author
  • Offline
  • Senior Member
More
3 years 7 months ago #176910 by Andrea
Replied by Andrea on topic K2 tag subtemplate not working as expected
Ok so i've created the default folder and edited the tag.php for it to display the image above the header, and that went fine. However it has messed up with other things, including the pagination, which i didn't alter (i just edited the code between the <!-- Start K2 Tag Layout --> / <!-- End K2 Tag Layout --> comments).
Please see the attached screenshots: any idea on what i should do?
Thanks again
Attachments:

Please Log in or Create an account to join the conversation.

  • Andrea
  • Andrea's Avatar Topic Author
  • Offline
  • Senior Member
More
3 years 7 months ago #176911 by Andrea
Replied by Andrea on topic K2 tag subtemplate not working as expected
Nevermind i figured it out, couldn't find the "delete reply" option so thanks, i'll post here in the event i get other related issues!

Please Log in or Create an account to join the conversation.

  • Andrea
  • Andrea's Avatar Topic Author
  • Offline
  • Senior Member
More
3 years 7 months ago #176913 by Andrea
Replied by Andrea on topic K2 tag subtemplate not working as expected
Hi, i got nearly everything i wanted to do, i just have another question: is it possible to have all the tags of a given article displayed in the tag view? Please see attached screenshots: the first one is an item in the blog main category, the second is an item in the filter for tag page.
Links: verticalife.it/it/blog // verticalife.it/it/blog/tag/news

Thanks again for everything!
Attachments:

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #176916 by JoomlaWorks
Replied by JoomlaWorks on topic K2 tag subtemplate not working as expected
Try placing this block where you want the tags to show up for each item:
        <?php if(isset($item->tags) && count($item->tags)): ?>
        <!-- Item tags -->
        <div class="tagItemTagsBlock">
            <span><?php echo JText::_('K2_TAGGED_UNDER'); ?></span>
            <ul class="tagItemTags">
                <?php foreach ($item->tags as $tag): ?>
                <li><a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?></a></li>
                <?php endforeach; ?>
            </ul>
            <div class="clr"></div>
        </div>
        <?php endif; ?>

Let me know if it works.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Andrea
  • Andrea's Avatar Topic Author
  • Offline
  • Senior Member
More
3 years 7 months ago #176922 by Andrea
Replied by Andrea on topic K2 tag subtemplate not working as expected
Hi Fotis, thanks again for your assistance! I indeed managed to make tags appear thanks to your kind advice.
Just one more small thing: when i did so, the readmore below kind of got upwards, check both previous links to see the difference -- on the main blog page the readmore is standing at the very bottom of the container, on the tag view pages it has a gap. Any idea how i can fix it?

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #176927 by JoomlaWorks
Replied by JoomlaWorks on topic K2 tag subtemplate not working as expected
Looks OK now on your site so I guess it was some CSS or order-of-HTML issue.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum