Solved

Yoast and Simple Press Titles

Posted on 2014-09-23
10
217 Views
Last Modified: 2014-09-23
All of the page titles on the forum section have the same title - the main title of the forum itself: http://www.sempdx.org/forum/search-specifics/

Using that page as the example, the title is SEMpdx Search Marketing Forum which is the same no matter what your viewing on the forum. What we need it to show for the title is the title you see in the light blue bar which is Search Specifics.

Neither Yoast or Simple Press have a solution for this. They feel that it's picking up the title correctly, which wordpress's wp_title, yes it is, but now we have over a hundred listed pages with that exact same title.

Anyone have any ideas on how to pick up that next title in the blue bar so we have unique page titles? I think even getting the deepest level in the url could be a decent solution as long as the dashes could be replaced with spaces and the first letter of each word capitalized.

Thanks for any help.
Heather
0
Comment
Question by:Dzynit
  • 4
  • 4
  • 2
10 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40339642
Agree with them, whatever plugin you are using for the forums is not setting the page title correctly.
0
 
LVL 14

Author Comment

by:Dzynit
ID: 40339673
Right. But I'm not going to pay for the support membership and continue arguing with the plugin author because the forum there at sempdx is no longer active for new posts. But the forum is staying in place so people can still read previous posts.

That's why I'm thinking the simplest solution would be to grab that last section from the urls and use them as the title. I just need help with some php that would grab that and then convert it into a visually correct title.
Like /search-specifics/ should convert into Search Specifics.

Do you agree something like that would work?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40339689
Not knowing the plugin you could delve into the code, see what variable it is using for the title and use that in the page meta title tag.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 14

Author Comment

by:Dzynit
ID: 40339711
I tried, but the plugin is so bulky. My customer doesn't want me to spend a pile of time on this either. Simplest solution is the best.
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40339831
You can try

$urlparts = explode("/",$_SERVER["REQUEST_URI"]);

$title=ucwords(str_replace("-"," ",$urlparts[count($urlparts)-1]));

Open in new window


And hardcode the $title in the meta tag.
0
 
LVL 1

Expert Comment

by:Richard Francis
ID: 40339860
It's not the most optimal solution but you could get the page title from the contents of div with the id spTopicHeaderName. You could then set the page title with jQuery.

Something like:

$(document).ready(function() {

  Var newTitle = $( "#spTopicHeaderName" ).text()
  $(document).prop('title', newTitle);

});

Open in new window

0
 
LVL 58

Expert Comment

by:Gary
ID: 40339865
Using javascript search engines et al will still list the original title
0
 
LVL 14

Author Comment

by:Dzynit
ID: 40339873
Thanks Richard, but I was thinking the same thing as Gary. Gary, I'm going to try your suggestion here shortly. I have something else to finish up then I get back to that site and try it out.
0
 
LVL 1

Expert Comment

by:Richard Francis
ID: 40339892
No worries. As I said it wasn't the most optimal solution.
0
 
LVL 14

Author Comment

by:Dzynit
ID: 40339955
Gary, I had to make one edit on the count to -2 because it was counting the trailing slash that's auto added and it works great.

Here's what I used:

to the theme's functions.php
function forumtitle() {
	$urlparts = explode("/",$_SERVER["REQUEST_URI"]);
	$title=ucwords(str_replace("-"," ",$urlparts[count($urlparts)-2]));
	if ($title == 'Forum') { $title = 'SEMpdx Search Marketing Forum'; }
	return $title;
}                                          

Open in new window


In the header.php (id of course being the forum's main page id #)
<title><?php if(get_the_id() == 392) { echo forumtitle(); } else { wp_title(); } ?></title>

Open in new window


Thank you very much!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question