Home Page and Front Page and Templates, Oh My!

Filed in Web DevelopmentTags: Template Hierarchy, Themes, WordPress

Since the introduction of the front-page.php template file in WordPress 3.0 over three years ago, there remains a great deal of confusion about the proper implementation of custom/static site front pages in WordPress. This post will address that confusion, and explain the proper implementation of the custom/static site front page feature in WordPress.

Nomenclature

The first area of confusion involves nomenclature. In most contexts, "home page" refers to the site front page; however, in WordPress, the "home" page is not the site front page, but rather the Blog Posts Index page. WordPress refers to the site front page as the Front Page.  This nomenclature applies in several areas. For example:

Query conditionals:

  • is_front_page() - returns true when the stie front page is being displayed, whether the site front page is set to display the blog posts index or a static page
  • is_home() - returns true when the blog posts index is being displayed, whether the blog posts index is displayed on the site front page or on a static page

Template file names:

  • front-page.php - used to display the site front page, whether the site front page is set to display the blog posts index or a static page
  • home.php - used to display the blog posts index, whether the blog posts index is displayed on the site front page or on a static page
  • index.php - used as the default fallback template file for all contexts

Unfortunately, this nomenclature isn't consistent throughout WordPress core. For example, the body_class() template tag adds the following classes:

  • Front Page: home
  • Blog Posts Index: blog

(Long term, it would possibly be wise for WordPress core to deprecate the "home" nomenclature in favor of "blog" nomenclature - i.e. an is_blog() conditional and a blog.php template file - but that's a discussion for another day.)

The key point here is: in WordPress parlance: home means blog posts index, and not site front page.

Creating a Static Front Page

WordPress core has a specific method for implementing a static front page. Themes need to account for the core implementation, rather than implement a non-core method for displaying a static front page and displaying the blog posts index on a separate static page.

The core method involves creating two static pages, and configuring the front page options under Settings -> Reading.

  • The "Front page displays" option correlates to get_option( 'show_on_front' ), which returns either 'page' if "Front page displays" is set to "A static page", or 'posts' if "Front page displays" is set to "Your latest posts".
  • The "Front page" option is available if "Front page displays" is set to "A static page", and correlates to get_option( 'page_on_front' ), which returns the ID of the page assigned to "Front page"
  • The "Posts page" option is available if "Front page displays" is set to "A static page", and correlates to get_option( 'page_for_posts' ), which returns the ID of the page assigned to "Posts page"

When a user sets these options, it is reasonable and expected for a Theme to respect/incorporate those option settings in the Theme's template files.

Template Hierarchy

When developing a WordPress Theme, understanding the Template Hierarchy is critical to ensuring proper use of Theme template files for the site front page and blog posts index contexts. For the site front page, there are basically three rules:

  1. If the front-page.php template file exists, use it
  2. If the front-page.php template file does not exist, and the front page is set to display the blog posts index, use the Home Template hierarchy
  3. If the front-page.php template file does not exist, and the front page is set to display a static page, use the Page Template hierarchy

To understand how this works, we need to dig a bit into the Template Hierarchy, which is defined in core via wp-includes/template-loader.php. The meat of the code is here:

if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) :
	$template = false;
	if     ( is_404()            && $template = get_404_template()            ) :
	elseif ( is_search()         && $template = get_search_template()         ) :
	elseif ( is_tax()            && $template = get_taxonomy_template()       ) :
	elseif ( is_front_page()     && $template = get_front_page_template()     ) :
	elseif ( is_home()           && $template = get_home_template()           ) :
	elseif ( is_attachment()     && $template = get_attachment_template()     ) :
		remove_filter('the_content', 'prepend_attachment');
	elseif ( is_single()         && $template = get_single_template()         ) :
	elseif ( is_page()           && $template = get_page_template()           ) :
	elseif ( is_category()       && $template = get_category_template()       ) :
	elseif ( is_tag()            && $template = get_tag_template()            ) :
	elseif ( is_author()         && $template = get_author_template()         ) :
	elseif ( is_date()           && $template = get_date_template()           ) :
	elseif ( is_archive()        && $template = get_archive_template()        ) :
	elseif ( is_comments_popup() && $template = get_comments_popup_template() ) :
	elseif ( is_paged()          && $template = get_paged_template()          ) :
	else :
		$template = get_index_template();
	endif;
	if ( $template = apply_filters( 'template_include', $template ) )
		include( $template );
	return;
endif;

 

Basically, this code steps through each of the query context conditionals in a specific order, and defines the template to use for the first one that returns true.

For our purposes, the contexts we are concerned with are Front Page, Home, and Page, which are evaluated in the following order (with conditionals in-between omitted):

elseif ( is_front_page()     && $template = get_front_page_template()     ) :
elseif ( is_home()           && $template = get_home_template()           ) :
elseif ( is_page()           && $template = get_page_template()           ) :

 

Translated, this says:

  • If a valid Front Page template file exists, use it
  • Otherwise, if this is the blog posts template and a valid blog posts index template file exists, use it
  • Otherwise, if this is a static page and a valid page template file exists, use it
  • Otherwise, use the default template file

To understand further what core is doing here, we need to look at get_front_page_template(), get_home_template(), and get_page_template(), which are defined in wp-includes/template.php:

get_front_page_template() looks for

  • front-page.php

get_home_template() looks for:

  • home.php

get_page_template() looks for

  • _wp_page_template meta-key value (user-assigned custom page template)
  • page-{slug}.php
  • page-{id}.php
  • page.php

Which Template File?

So understanding the hierarchy, it should be easy to determine which template file to create for each given context.

Blog Posts Index

Use home.php.

Simple, right? But what about a custom page template, such as template-blog.php? Can't a Theme also use that? Not to put too fine a point on it, but: no. That would be _doing_it_wrong(). Using a custom page template for the blog posts index, either:

  • Won't work, because when implemented properly, a static page as custom page template simply won't ever use a custom page template
  • Would require the Theme to force the user to use a method of assigning the blog posts index that does not conform to the WordPress core method
  • Would cause pagination issues when rendering the blog posts index using the custom page template, because WordPress recognizes the main query for the custom page template to be the static page post object, rather than the blog posts index

So, while technically you can use a custom page template to display the blog posts index, in doing so you'll be forcing your Theme users to use a non-standard way of assigning the static page used to display the blog posts index, and will cause yourself headaches in getting the custom page template to function properly - all of which is easily avoided simply by using home.php instead.

Site Front Page

Use front-page.php.

But there are some caveats - namely, because front-page.php takes precedence on the site front page regardless of what the user has configured the front page to display, the Theme needs to account for the front page displaying either a static page or the blog posts index. There are a few methods to do so.

Conditional output in front-page.php

The first method uses a conditional statement inside front-page.php, that evaluates get_option( 'show_on_front' ), and either includes get_home_template(), or custom front-page markup:

if ( 'posts' == get_option( 'show_on_front' ) ) {
    include( get_home_template() );
} else {
    // Custom content markup goes here
}

 

This method is useful if the Theme already includes a front-page.php template file, and you need to implement an easy way to account for the blog posts index-as-front-page use case.

Conditional output in front-page.php, with a custom page template

The second method is a variation of the first, that includes get_page_template() instead of hard-coded custom front-page markup inside of front-page.php:

if ( 'posts' == get_option( 'show_on_front' ) ) {
    include( get_home_template() );
} else {
    include( get_page_template() );
}

 

This method is useful if the Theme includes a featured-content (or perhaps a portfolio-style) custom page template that isn't necessarily intended to be used as the site front page. When using this method, the user will need to apply the custom page template to the page assigned to display the site front page. This is an extra step for the user, but also gives the user the flexibility to use the featured-content custom page template on any static page, rather than only as the site front page.

Note also: if using this method, you can also safely omit front-page.php entirely, as it is technically unnecessary.

Filter front_page_template

The third method uses front-page.php solely as custom static-page-as-front-page content, and filters front_page_template when the front page is set to display the blog posts index, causing the Template Hierarchy to ignore front-page.php and fall back to get_home_template(), via callback in functions.php:

function themeslug_filter_front_page_template( $template ) {
    return is_home() ? '' : $template;
}
add_filter( 'front_page_template', 'themeslug_filter_front_page_template' );

 

To see how this method works, we need to take another look at get_front_page_template():

function get_front_page_template() {
	$templates = array('front-page.php');

	return get_query_template( 'front_page', $templates );
}

 

The $templates array is passed through get_query_template():

function get_query_template( $type, $templates = array() ) {
	$type = preg_replace( '|[^a-z0-9-]+|', '', $type );

	if ( empty( $templates ) )
		$templates = array("{$type}.php");

	return apply_filters( "{$type}_template", locate_template( $templates ) );
}

 

And here you can see the filter being applied:

return apply_filters( "{$type}_template", locate_template( $templates ) );

 

For the front page context, $type = "front-page", resulting in the filter front_page_template.

By returning an empty string for front_page_template, the Template Hierarchy will evaluate this line as false:

elseif ( is_front_page()     && $template = get_front_page_template()     ) :

 

Causing it to move on to the blog posts index line:

elseif ( is_home()           && $template = get_home_template()           ) :

 

This is probably the simplest method to implement. (H/T Justin Tadlock)

EDIT:

There is a bug in WordPress, that causes the front_page_template filter name to be truncated as frontpage_template. So, use this instead:

function themeslug_filter_front_page_template( $template ) {
    return is_home() ? '' : $template;
}
add_filter( 'frontpage_template', 'themeslug_filter_front_page_template' );

 

Questions? Use cases unaccounted for? Let me know in the comments.

In Which Bryan Fischer Doubles Down on Todd Akin’s Pseudo-Science Stupidity

Filed in Politics, Science, Social IssuesTags: Conservatism, Elections, Pseudo-Science, Rape

I used to enjoy a good Fisking, usually of an article by a liberal columnist from the St. Louis Post-Dispatch. But today, the honor goes to Bryan Fischer of the American Family Association.

In the wake of Todd Akin's profoundly stupid comments asserting pseudo-science in defense of a policy position, Mr Fischer has chosen to double-down on Akin's stupidity by attempting to defend the scientific credibility of Akin's statements.  First, for background, Akin's quote:

From what I understand from doctors, [pregnancy from rape is] really rare. If it's a legitimate rape, the female body has ways to try to shut that down.

Now, both this comment, and the response it has elicited, is fertile ground for discussion (not the least of which is the left's absurd attempt to claim that Akin somehow expressed "pro-rape" views due to the term "legitimate rape"); but the bottom line is that Akin's assertion is prima facie absurdity. Debate whether or not such comments should be grounds for pressuring Akin to withdraw from the Senate race, but don't be foolish enough to try to defend the validity of his assertion.

Alas, that is precisely what Bryan Fischer has done. And because of such manifest foolishness, I must respond. Let's roll tape on Fischer's on-air remarks in defense of Akin. Fischer accompanies those remarks with a blog post, from which I will quote liberally (all emphasis added by me):

Akin’s words, for which he apologized even though he had no need to, were right. He was entirely correct to say that pregnancies in cases of forcible rape are rare. Even if the exaggerated figures of the pro-abortion medical community are accurate, pregnancies due to rape amount to just 0.005% of all pregnancies. That’s rare in anybody’s book.

In defending the assertion that a woman's body can somehow reject or stop conception from rape, the relevant question is not whether total pregnancies resulting from rape are rare with respect all total pregnancies, but rather whether rape results in conception less frequently than conception from consensual, unprotected sex. The given statistic is silent on this comparison.

Fischer later says:

Unfortunately for the nattering nabobs of negativism who think Akin is some kind of medical Neanderthal, the London Daily Mail has a headline story TODAY which has this as the very first paragraph: “Stress can make women infertile, research has revealed. Scientists found that those with high levels of a stress hormone stop ovulating and are therefore unable to conceive.”

Who look like the dumb ones now?

Who looks like the dumb ones, indeed? Implying that the linked study proves his point requires one to ignore the cardinal rule of data analysis: correlation does not prove causation. Did Fischer consider any of the following questions:

  • Does the study involve acute stress, chronic stress, or both?
  • Does the study address the effects of acute stress on ovulation?
  • Assuming that acute stress can adversely impact ovulation, how often does rape occur within the extremely small window  of time required for the rape-induced stress to have that impact?
  • What impact does rape have on the body's production and sustained levels of cortisol?
  • Can rape interrupt or stop altogether the victim's menstrual cycle?

In fact, the referenced study can't answer any of those questions. It was merely an epidemiological study intended to suggest a potential correlation between stress levels and ovulation/menstruation. Sound science doesn't take a small, epidemiological study that can do nothing but suggest a correlation that may warrant further study, and turn it into an assertion of causation. Unfortunately, Fischer is not similarly disciplined:

Here’s the American Society for Reproductive Medicine: “In an occasional woman, too much stress can change her hormone levels and therefore cause the time when she releases an egg to become delayed or not take place at all.” Sounds like maybe her body can shut down the process after all.  

Such an assertion is an unwarranted jump to conclusion, and is as foolish as it is absurd. Suggesting a link between stress levels and ovulation in no way whatsoever proves an assertion that a rape victim has an innate physiological response that inhibits ovulation, and therefore conception.

Unperturbed by scientific and logical discipline, Fischer finds yet another epidemiological study to attempt to defend his position:

How about the New York Times, the Bible of wingers on the left? Here’s the headline of a May 11, 2011 feature article: “Lowering Stress Improves Fertility Treatment.” The article refers to findings published in the journal Fertility and Sterility, and quotes Dr. Alice D. Domar, a psychologist at Beth Israel Deaconess Medical Center in Boston who serves as director of mind-body services at Boston IVF, a large fertility center.

Said Dr. Domar, “If you’re really stressed out and depressed, the body seems to sense that’s not a good time to get pregnant.” Hmm. Sound suspiciously like the body shutting down, no?

Multiple epidemiological studies suggesting the same correlation still do not prove causation; rather, they merely provide a stronger argument for further studies. So I'll refrain from quoting the third such example Fischer uses.

Instead, I'll turn to relevant analysis of the assertion, by attempting to make a meaningful statistical comparison: the percentage of rapes that result in pregnancy, versus the percentage of consensual, unprotected sex that results in pregnancy. To that end, I'll reference three studies linked by PopSci.

Using this study as the baseline, 3.1% of unprotected, consensual sex results in pregnancy. How does that compare to pregnancy rates from rape? This study indicates that 5% of rapes result in pregnancy, and this study indicates that anywhere from 6.4% - 8% of rapes (factoring in birth control usage) result in pregnancy. Thus, according to these studies, rapes result in pregnancy at a rate around 2-3 more frequently than consensual, unprotected sex.

I don't know if those studies controlled for forcible versus statutory rape. But even such distinction likely won't change the numbers significantly enough to lend credence to the "magic uterus" pseudo-science. While hard numbers are difficult to acquire immediately, I did find this reference to a study from 1949 that indicates that statutory rape constitutes 30 percent of all sex crimes, and this site that asserts that 3/4 of all juvenile rape is forcible. Taken together, the two studies would indicate that non-forcible, statutory rape accounts for anywhere from 7.5% to 30% of all rapes. So even assuming the worst-case scenario, the statistics still indicate that rapes result in pregnancy with a frequency equal to or higher than consensual, unprotected sex.

I welcome more precise statistics, but based on what I've found, I don't see any reason to believe that differentiating between forcible rape and other forms of sexual assault (statutory rape, incest, etc.) would alter the conclusion that there is no evidence to support the assertion that rapes result in pregnancy less frequently than consensual, unprotected sex.

Thus, both Todd Akin and Bryan Fischer are foolishly and dangerously peddling pseudo-science. In so doing, the least of our worries is that Todd Akin will lose a Senate race. The bigger travesty is that, by changing the narrative to a defense of pseudo-science, those who peddle that pseudo-science forfeit the ability to hold a legitimate policy discussion regarding rape and abortion. Those who are pro-life, who believe that life begins at conception and that an innocent, unborn child should not be murdered simply because his father is a rapist, lose the opportunity to have that debate.

Thus, Todd Akin, Bryan Fischer, and anyone else who chooses to peddle such pseudo-science (or defend those who do) actively harm the objectives of the pro-life movement.

TRANSCRIPT: Barack Obama and The God Factor Interview

I'll have more to say on this later; for now, if you are a Christian and want to hear Obama describe his faith in his own words, then you will find this interview instructive*.

* H/T: Glen Davis

Anders Breivik: NOT a Christian

Filed in Politics, ReligionTags: Conservatism, Liberalism, Media Bias

Anders Breivik in his own words:

A majority of so called agnostics and atheists in Europe are cultural conservative Christians without even knowing it. So what is the difference between cultural Christians and religious Christians?

If you have a personal relationship with Jesus Christ and God then you are a religious Christian. Myself and many more like me do not necessarily have a personal relationship with Jesus Christ and God. We do however believe in Christianity as a cultural, social, identity and moral platform. This makes us Christian.

Jesus Christ in His own words (from John 14):

Jesus answered, "I am the way and the truth and the life. No one comes to the Father except through me. f you really know me, you will know my Father as well. From now on, you do know him and have seen him."

Don’t you believe that I am in the Father, and that the Father is in me? The words I say to you I do not speak on my own authority. Rather, it is the Father, living in me, who is doing his work. Believe me when I say that I am in the Father and the Father is in me; or at least believe on the evidence of the works themselves. Very truly I tell you, whoever believes in me will do the works I have been doing, and they will do even greater things than these, because I am going to the Father.

Jesus replied, “Anyone who loves me will obey my teaching. My Father will love them, and we will come to them and make our home with them. Anyone who does not love me will not obey my teaching. These words you hear are not my own; they belong to the Father who sent me.

And this is instructive, too (James 1:22-25):

Do not merely listen to the word, and so deceive yourselves. Do what it says. Anyone who listens to the word but does not do what it says is like someone who looks at his face in a mirror and, after looking at himself, goes away and immediately forgets what he looks like. But whoever looks intently into the perfect law that gives freedom, and continues in it—not forgetting what they have heard, but doing it—they will be blessed in what they do.

And James goes even further: (James 2:14-19):

What good is it, my brothers and sisters, if someone claims to have faith but has no deeds? Can such faith save them? Suppose a brother or a sister is without clothes and daily food. If one of you says to them, “Go in peace; keep warm and well fed,” but does nothing about their physical needs, what good is it? In the same way, faith by itself, if it is not accompanied by action, is dead.

But someone will say, “You have faith; I have deeds.”

Show me your faith without deeds, and I will show you my faith by my deeds. You believe that there is one God. Good! Even the demons believe that—and shudder.

I rest my case: Anders Breivik, by his own admission, is not a Christian. He claims to be only a "cultural" Christian - a term that has absolutely no meaning in Christian doctrine.

(H/T: cordpt @ RedState)

Review: Flight of Shadows

Filed in ReviewsTags: Blogging for Books, Books, Christian

I do not regret the price I paid for my love for you. But I do regret what it has cost you, all your life. And I have never stopped regretting all that I kept hidden from you.


And so concludes the mysterious letter with which Sigmund Brouwer begins Flight of Shadows, the dystopian sequel  to Broken Angel, set in the post-apocalyptic, former United States of America, that combines the Handmaid's Tale-esque, cult-like theocracy of Appalachia with the Orwellian caste system of the City-States. Caitlyn Brown, having escaped from Appalachia, struggles to survive as an outcast in the City-State caste system as she searches for answers to questions of her identity and the origin of the horrific secret she holds.

Read the rest of this entry »

Empire Avenue Blog Verification

Filed in PersonalTags: Empire Avenue, Geekery, Social Networks

{EAV_BLOG_VER:03e3025f70d7b469}

Nothing to see here... just verifying my blog for my Empire Avenue profile.

P.S. Wanna join?

2011 NFL Draft – Colts Round 1

Filed in SportsTags: Colts, Draft, Indiana, Indianapolis, NFL
Anthony Costanzo, LT, Boston College

Anthony Costanzo, LT, Boston College

With the 22nd overall pick in the 2011 NFL Draft, the Indianapolis Colts take:

Anthony Costanzo, LT, Boston College

Stats:

  • HT: 6'7 / WT: 311 / 40: 5.23

Overview:

After a surprising number of teams selected quarterbacks in the first round, Costanzo became the "Best Player Available'", falling to the Colts at the #22 pick. Costanzo, rated by many as one of the top 2 or 3 left tackles in this year's draft, appears ready to step into a starting role as an NFL left tackle, which would fill a glaring upgrade need for the Colts. Costanzo is clearly a value pick, and may prove to be a steal.

Bio:

Draft Analysis:

  • NFL.com

    The selection of Castonzo shows that Bill Polian was serious about upgrading the protection of Peyton Manning. The Boston College star enters the league with a ton of experience and is one of the most technically sound players at the position. He gives the Colts a potential starter as a left or right tackle and some flexibility in configuring a rebuilt offensive line.

  • Yahoo Sports

    The Colts' offensive line faltered last season and made Peyton Manning's job as challenging as ever. Castonzo can plug in at left tackle and protect Manning's blind side from Day 1. He's a smart, versatile, technically sound pass protector who could stand to improve his core base strength.

  • ESPN

    What he brings: A smart, instinctive and polished player, Castonzo has the technique and maturity to step in and play right away. His lateral mobility is just average but he does a good job sinking his hips and using his hands when he can get into position. He's not a road-grader as a run blocker but does a good job getting on the edge and covering defenders to create running lanes, which works well with Indy's zone blocking scheme.

    How he fits: Offensive tackle may have been the No. 1 need and he is an excellent fit as an intelligent player in a very sophisticated offense. Even though the Colts get a lot of publicity for not giving up a lot of sacks, much of it is due to Peyton Manning's quick release and not their pass protection.

  • Fox Sports

    Castonzo could be an immediate starter and he showed a lot of versatility by playing three different offensive line positions at the Senior Bowl. This is a smart kid and the Colts definitely have an need on the offensive line.

    The Colts were very lucky to be able to select the talented Castonzo because he was projected to go off the board much earlier in the first round. He’ll be expected to start as a rookie at left tackle.

Scouting Reports

  • Draft Board Insider (Rank: #14 Overall / #3 OT)

    Castonzo is a very smart player with very good awareness and instincts. He's a very sound technical blocker and while he isn't always the most athletic or powerful guy on the field, rarely is he caught out of position or beat on a play because he didn't do his job or follow his assignment. In terms of a resume' you can't discount a guy who's a four year starter at both left and right tackle.

  • NFL.com (Grade: 8.0)

    Strengths: Castonzo possesses ideal height for the tackle position and has great feet. A highly-productive and extremely durable performer with over 50 starts in his college career. Smart, tough player and a hard worker. Huge, long frame coupled with impressive mobility allows him to shut down speed rushers. Puts himself in good position while run blocking. Comfortable and productive in space.

    Weaknesses:: Must improve his bulk and playing strength (both upper and lower body). Can be beat by a strong bull rush or violent pass rushing moves. Can get caught dipping his head in pass protection. Does not push people off the line of scrimmage in the running game.

  • SI.com (Grade: 3.05 - First-Year Contributor)

    Positives: Tall, relatively athletic tackle prospect who comes with a high upside. Keeps his feet moving throughout the action, displays better than average footwork off the edge, and is effective in pass protection. Moves well about the field, easily slides out, and fights hard to finish blocks. Adjusts to defenders, blocks with good lean, and easily holds the point. Shows good quickness, stays square, and is an effective position blocker who seals opponents from the action. Turns defenders off the line run blocking and uses his long arms to push opponents from their angle of attack. Makes good use of angles, keeps his head on a swivel, and works well with teammates.

    Negatives: Just average blocking in motion. Must improve his blocking balance. Overextends into blocks, adversely affecting his ability to finish the play.

    Analysis: Castonzo has been a terrific tackle on the college level and offers the size, athleticism, and blocking fundamentals to eventually start at the next level. He should be given a chance at the all-important left tackle position before any consideration is given to moving him to the right side.

  • Mocking The Draft (Rank: #4 OT)

    Castonzo is much better as a pass blocker than run blocker at this point of his development. He can use his natural abilities – agility, quickness, length – to his advantage to wall off defenders. Does really well moving his hands in and out to knock defenders back. Possesses a wide, smooth kick slide to the outside. Castonzo is quick enough to work his power slide to stop inside rushers. Will get fooled at times by stunting defenders.

  • National Football Post (Grade: 6.9 - B - Dirty Starting Caliber)

    The size, length and natural athleticism is there, but he needs more time to mature physically. I don't think he's a guy who you can pencil in as a starter on the left side from day one, but with some time he has the skill set to eventually develop into a serviceable starting left tackle in the NFL. However, as of now, isn't an elite offensive tackle prospect by any stretch in my book.

  • Draft Countdown (Rating: 4 Stars / Projection: 1st Round)

    Strengths: Ideal size with a large frame, long arms and big hands, Very good athleticism, quickness, agility and balance, Shows relatively nimble feet to slide laterally and mirror, Displays the ability to recover and adjust in action, Effective run blocker who generates sufficient movement, Polished technician who understands positioning / angles, Able to stun with initial punch and uses hands well overall, Mobile with range to work in space and get to second level, Extraordinarily smart with great instincts and awareness, Competitive, aggressive and active with a terrific motor, Mature and a fiery leader with an outstanding work ethic, Durable with a ton of experience against top competition

    Weaknesses: Still developing in terms of weight / strength, Is not overly stout at the point of attack, Narrow base and struggles to anchor / sustain, Isn't a powerful, road grading run blocker, Can be inconsistent with knee bend / leverage, Had some trouble with elite speed off the edge

  • Fox Sports

    Scouts love his feel for the game and smarts, qualities that are no surprise since he was a Rhodes Scholar nominee as a biochemistry major. Castonzo is also considered very disciplined, perhaps from his time playing football at Fork Union Military Academy in Virginia. He rates high in athleticism, size and versatility since he can fit in well at either tackle slot. Castonzo is a solid bet to be drafted in the top 15 and could be the top offensive lineman taken.

  • FFToolbox (Rank: #19 in Top 100)

    At 6-7 and 308 pounds Castonzo certainly has the size to play in the NFL. He could have left a year early, but the extra year at Boston College saw him add quite a bit of needed weight. The pundits have already been paying close attention to Castonzo since he was on the radar last year and his year bulking up at BC should move him up into the late first round or the second round.

  • WalterFootball (Rank: #2 OT / Projection: Top 20)

    Castonzo uses finesse and technique to his advantage. His upside is in adding a few pounds and more strength. This would make him a better run blocker and more able to slow down powerful NFL rushers.

  • NFL Draft Geek (Rank: #5 OT / Tier: 2)

    He does a good job walling his defender off, blocking into the second level, and opening up holes for the back to run through. He has great height and long arms, and uses his arms well to guide his defender where he wants them to go when run blocking. His pass protection is a real cause for concern from me though, he is not very agile, he plays way too high, which allows defenders to get underneath him, and he is not very strong as of now.

St. Louis Good Friday 2011 Tornado

Filed in PersonalTags: Missouri, Saint Louis, Tornado, Weather

The St. Louis Good Friday tornado ended up being a rather close call for us. The storm track is in red; our location is in yellow:

Good Friday Tornado Track

St. Louis Good Friday Tornado, 22 April 2011

Unlike the 2010 Saint Ann tornado, this one did major damage in the area. Thankfully for us, though, the worst thing we suffered was a 12-hour power outage.

A Guide to Reviewing Themes for the WordPress Theme Repository

Filed in Web DevelopmentTags: Theme Review, Themes, tutorials, WordPress

Thanks in large part to Justin Tadlock's recent blog post, in which he solicited more people to get involved with the WordPress Theme Review Team (WPTRT), we have seen a fantastic, huge influx of new volunteers. Many of these new volunteers have had questions about how to perform a Theme review. Hopefully this guide will help answer those questions.

Getting Started

Test Environment Setup

First things first: review How to Join WPTRT.

WordPress Setup

Ensure that a few WordPress settings are modified in order to facilitate the Theme Unit Tests:

  • Settings -> General: set the Site Title to something fairly long, and set the Tagline to something even longer. These settings will facilitate testing how the Theme handles these values.
  • Settings -> Reading: set "Blog pages show at most" to 5. This setting will ensure that index/archive pagination is triggered.
  • Settings -> Discussion: enable Threaded Comments, at least 3 levels deep. This setting will facilitate testing of Theme comment list styling.
  • Settings -> Discussion: enable Break comments into pages, and set 5 comments per page. This setting will facilitate testing of Theme paginating link markup/styling.
  • Settings -> Media: ensure that no values are set for max width or height of Embedded media. This setting will facilitate testing of the Theme $content_width setting/implementation.
  • Settings -> Permalinks: ensure that a non-default permalink setting is selected, e.g. "Month and name". This setting will facilitate stepping through the Theme Unit Tests.

Next, create at least two Custom Menus:

  • Long Menu: all included Pages
  • Short Menu: a menu of 2-3 Pages

Now, you're ready to be assigned a ticket! Read on for the detailed review process.

Policy Requirements

The first area to review involves some policy requirements, rather than code quality. I verify these before I ever download or install the Theme, by reviewing the appropriate template files using the "SVN" link in the Trac ticket.

License

  • Review the header tags in style.css. Ensure that the License: and LicenseURI: header tags exist, that the indicated license is GPL-compatible, and that the indicated URI is a valid, full-text license.
  • Review the Theme files for bundled fonts or icon sets; if included, verify that the licenses for these bundled resources are GPL-compatible, and explicitly declared by the Theme, either in style.css, readme.txt, or somewhere similarly appropriate.
  • Review other template files, such as footer.php, to ensure that there are no inline comments regarding use restriction, such as prohibiting changing the footer, or requiring a credit link, etc.

Credit Links

  • Review the header tags in style.css. Ensure that Theme URI and Author URI, if used, are valid and appropriate.
  • Review the indicated URLs. Ensure that the sites are appropriate, that they do not sell or promote non-GPL WordPress Themes, and that any license or terms and conditions information does not include non-GPL-compatible content.
  • Review footer.php, sidebar.php, etc. and ensure that the Theme does not include any other inappropriate hard-coded links (sponsor links, SEO links, spam links, etc.). Ensure that all public-facing copyright notices indicate the site name, rather than the Theme name or developer.
  • Review functions.php and ensure that the Theme does not hook in any other inappropriate links or copyright notices.

Theme Name

  • Verify that the Theme name meets naming convention requirements.

Screenshot

  • Verify that screenshot.png is sized appropriately.

Theme Check

Next, install the Theme, and before activating, run Theme Check. Note any Warning or Required notices in the Trac ticket. (Note: for any Theme uploaded since late March 2011, Theme  Check should return no such notices, as they should all be caught by the Theme uploader script. If you notice any, please email the Theme-Reviewers mail list, and indicate what notices you observed.)

You are welcome to note Recommended or Info notices in the Trac ticket, but I generally don't. These notices are more for your reference, as you continue to review the Theme.

For Recommended notices regarding Theme functionality (Post Formats, Post Thumbnails, Navigation Menus, etc.), verify that the Theme does not use a custom implementation. If the Theme does use a custom implementation, note in the Trac ticket that the Theme is required to support the core implementation of the functionality.

Step through each Info notice, and review the Theme template files to determine if the notice is applicable. For example: verify appropriate use of include() vs. get_template_part(); verify appropriateness of hard-coded links; etc.

Code Quality

Now, the review enters the bulk of the requirements in the Theme Review guidelines.

header.php

Review header.php, and verify:

  • All appropriate document head guidelines (valid doctype declaration, properly formed tags (html, head, meta, etc.)
  • Feed links are not hard-coded into the document head
  • No CSS files other than style.css are hard-coded into the document head. (These files must either be enqueued and hooked in appropriately, or added using IE conditional tags.)
  • No scripts or script file links are hard-coded into the document head. (These must be enqueued and hooked in appropriately.)
  • No unnecessary meta tags (WordPress generator tag, SEO meta tags, copyright meta tags, etc.) are hard-coded into the document head.
  • The wp_head() template tag is placed immediately before the closing HTML head tag.

footer.php

Review footer.php, and verify:

  • No scripts or script file links are hard-coded into the footer. (These must be enqueued and hooked in appropriately.)
  • The wp_footer() template tag is placed immediately before the closing HTML body tag.

functions.php

Review functions.php, and verify:

  • All custom Theme functions, constants, classes, global variables, and options are prefixed with theme-slug (or an appropriate variant).
  • Theme Settings are implemented properly:
    • Theme options are added to the database via a single options array, rather than separately
    • Settings page added via add_theme_page() rather than add_menu_page()
    • Settings page capability is edit_theme_options, rather than admin, manage_options, edit_themes, etc.
    • All untrusted data are sanitized/validated upon input into the database, and escaped upon output
    • If the Theme is not using the Settings API:
      • Nonce-checking is performed explicitly
      • $_POST, $_GET, and $_REQUEST data are sanitized/validated upon input into the database, and escaped upon output
  • No core WordPress functions introduced prior to one previous, major WordPress release are wrapped in function_exists() conditionals.

style.css

Verify that all tags listed in the Tags: header tag are appropriate, and that all claimed functionality is included in the Theme.

Theme Template Files

Note which hierarchical template files are used (e.g. single.php, page.php, archive.php, date.php, author.php, category.php, tag.php, taxonomy.php, 404.php, home.php, front-page.php, and search.php), so that you will know which of these to verify when performing the Theme Unit Tests, later.

Review Theme template file names, and ensure that any hierarchical template file name variants (e.g. page-foo.php, category-foo.php, etc.) are included in the Theme documentation, with an explanation for their use.

File Includes

Review Theme template files, make note of any uses of include() or require() and ensure that such use is valid. Verify that:

  • All headers are included via get_header()
  • All footers are included via get_footer()
  • All comments templates are included via comments_template()
  • All sidebars are included using get_sidebar()
  • All template part files are included via get_template_part()
  • Any search form markup is included via get_search_form()
  • Any login form markup is included via wp_login_form()

Theme Unit Tests

Now the review moves on primarily to the requirements in the Theme Unit Tests.

Theme Activation Tests

  • Activate the Theme, and open the site in your browser. Verfiy that Debogger returns no PHP errors, warnings, or notices for index.php.
  • Via Dashboard -> Tools -> Deprecated Calls, verify that Log Deprecated Notices does not return any deprecated function calls or other notices.
    • Note: check the Deprecated Calls log one final time when you complete the review, after you switch back to your default Theme. Sometimes, some notices get thrown when the Theme is deactivated.
  • If the Theme includes a Custom Theme Settings:
    • Load the Settings page, and verify that Debogger returns no PHP errors, warnings, or notices.
    • Save current/default settings, and again verify that Debogger returns no PHP errors, warnings, or notices.
    • Test each Theme Option in turn, and verify that each option can be updated, that the setting is applied properly in the Theme, and that Debogger returns no PHP errors, warnings, or notices.
    • If the Theme Settings page includes a "Reset Defaults" button, reset defaults, and verify that default settings are applied, and that Debogger returns no PHP errors, warnings, or notices.
  • If the Theme supports Custom Image Headers, select a custom header, and verify that it is applied/displayed properly
  • If the Theme supports Custom Backgrounds, select a custom background image or color, and verify that it is applied/displayed properly
  • If the Theme supports Custom Nav Menus:
    • Verify that the default/fallback output renders properly
    • Apply the Short Menu to each theme_location, and verify that the menu renders properly
    • Apply the Long Menu to each theme_location, and verify that the menu renders properly, without breaking the site/menu layout
    • If the Theme has a limitation on number of list items in any theme_location, ensure that such limitation is documented in readme.txt
  • If the Theme adds Custom Widgets, verify that all custom Widgets function as intended, generate no PHP errors, are secure, etc.
  • If the Theme supports Custom Editor Style, verify that the Post editor content renders reasonably similar to the site output
  • If the Theme requires any custom settings or setup, ensure that setup instructions are documented in readme.txt

General Tests

Run the W3C HTML/CSS validator on the Readability Test post (to ensure minimal WordPress-caused validation errors), and note any egregious validation errors, such as:

  • Malformed or improperly closed tags, that cause the page layout to break
  • An exceptional number of HTML or CSS errors

View the site index page, and verify:

  • The screenshot, as seen in the Trac ticket, is a "reasonable facsimile" of the default view of the site
  • The Site Title and Tagline, if displayed, do not break the page layout

Template Page Tests

  • For all included template-hierarchy index pages (index.php, home.php, archive.php, date.php, author.php, category.php, tag.php), verify requirements, as specified.
  • If the Theme includes either a front-page.php or a home.php template file, go to Dashboard -> Settings -> Reading, and set the Front Page to display a Static Page (use any existing Page), and set the Blog Posts index to another Static Page (e.g. "Lorem Ipsum"). Verify requirements, as specified.
  • Trigger the Theme's 404.php page by navigating to a non-existent Page slug (e.g. www.domain.tld/sit-amet). Verify requirements, as specified.
  • Trigger the Theme's search.php page by performing a search (e.g. "lorem ipsum"). Verify requirements, as specified.

Blog Posts Index Page Tests

Return to the Blog Posts index page. Step through the Blog Posts Index Page tests.

Individual Unit Tests

Step through each Blog Post and Static Page, verifying all requirements, as specified. Each unit test should be fairly self-explanatory.

Finishing the Review

At this point, the review is thorough and complete. Summarize your comments in the Trac ticket and close the ticket with the appropriate resolution (or propose a suggested resolution, if you do not have appropriate rights to close the ticket).

Radiation Dose and Effect: Visual Perspective

Filed in ScienceTags: Media Bias, Radiation

If you're worried about radiation dose and health effects in the wake of the hurricane- and tsunami-induced damage to the Japanese nuclear power plants, then I would highly recommend that you take a look at this Radiation Infographic. 1

Radiation dose and health effects infographic

Radiation Dose Chart

More than likely, this infographic should help to allay some unwarranted fear about radiation and health effects.

(h/t: @BradleyPotter)

Notes:

  1. Source: xkcd.com. Licensed under CC-BY-NC-2.5