Posts Tagged "code"

Showing code examples in WordPress posts

Posted by on Oct 5, 2010 in howto, wordpress

Very  brief post here, I’ve just spent literally 3 hours writing my last post – trying to show examples of the wordpress php and css I used to create a custom horizontal menu.

There are many great plugins out there that help you show code in your posts.  I specifically needed something that:

  • can be used in the Visual side of the WYSIWYG
  • can survive flipping back and forth between HTML and Visual without losing code or format
  • can handle <?php wp_nav_menu($args); ?>

The plugin that can do this, after 3 hours of trying various options, is SyntaxHighlighter Evolved.

With this plugin activated, I just paste my code within [code][/code] tags – right in the Visual editor.

Some finicky things I noticed:

  • If there are any blank lines in your code, you will end up with extra <div>, <br>, <p> tags that don’t belong
  • If you have code that is on two lines, but separated by a blank line – the display will number 3 lines of code.  To fix this, go into the HTML side of the WYSIWYG and backspace until your code is all on one line, then separate by hitting enter/return once. (If you try this on the Visual side, you will end up with a <br> tag that you don’t want.)
Learn More

#heweb09 jQuery: An Introduction – as easy as (pan)cakes?

Posted by on Oct 5, 2009 in Uncategorized

View the S5 presentation: http://www.ViethFamily.com/jQuery

There is absolutely no room in the jQuery session at #heweb09 – we started early because no one else could fit. Overall it’s been quietly exciting – lots of demos, a great introduction – I’d like to hear about the pros, cons vs flash and also some live examples (i.e. a school website)

BTW Our new homepage (launched last week) uses jQuery for its animations: http://www.ivey.uwo.ca

Learn More