Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
How to change the page title?
Avatar
Marco Rossi
Member
Free Members
sp_UserOfflineSmall Offline
Oct 10, 2012 - 7:21 pm

Hi all,

I bet that this topic has been discussed but I was not able to find it, in forum or codex, so ask here.

The page title formed by the forum is really terrible :) and I explain why.

The structure is inverse from forum's breadcrumbs, starting from the last to main title: topic | (page) | Forum | (optionally) Group | and this path is used to form the page title, that it's shown by page breadcrumbs too.

I attach a screen of this forum as it's the same thing that happens on mine.breadcrumb-page-title.pngImage Enlarger

In number ( 1 ) part there is the page breadcrumb/title and in ( 2 ) is the forum breadcrumb (correct).

I know that I can hide totally the page title in forum admin but, apart that in my theme it create a mess with the theme menu, I'd like to have a page title "topic tile" without page, forum or whatever or, at least, have the correct path from parent to childs.

How can I achieve this? I digged within forum theme but could not be able to find it, could you point me in the right direction?

Thanks in advance.

Marco

Hakuna Matata

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 10, 2012 - 7:36 pm

#1 is not put there by the forum... its done by the wp theme...  you can change the wp theme to output whatever you want...  it is typically done by page.php template file..  just make your own wp theme template file..

Avatar
Marco Rossi
Member
Free Members
sp_UserOfflineSmall Offline
Oct 10, 2012 - 7:53 pm

Hi Mr Papa,

I was in page.php and you are right, the page title function is called there but seems to me that it takes the page title, this is the code:

 <span id="map"><a href="<?php echo get_option('home'); ?>/"><?php _e('Home','colabsthemes');?></a> » <?php the_title(); ?></span>

        

    <h2 class="title"><?php the_title(); ?></problem-with-post-edit-button2>

I believe that the first part creates the breadcrumb and the second part, showns the page title, am I in error? If I disable the page title, in forum admin, it disappears from both locations.

What do you think about?

Hakuna Matata

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 10, 2012 - 8:04 pm

yes, that wp theme code will output your blog title » wp page title...

what do you want it to be?

Avatar
Marco Rossi
Member
Free Members
sp_UserOfflineSmall Offline
Oct 10, 2012 - 8:08 pm

I'd like that the title should not be "How to change the page title? | Simple:Press 5 General Topics | Support Forum" but simply "How to change the page title?" and this is formed by the forum, I suppose.

Hakuna Matata

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 10, 2012 - 8:09 pm

that is fine on topic view... but what about on the main group view page or a forum view page?

Avatar
Marco Rossi
Member
Free Members
sp_UserOfflineSmall Offline
Oct 10, 2012 - 8:22 pm

Ideally I'd like to see only the last ring of the chain:

if I'm in "How to change the page title? | Simple:Press 5 General Topics | Support Forum"

I'd like to see "How to change the page title?"

if I'm in "Simple:Press 5 General Topics | Support Forum"

I'd like to see "Simple:Press 5 General Topics"

and, of course, if I'm in "Support Forum" see only this.

Or, at least, how to invert positions from:

"How to change the page title? | Simple:Press 5 General Topics | Support Forum"

to: "Support Forum | Simple:Press 5 General Topics | How to change the page title? ! Page x" ?

Hakuna Matata

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Oct 10, 2012 - 8:36 pm

the page title is optimized for best seo...  putting the site first, will cause seo issues for you because all pages will start with a duplicate wording...  Getting the topic title out there first, is important for seo...

the breadcrumbs are organized differently because they are for reading rather than getting your site the best search engine results...

well, you will need to write a little piece of php code then...  where you check for page type and output something... there is nothing built in to do that...  something like:

global $sfvars;   
if ($sfvars['pageview'] == 'forum') {
    global $spThisForum;
    echo $spThisForum->forum_name;
} else if ($sfvars['pageview'] == 'topic') {
    echo $spThisTopic->topic_name;
} else {
    the_title();
}

but completely untested... ;)

Avatar
Marco Rossi
Member
Free Members
sp_UserOfflineSmall Offline
Oct 10, 2012 - 9:31 pm

Well, I'm not so tech savy so I tried to put your code here and there, without results :)

After I tried to build a function, inserting it in function.php and call it at place of the_title();

this is the code:

function spforum_page_title() {

global $sfvars;   
if ($sfvars['pageview'] == 'forum') {
    global $spThisForum;
    echo $spThisForum->forum_name;
} else if ($sfvars['pageview'] == 'topic') {
    echo $spThisTopic->topic_name;
} else {
    the_title();
}
}

 

and after I called it from the page template:  <h2 class="title"><?php spforum_page_title(); ?></problem-with-post-edit-button2>

and nothing works :(

I wrong so much?

Hakuna Matata

Avatar
Marco Rossi
Member
Free Members
sp_UserOfflineSmall Offline
Oct 10, 2012 - 9:36 pm

Regarding SEO you're completely right, but I manage SEO from a plugin or, as in this case, directly from theme settings, so I'm not worried for this.

The problem is with users, that with this kind of page title they get confused.

Hakuna Matata

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625