As I was optimizing my new website tonight (still has a long way to go) I thought I’d post about what I was doing. Little did I know the blog post would take longer than the actual work I’m posting about.
Tonight I worked on the beginnings of a footer link silo using conditional PHP tags. Those who are familiar with tweaking PHP might find this elementary to moderate, while newer SEOs without a code background will find it a little more advanced, but still easy to learn.
You will notice my footer links change, depending on which page you’re viewing:
Footer version for Home Page.
Footer version for the SEO blog category.
Footer version for Non-SEO blog category.
…And so on and so forth. But how do you do this?
Using Conditional PHP Tags for WordPress SEO
This can be used for many applications, but in the following example we’ll just work on footers. As you’re working on the files to your WordPress blog you’ll probably have one called footer.php.
Don’t completely replace your main footer.php file or you’ll have a lot of updating to do when you want to change a global element. You’ll basically be back to static html days. Instead, just put the “different” element in its own file and call then into the footer.php file on a conditional basis.
Example of Conditional PHP Tags in Footer.php File
Example of Simple Code in the Referrenced PHP Files
Some Conditional PHP Tags I Often Use With WordPress
(Great for building link silos within your site, but watch out for posts that are in multiple categories. You may end up with more than one file included)
(Key to creating custom 404 pages. Most themes already have them)
(Messages to Clients for Whom You Built a WordPress Site)
(Let them know they’re looking at archives)
(I have a site where each author gets their own Ad block)
(Great building link silos)
(Especially useful when you have static home pages)
(For the blog page, even when it’s not your static home page)
(For pages like About and Contact. See my example screenshot above)
(Custom messages like “We couldn’t find what you were searching for”)
(If you want to target ALL blog posts – like I did with my Adsense links 😉 …)