- Posts: 46
COMMUNITY FORUM
K2 item - page title extra field not working
- Andrea
-
Topic Author
- Offline
- Senior Member
Less
More
4 years 7 months ago #176938
by Andrea
K2 item - page title extra field not working was created by Andrea
Hi, as always thanks for the super reliable support.
This time i must be doing something wrong with the pagetitle extra field i tried to set for the new website i'm working on. I previously managaed to do this on other websites but time has passed and i no longer remember the steps.
Anyway i assigned the items of this category (valpelliceoutdoor.it/attivita/trekking/bobbio-pellice) the extra-field "PageTitle", in order to have it used as the browser page title instead of the default one.
I then proceeded to put this in item.php, just below the itemHeader opening tag:
But this does not work. Any suggestions?
This time i must be doing something wrong with the pagetitle extra field i tried to set for the new website i'm working on. I previously managaed to do this on other websites but time has passed and i no longer remember the steps.
Anyway i assigned the items of this category (valpelliceoutdoor.it/attivita/trekking/bobbio-pellice) the extra-field "PageTitle", in order to have it used as the browser page title instead of the default one.
I then proceeded to put this in item.php, just below the itemHeader opening tag:
Warning: Spoiler!
<?php
$newtitle= $this->item->extraFields->PageTitle->value;
$document = JFactory::getDocument();
$document->setTitle($newtitle);
?>
But this does not work. Any suggestions?
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
Less
More
- Posts: 6227
4 years 7 months ago #176941
by JoomlaWorks
Replied by JoomlaWorks on topic K2 item - page title extra field not working
Did you check if $newtitle returns anything? Just to be on the safe side, you could wrap everything after the $newtitle assignment to an if statement that checks if a value is returned for it...
The only other reason why the <title> would not change is some 3rd party plugin for SEO/meta tags.
The only other reason why the <title> would not change is some 3rd party plugin for SEO/meta tags.
Please Log in or Create an account to join the conversation.
- Nathan
-
- Offline
- Junior Member
Less
More
- Posts: 25
4 years 7 months ago #177035
by Nathan
Replied by Nathan on topic K2 item - page title extra field not working
Hi Fotis,
A piggy back question on this topic... if I customise the Page Title via this method will the Open Graph title also be updated?
Thanks
Nathan
A piggy back question on this topic... if I customise the Page Title via this method will the Open Graph title also be updated?
Thanks
Nathan
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
Less
More
- Posts: 6227
4 years 6 months ago #177043
by JoomlaWorks
Replied by JoomlaWorks on topic K2 item - page title extra field not working
No, because it's created before the template renders. You'll need to override that meta tag as well.
Please Log in or Create an account to join the conversation.
- Nathan
-
- Offline
- Junior Member
Less
More
- Posts: 25
4 years 6 months ago #177048
by Nathan
Replied by Nathan on topic K2 item - page title extra field not working
Thanks Fotis, that makes sense.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
Less
More
- Posts: 6227
4 years 6 months ago #177050
by JoomlaWorks
Replied by JoomlaWorks on topic K2 item - page title extra field not working
You're welcome.
Please Log in or Create an account to join the conversation.