pxnx

In the course of my WordPress customization projects I have written a handful of plugins.  Here are two plugins geared towards Page management which I created to extend the CMS capabilities of WordPress.

PageSpot

Download current version from WordPress plugin repository

My goal with PageSpot was to facilitate more complex layout options for Pages; and to add the capability to dynamically switch out the sidebar content on a per-Page basis.

PageSpot uses private Pages as groups of content to be inserted in various other places in your Page or theme.  By default it creates two “special” private Pages:

PageSpot Snippets are pieces of another Page.  To create a new snippet, just create a child Page of the [PageSpot] Page Snippets page.  PageSpot will ensure your new snippet remains Private and inaccessible on its own.  PageSpot then expects you to assign the snippet to a Spot on one of your public Pages.

To do that, you will first need to create custom templates in your theme directory.  If you create a template with “pagespot” in the name, and select it in the Page editor, the PageSpot admin box will become active for that Page.  PageSpot will parse the template for annotations that look like “[[PageSpot:Foo]]”, and allow you to assign a PageSpot Snippet to that spot, named “Foo”.

The final result is that when viewed from the front end, your Page will have the assigned snippet Page’s content inserted in place of your [[PageSpot]] annotation.  This lets you build up complex layouts for a Page, composed of other Pages’ content which you can edit and replace independent of each other.

Sidebar Items are pages that together comprise a sidebar for your theme.  To create a sidebar, just create a private Page named “[Sidebar] Foo”.  All child pages of that page constitute the Foo sidebar.  PageSpot will add a meta-box in the Page Edit screen to select the sidebar to use for the current Page.  Adding some simple PHP code to your sidebar template is all you then need to bring this functionality into your custom theme:

<?php PageSpot::print_sidebar(); ?>

Media2Layout

Download current version from WordPress plugin repository

This plugin facilitates the dynamic inclusion of media library artwork into predefined places in your site’s theme.  It creates named positions (by default “campaign” and “header”) which can be assigned a media item per each Page.

  • Adds an admin menu item under Themes to edit your Position names
  • Adds a dropdown control when editing Pages to select the images for each Position in that Page

To insert the images into your theme, just add a bit of PHP code to your theme in the appropriate spot, for example:

<?php Media2Layout::banner('header'); ?>

For the position named “header”, this would print an <img/> tag for the image assigned to the current Page at that position, if one is assigned there.  Currently it wraps the <img/> in a <div/> with class “media2layout_[position name]“.