Keyword

[SOLVED] Adding markup before & after display of K2 Module Items

  • Chris Lawson
  • Chris Lawson's Avatar Topic Author
  • Offline
  • New Member
More
7 years 6 months ago #161093 by Chris Lawson
I am trying to change the markup rendered in the K2 Content Module before and after items like the title, the image etc.

There are these tantalizing comments in the page source like
<!-- K2 Plugins: K2BeforeDisplay -->

...which hint that there might, somewhere be a place where I could insert something a bit more semantic, like, say H2 or H3 so that my item titles had something other than
<a class="moduleItemTitle" etc etc">
to hang CSS style declarations on and not get me in trouble with the accessibility people.

But I cannot for the life of me find where in the admin interface this is.

What am I missing?

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

More
7 years 6 months ago - 7 years 6 months ago #161095 by STEPHAN HERBY
Hi Chris,
Actually the way I do that kind of things is override...

Duplicate the source page you are talking about, probably :
MySite/modules/mod_k2_content/tmpl/Default/default.php

And paste it in :
MySite/templates/MyTemplate/html/mod_k2_content/MyModuleoverride/default.php
Where "MyTemplate" is the folder of the template used on your frontend and where "MyModuloverride" is the name of the template of you module you have just created (name it as you want actually).

There you can modify your "default.php" to fit your needs...
I.E. change line 38 :
<a class="moduleItemTitle" href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a>
to
<h1><a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a></h1>
Last edit: 7 years 6 months ago by STEPHAN HERBY.

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

  • Chris Lawson
  • Chris Lawson's Avatar Topic Author
  • Offline
  • New Member
More
7 years 6 months ago #161097 by Chris Lawson
Fabulous. Then I just have to edit the module and select the sub-template that named "MyModuleoverride" or whatever you end up calling it and it works.

Thanks so much for the quick, spiffy solution.

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


Powered by Kunena Forum