Showing Code in a WordPress Post

  • Author
  • #46630

    I recently migrated my blog from Blogger to under my own domain. I have updated my blog buttons accordingly and would like to display the relevant code in a post so that readers can cut and paste my blog button code.

    I did this successfully in Blogger by going into the html editor and replacing relevant tags with > < "

    However when I do this in the html editor on my WordPress dashboard and then update, the code reverts to show my blog button.

    I would be grateful if anyone can tell me how to display html code in a post that is capable of being cut and pasted.

    Thank you.



    It’s just basic HTML: <a href="The URL of the image that you are linking to">The text for the link</a>
    The code goes inside a text widget

    The easiest way of all to do this and be sure there are no coding errors is to upload the badge(image) into a post and link it there. Copy that code and paste it into a text widget and save it. (You don’t need to either save or publish the post if you are going to display it in the sidebar.)



    Edit: timethief replied all now ;)

    Edit2: have you tried the <code> tag?



    Have you tried clicking on the code tab (next to the ‘visual’ tab)? By clicking on it, you should see a [code] button that should help you display your code.

    Should I learn how to type faster? :D
    Well, I hope my suggestion can be of some help too :)



    @jaoche & devblog
    Thank you for your help. I think I went off on a tangent assuming this was another issue entirely i.e. inserting a button image into a text widget and displaying it in the sidebar. Sheesh :(
    I’m tired … g’night :)



    TT, no biggy. Because you’re always such a great help, you’re forgiven… for now, but don’t let this happen again. (J/K) :)



    @devblog: sometimes I believe TT has canned messages somewhere ;)


    I found the answer over on the forum (where I should have posted this question):

    Disable the RTE – access wp-admin, click on Users, click on My Profile, scroll to the bottom, uncheck the box bottom left.

    I then inserted the html replacing the <> tags and “quotes” and it all worked fine. Thanks for your speedy response.

The topic ‘Showing Code in a WordPress Post’ is closed to new replies.