Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
806 views
in Q2A Core by
How i can remove sitename from questions titles.

currently : questions title - site name

need

question title only

2 Answers

+2 votes
by
edited by
 
Best answer

Option 1:

1. Open your qa-theme.php file

2. If your head_title() function is already overriden then you'll have to see how to remove the page title on your own (use Option 2 below for some ideas)

3. If your head_title() function is not there, then just add it with the following code:

function head_title() {
    $pagetitle=strlen($this->request) ? strip_tags(@$this->content['title']) : '';
    $headtitle=strlen($pagetitle) ? $pagetitle : '';
    $this->output('<title>'.$headtitle.'</title>');
}

Option 2 (Core hack, so try to avoid this):

1. Open qa-include/qa-theme-base.php

2. Replace:

$headtitle=(strlen($pagetitle) ? ($pagetitle.' - ') : '').$this->content['site_title'];

with:

$headtitle=strlen($pagetitle) ? $pagetitle : '';


According to the comments, it seems the user is looking for a way to just remove the site name from the title on questions page. Applying a similar fix this is the code that should be placed in the head_title() function:

function head_title() {
    $pagetitle=strlen($this->request) ? strip_tags(@$this->content['title']) : '';
    $headtitle=strlen($pagetitle) ? $pagetitle : '';
    if (!isset($this->content['q_view']))
        $headtitle.=' - '.$this->content['site_title'];
    $this->output('<title>'.$headtitle.'</title>');
}

 

by
function head_title() {
    $pagetitle=strlen($this->request) ? strip_tags(@$this->content['title']) : '';
    $headtitle=strlen($pagetitle) ? $pagetitle : '';
    $this->output('<title>'.$headtitle.'</title>');
}

working fine for page titles but home page title removed using this hack
by
What pages do you want to hide it from? Also note the "home page" is configurable. What is your home page? All activity?
by
my home page is default recent question answer and title of this page removed.

I need only sitename removed at end of questions titles
by
I've updated the answer to also reflect this behaviour
by
i want remove website title from category page i want leave only category name , how can do this? give me a code please.
0 votes
by
this plugin(Q2A Ultimate SEO) is in alpha, but it has the features to let you make complete title customizations:

http://www.question2answer.org/qa/35223/looking-for-ideas-to-improve-plugin-q2a-ultimate-seo
by
I always avoid to use plugins
...