Posted by Wordmobi
Posted by Wordmobi
I wanted to create a couple of static pages on the blog, namely the about & projects pages. On each of these I wanted to display different content in different styles. This turned out to be more of a challenge than I initially though (probably due to ‘what’ I actually wanted to do). The idea was simple, the about page should contain information about me, possibly containing an embarrassing mugshot and other various contact details and info. The projects page is to be somewhere I can blog about the various personal projects I’m working on. Let me go into more detail….
Well, I tried. I have been wrestling with various plugins/hacks/work-arounds that will allow me to post code snippets into my blog without it ending up borked. Every plugin worked, but then WP would insist on adding <p> and <br /> tags everywhere, even on the code inside the respective tags. I have now decided the hard work is just not worth it and went back to using Snipt and linking to my code that way.
That was until I noticed the little “embed” function at the bottom of the Snipt code box – What A Find! I can now embed the Snipt code directly in my post, retaining all of the formatting and language syntax bits that snipt does by default. I can’t recommend this enough – give up on WordPress natively handling code snippits and just go ahead and use this method, much simpler and sexy.
Before you style gurus complain that “it doesn’t blend in to my beautifully designed layout” – you can also style the script however you want using css, check out this blog post.
So, as you may have noticed I have added a lovely dynamic Skype button widget to my sidebar. Now, like any good developer/geek I decided I had best test it all out, make sure everything was working as it should. That’s where my problems started!
If you are having issues with newer version of Firefox not detecting Skype, or handling skype: links properly jump here
So I create a nicely formatted post, using the flexible ‘Visual’ editor within WordPress (please no code-monkey fan-boy flaming for this… :p) – however I need to add some code to the post, using my shiny new DirtyCode plugin. So I switch over to the HTML editor, add my dirtycode tags, and wrap my code, all nicely formatted and enclosed in a sweet JavaScript drop down container. Nice.
However, it turns out I need to come back to my post at some point in the future and make a slight change, perhaps correct a spelling mistake? So I load up my post editor, visual editor selected by default and bam all my lovely formatted code wrapped in my sexy dirtycode tags has now been completely borked. What gives WordPress? Why can’t you leave my code alone and let me get on with things the way “I” want to do them…?
**UPDATE**
So I manage to keep the <dirtycode> tags in my post, but now the next time I go to edit, whether in the HTML editor or not, WordPress decides it is going to add<p> & <br /> tags all over the place. What makes this worse is dirtycode (obviously) renders them as pure code so I end up with a load of unwanted tags all over my code snippet. Im still fighting with this. Grrr.
Ok, rant over. Now does anyone have any answers? I know this is not an uncommon issue and there must be ways around this without hacking up the tinyMCE settings. I guess for now I will write up my posts first, adding the wrapped code at the end and never touch it again until this issue is fixed! That, or just use the HTML editor…. hmm.