- Posts: 8
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] Estimated Reading Time plugin How to adapt K2
[SOLVED] Estimated Reading Time plugin How to adapt K2
- Valentine Solo
- Topic Author
- Offline
- New Member
May be community can help?
As follows from doc reference, to use it on overrides templates we should add the following:
$this->item->readingtime->slowtime : The slower time your users might take reading the article
$this->item->readingtime->quicktime : The quicker time your users might take reading the article
$this->item->readingtime->formattedtime : The plugin output, which you can override using directions in previous section.
$this->item->readingtime->wordCount (Since 3.5.1) : The number of words in the article
But default.php of this plugin is just all about com content. I'd like to use it in K2 and appreciate any tips.
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
I have looked into the code of the plugin, it is restricted to work with Joomla articles only, so you need to modify it to work with K2.
Edit the readingtime.php file, and the required if conditions to work with K2, just like $context == 'com_k2.item' and/or $context == 'com_k2.itemlist'
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Valentine Solo
- Topic Author
- Offline
- New Member
- Posts: 8
Mohamed Abdelaziz wrote: Hi Valentine,
I have looked into the code of the plugin, it is restricted to work with Joomla articles only, so you need to modify it to work with K2.
Edit the readingtime.php file, and the required if conditions to work with K2, just like $context == 'com_k2.item' and/or $context == 'com_k2.itemlist'
Just the thing I needed. Thanks. Now It is clear and easy)
As conclusion:
if ($context == 'com_content.article' || $context == 'com_content.featured' || $context == 'com_content.category' || $context == 'com_k2.item')
Or to use js to get the same value of reading time.
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] Estimated Reading Time plugin How to adapt K2