The Simple Side: Introduction

Loading

The Simple Side:

Creating and Manipulating Sidebars in WordPress

For the last year I’ve been learning all I can about the workings of WordPress, rightfully the most popular web program in use today, and likely tomorrow as well. After a great deal of reading and experimentation, I have a basic grasp of a rather tricky operation, that of creating sidebars and adjusting their widths to fit different formats – pages and posts, for example. What follows should be read in the spirit of the beginner who wants to convey to others, at this level and below, a basic notion of the operation of sidebars in WordPress; thus, the title, “The Simple Side.”

My quest to manipulate sidebars led me in several directions. Googling the topic only showed what a mass of confusion and frustration existed among others who, like me, needed to perform this maneuver. Days of gleaning search results finally yielded some good information. However, it was compartmentalized: some bits about registration, fragmented forum comments alluding to adding certain types of sidebars to certain templates, the structure of the sidebar.php template itself. What I’ll try to do here is put most of these bits and pieces together. Absolutely no claims for efficiency or correctness are implied. I’m just filling in the middle ground between other struggling beginners and those who know far more than me.

Four Areas to Work With

  • Functions.php where the sidebars themselves are created
  • Sidebar(s).php where these registered sidebars are picked up for use
  • Style.css which allows us to format their presentation (width, floating right and left
  • )

  • Page and Post php’s where that <?php get_sidebar(); ?>> statement allows use of particular sidebars

Tools

Gospel: Anyone who says that adding sidebars to any theme is simple, just do this . . . is 1) naïve, 2) arrogant, 3) ignorant of the mass of theme files, or 4) both #2 and #3. I tried many themes while attempting to put into practice what I read in dozens of forums and tutorials and I learned this: The simpler the theme, the easier the task. By the way, now is an excellent time to present an easy out for the timid. The most ingenious, as well as sophisticated, theme available is “Atahualpa.” Practically anything can be accomplished (including this very topic) through the theme’s options. So, if you want to bail out, head on over to WordPress.org and install this beauty.

Still here? Okey Dokey, then onward. I have to assume a couple things as we do so.

  • You’ve dipped into the various templates.php and have an idea what each does
  • That you’ve played a bit with various aspects of them, at least enough to make the front end look different, no matter how awful the result
  • That you have at least used the basic css formatting tools (not critical – we’ll only use a couple)

My Theme Arena

I mentioned that the simpler theme templates are the easiest to use. With that in mind, and having experimented with several “minimalist” and “simple” ones, I will be using my favorite, “Blass2 1.6.2” by 1000ff. Nothing elegant, eye-catching, or loveable – just very easy to modify templates which are just what we need. So, to follow along (which I urge you to do), install Blass2. Yes, it looks like a theme only a mother could love, but it’s perfect for our use.

On installing Blass2 you will wonder how to get to the dashboard. At the end of the address string at the top of the browser, add “/wp-admin” – that will take you to the back end. I’ve no idea why the author neglected this simple feature.

Now for some brief housekeeping. In the Editor (Appearance/Editor), bring up the Page Template and add “<?php get_sidebar(); ?>” below “<?php get_header(); ?>”. This will put a much-needed sidebar on the front end.

Next, add a couple plugins to make life simpler:

  • Ozh’ Admin Drop Down Menu (just do it)
  • Sidebar Login (to replace the Meta group mess)
  • Admin Menu Editor (to arrange the menu items along the top and hide unwanted ones)

Yes, too many plugins slow a site way down, but these three are pretty handy. You will notice a marvelous change in the Dashboard from activating the Ozh top menu plugin. Now, go to Appearance/Widgets and drag Sidebar Login onto the Sidebar section to the right. That will replace the default meta links with a simple log in and dashboard link.

Add two pages. Pages/Add New. Name it “Welcome” and throw in some dummy text. I use filler called Lorem Ipsum. If you don’t know what that is, Google it. Should be enlightening.

Next:

  • Add another Page and call it Posts. Leave the text area blank.
  • Go to Settings/Reading. Choose Static Page. Use these settings:
    • Front Page: Welcome
    • Posts Page: Posts

What We Will Accomplish

At this point, your front page should look something like the below.

Early Front Page

You can see that, after placing get_sidebar() in the Page.php template, we now have a default right sidebar, the one in which we added our sidebar-login plugin. Our goal is to add a second sidebar and place the content in the middle of the two like this:

Old Page and New Page

We will have two sidebar files:

  • LeftThinSB
  • RightThinSB
This entry was posted in Computer-Related. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *