About those variables …

Today, I added a new page, Template Documentation, which explains the variables at the top of every page of my new PHP template. And I refined a few things here and there.

I also recrafted a PHP function that was originally authored by a former colleague; the function allows you to create subsites within the new PHP template, for new directories, like the docs directory I created today.

Can’t wait until I can actually begin the design of the new template. Soon, perhaps?

What /docs/template/ looks like today.

New PHP template begins

Today, I set up a new public repo for a PHP template I created, which can be seen here. It’s not much to look at yet, but I wanted its first commits to be a bare shell of a template that can be expanded with room to grow.

I will be working through some new tutorials and using this template to show my work.

I might keep going and fully redesign this entire website.

Suggestions, collaboration, pull requests – welcome and considered.

What /index2.php looks like today

More than 20,000 photos and 700 posts

Today, I counted my 20,000 photo uploaded to Google Picasa Web Albums (OK, Google+ Photos, or whatever Google is calling it these days).

photos-web

postsAlso, I have created more than 700 posts on this WordPress-powered website. Not bad for a site I started a little more than six years ago. (Previously, I had a static HTML-powered website for about eleven years).

Featured images: too much of a good thing

I like featured images. In moderation. But nothing about WordPress irritates me more than when themes display them … everywhere.

On the homepage is fine — in fact, it’s the only place I prefer to see them, in some kind of design element whether it be a slideshow or a grid of images that serve a functional purpose to show the readers the most important content.

But I don’t like clicking these links and then seeing the featured image again, above the headline of the post. That seems to be a popular place to put it, for most of the recent default themes. While creating my own custom child themes, it’s always one of the first things I change.

And I don’t like seeing it above posts that aren’t currently “featured” on the homepage or on other archive pages (categories, tags, month, etc).

Most of the recent WordPress default themes (twentyfourteen, twentyeleven, etc) display featured images in this way on default, with few if any controls built in allowing theme users to customize it.

As I’m developing my twentyfourteen child theme, I thought I’d share with you how I removed featured images from the eight content- templates.

The nine files you will want to re-create by duplicating them from the parent them into your child theme are:

content.php
content-aside.php
content-audio.php
content-gallery.php
content-image.php
content-link.php
content-quote.php
content-video.php

These files are the content templates, they control the structure of how posts are displayed, depending on their post format.

In the TwentyFourteen theme, each and every one of these post formats include the featured image before the headline of the post. I liked this behavior in the default theme TwentyTen, but that was back when the technique was new to me and it was at the very top of the page.

To prevent the featured image from displaying on these post formats, remove the following code from the second line of code of each of the files, right after the opening article tag.

<?php twentyfourteen_post_thumbnail(); ?>

That’s it! So simple, it makes you wonder why the default themes don’t come with a checkbox allowing one to quickly disable featured images from appearing above headlines in the single post page and archive pages.

How much do you hate featured image overuse? Tell me in the comments.

Reducing duplicity in the homepage loop while using the ephemera widget on the twentyfourteen child theme

-OR-

Say something once, why say it again?

Step one toward a better WordPress twentyfourteen child theme

Today, I launched my new child theme for WordPress’ new default theme, twentyfourteen, which will be a running work in progress on this site likely for the next few weeks leading to the official initial release of it in the WordPress theme repository.

As I’m developing it, I will post here about new features and ways I’ve chosen to craft the theme to my liking.

Some of the first adjustments I have made include tweaking the width of the theme to display better at full width on my 17″ laptop screen and adjust the themes colors to a custom palette. But I’m not finished in these departments, so I will wait until I am completely satisfied before I elaborate more here.

Today’s adjustment focuses on adjusting the main loop of the theme so that it doesn’t repeat content found in the ephemera widget floated to the right of the main content. The ephemera widget has come with the last few incarnations of the default theme, and allows the user to display posts of a certain post format of their choosing … However, that content, on default, is also displayed in the main loop, which means the day you post a new post in that format, identical content will run side-by-side. It’s a shame that a solution to this problem isn’t offered in the default theme twentyfourteen, but below, find the solution I implemented by creating a functions.php file for my new child theme and adding the following code to it (between the opening and closing PHP tags, of course):



function exclude_post_formats( $query ) {
	if ( $query->is_main_query() && $query->is_home() ) {
		$tax_query = array(
			array(
				'taxonomy' => 'post_format',
				'field' => 'slug',
				'terms' => array(
					'post-format-link'
				),
				'operator' => 'NOT IN',
			)
		);
		$query->set( 'tax_query', $tax_query );
	}
}

add_action( 'pre_get_posts', 'exclude_post_formats' );

This function will exclude posts with the link post format from the homepage loop query, because I prefer to have those posts display in the ephemera widget floated to the right of the main content, and the duplicity is irksome. I learned how to do this by reading the article Modifying the default WordPress loop to exclude specific post formats by Jeffrey Barke.

Initially, I tried doing this by duplicating the index.php file from twentyfourteen, and then using an advanced taxonomy query to tell the homepage loop what to display by telling it what NOT to display (as suggested by Roy Scribner and Otto); but this didn’t work, because the twentyfourteen theme takes a different approach to doing this via the pre_get_posts action in the file inc/featured-content.php … so the above function that runs along side it works great in my new twentyfourteen child theme, and filters out the post-format-link posts while keeping the other query features of the parent twentyfourteen theme in tact.

News just for Marshall, Corina

I’m proud that I’ve been able to secure domain names for Marshall and Corina.

marshallmoeller.com

and

corinamoeller.com

I’ve had these now for a few years, but today, they’ve now been properly redirected to their corresponding tags on this site. My previous web host didn’t allow redirects to the dynamic pages created by WordPress tags. (Sigh)

I also added campaign tagging to the redirected URLs so I can know when people are using the domain names by analyzing my site’s traffic with Google Analytics.