How to Automatically Input Code to a WordPress Post

When you need to insert code into your blog posts, it is preferable that you set up WordPress to automatically insert the code into the posts. Not only does automatic insertion save you time, it also lets you make site-wide changes without editing each individual post. For instance, you may wish to move an advertisement code above or below a post or use a change your share button plugin.

Things You'll Need

  • Self-hosted WordPress.org account
Show More

Instructions

    • 1

      Log in to your self-hosted WordPress blog. Click "Appearance" and then click "Editor."

    • 2

      Click "Single Post (single.php)" or whichever PHP file in the current WordPress template corresponds to single posts. This link appears on the list of PHP files on the right side of the page.

    • 3

      Look for a line similar to the following example:

      <?php the_content(__('Continue Reading;')); ?>

    • 4

      Insert the code below the code. This will position the code immediately after the post content.

    • 5

      Click "Update File."

Tips & Warnings

  • Always back up your WordPress blog files -- including your themes -- before you edit any code or install a plugin.

  • If you are uncomfortable with the idea of editing code, search for WordPress plugins that can insert the code you need for you. For example, a traffic analyzer such as StatCounter has its own official plugin for WordPress.

  • You can insert code in other places on a post template. For example, you can insert the code above the content. This can be difficult, however, if you are not sure what each line of code is about.

  • WordPress.org software, which is self-hosted on your own Web host, lets you edit code freely. The free version hosted by WordPress, called WordPress.com, limits what you can do with your blog and you can't edit theme files.

Related Searches:

Resources

Comments

You May Also Like

Related Ads

Featured