Keyword

Set ItemID for links from k2 Content module?

  • Wire Creative
  • Wire Creative's Avatar Topic Author
  • Offline
  • Senior Member
More
5 years 7 months ago #169042 by Wire Creative
Set ItemID for links from k2 Content module? was created by Wire Creative
Hi, I'm trying to help someone out with a site that uses K2 for their blog. They have no link to the blog in their navigation, only a k2 content module on the home page showing the three most recent posts. The template they are using adds some design options to each menu item. However, there is no way to set these options for pages that don't come from a menu item, like the links from the k2 content module, so the design looks unfinished on the blog pages.

I've tried creating a hidden menu item for the blog (latest items from k2 category) with the correct design settings, but the links from the content module still display differently. Is there a way to set the k2 content module to load links with a specific itemid so that we can control the design on those pages?

Thanks!

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

More
5 years 7 months ago #169046 by JoomlaWorks
Replied by JoomlaWorks on topic Set ItemID for links from k2 Content module?
Make sure the menu item you create points to the related K2 category that you use as blog, add a "blog" menu alias, make sure it's published and belongs to a Joomla menu that is also published but simply not displayed anywhere in Joomla through some module. Then clean your cache and re-test. All links will now become /blog/X-something. If you have sh404SEF on, you will need an extra addon for K2 to work with it. If you already have that, purge sh404SEF's cache. Similarly, if you use any other 3rd party SEF component, just delete its cache.

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

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

  • Wire Creative
  • Wire Creative's Avatar Topic Author
  • Offline
  • Senior Member
More
5 years 6 months ago #169228 by Wire Creative
Replied by Wire Creative on topic Set ItemID for links from k2 Content module?
Thanks for the feedback. This half-works. I normally use sh404sef, but this site doesn't have it, so I haven't faced this before.

I have a hidden menu item, which, when used, loads the pages using the correct /our-blog/ slug. When the items are clicked on from this category listing, the individual items load correctly using that slug followed by the item title alias. In these instances, all blog pages load with the correct modules and template settings.

The problem is that there are two K2 Content modules on the site. One is on all pages and one is just on the home page. Both of these modules link to the blog items using URLs like this:
/component/k2/item-title-alias
which loads the item pages without the correct module/layout assignments.

Interestingly, the one k2 content module that displays on all pages uses the correct "/our-blog/" slug in the URLs when its loaded on blog pages, but uses the "/component/k2/" slug when it loads on other pages, like the home page.

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

  • Wire Creative
  • Wire Creative's Avatar Topic Author
  • Offline
  • Senior Member
More
5 years 6 months ago #169229 by Wire Creative
Replied by Wire Creative on topic Set ItemID for links from k2 Content module?
Oh, I've also enabled the "extra link" at the bottom of the k2 content module that appears on every page, and set it to use the blog menu item. This always displays that menu item's url correctly as "/our-blog/" even when the list of items above it are using the component slug.

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

More
5 years 6 months ago #169241 by JoomlaWorks
Replied by JoomlaWorks on topic Set ItemID for links from k2 Content module?
Are all affected modules the official "K2 Content" module or 3rd party modules that offer similar functionality?

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

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

  • Wire Creative
  • Wire Creative's Avatar Topic Author
  • Offline
  • Senior Member
More
5 years 6 months ago #169251 by Wire Creative
Replied by Wire Creative on topic Set ItemID for links from k2 Content module?
Version 2.8.0 of K2 Content by Joomlaworks.

I didn't set-up this site, so anything's possible in terms of things being screwed up and not working normally.

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

More
5 years 6 months ago #169274 by JoomlaWorks
Replied by JoomlaWorks on topic Set ItemID for links from k2 Content module?
You mentioned sh404SEF but I forgot to ask... Do you have this? www.joomlaworks.net/extensions/commercial/k2-plugin-for-sh404sef

You'll need it for sh404SEF to work with K2 v2.7.0+.

If you already have that, it could be a faulty override. First off, upgrade to the latest K2 release (v2.9.0). Then have a look at the templating guide here: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

Disable any overrides by adding an underscore in front of the related module name inside your template's /html folder, e.g. rename /html/mod_k2_content to /html/_mod_k2_content. Clean site and sh404SEF caches. Does this issue still occur?

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

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

  • Wire Creative
  • Wire Creative's Avatar Topic Author
  • Offline
  • Senior Member
More
5 years 6 months ago #169284 by Wire Creative
Replied by Wire Creative on topic Set ItemID for links from k2 Content module?
No, this site DOES NOT use sh404sef. I've pitched that to the client as one means of fixing this issue, but right now it is just Joomla SEF.

However, it is using overrides for the K2 Content module. I'll see if I can take a look at those. It's complicated by my not having FTP access, but there is a Joomla extension that gives me file access.

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

More
5 years 6 months ago #169298 by JoomlaWorks
Replied by JoomlaWorks on topic Set ItemID for links from k2 Content module?
Sorry, I was skimming through the posts and misread your comment on sh404SEF. If you don't see the issue elsewhere, it's most likely a bad override.

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

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

  • Wire Creative
  • Wire Creative's Avatar Topic Author
  • Offline
  • Senior Member
More
5 years 6 months ago #169358 by Wire Creative
Replied by Wire Creative on topic Set ItemID for links from k2 Content module?
I'm looking at the overrides. They are quite different, but they still still load the item URLs with the "echo $item->link;" slug, just like the default template for this module, so wouldn't the URL be the same regardless of which template was used?

It does look like these overrides were made using K2 v2.6.0 while the site is using k2 v2.8.0. Could that be a problem?

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


Powered by Kunena Forum