Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Yoast and Simple Press Titles

Posted on 2014-09-23
10
Medium Priority
?
233 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 2000 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Online promotion is consistently becoming more important for all types of businesses. From Facebook ads to search engines to YouTube videos, there are all sorts of channels that can effectively be used to promote a business or product. But how shoul…
While Plesk offers many potential benefits to website administrators, including compatibility with Windows Server and other leading technologies, the company has also been working to differentiate it from other control panels for content management…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

972 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