Skip to content
Jose Castaneda edited this page Jul 28, 2016 · 1 revision

The following code snippets can be used inside of your functions.php file of the theme, child theme or in a functionality plugin.

Adding custom header support

add_action( 'after_setup_theme', function(){

	add_theme_support( 'custom-header' );

	add_filter( 'alpha_attr_site-header', function( $attr, $context ) {
		if ( get_custom_header() ) {
			$attr['style'] =  "background: url( " . get_custom_header()->url . " ) fixed center;";
			$attr['style'] .= 'background-size: cover;';
		} else {
			$attr['style'] = 'background: #feefee;';
		}
		$attr['style'] .= 'min-height: 18.75em;';
		return $attr;
	}, 10, 2 );

}, 10);

Removing 'Designed by'

// First we remove the hook for that
remove_action( 'tha_footer_bottom', 'alpha_footer_content', 10 );
// then we add our own
add_action( 'tha_footer_bottom', function(){
	printf( '<p class="credit">%s</p>', sprintf(
		// Translators: 1 is current year, 2 is site name/link, 3 is WordPress name/link.
		__( 'Copyright &#169; %1$s %2$s.', 'text-domain' ),
		date_i18n( 'Y' ),
		carelib_get_site_link()
	) );
});

Changing primary menu location

remove_action( 'tha_header_bottom', 'alpha_menu_primary', 10 );
add_action( 'tha_header_after', 'alpha_menu_primary', 0 );