Keyword

Subtitle under title

  • IOANNIS PAPAKOSTAS
  • IOANNIS PAPAKOSTAS's Avatar Topic Author
  • Offline
  • New Member
More
7 years 9 months ago #156571 by IOANNIS PAPAKOSTAS
Subtitle under title was created by IOANNIS PAPAKOSTAS
Hi, i am building a news site and i use k2 for articles.

I would like to give the option to the authors to write a subtitle under the main title of the article. I searched around but i didn't find any solution.
I am a beginner with php so i need some help here.

One idea is to edit the item.php file so when writting the title the author could enter a special character like a semicolon and after enter the text for the subtitle. This way it will not be necessary to make an extra field in the backend for this purpose.
An example:
The author writtes Title | Subtitle in k2 title field and the output should be:
Title
Subtitle


Any idea how can i make this?

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
7 years 9 months ago #156577 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Subtitle under title
Hi

This can be done by explode() function.
$titlesArray = explode("|", $this->item->title);
echo $titlesArray[0];                // This is the main title
echo $titlesArray[1];                // This is the subtitle

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.


Powered by Kunena Forum