Learning Where To Insert Code In A WordPress Blog

Learning where to insert code into a WordPress blog can be confusing. Most code is written in HTML, as are the “presentation”, “theme editor” pages. All the more reason to learn HTML.

The process I follow to make inserting code into my WordPress blogs easier, is to study the “theme editor” pages. If you have become somewhat familiar with HTML, you’ll see how each line or section of code translates into your actual theme’s look.

If you experiment with inserting code and then “View Site”, you’ll immediately know if you’ve inserted it correctly.

Yesterday I decided to add a block of Google Adsense to my individual posts. The theme I’m using has a “single post” page, however, it’s written completely different than my other blog’s (Observation Mountain) code. I took a few minutes to read and study the code, and was then able to figure out the exact place to insert the ad block. This time it worked perfectly. Unfortunately, in the past I’ve made many mistakes and inserted code incorrectly.

Improperly inserted code is an easy fix. Just go back to where you inserted the code, highlight the code and delete it. If you know where it should go, just cut and paste.

Or…..if you’ve done like I have several times, when I really messed up, just start all over. Reload your theme and start with a blank slate.

Hint: It helps of you save a copy of your “Theme Editor” pages, before inserting code.

5 thoughts on “Learning Where To Insert Code In A WordPress Blog

  1. Thous I have a tech blog but I really hate editing theme and inserting codes…Because it takes time and need constant experiment..
    This always cost in quality time I could have spend on researching for new ideas and thoughts…

    Gsshh… I hate codes šŸ˜€

    Harsh AgrawalĀ“s last blog post..Yahoo messenger for iPhone is officially launched || Download yahoo messenger for iPhone

  2. Hi Harsh Agrawsi – You’re right. Editing and inserting code does take up a lot of precious time. Unfortunately, it appears it’s something us bloggers must learn.

    Hi Bregui – Since I wrote this post, WordPress has made many changes. I’m currently using WordPress 2.7.1 so to add code to the theme itself, I go to “appearance”. There is where you’ll find the theme “editor”.

    As a reminder, save the original code before making changes to it.

    If you need more information, either leave a comment here or send me an email via my “contact” page (in navigation bar – in the header), and I’ll do what I can to help you out.

  3. iĀ“m new on this, i cant find the ā€œtheme editorā€ pages. i can only see manager theme

    BreguiĀ“s last blog post..watch out world my mom learned how to use IM

  4. umm, thanks for try to help me but I’m still clueless
    i click appearance/manager theme. i see a lot of theme but i cant edit it. the manager themes just let me ACTIVE OR PREVIEW

    BreguiĀ“s last blog post..watch out world my mom learned how to use IM

    1. Hi Bregui,

      You’re welcome. Listed below themes it should show “widgets” (if your theme allows for them) and “editor”. By clicking on “editor” you should see the php files for your theme.

      Are you using WordPress 2.7 or above?

Comments are closed.