Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.2k views
in Q2A Core by
How do I go about changing the title for the index/homepage only?

Example:

For the example the website will be called "Test Website"

Homepage Title:

"Test Website - This is the best website come check us out!"

and for all the other pages it should just be:

"whatever - Test Website"

I'm using the Donut theme.

Thanks.
Q2A version: 1.8.3

1 Answer

+5 votes
by
selected by
 
Best answer

1. Edit file qa-theme/Donut-theme/qa-donut-layer.php

2. Add this function to the class:

public function head_title() {
    if (qa_request() === '') {
        $firstPart = $this->content['site_title'];
        $secondPart = 'This is the best website come check us out!';
    } else {
        $firstPart = strip_tags(@$this->content['title']);
        $secondPart = $this->content['site_title'];
    }
    $this->output(sprintf('<title>%s - %s</title>', $firstPart, $secondPart));
}
by
+1
Thanks it worked!
by
+1
thank you worked yes!
...