How to add HTML and other code to your WordPress website

Chapter 1: Adding code in a page or post
Chapter 2: Adding code to the footer of pages or posts
Chapter 3: Adding code to the site's footer or sidebar

Chapter 1: Adding code in a page or post

To add codes to pages or posts use the Raw HTML plugin. Post all HTML and other codes you want to add to your posts or pages between <!--start_raw--><!--end_raw--> tags. Hence:

<!--start_raw-->Enter your HTML Code here<!--end_raw-->

and you’re done. If you don't use the Raw HTML plugin codes may or not work.

Chapter 2: Adding code to the footer of pages or posts

The Add Post Footer plugin allows you to add a general footer to all your pages and posts.

To add the content login to your admin panel, choose "Settings" and "Post Footer".
Add the code and text content you want to appear as a footer of each page and post to the "Optional text" text box.

If on some pages or posts you don't want some parts of the footer displaying or want to hide it completely I would recommend you to split the footer into different parts by using different <div> like follows:

<div id="myfooter>
<div id="firstpart">First part of the footer</div><!-- closing firstpart -->
<div id="secondpart">Second part of the footer</div><!-- closing secondpart -->
<div id="thirdpart">Third part of the footer</div><!-- closing thirdpart -->
</div><!-- closing myfooter -->

Now if on a page or post you don't want the footer to display at all you can add

<style type="text/css">
#myfooter {
display: none;
}
</style>

to the page or post and the footer will be completely hidden. If you want to have the footer displaying but not the first part of it you just hide the first part by adding

<style type="text/css">
#firstpart {
display: none;
}
</style>

Same for other parts. This way you can set a footer for all pages or posts but can also hide it where you don't want it to display or hide parts you don't want to display on certain pages or posts.

Chapter 3: Adding code to the site's footer or sidebar

To add HTML Codes to your site's footer or sidebar go to Appearance, Widgets and add a Text widget (Arbitrary text or HTML) to the Sidebar or to the Footer. Paste the code you want to add into the widget and hit Save. Make sure "Automatically add paragraphs" is not select.


This FAQ is also discussed in my WPFAQ.org E-Book (sample)


© WPFAQ.org - Tutorials, Tips & Tricks is made with WordPress and for WordPress.
It's an EBookStoretoday.com company. It’s presented by Cédric Giger and hosted by HostGator.com

Thank you for visiting and supporting my website,
- Cédric -




Now share it…

Share

Comments are closed.