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
I have want to use prism, a lightweight syntax highlighter. I am new to php and web programming, and I am using the default snow theme for q2a 1.5.4. Please guide me how to add a CSS and JS file through theme. I would highly appreciate if someone can provide step-by-step approach .

Here is the highlighter, which i want to add through my theme
http://www.prismjs.com/
Q2A version: 1.5.4

2 Answers

–1 vote
by

For the css file. Find this function in  qa-theme-base.php

I never used this, but I am just assuming. Hopefully someone else let know :)

function css_name()
{
return 'qa-styles.css?'.QA_VERSION;
return 'prism.css?'.QA_VERSION;
}
 
This one for javascript
 
function body_script()
{
$this->output(
'<SCRIPT TYPE="text/javascript"><!--',
"var b=document.getElementsByTagName('body')[0];",
"b.className=b.className.replace('qa-body-js-off', 'qa-body-js-on');",
'//--></SCRIPT>',
'<script src="prism.js"></script>
'
);
}
 
And this done by using overriding those two functions in qa-theme.php and not  qa-theme-base.php
 
Do not edit  qa-theme-base.php

 

by
Thanks for your answer.
I tried this on my local machine. I edited qa-theme.php and added the above two function. but its not working.
Am I going in the wrong direction???
+1 vote
by
by
Nice article.
by
thanks.. hope it would be useful...
...