TOPIC: PHP

  • Creating Unique Sidebar Content for WordPress Pages using Custom Post Types

    In this article, I show how to use Wordpress’ custom post functionality to create unique sidebar content blocks for static pages which run off the same template.

    A non-profit organization I volunteer for recently requested a way to add contextual content to specific Wordpress page sidebars. The content could include quotes, donation and course banners and other images which were related to the content of the page.

    The website has almost 100 static pages which use page.php as their template. The challenge was to find functionality which could provide page-specific sidebar content that could easily be administrated by volunteers who had a wide variety of technical backgrounds.

    I usually try to provide custom functionality for my clients without resorting to Wordpress plugins. Don’t get me wrong, I love plugins for a lot of things such as displaying the latest tweets, optimizing SEO and displaying content via light boxes (all of which are used on this site). I just don’t always care for the excessive quantity of poorly outputted code which often accompanies the functionality.