WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Aug 10 2013

Genesis 2.0 Drops Fifths from Column Classes

Due to the grid layout, Genesis drops support of the fifths class family (one-fifth, two-fifths, three-fifths, and four-fifths). This is logical since the grid that Genesis adopts is from Twitter Bootstrap, and they didn't include it. Since the Bootstrap grid was based on 12 columns, fifths does not naturally "fit" within the grid. 1, 2, 3, 4 and 6 are equally divisible into 12.

In discussing whether to include it in core or not, it came down to this:

Reasons to include:

  • Legacy: In light of having it in previous style sheets I believe it should be included.
  • One Style Sheet: Twitter Boostrap has the fifths via media queries with the non-fluid rows in the base CSS. Since we are not doing a base.css with a responsive.css, I believe it should be included.
  • Accurate Calculations: I have done the calculations that fit within the Bootstrap model to the 15 decimal places (cut off if zeros).

Reasons not to include:

  • Does Not Fit into 12-Column Grid: 12 is not divisible by 5 thus should not be included.
  • Responsive Twitter Bootstrap: The responsive style sheet of Twitter Bootstrap does not include it.

So, for those who like me have used it and need it in their style sheet, here is the Columns Classes section for you:

/* Column Classes
Link: Link: http://wpsmith.net/2013/wp/genesis-2-0-drops-fifths-from-column-classes/
Link: http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css
--------------------------------------------- */
.five-sixths,
.four-sixths,
.four-fifths,
.one-fifth,
.one-fourth,
.one-half,
.one-sixth,
.one-third,
.three-fourths,
.three-fifths,
.three-sixths,
.two-fourths,
.two-fifths,
.two-sixths,
.two-thirds {
float: left;
margin-left: 2.564102564102564%;
}
.one-half,
.three-sixths,
.two-fourths {
width: 48.717948717948715%;
}
.one-third,
.two-sixths {
width: 31.623931623931625%;
}
.four-sixths,
.two-thirds {
width: 65.81196581196582%;
}
.one-fourth {
width: 23.076923076923077%;
}
.three-fourths {
width: 74.35897435897436%;
}
.one-fifth {
width: 17.9487179487179488%;
}
.two-fifths {
width: 38.4615384615384616%;
}
.three-fifths {
width: 58.9743589743589744%;
}
.four-fifths {
width: 79.4871794871794872%;
}
.one-sixth {
width: 14.52991452991453%;
}
.five-sixths {
width: 82.90598290598291%;
}
.first {
clear: both;
margin-left: 0;
}
view raw column-classes.css hosted with ❤ by GitHub
.five-sixths,.four-sixths,.four-fifths,.one-fifth,.one-fourth,.one-half,.one-sixth,.one-third,.three-fourths,.three-fifths,.three-sixths,.two-fourths,.two-fifths,.two-sixths,.two-thirds {float: left;margin-left: 2.564102564102564%;}.one-half,.three-sixths,.two-fourths {width: 48.717948717948715%;}.one-third,.two-sixths {width: 31.623931623931625%}.four-sixths,.two-thirds {width: 65.81196581196582%}.one-fourth {width: 23.076923076923077%}.three-fourths {width: 74.35897435897436%}.one-fifth {width: 17.9487179487179488%}.two-fifths {width: 38.4615384615384616%}.three-fifths {width: 58.9743589743589744%}.four-fifths {width: 79.4871794871794872%}.one-sixth {width: 14.52991452991453%}.five-sixths {width: 82.90598290598291%}.first {clear: both;margin-left: 0}
view raw column-classes.min.css hosted with ❤ by GitHub

Written by Travis Smith · Categorized: WordPress

Jun 07 2013

Perl Shebang

Slang often used in computer Perl programming and other script files. The term shebang refers to the "#!" located at the top of many script files that points to the path of the associated program. For example, in a Perl script, the complete line may look similar to the below line.

#!/usr/local/bin/perl

This line instructs the operating system the Perl script is being run in where the executable for Perl and all of its associated files are located. This line is commonly only required in Linux and Unix variants, users running Perl in Microsoft Windows do not need this line.

Original Source: http://www.computerhope.com/jargon/s/shebang.htm

Written by Travis Smith · Categorized: WordPress

Jan 22 2013

How to orderby include Argument for get_terms()

WordPress 3.5 came out with an awesome feature of ordering by post__in (Codex). So when I got to my current issue, I noticed that I could not use the default orderby options (alphabetical title, ID, etc.), so the code used to create the post__in orderby can also be extended to be used for get_terms, which by default is not available in WordPress core. However, there is a great filter to enable this (see WordPress ticket).

Call get_terms()

So, first, I need to setup the function. In this scenario, I am using WooCommerce, but it could work with any theme, or ecommerce solution. For more information on get_terms() please see the WordPress Codex.

<?php
/**
* Output the homepage categories HTML Markup
*
* @uses wps_category_image() Outputs image HTML Markup
*/
function wps_homepage_categories() {
$args = array(
'orderby' => 'include',
'order' => 'ASC',
'hide_empty' => false,
'include' => array( 28 /* Appearal */, 27 /* Accessories */, 30 /* Outerwear */, 29 /* Hiking */, 22 /* Grooming */, ),
'fields' => 'all',
'pad_counts' => false,
'd2c_home' => true, //optional
);
$product_cats = get_terms( 'product_cat', $args );
foreach ( $product_cats as $cat ) {
wps_category_image( $cat->term_id, $size );
}
}
view raw wps_homepage_categories.php hosted with ❤ by GitHub

In this code, I use wps_category_image() which outputs the WooCommerce category image.

<?php
/**
* Outputs HTML markup for category image for WooCommerce.
*
* @param int $cat_id Category ID.
* @param string $size Image size.
* @param array $attr Image attributes.
* @return string $orderby Modified orderby SQL string.
*/
function wps_category_image( $cat_id, $size, $attr = array() ) {
// get the thumbnail id user the term_id
$thumbnail_id = get_woocommerce_term_meta( $cat_id, 'thumbnail_id', true );
// get the image URL
$image = wp_get_attachment_url( $thumbnail_id );
// print the IMG HTML
echo wp_get_attachment_image( $thumbnail_id, $size, false, $attr );
}
view raw wps_category_image.php hosted with ❤ by GitHub

Filter get_terms_orderby

Next, is the really cool part. You want to filter the get_terms_orderby SQL.

<?php
add_filter( 'get_terms_orderby', 'wps_get_terms_orderby', 10, 2 );
/**
* Modifies the get_terms_orderby argument if orderby == include
*
* @param string $orderby Default orderby SQL string.
* @param array $args get_terms( $taxonomy, $args ) arg.
* @return string $orderby Modified orderby SQL string.
*/
function wps_get_terms_orderby( $orderby, $args ) {
if ( isset( $args['orderby'] ) && 'include' == $args['orderby'] ) {
$include = implode(',', array_map( 'absint', $args['include'] ));
$orderby = "FIELD( t.term_id, $include )";
}
return $orderby;
}
view raw wps_get_terms_orderby.php hosted with ❤ by GitHub

First, you need to check to see if include is the preferred orderby argument.

Second, you want to sanitize it with absint().

Third, set the order to the FIELD include (see here for more information).

Written by Travis Smith · Categorized: WordPress

Jan 10 2013

The Role of Online Learning for Churches with WordPress

Online Church OpportunitiesIn my experience, churches have failed dismally in the area of providing learning opportunities to their members. Please don't get me wrong here...many churches have great learning opportunities, in person, one, maybe two, days a week. Typically, however, as it pertains to online opportunities, churches typically only provide the Sunday Morning message as a podcast, and that's it! It is true that some churches have more elaborate children ministries' resources for parents and children. Yet, for the most part, opportunities for teens are typically centered around social media (if at all) and for adults, abismally non-existent. Education pastors design and develop curricula, possibly even publish the curriculum. Rarely, however, do churches provide online member areas to provide more than just the sermon podcast. Churches rarely integrate the sermon with supportive learning exercises during the week.

Yes, there is power in the preaching of the Word of God. Recently, my own pastor of a larger church in Atlanta admitted from the pulpit that he doubts that any of his sermons will be remembered. Yet, he believes that the sermons in totality over the course of a year or more will have an impact. What if his sermons can have even more of an impact through online supporting materials? Journal questions? Discussion boards? Supportive online inductive Bible Studies? Etc. What if?
Church Podcast
Almost any full-time Evangelist would admit that their job is "easy." It's easy to go in and preach and leave. They, however, would also admit that the difficult part of their job is knowing whether the church will effectively follow-up with the fruit of their labor. Many times, people fall through the cracks. So I am suggesting that online activities and opportunities, such as "I'm a new believer. Now what?" kind of courses. Just as new hire orientation greatly helps organizations orient new employees to their culture, the church can do something very similar.

Recently, I was contacted by one church who wanted to do a series where they gave the sermon, provided extra videos for Monday through Wednesday with follow-up discussion questions for their small groups Tuesday through Saturday. It's the first time they've done this! What a great idea! One very similar model would be Pantego Bible Church when Randy Frazee as described in The Connecting Church.The Connecting Church by Randy Frazee They integrate the sermon with their community group curricula so that the big idea or the main proposition is studied through the week at different levels/depth, embodied, and thoroughly learned. So instead of the believer being bombarded with all sorts of knowledge on Sunday AM, Sunday PM, Wednesday PM, and any other day. It's tragic that though churches offer so much learning opportunities, the body of Christ in America is becoming more and more biblically illiterate and unaware (from Dallas Theological Seminary survey but supported by Barna here and here).

Now, if churches would provide online modules to supplement the sermons, life change can be reinforced during the week thus making a deeper impact and a deeper change. Furthermore, besides further formal (courses and workshops) or informal learnings (such as journal/reflection questions, more videos, other podcasts or presentations, blog entries, etc.), if churches provide discussion boards/forums (via bbPress) or various social online situations (BuddyPress), immense growth can happen, maybe even have exponential, grassroots growth. Not only can spiritual growth take place, if an authentic and dynamic community can be encouraged and managed, then the church becomes even more connected...more like the church. However, in larger communities and cities where members are greatly dispersed throughout the city (and with traffic as bad as it is in Atlanta!!), having an online arena would be a great place to connect during the week. Instead, churches depend on email newsletters (e.g., MailChimp & Constant Contact), and well...I have no idea what else.

Recently, a friend of mine developed a site for pastors to network about small groups, Small Group Network utilizing BuddyPress and bbPress. From their site,

Founded by Steve Gladen, the Small Group Network is a free world-wide network for leaders of small group ministry. Our goal is to provide these leaders with relevant information and resources while connecting them to each other so that they might build relationships and encourage one another in creating healthy small group ministries.

However, I believe this is completely doable with churches (Now the caveat with churches will be to determine the legal ramifications, forum moderation, etc. for extensions like BuddyPress and bbPress).

Many churches have classes or workshops for new members and new believers. However, they are often at the worst times. For example, my wife and I have been trying to become members of a church in Atlanta, but due to our schedule, due to sickness and other random circumstances (sometimes our fault even), it has been over a year since we began "trying" to become members. However, membership class is only offered either once a month or once a quarter. What if the church provided some online modules (via a Learning Management System, or also known as a LMS) and then only one Sunday morning discussion and conversation to finalize the memberships. This could be slated for one of the Sunday morning hours rotating elders and pastoral staff as needed/desired. In this manner, instead of a bottlenecked entry point, becoming members is entirely dependent on the member-to-be.

This can be done in WordPress alongside a church's WordPress website. If the church wants to accomplish a course-like feel (like Moodle) then consider what Chris Lema just wrote about in his recent elearning post. The other approach would be Learn Dash, which I haven't tried or tested. WooThemes will be releasing Sensei this month, which I am excited to see. WooThemes was nice enough to give me the plugin to test today, so I will be writing about it soon!

Yes, I can hear it now..."We like to have the interaction." Or, "We like to see their faces." Or, "As the church, we should be rubbing shoulders with one another." Yes, very true. But how much interaction really takes place at medium to larger churches? In all honesty, not much. I am not negating meeting face-to-face and the importance of gathering together as believers. However, I am encouraging churches to optimize the face-to-face meeting times. Most of the workshops tend to be question-less anyways even though most of them provide opportunities for members-to-be to ask questions. I've sat through these seminars, and I find them extremely boring and hope and pray no one asks any questions. For the average member-to-be, I imagine that people fear asking questions, or the questions have percolated yet, or spouses and families haven't had a chance to discuss what they've heard and aren't able to come up with questions in less than 5 minutes. Instead, if online learnings (and every church has a base curriculum that needs to be pushed to the potential member) to provide a base for discussion, then membership classes can take meaning.

Written by Travis Smith · Categorized: WordPress

Jan 07 2013

Create Genesis Constants Based on Theme

In my child themes, this little function that I wrote based on the new wp_get_theme() function (Codex, WP Ticket). Previously, I had to create style.css with all the data and then had to do the same thing in functions.php (or my child init.php). So to save 30 seconds or so, I have no fully automated this entirely, so everything in style.css matters. Everything!

Let's step through the style.css header.

/*
Theme Name: Genesis Child
Theme URI: http://wpsmith.net/
Description: Default Genesis Child Theme.
Author: Travis Smith
Author URI: http://wpsmith.net/
Version: 1.0.0
Text Domain: genesis-child
Tags: black, white, red, one-column, two-columns, three-columns, left-sidebar, right-sidebar, fixed-width, custom-background, custom-header, custom-menu, editor-style, full-width-template, sticky-post, theme-options, threaded-comments, translation-ready
Template: genesis
Template Version: 1.9.0
License: GNU General Public License v3.0 (or later)
License URI: http://opensource.org/licenses/gpl-license.php
*/
view raw style.css hosted with ❤ by GitHub

Obviously, Template and Template version should be set for every child theme.

So Theme Name will determine CHILD_THEME_NAME, which will automatically appear in the Genesis Footer connected with the Theme URI, which is set as CHILD_THEME_URL. WordPress pulls in the Description on the Appearance > Themes page. I have an admin script that I make better use of Author and Author URI besides the basic WordPress listing them in Appearance > Themes (as it also uses Tags). It places it in the footer stating, "Thank you for creating with WordPress & CHILD_THEME_NAME designed by CHILD_DEVELOPER" linked with CHILD_DEVELOPER_URL.

What's even more awesome is that Genesis 1.9 makes use of CHILD_THEME_VERSION if it is set in enqueuing the style. So, it's important, but I also use it elsewhere. Then the even more awesome thing is Text Domain! Text Domain sets two constants: CHILD_DOMAIN (localization) and CHILD_THEME_SETTINGS (admin page). So if Text Domain is set as 'genesis-child' then the CHILD_DOMAIN will be 'genesis-child' and the CHILD_THEME_SETTINGS will be 'genesis-child-settings'.

Now, I don't have to think a single bit for my theme constants. I just use this function in all child themes I create.

<?php
add_action( 'genesis_init', 'gs_constants', 15 );
/**
* This function defines the Genesis Child theme constants
*
* Data Constants: CHILD_SETTINGS_FIELD, CHILD_DOMAIN, CHILD_THEME_VERSION
* CHILD_THEME_NAME, CHILD_THEME_URL, CHILD_DEVELOPER, CHILD_DEVELOPER_URL
* Directories: CHILD_LIB_DIR, CHILD_IMAGES_DIR, CHILD_ADMIN_DIR, CHILD_JS_DIR, CHILD_CSS_DIR
* URLs: CHILD_LIB, CHILD_IMAGES, CHILD_ADMIN, CHILD_JS, CHILD_CSS
*
* @since 1.1.0
*/
function gs_constants() {
$theme = wp_get_theme();
// Child theme (Change but do not remove)
/** @type constant Child Theme Options/Settings. */
define( 'CHILD_SETTINGS_FIELD', $theme->get('TextDomain') . '-settings' );
/** @type constant Text Domain. */
define( 'CHILD_DOMAIN', $theme->get('TextDomain') );
/** @type constant Child Theme Version. */
define( 'CHILD_THEME_VERSION', $theme->Version );
/** @type constant Child Theme Name, used in footer. */
define( 'CHILD_THEME_NAME', $theme->Name );
/** @type constant Child Theme URL, used in footer. */
define( 'CHILD_THEME_URL', $theme->get('ThemeURI') );
// Developer Information, see lib/admin/admin-functions.php
/** @type constant Child Theme Developer, used in footer. */
define( 'CHILD_DEVELOPER', $theme->Author );
/** @type constant Child Theme Developer URL, used in footer. */
define( 'CHILD_DEVELOPER_URL', $theme->{'Author URI'} );
// Define Directory Location Constants
/** @type constant Child Theme Library/Includes URL Location. */
define( 'CHILD_LIB_DIR', CHILD_DIR . '/lib' );
/** @type constant Child Theme Images URL Location. */
define( 'CHILD_IMAGES_DIR', CHILD_DIR . '/images' );
/** @type constant Child Theme Admin URL Location. */
define( 'CHILD_ADMIN_DIR', CHILD_LIB_DIR . '/admin' );
/** @type constant Child Theme JS URL Location. */
define( 'CHILD_JS_DIR', CHILD_DIR .'/js' );
/** @type constant Child Theme JS URL Location. */
define( 'CHILD_CSS_DIR', CHILD_DIR .'/css' );
// Define URL Location Constants
/** @type constant Child Theme Library/Includes URL Location. */
define( 'CHILD_LIB', CHILD_URL . '/lib' );
/** @type constant Child Theme Images URL Location. */
define( 'CHILD_IMAGES', CHILD_URL . '/images' );
/** @type constant Child Theme Admin URL Location. */
define( 'CHILD_ADMIN', CHILD_LIB . '/admin' );
/** @type constant Child Theme JS URL Location. */
define( 'CHILD_JS', CHILD_URL .'/js' );
/** @type constant Child Theme JS URL Location. */
define( 'CHILD_CSS', CHILD_URL .'/css' );
}
view raw gs_constants.php hosted with ❤ by GitHub

Written by Travis Smith · Categorized: WordPress

  • « Previous Page
  • 1
  • …
  • 4
  • 5
  • 6
  • 7
  • 8
  • …
  • 25
  • Next Page »
  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in