So I was finally irritated enough to investigate the Case of the Missing Sidebar.

I think the google gods must have been looking out for me. Y’know? Sometimes you have to enter the perfect search terms to get the information you need. I have done a search before, of course, but my search terms were probably too vague. Anyway this time I googled “wordpress sidebar at bottom of page” which brought up two informative posts, this one and this one. Both of these suggest that the culprit is disagreeable HTML somewhere in one of the posts that displays on the front page of the blog.

Mmm, that’s quite a few posts. At first I tried scanning the post content, but this felt a bit hit and miss, and prone to human error. So what I did then was to “disable” each post one-by-one working backwards starting with the second most-recent post. It helps to open 3 separate windows:

  1. one to display the front page;
  2. one to display the list of posts;
  3. and one to display the post itself.

Drag a post from window 2 to window 3. Change the publication status from “published” to “pending”. Don’t forget to “Update Post”. Refresh the front page in window 1. Has the sidebar reappeared? No, so go to window 2 and drag the next post to window 3. Rinse, and repeat.

I finally found the offending post. It was one in which I had used HTML comment characters to comment out a chunk of text at the end of the post. On the one hand this worked insofar as the text didn’t display (ie, the HTML comment worked) but it confused someone (safari? wordpress?). The sidebar displayed in the correct place once I removed the commented-out text.

Probably one of the morals of this story is to avoid using HTML comment characters in a wordpress blog. Possibly another one is that the old programmer’s trick of slowly excluding sections of code can be used to track down problems in a blog.

Categories: Geekery


Leave a Reply

Avatar placeholder

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