Support Forum

How to change the page title?

MR Marco Rossi
Marco Rossi
Member

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.png

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

14 Answers

New Answer

MP Mr Papa
Mr Papa
Member

#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..

MR Marco Rossi
Marco Rossi
Member

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?

MP Mr Papa
Mr Papa
Member

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

what do you want it to be?

MR Marco Rossi
Marco Rossi
Member

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.

MP Mr Papa
Mr Papa
Member

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

MR Marco Rossi
Marco Rossi
Member

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” ?

MP Mr Papa
Mr Papa
Member

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… ;)

MR Marco Rossi
Marco Rossi
Member

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?

MR Marco Rossi
Marco Rossi
Member

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.

MP Mr Papa
Mr Papa
Member

but I was referencing the actual page title… that in the meta title tag… the displayed content page title is different…

I wanted you to put the code in your wp theme page.php file…  replace the code you pasted in post #3

MR Marco Rossi
Marco Rossi
Member

May be I didn’t explained well so attach a screenshoot of my page.

What I wish to change is this page title

page-title.png

and the code that I posted on #3 it produce this one.

First I tried to replace that code with yours in page.php but nothing changed so tried to replace in fullwidth_page.php that is the same code but in the specific template and your code only shown as plain text, so I tried to use it as function as I wrote in #9 .

Hope that now be more clear, if isn’t please let me know what info I have to provide to help.

I think that there is a function in SP that produce this sequence: “topic | (page) | subforum | forum | (Group) |” and use it as page title, what I ask is to change this sequence to ” forum | subforum | topic ” if only “topic” is not possible .

MP Mr Papa
Mr Papa
Member

to your last paragraph, yes there is a sequence that produces the topic | forum | wp page sequence… but as I explained it used in the head meta title tag which you really dont want to change for seo purposes… so there is no way to alter the sequence short of just writing a new function yourself…

our breadcrumbs do generate the sequence you want, but they are already displayed on the page, so not sure why you want to duplicate it…  why not just remove your wp page title and display the sp breadcrumbs in that case??  The breadcrumbs do not have to be graphical like on our site…

which left us with you saying you would take just the first part of that… on topic view, the topic title… on forum view, the forum title… and on group view, the wp page title…

which if you replaced all that wp code from post #3 with my code, should have done…  but perhaps there is an error in my code, but I dont see any way it would do the same thing if you remove the old code…

please post that whole code segment from the page.php template file…  it should not have the original code and should have my code…  I can try testing it out tonight and verify it works…

MR Marco Rossi
Marco Rossi
Member

Steve, I don’t want bother you anymore with this matter, I thought that was something easy to achieve, not create all this mess.

I duplicate the page template and will remove the page title completely.

Thanks for all your time, I appreciated it.

Marco