WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Feb 09 2012

How to Enable Genesis Author Boxes Automatically for ALL Users

In Genesis there are two ways to do this: there is the direct filter or the simple function call. Calling the function calls the filter, so either way the filter is being called.

To enable the Author Box you can add the following to your functions.php file.
[php]
// Enable Author Box on Single/Archive pages
add_filter( 'get_the_author_genesis_author_box_single', '__return_true' );
add_filter( 'get_the_author_genesis_author_box_archive', '__return_true' );
[/php]

Or, the Genesis way to do this is:
[php]
// Enable Author Box on Single/Archive pages
genesis_enable_author_box();
genesis_enable_author_box( array( 'type' => 'archive' ) );
[/php]

Written by Travis Smith · Categorized: Genesis

Feb 08 2012

How to Add a Body Class to the WordPress Activation Page for Targeted CSS Styling

So the activation page (for a multisite network) can be a bit difficult to style for a full-width site that has a background on the body and a background on the #content-sidebar-wrap. Since this section is not part of Genesis (or any theme/framework for that matter) and is part of WordPress (thus no real hooks within the page), you need to add a body class to be able to target style.

[php]
add_action( 'activate_header' , 'wps_add_activate_class' );
/*
* Call body_class filter on activate_header action hook that only appears on wp-activate.php
* @author Travis Smith
*/
function wps_add_activate_class() {
add_filter( 'body_class' , 'wps_activate_class' );
}

/*
* Add specific CSS class by filter
* @author Travis Smith
*/
function wps_activate_class( $classes ) {

// add 'class-name' to the $classes array
$classes[] = 'activation-page';

// return the $classes array
return $classes;
}[/php]

Written by Travis Smith · Categorized: WordPress

Jan 26 2012

Speaking at WordCamp Atlanta

Speaking at WordCamp AtlantaSo, I have been rather lazy announcing this, but I am speaking at WordCamp Atlanta coming up on February 4th at 11am on Professional Rapid Web Development Using the Genesis Framework.

During this seminar I plan to do the following:

  1. Introduce Genesis 1.8 and the new built-in Genesis Admin Class
  2. Introduce/Discuss 3 Other Classes including an Admin Builder Class (by Nick Croft), the Custom Metabox Class (by Jared Atchinson, Bill Erickson, & Andrew Norcross), and the Plugin Activation Class (by Thomas Griffin and Gary Jones) for rapid development
  3. Introduce my Genesis Starter Theme, WPS Starter Flex, which includes nearly everything a Genesis developer will need
  4. Discuss the Core Functionality Plugin approach to building websites
  5. Discuss the various resources available to a Genesis developer including the very active community

Beyond all these things, StudioPress has graciously donated some WordPress swag to give away during the presentation including 1 ProPlus Package & 3 Theme Packages (e.g., AgentPress).

Did I miss anything? Is there anything else that I should include? Please let me know!! I'll see you there!

Written by Travis Smith · Categorized: Genesis, WordPress

Jan 24 2012

How to Add a Custom Screen Icon for Genesis Admin Pages

In a previous post I discussed how to create a child theme admin page, and talked about a few of the new features of Genesis 1.8, . However, one thing I didn't discuss in the creation of the new admin pages is setting a custom screen icon.

While this may or may not make Genesis core, it is a simple addition. So in your __construct() method with $page_ops, enter a screen icon of 'custom'.
[php highlight="22,23,24"]
/**
* Create an admin menu item and settings page.
*
* @since 1.0.0
*/
function __construct() {

// Specify a unique page ID.
$page_id = 'child';

// Set it as a child to genesis, and define the menu and page titles
$menu_ops = array(
'submenu' => array(
'parent_slug' => 'genesis',
'page_title' => 'Genesis - WPS Starter Settings',
'menu_title' => 'WPS Starter Settings',
'capability' => 'manage_options',
)
);

// Set up page options. These are optional, so only uncomment if you want to change the defaults
$page_ops = array(
'screen_icon' => 'custom', // see $this->screen_icon() below
);

// Give it a unique settings field.
// You'll access them from genesis_get_option( 'option_name', CHILD_SETTINGS_FIELD );
$settings_field = CHILD_SETTINGS_FIELD;

// Set the default values
$default_settings = array(
'phone' => '',
'address' => '',
);

// Create the Admin Page
$this->create( $page_id, $menu_ops, $page_ops, $settings_field, $default_settings );

// Initialize the Sanitization Filter
add_action( 'genesis_settings_sanitizer_init', array( $this, 'sanitization_filters' ) );
}
[/php]

Next you will need a method to output the necessary CSS to display your icon.
[php highlight="42,43"]
/**
* Create an admin menu item and settings page.
*
* @since 1.0.0
*/
function __construct() {

// Specify a unique page ID.
$page_id = 'child';

// Set it as a child to genesis, and define the menu and page titles
$menu_ops = array(
'submenu' => array(
'parent_slug' => 'genesis',
'page_title' => 'Genesis - WPS Starter Settings',
'menu_title' => 'WPS Starter Settings',
'capability' => 'manage_options',
)
);

// Set up page options. These are optional, so only uncomment if you want to change the defaults
$page_ops = array(
'screen_icon' => 'custom', // see $this->screen_icon() below
);

// Give it a unique settings field.
// You'll access them from genesis_get_option( 'option_name', CHILD_SETTINGS_FIELD );
$settings_field = CHILD_SETTINGS_FIELD;

// Set the default values
$default_settings = array(
'phone' => '',
'address' => '',
);

// Create the Admin Page
$this->create( $page_id, $menu_ops, $page_ops, $settings_field, $default_settings );

// Initialize the Sanitization Filter
add_action( 'genesis_settings_sanitizer_init', array( $this, 'sanitization_filters' ) );

// Add custom screen icon
add_action( 'admin_head' , array( $this, 'screen_icon' ) );
}
[/php]

Now you will need to create the method within the class extension.
[php]

/**
* Custom Admin screen icon
*
* See /lib/classes/sanitization.php for all available filters.
*
* @since 1.0.0
*/
public function screen_icon() { ?>
<style>
#icon-custom { background-image: url('<?php echo WPS_ADMIN_IMAGES . '/staff_32x32.png'; ?>'); background-repeat: no-repeat; }
</style>
<?php
}
[/php]

Written by Travis Smith · Categorized: WordPress

Jan 23 2012

How to Add an Avatar To WordPress Defaults, Remove Default Avatars, & Set Your Default

With WordPress and Genesis, Avatars are used as identification (like the Twitter icon), and with Gravatar it is in the comment area and the User Profile Widget.

Default Avatars
Click for larger image

WordPress allows the user to set a default or generated Avatar, if the commentator doesn't have one. However, I find these options rather ugly or not fitting to the theme most of the time.

Add an Avatar to WordPress Defaults

So I'd like to show you how to add an avatar to the WordPress defaults.
[php]
// Add Custom Avatar (Discussion Settings)
add_filter( 'avatar_defaults' , 'wps_new_avatar' );
function wps_new_avatar( $avatar_defaults ){
$new_avatar = get_stylesheet_directory_uri() . '/images/genesis-48x48.png';
$avatar_defaults[$new_avatar] = "Genesis";

return $avatar_defaults;
}
[/php]

Add New Avatar
Click for larger image

Remove Default Avatars from WordPress Defaults

For those of us who don't care for some of the WordPress defaults, within that function you can easily remove them at your will:
[php]
// Add Custom Avatar (Discussion Settings)
add_filter( 'avatar_defaults' , 'wps_new_avatar' );
function wps_new_avatar( $avatar_defaults ){
// Get Avatar from child theme images folder
$new_avatar = get_stylesheet_directory_uri() . '/images/genesis-48x48.png';
$avatar_defaults[$new_avatar] = "Genesis";

// Remove default avatars
unset ( $avatar_defaults['mystery'] );
//unset ( $avatar_defaults['blank'] );
//unset ( $avatar_defaults['gravatar_default'] );
//unset ( $avatar_defaults['identicon'] );
//unset ( $avatar_defaults['wavatar'] );
//unset ( $avatar_defaults['monsterid'] );
//unset ( $avatar_defaults['retro'] );

return $avatar_defaults;
}
[/php]

Remove Avatars
Click for larger image

Set Your Default

Now, WordPress gladly will set your default avatar to the well-known, popular Mystery Man. However, instead of navigating to Settings > Discussion, you can easily set your default as well.
[php]
// Set new avatar to be default
add_action ( 'admin_init' , 'wps_avatar_default');
function wps_avatar_default () {
$default = get_option('avatar_default');
if ( ( empty( $default ) ) || ( $default == 'mystery' ) )
$default = get_stylesheet_directory_uri() . '/images/genesis-48x48.png';
update_option ( 'avatar_default' , $default );
}
[/php]
The known downside of this is that now, Mystery Man can never be chosen so long as this code is active (so it would work well to remove Mystery Man (unset ( $avatar_defaults['mystery'] );) above. This way you can easily control the avatars on your site.

Final Avatar
Click for larger image

Written by Travis Smith · Categorized: Genesis, WordPress

  • « Previous Page
  • 1
  • …
  • 24
  • 25
  • 26
  • 27
  • 28
  • …
  • 60
  • Next Page »

Need Help?

Please let us know how we can help you!

Get Help

Recommendations

Genesis WordPress Framework
Sucuri Security
Gravity Forms
GetSoliloquy
Get Envira
Scribe SEO
BackupBuddy
WordPress Video User Manuals

Recent Posts

  • Solving WordPress 5XX Server Errors on SiteGround
  • Hiding an User in the WordPress Admin
  • Custom Rewrite Rules for Custom Post Types and Taxonomies
  • WordPress JavaScript Manager Native Functions
  • Causes of WordPress Site Performance Slowdown

About Travis

As a WordPress enthusiast, developer, and speaker, Travis writes about what he learns in WordPress trying to help other WordPress travelers, beginners and enthusiasts with tutorials, explanations, & demonstrations.

  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

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