- Posts: 28
COMMUNITY FORUM
Adding an extra field to item.php
- Robert Peterson
- Topic Author
- Offline
- Junior Member
Less
More
10 years 10 months ago #120674
by Robert Peterson
Adding an extra field to item.php was created by Robert Peterson
I feel silly even asking this, but how can I add a specific extra field to item.php? I'd like to add a field near the item title.
Surely there's a shortcode for this, right?
Thanks!
Surely there's a shortcode for this, right?
Thanks!
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
10 years 10 months ago #120675
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Replied by Mohamed Abdelaziz on topic Re: Adding an extra field to item.php
Yes there is, get the field alias at first from the backend, lets say it is: ALIAS
then add this code anywhere you want in item.php:if you want to display the field label, use this code snippet:
then add this code anywhere you want in item.php:
<?php echo $this->item->extraFields->ALIAS->value
<?php echo $this->item->extraFields->ALIAS->name
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.
- NAEEM ISHAQ
- Offline
- New Member
Less
More
- Posts: 2
10 years 10 months ago #120676
by NAEEM ISHAQ
Replied by NAEEM ISHAQ on topic Re: Adding an extra field to item.php
Mohamed Abdelaziz, Please tell me what to do, I want to display an introduction text for item. which type for extra field has to be selected? and which & where code to be added in the item.php
thanks.
thanks.
Please Log in or Create an account to join the conversation.
- Robert Peterson
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 28
10 years 10 months ago #120677
by Robert Peterson
Mohammed, thanks so much for the information!
Replied by Robert Peterson on topic Re: Adding an extra field to item.php
Mohamed Abdelaziz wrote: Yes there is, get the field alias at first from the backend, lets say it is: ALIAS
then add this code anywhere you want in item.php:if you want to display the field label, use this code snippet:<?php echo $this->item->extraFields->ALIAS->value<?php echo $this->item->extraFields->ALIAS->name
Mohammed, thanks so much for the information!
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
10 years 10 months ago #120678
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Replied by Mohamed Abdelaziz on topic Re: Adding an extra field to item.php
Hi Naeem,
The introduction text is not an extra field, you can access it by this statement:in item.php file.
In fact you will find it already there, but you may need to inset a readmore link in the item text to divide it into intro and full text.
The introduction text is not an extra field, you can access it by this statement:
<?php echo $this->item->introtext; ?>
In fact you will find it already there, but you may need to inset a readmore link in the item text to divide it into intro and full text.
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.