Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.6k views
in Plugins by

I wanna add few stuff to qa_post_html_fields funtion in qa-app-format.php and already did it but woth core hack. How an I override it without touching the core, using layer or plugin?

 

by
Maybe you don't really need to override anything. What is exactly what you're looking for? I mean, your requirement, to put it some way
by
Hi Pupi
In question list and question page I wanna style the category name next to the title of that question according to the logic below:
if (categoryNumber == 1 ){
     echo (categoryName in red + question title )
} else  {
    echo (categoryName in blue+ question title )
}

2 Answers

0 votes
by
selected by
 
Best answer

Based on your comment, you just want to add the category title before the question title in question view and question lists. It is not necessary to override a 362-line function to do so.

Answer is a bit long so I'm exceeding the max answer length so I created this Gist: https://gist.github.com/pupi1985/ebeb18fae2d8cc9cf31f

You should modify your qa-theme.php accordingly.

Then just apply the CSS based on your category: span.qa-q-item-title-cat-44 applies to category id 44. A screenshot might help users who don't find it easy to follow code:

 
by
Thank you very much, your solution only works in the question list, it doe snot change the title at the question page!
by
Yes, it does. That is what the code in the doctype() is doing. Double check that. If you still don't see that then remove all methods in the qa-theme.php but the ones I've given you, that should be enough to check if something in that file is interfering. I've tested it in Snow theme and works fine.
by
You were right about the interfering. Thank you!
by
And btw i am appending the category to the title for better SEO! Not %100 sure it helps though
by
Welcome. Sorry, I don't know much about SEO but being a Stack Exchange frequent user I'd advise you to ask that in http://webmasters.stackexchange.com
by
Getting back to you buddy, Thank you for the tips I finally decided to use this beauty:http://www.question2answer.org/qa/35946/q2a-breadcrumbs-v1-1-released-now-its-free
with the hope to improve my SEO
0 votes
by

1\ In qa-plugin.php

qa_register_plugin_overrides('Your plugin php file').

In "your plugin php file," just override the function you want to change.

 

source:http://question2answer.org/overrides.php

by
Thank you for your input, the issue is qa_post_html_fields cannot be overriden
...