Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
353 views
in Q2A Core by
edited by
How can I add a h2 or h3 tag to text in answers or in questions?

Should be easy to add that option to the wysiwyg editor, question is how?

I see settings in qa-wysiwig-editor.php, I guess it has to be added somewhere in these lines:

$qa_content['script_onloads'][]="CKEDITOR.replace(".qa_js($fieldname).", {toolbar:[".
                "['Bold','Italic','Underline','Strike'],".
                "['Font','FontSize'],".
                "['TextColor','BGColor'],".
                "['Link','Unlink'],".
                "'/',".
                ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'].
                "['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],".
                "['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],".
                "['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'],".

Anyone know the code to add h2, h3 tags here?

1 Answer

+2 votes
by
 
Best answer
I found it myself, here's how to do it - quite easy.

Open qa-wysiwyg-editor.php

add this to the section mentioned above in the question itself

"['Styles'],".

Now go to the following directory and open the default.js:

/qa-plugin/wysiwyg-editor/plugins/styles/styles/default.js

and add this or edit to your liking:

{name:'Blue H2',element:'h2',styles:{color:'Blue'}},{name:'Red h2',element:'h2',styles:{color:'Red'}},{name:'Red h3',element:'h3',styles:{color:'Red'}},{name:'Blue H3',element:'h3',styles:{color:'Blue'}},

Upload the changed files and now you can easily add h2 and h3 headers.

Which can sure help with your seo efforts.

BTW Gideon, thanks for such a great script!

Shalom!
...