Support Forum

Posting Code into Topics

RE rebeccagill
rebeccagill
Member

We are using the forum for theme support and my technical support team is having trouble posting actual code for forum users to read and copy.  I’m 100% sure there is an easy fix for this and it is probably already listed in the forum somewhere.  For the life of me I can’t find it.

 

Can you provide a brief set of instructions for posting code into the forum and having it display as code?

 

Thanks so much!

12 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

First, install and activate the SP ‘Syntax Highlighter’ plugin.

To use it you really need to be using the tinymce editor although it can be used manually in other editors.

Insert the code. You need to really copy the code from a code editor and paste it into the post. Highlight the code section (only) with the mouse cursor and then open the editor toolbar code button (far right) and select the code language being used.

That’s it.

RE rebeccagill
rebeccagill
Member

Thanks so much for the thorough and prompt reply.  I will pass onto my tech guys to implement.

YS Yellow Swordfish
Yellow Swordfish
Member

Hope it works for you OK. We use it on this site quite extensively. You have the option to use it in blog posts as well once it is active.

RH Rolf Hassel
Rolf Hassel
Member

Sorry for the test here:

 

<?php
 if ( file_exists(STYLESHEETPATH . '/featured.php') )
 include_once(STYLESHEETPATH . '/featured.php');
 else
 include_once(TEMPLATEPATH . '/featured.php');
 ?>

 

test

YS Yellow Swordfish
Yellow Swordfish
Member

I would need to be able yo see the actual forum page this is on to be able to see what CSS is being applied (using Firebug or any built in browser development tools) but my guess is that this is being overridden in some way by your WP theme or another plugin. No way to know without inspecting it…

RH Rolf Hassel
Rolf Hassel
Member

Thanks for helping here. Here is the site: http://myclassipress.com/

WordPress 3.5.1

Theme: “Appply” from Woothemes ( http://www.woothemes.com/products/appply/ )

Changes done in the forum: Only some color changes in shades-of-gray(css)

It seems that there is a conflict between this syntax highlighter in the forum and the Crayon highlighter from http://aramk.com/projects/crayon-syntax-highlighter/ because i just made a test and switched off the Crayon plugin. The code then gets highlighted in the forum as it does here.

It’s not a solution for me to use the highlighter from the forum in my blog, as Crayon gives much more possibilities in use. When you visit the site you will understand why the syntax highlighter is one off the most important things that gets used. (tutorials)

I hope you can give me a solution. 

Thank you

 

 

 

YS Yellow Swordfish
Yellow Swordfish
Member

First question is does this ‘Crayon’ plugin allow you to stop it being loaded on certain pages?

MP Mr Papa
Mr Papa
Member

so its loading its stuff on every page?  even if not needed?  what a waste…

can you find in the code of the plugin, where the script is loaded?  then we can help give you some code for your sp functions file to unload it on the forum page…

RH Rolf Hassel
Rolf Hassel
Member

Well, i’m not sure how else it should work. The script gets loaded when a WP page or post is in use.

I’m absolutely not blaming Simple-Press for this behaviour, i’m just not clear about how to tell a script in which WordPress page it should not load.

For example: I create a “about us” page and a “Forum” page. How can i tell a script “do it here, but not there”

Don’t even know where i should look in this plugin: http://wordpress.org/extend/plugins/crayon-syntax-highlighter/changelog/

 

MP Mr Papa
Mr Papa
Member

guess it should be expected that two plugins trying to do the same thing to content would have problems…  and since they dont selectively load their stuff when needed, and do not appear to provide a hook to keep it from loading, then I would suggest forcing it not to load the entire plugin on the forum page…

there are multiple plugins for wp that you selectively disable (or enable) plugins on certain pages… I would give one of those a try… I think the one folks use the most is:  http://wordpress.org/extend/plugins/plugin-organizer/