siga
7/20/2015 - 8:35 PM

Moves titles above content and sidebar and adds a custom CSS class to style them without affecting those who weren´t moved. Credits to: http

Moves titles above content and sidebar and adds a custom CSS class to style them without affecting those who weren´t moved. Credits to: https://gist.github.com/SmartWizardSolutions/8468002 and: https://gist.github.com/salcode/7164690

//Moves titles above content and sidebar and adds a custom CSS class

function siga_add_class( $attr, $class ) {
    $attr['class'] .= ' ' . sanitize_html_class( $class );
    return $attr;
}
// Now the name of the called function tells us what's happening (add a class).
function siga_attr_entry_title( $attr ) {
    return siga_add_class( $attr, ' above' );
}

add_action('get_header', 'move_post_titles');
function move_post_titles() {
// Setting up conditionals for pages where the title shouldn´t be moved
    if (!is_home() && !is_archive() && !is_page('blog') && !is_category()) { 
        // Removes entry title
        remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
        // Puts entry title back in after header
        add_action( 'genesis_after_header', 'genesis_do_post_title', 20 );
        // Adds the custom class to entry-title
		    add_filter( 'genesis_attr_entry-title', 'siga_attr_entry_title' );

}
}
h1.entry-title.above {
	text-align:center;
	background:#000000;
	color:#fff;
	padding: 15px 0;
}