Posts Tagged ‘ wordpress template ’

Custom WordPress Sidebar

In order to customize your WordPress sidebar or other pieces of your site, you will need basic html and PHP knowledge. These few tips will help customize or change your theme to make it fit what you want. There are two methods I will mention in this post.

Sorting it out
Creative Commons License photo credit: Andy Ciordia

  • One File Method
    • This method places more code on a particular page.
  • Two File Method
    • Instead of using code built into the page, you attach to a page located elsewhere

Each method works just as well as each other and it depends on how you want to work it.

One File Method

After opening up your sidebar.php page, you will see alot of different things going on. By adding the below code and moving what the text around you can make the code act differently. For instance, when I go to my frontpage(homepage), it will display “Displayed on Front Page only”. When I navigate to any other page, “Displayed on other pages” shows.

<?php if (is_front_page()) { ?>
             Displayed on Front Page only
<?php } else { ?>
             Displayed on other pages
<?php } ?>

WordPress Codex

The WordPress Codex has other available tags: for example is_admin(), will check for the user to be logged in and can display certain information.

Two File Method

The two file method will be introduced in my next post. As its a little more intensive and requires other modifications for it to work.

»crosslinked«

Category: Wordpress | Comments Off on Custom WordPress Sidebar

|

Flickr Photos

Quick Contact

Your Name (required)

Your Email

Your Message

captcha