I set out this weekend with one goal in mind. My research shows that having the same sidebar show up on every page of my blog is going to hurt my Google ranking as it could be considered duplicate content. I’ve been diligently working to understand search engine optimizaton (making a search-engine friendly website) ever since I added Squidoo to my list of online hobbies. I’d tried to change the sidebars around before with no success. WordPress code is in PHP, a scripting language I’m only beginning to learn. But I have a book, the web, and a few hours to kill. How bad could it get?
You’ll have to excuse me, though, if while visiting this blog, you might have caught a glimpse of an unsightly blog sidebar. My new friend:
Uh-oh, Houston, we have a problem.
I’ve been patiently (oh, who am I kidding) working through two articles to make this blog more attractive to my new pal, Google. The first article, WordPress SEO was written by Joost De Valk, the ultimate WordPress guru and master. The second article, WordPress SEO – The Ultimate Guide is written by a man who doesn’t seem to be doing too badly for himself. His blog has a Google rank of 6 and his posts are concise, easy to read, and informative.
So, as I’m following these two guides, I realize I have some changes to make to my WordPress theme. My sidebars are the same no matter which URL of my site you might be viewing. That’s more links going out than I’ll ever have coming in. In the world of finance we’d call that negative equity.
I start tackling that PHP code in my blog theme files. Let’s see, tweak here…check sidebar. Huh…sidebars completely gone. Tweak over there…sidebars back but not right. Tweak over there…check sidebar. FATAL ERROR. Oops. That’s gonna hurt. (This would be the time of course, I get my one visitor for the day.)
Ten “fatal errors” laters, I eventually figured it out. Quite proud of myself! I wrote my own little PHP fix for my theme and modified the sidebars on my single post pages to be nothing at the moment but a list of recent posts. In total, it took me 7 hours. I’ve had a lot of coffee.
Having tackled that monster, I decide to keep going before I forget what I’ve done. I wanted to change the sidebars for my category pages, too. That’s when I stumble across a widget that would have taken care of what I’d just finished doing myself. (Really, I’m a search hound. Where was this widget when I had 30 searches going about the single post page issue?)
In case you’d rather spend your 7 hours doing something more productive, you’ve got to try Widget Logic. You can download from that link or directly through your WordPress dashboard. Install, activate, and click on it in your left hand menu. Towards the bottom of the page you’ll see a box labeled Widget Content Filter. Check the box to use the filter and Save.
Now, every time you add a widget to your sidebar, you can specify on which page types you want to display that widget. Use WordPress WordPress Conditional Tags. For example, if you wanted to show your recent comments only on your home page, you’d type is_home () in the filter box when adding that widget. To edit existing widgets, I had to remove them and add them again. Hey, ten times easier than writing that bit of PHP code.
However, I don’t regret the time on the code. I was able to make a completely new sidebar style that applies to my single post pages. It’s wider than the others which will allow me to do more than I could before. What exactly that might be, I don’t know yet, but rest assured I’ll figure it out.