Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
in Q2A Core by
I'd like to control the wording of the meta titles on the tags and categories pages. Is there an easy way to do so in a theme so I don't have to modify core files?


2 Answers

0 votes
edited by
Best answer

Sounds like you mean the <title> tag. If so, this is still in the core unfortunately... in qa-includes/qa-page.php, line 628. You should have access to the $qa_request variable to check which page you are on.

What you can do for now if you need to modify the core is mark it with a special comment, e.g. I use double star and my initials: /** SV: [description] */

Then when an upgrade comes, back up the old core, upgrade to the new core, then search all the files in your backup for the special comment, i.e. /** SV in my case. Copy the modifications into the new core. A little bit messy but the easiest solution I've found.

But hopefully all output will move into qa_theme_base next time, so we don't need any of these hacks!

0 votes

If you mean the title that shows up when you mouse over the links, you can change this using an advanced theme, i.e. without touching the core. The function you want to override is called ranking_label(...) and you can add a <SPAN TITLE="...">...</SPAN> around the $item['label'] in your version of that function. You can also check which page you're on by looking at $this->template.

Really ought to move all HTML output into qa_html_theme_base. Pretty simple, right?

...etc etc
Hmmm... I had the idea that certain things should not be able to be overridden by the theme (e.g. Javascript and custom header/footer set in the admin panel) but you're right that more things could certainly move to the theme. I'll revisit this issue for the next major release.
Yeah I can see where you're coming from. But I assume that people are only overriding functions when they need to. And would only override them if they knew what they were doing.
e.g. I always intended to override the Javascript inclusion to compile and integrate into my existing JS. For every tag, there is probably a notable situation where you might want to override the output.