Header hooks and filters
Remove site description
add_action( 'genesis_site_description', 'genesis_seo_site_description' );
Custom Logo structure
add_filter( 'genesis_seo_title', 'genesis_custom_seo_title', 10, 3 ); function genesis_custom_seo_title( $title ) { if( get_header_image() ){ $title .= '<div class="logo-wrap">'; $title .= '<a class="logo-image" href="'.get_bloginfo('url').'" title="'.get_bloginfo('name').'">'; $title .= '<img src="'.get_header_image().'" alt="'.get_bloginfo('name').'"/>'; $title .= '</a>'; $title .= '</div>'; }else{ $title = '<h1 class="site-title">'.get_bloginfo('name').'</h1>'; } return $title; }
Search form on the primary navigation
add_filter( 'wp_nav_menu_items', 'genesis_search_primary_nav_menu', 10, 2 ); function genesis_search_primary_nav_menu( $menu, stdClass $args ){ if ( 'primary' != $args->theme_location ) return $menu; if( genesis_get_option( 'nav_extras' ) ) return $menu; $menu .= sprintf( '<span class="custom-search">%s</span>', __( genesis_search_form( $echo ) ) ); return $menu; }
Category Title
function category_page_title() { if ( is_category() ) { global $wp_query, $wpdb; $category_ = get_query_var('cat'); $current_cat = get_category ($category_); $category_id = $current_cat->term_id; $category_term = get_term_by('id', $category_id, 'category'); $category_meta = $category_term->meta; if( $category_meta['headline'] != '' ){ return; } echo'<h1 class="archive-title category-title">'.get_cat_name( $category_id ).'</h1>'; } } add_action( 'genesis_before_loop' , 'category_page_title', 1 );
Register sidebar
genesis_register_sidebar( array( 'id' => 'sidebar', 'name' => __( 'Primary Sidebar', 'genesis' ), 'before' => '<div id="%1$s" class="widget %2$s">', 'after' => '</div></div>', 'before_title' => '<h4 class="widget-title widgettitle">', 'after_title' => '</h4><div class="widget-inner">' ) );
Loop
remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); add_action( 'genesis_entry_header', 'genesis_post_info', 5 );
Footer
function genesis_do_footer() { //* Build the text strings. Includes shortcodes $backtotop_text = '[footer_backtotop]'; $creds_text = sprintf( '[footer_copyright before="%s "] · [footer_childtheme_link before="" after=" %s"] [footer_genesis_link url="http://www.studiopress.com/" before=""] · [footer_wordpress_link] · [footer_loginout]', __( 'Copyright', 'genesis' ), __( 'on', 'genesis' ) ); //* Filter the text strings $backtotop_text = apply_filters( 'genesis_footer_backtotop_text', $backtotop_text ); $creds_text = apply_filters( 'genesis_footer_creds_text', $creds_text ); $backtotop = $backtotop_text ? sprintf( '<div class="gototop"><p>%s</p></div>', $backtotop_text ) : ''; $creds = $creds_text ? sprintf( '<div class="creds"><p>%s</p></div>', $creds_text ) : ''; $output = $backtotop . $creds; //* Only use credits if HTML5 if ( genesis_html5() ) $output = '<p>' . $creds_text . '</p>'; echo apply_filters( 'genesis_footer_output', $output, $backtotop_text, $creds_text ); }
Header
remove_action( 'genesis_header', 'genesis_do_header' ); # REMOVE DEFAULT TITLE remove_action( 'genesis_site_title', 'genesis_seo_site_title' ); # REMOVE DEFAULT DESCRIPTION remove_action( 'genesis_site_description', 'genesis_seo_site_description' );
Primary navigation menu
# REMOVE DEFAULT PRIMARY NAV MENU remove_action( 'genesis_after_header', 'genesis_do_nav' ); # REMOVE DEFAULT SECONDARY NAV MENU remove_action( 'genesis_after_header', 'genesis_do_subnav' ); // add extra div wrapper insude of wrap class ( <div class="wrap"></div> ) add_filter( 'genesis_do_nav', 'genesis_child_nav', 10, 3 ); function genesis_child_nav($nav_output, $nav, $args) { $my_array = array( 'html5' => '<nav %s>', 'xhtml' => '<div id="nav">', 'context' => 'nav-primary', 'echo' => false, ); $nav_markup_open = genesis_markup( $my_array ); $nav_markup_open .= genesis_structural_wrap( 'menu-primary', 'open', 0 ); $nav_markup_open .= '<div id="menu-wrap">'; $nav_markup_close = genesis_structural_wrap( 'menu-primary', 'close', 0 ); $nav_markup_close .= genesis_html5() ? '</div></nav>' : '</div>'; $nav_output = $nav_markup_open . $nav . $nav_markup_close; return $nav_output; }
remove_action( 'genesis_after_content', 'genesis_get_sidebar' ); remove_action('genesis_footer', 'genesis_do_footer'); remove_action( 'genesis_loop', 'genesis_do_loop' ); remove_action( 'genesis_header', 'genesis_do_header' ); # REMOVE THE LOCATION OF THE STYLESHEET REFERENCE remove_action( 'genesis_meta', 'genesis_load_stylesheet' ); # REMOVE FILTERED BY remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); # REMOVE POST TITLE remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); # REMOVE POSTED BY AUTHOR remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); # REMOVE FEATURED IMAGE remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
Content breadcrumbs
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); add_action( 'genesis_after_header', 'genesis_do_breadcrumbs' ); add_filter( 'genesis_breadcrumb_args', 'sp_breadcrumb_args' ); // modify function sp_breadcrumb_args( $args ) { $args['home'] = 'Home'; $args['sep'] = ' >> '; $args['list_sep'] = ', '; // Genesis 1.5 and later $args['prefix'] = '<div class="breadcrumb">'; $args['suffix'] = '</div>'; $args['heirarchial_attachments'] = true; // Genesis 1.5 and later $args['heirarchial_categories'] = true; // Genesis 1.5 and later $args['display'] = true; $args['labels']['prefix'] = 'You are here: '; $args['labels']['author'] = 'Archives for '; $args['labels']['category'] = 'Archives for '; // Genesis 1.6 and later $args['labels']['tag'] = 'Archives for '; $args['labels']['date'] = 'Archives for '; $args['labels']['search'] = 'Search for '; $args['labels']['tax'] = 'Archives for '; $args['labels']['post_type'] = 'Archives for '; $args['labels']['404'] = 'Not found: '; // Genesis 1.5 and later return $args; }
Hooks
// REMOVE SIDEBAR remove_action( 'genesis_after_content', 'genesis_get_sidebar' ); remove_action( 'genesis_after_content_sidebar_wrap', 'genesis_get_sidebar_alt' ); //* HTML5 Hooks add_action( 'genesis_entry_header', 'genesis_do_post_format_image', 4 ); add_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); add_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); add_action( 'genesis_entry_header', 'genesis_do_post_title' ); add_action( 'genesis_entry_header', 'genesis_post_info', 12 ); add_action( 'genesis_entry_content', 'genesis_do_post_image', 8 ); add_action( 'genesis_entry_content', 'genesis_do_post_content' ); add_action( 'genesis_entry_content', 'genesis_do_post_content_nav', 12 ); add_action( 'genesis_entry_content', 'genesis_do_post_permalink', 14 ); add_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 ); add_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 ); add_action( 'genesis_entry_footer', 'genesis_post_meta' ); add_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 ); add_action( 'genesis_after_entry', 'genesis_get_comments_template' ); //* Pre-HTML5 hooks add_action( 'genesis_before_post_title', 'genesis_do_post_format_image' ); add_action( 'genesis_post_title', 'genesis_do_post_title' ); add_action( 'genesis_post_content', 'genesis_do_post_image' ); add_action( 'genesis_post_content', 'genesis_do_post_content' ); add_action( 'genesis_post_content', 'genesis_do_post_permalink' ); add_action( 'genesis_post_content', 'genesis_do_post_content_nav' ); add_action( 'genesis_before_post_content', 'genesis_post_info' ); add_action( 'genesis_after_post_content', 'genesis_post_meta' ); add_action( 'genesis_after_post', 'genesis_do_author_box_single' ); //* Other add_action( 'genesis_loop_else', 'genesis_do_noposts' ); add_action( 'genesis_after_endwhile', 'genesis_posts_nav' );
Leave a Reply