how to post code tips?
-
imagine you want to give visitors tips and instructions
when posting a link, you’d like them to use code like
[a href=”URL” target=”_blank” ]Text [/a]
but if you use the proper symbol in place of the square brackets, they won’t see the code but the result, a clickable link. Of course I can write lines of explanations but I’d rather make things simple.
-
-
-
-
Well I’m stumped. Works on the bulliten board systems I have here.
Only thing I can think of is using a HTML to ASCii converter. Can’t find any webbased ones though. They’re all downloads.
Sorry,
-drmike -
You need to encode the HTML, a less than bracked should be & l t ; (spaces here so it doesn’t show the actual symbol. > is & g t ;.
-
Actually, I’ve had this same problem. You have to encode the html, yes, but you can’t do it by choosing the “edit html” button from the rich editor. Instead, you have to turn of wysiwyg editing alltogether (it’s under your personal options). Otherwise, WP (at least my WP account) takes left angle brackets (<) out, and sometimes all of the text after the bracket.
-
Okay, there are several things going on with this discussion.
First of all, if you are going to create a link in WordPress.com blogs, then you can use the link quicktag button at the top of the Write Post panel in Rich Text Editor or HTML mode, or manually write it.
Second, if you want to showcase code, for example some HTML or style references (the link is a tough example), then you can use, as Matt mentioned, the HTML Character Entity Reference to replace the > character with a three or more letter code. The browser will then convert that into the single character and it won’t appear as a link or “active” HTML.
&lt;a href="blah.php" title="this is blah">blah link&lt;/a>This will turn into the following when viewed through a browser:
<a href="blah.php" title="this is blah">blah link</a>Third, I recommend that people use PRE or CODE tags to wrap their code in so the reader’s know it is code. The problem with this, unfortunately, is that some Themes don’t include styles for these codes, so while you put the tags in, they look like the rest of the text. I hope Theme designers see this and understand that these common tags need to be styled so we can use them. Still, put the tags in so if they upgrade the Theme, it will then appear as code and you don’t have to go back and fix it.
Fourth, please, please, please avoid using
target="_blank"in your links. This opens a link in a new window and makes your blog break strict XHTML validation standards, and it is VERY bad form. People now know how to use the back button. The only time I now use this is when I’m showing an example and I want people to go back and forth between my how to article and the example without constantly waiting for page loads. But all other links shouldn’t have this.I hope that helps.
-
The browser will then convert that into the single character and it won’t appear as a link or “active” HTML.
Agreed but there should be a method of doing this automatically. Either that or a method of telling WP not to convert the html code within a post into a link or whatever.
Other software packages can do this like phpbb and phpnuke.
-
WordPress has a plugin or two that will recognize when CODE is being used for those who do a lot of posting of programming code that makes this possible, but it is only available for the full version WordPress.
-
I do believe we’re discussing the WordPress version we have install here. The full version of WP is discussed on another forum.
-
- The topic ‘how to post code tips?’ is closed to new replies.