Blog Pile, Wordpress

WordPress Dissected: The Blogless Blog

It’s been a while but it is time to add to my collection of WordPress Dissected where I break down web sites I have been building using WordPress but with some moderate to severe template wrangling.

Today I present an NMC project set that is sort of a Zen Riddle. If a blog has no posts is it a web site? This is the editing area for a finished web site:

marcus-no-posts

How? Why?

The web site is made up entirely of WordPress pages, because there is nothing chronological in the site’s structure (though if we ever added a news section it would be easy). There was a reason I organized it around Pages… and I cannot remember why, but had something to do with being able to list the pages in a sidebar. I think. To be honest, the work started more than a year ago and the site sat behind a password until the grant funders for the project where ready to go public.

The site is for the Edward and Betty Marcus Digital Education Project for Texas Art Museums, a project where we worked with 28 art museum or art education programs in Texas to help them apply storytelling concepts to their collections and artists, and use the Pachyderm software to create online exhibits.

marcus-site

screenshot The overall template design has morphed quite a bit. I knew form the beginning it was going to need a basic 3 column layout, and somehow ended up with Talian which actually does not now look like the first version I had… and beyond the cosmetic changes I ended up doing a lot of cleanup and fixes for the CSS.

There was an intermediate version (now lost) that had a pink and green theme, even an animated Flash Texas map– a mock layout is what found and the now unused map that wa supposed to be a splash intro:

layout test 2

texas

Soon before we went public, we got a hint that they wanted something less cartoonish and simpler, so we went to the more Texas color theme of the final site.

That’s just the cosmetics. Time to go under the hood and bang the pipes.

The bulk of the site are different WordPress Pages for each museum, such as the Blanton Museum of Art:

marcus-blanton

The left sidebar on all site pages is the same- some static top links, and using the command to list all the museum pages by excluding all the other pages

Museums

The main column content is written for each museum, with some standard headings. The project screen shots are linked to the museum’s Pachyderm Projects- which show a lot of evolution in the two years of the projects, as the Matto example from the Blanton demonstrates nicely.

At the bottom, in homage to the lost map, I have embedded Google MyMaps with locations for each museum, so if you are on the page for the Old Jail Art Center, there is a “Where in Texas is the Old Jail Art Center”

marcus-map-old-jail

and the main web page has a full map with all the museums located.

All the magic happens on the right sidebar. All of the Museum pages use a special page-museum.php template which just simply has it use a pecial sidebar template rather than the one used on the front page.

I am using some custom queries, external include files, and plugins to pull in museum specific content on the right sidebar. A lazy way would have been to use a separate template for each museum, but I was able to do it from a single sidebar template, using as a reference the database ID for the page.

The first section, Explore Projects, presents an abstract of all the museum’s projects, which can be anywhere from one to four like the Art House at Jones Center. The content in the box is pulled from an external content file in the template/projects subdirectory. The files are named based on the database ID for the page, like 3.php, 22.php etc. This makes it generic for the template to pull in the correct content.

We first jimmy through another iteration of the Loop to grab the ID of the current page

   
     
    	ID; ?>
     
    

On a single Page, there is only one “post” and from that we get the ID. Then we simply call an include PHP statement to insert the content of that file:


I created these content files as structured PHP statements, so our staff person creating content only had to define content for variables:

There is first some variables that provide the info for the museum:


The next part handles two ways this content is used- if called from a projects-page template we display the name of the museum as a header. But, as we show below, this same content can be called for the front page as a random museum highlighted, so we need to be able to echo different text if the current page template indicates it is a general page:

// logic to add explanatory text for pages other than museums
if (is_page_template('page.php')) {
	echo '

Explore these projects from ' . $mymuseumname . '

'; } elseif (is_page_template('page-projects.php')) { echo '

' . $mymuseumname . '

'; }

Finaly, we create a block like this for each project to be listed for a museum, so if there are 4 projects for the page associated with page ID 14, then file 14.php would need four copies of this block of code. The image file is for the square icon stored in the template directory





(explore...)

The next section lists recent comments that have been made only for a particiular museum– to get this to work, I use a function that was built into this template (I think it was, or I put it in there) that allows me to pull an abstact of a comment made specific to a page. I’m able to specify character limits for te comments title, author, format the date string, and most importantly, provide a post ID to limit it to pull comments just to this one page.

Recent Comments

Read what viewers have to say about these projects...

That’s all there is (hah) to a museum page.

I also created a single page that lists all projects in one display
, and this does so by simply inserting all of the include files described above used for the side bar. This page uses a special page-projects,php template, which instead of using the content entered for the page in the editor, just pulls it from the external files:

First we simply walk the directory that contains all of the page sidebar content files to build a list of all files, and then sort the file names:

if ($handle = opendir(TEMPLATEPATH . '/projects')) {
  // get all file names in directory
  while (false !== ($file = readdir($handle))) { 
    if ($file !='.' and $file != '..') $myfiles[] = $file;
  }			
  closedir($handle); 			
sort($myfiles, SORT_NUMERIC);

Now that we have all the file names in an array, we simply walk the array and include the files as indicated.

foreach ($myfiles as $item) {			
  // display content in file
  echo '
'; require_once(TEMPLATEPATH . '/projects/' . $item); echo '
'; } } ?>

And that’s it- a blog with no blog posts (does it make a sound?)

The next thing I am adding is a gallery page that will have icons for all projects that we can present as a way to explore all the projects in one page, maybe with some CoolIris action.

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for CogDog The Blog
An early 90s builder of web stuff and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as @cogdog@cosocial.ca

Comments

Leave a Reply

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