Keyword

Where to edit K2 after Item Fields

  • Mladen Mijatovic
  • Mladen Mijatovic's Avatar Topic Author
  • Offline
  • New Member
More
11 years 1 month ago #111570 by Mladen Mijatovic
Where to edit K2 after Item Fields was created by Mladen Mijatovic
I want to know where I can edit these data published after every K2 Item (these fields with: - read X times, published in:, Tagged, and social buttons). By the way I don't need to edit them I just wondered if there is an option to add one or two more fields (ex. Content downloaded from: x, or Pictures source: x).

In source I see this section is marked as "Plugins: AfterDisplayContent" but I don't know where to find it in backend.

I know there is extra fields option, but with that option I get two separated sections with "More details" fields.

Help please

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 1 month ago #111571 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Where to edit K2 after Item Fields
Since v. 2.6.2 you can directly output extrafields.

Have a look at this post , it explains how to achieve what you want.

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

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

  • Mladen Mijatovic
  • Mladen Mijatovic's Avatar Topic Author
  • Offline
  • New Member
More
11 years 1 month ago #111572 by Mladen Mijatovic
Replied by Mladen Mijatovic on topic Re: Where to edit K2 after Item Fields
Thank you Krikor, always found a solution for me.

Not so easy to fit into fields after item with my modest php knowledge, but I surely find a solution to put extra field name and value everywhere I want, thanks to you.

Appreciate that.

If someone have enough time and knowledge to put extra field name and value directly into these fields so it looks natural, please put a php source here I'll appreciate that too.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 1 month ago #111573 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Where to edit K2 after Item Fields
Hello Mladen this snippet inside item.php will do the trick :)
					
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Mladen Mijatovic
  • Mladen Mijatovic's Avatar Topic Author
  • Offline
  • New Member
More
11 years 1 month ago #111574 by Mladen Mijatovic
Replied by Mladen Mijatovic on topic Re: Where to edit K2 after Item Fields
Krikor you are the boss!

Thank you for your effort. Finally made what I want!

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

More
10 years 1 month ago #111575 by Joe Campbell
Replied by Joe Campbell on topic Re: Where to edit K2 after Item Fields
Your post is most helpful, I do have a question (I am not a coder :-)

What does this line of the code do...
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>

As I understand that this line tells the script to display whatever comes next if the extra field has a value
<?php if(isset($this->item->extraFields->EXTRAFIELDALIASHERE->value)): ?>

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
10 years 1 month ago #111576 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Where to edit K2 after Item Fields

Joseph wrote: Your post is most helpful, I do have a question (I am not a coder :-)

What does this line of the code do...
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>

As I understand that this line tells the script to display whatever comes next if the extra field has a value
<?php if(isset($this->item->extraFields->EXTRAFIELDALIASHERE->value)): ?>

The first line checks whether that k2 item has extra fields, i.e its parent category has a group assigned to it and this group has children extra fields, and also checks whether K2 is configured to display extra fields on the item view page.

As you said, this is to display whatever comes next, mainly what comes next are extra fields.

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.

More
10 years 1 month ago #111577 by Joe Campbell
Replied by Joe Campbell on topic Re: Where to edit K2 after Item Fields
Thanks Mohamed,

Based on what you said, the first line of code is not really needed, because if the item does not have Extra Fields assigned to it, it will just return/show nothing...correct?

Plus the display Extra Field parameter (based on category or item settings) determines if the item will display the extra fields. Does the first line of code have the ability to supersede the Extra Field parameter...is that the case?

I ask all of this (please remember, I am not a coder) because I want to create Item Template Overrides that will either

1) Display required extra field data (example: primary image), in that case, I would use
<img src="
<?php echo $this->item->extraFields->IMAGE1ALIAS->value; ?>
" />

2) Display non-required extra field data (example: secondary image), in that case, I would use
<?php if(isset($this->item->extraFields->IMAGE2ALIAS->value)): ?>
<img src="
<?php echo $this->item->extraFields->IMAGE2ALIAS->value; ?>
" />
<?php endif; ?>


So for my example,

A) Is my logic and code good/ideal?
B) Do I not need to include the following code, if I have the K2 item or category Extra Field parameter set to show?
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>

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


Powered by Kunena Forum