Skip to content

Instantly share code, notes, and snippets.

@mariogarcia-ar
Forked from nielslange/README.md
Created December 29, 2023 21:31
Show Gist options
  • Save mariogarcia-ar/e581ace56ce429f7c8cebde8776860c4 to your computer and use it in GitHub Desktop.
Save mariogarcia-ar/e581ace56ce429f7c8cebde8776860c4 to your computer and use it in GitHub Desktop.
Genesis Framework snippets

Genesis Framework snippets

Accessibility

Enable Accessibility Features

  • functions.php:
//* Enable Genesis Accessibility Components
add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) );
//* Remove Skip Links from a template, e.g. page_landing.php
remove_action ( 'genesis_before_header', 'genesis_skip_links', 5 );
//* Dequeue Skip Links Script
add_action( 'wp_enqueue_scripts','child_dequeue_skip_links' );
function child_dequeue_skip_links() {
	wp_dequeue_script( 'skip-links' );
}
  • style.css:
/* ## Accessible Menu
--------------------------------------------- */

.menu .menu-item:focus {
	position: static;
}

.menu .menu-item > a:focus + ul.sub-menu,
.menu .menu-item.sf-hover > ul.sub-menu {
	left: auto;
	opacity: 1;
}
/* ## Screen reader text
--------------------------------------------- */

.screen-reader-text,
.screen-reader-text span,
.screen-reader-shortcut {
	position: absolute !important;
	clip: rect(0, 0, 0, 0);
	height: 1px;
	width: 1px;
	border: 0;
	overflow: hidden;
}

.screen-reader-text:focus,
.screen-reader-shortcut:focus,
.genesis-nav-menu .search input[type="submit"]:focus,
.widget_search input[type="submit"]:focus  {
	clip: auto !important;
	height: auto;
	width: auto;
	display: block;
	font-size: 1em;
	font-weight: bold;
	padding: 15px 23px 14px;
	color: #333;
	background: #fff;
	z-index: 100000; /* Above WP toolbar. */
	text-decoration: none;
	box-shadow: 0 0 2px 2px rgba(0,0,0,.6);
}

.more-link {
    position: relative;
}
/* Skip Links
--------------------------------------------- */
.genesis-skip-link {
	margin: 0;
}

.genesis-skip-link li {
	height: 0;
	width: 0;
	list-style: none;
}

/* Display outline on focus */
:focus {
	color: #333;
	outline: #ccc solid 1px;
}

Admin Management

Force the Genesis Layout Settings (functions.php)

//* Force content-sidebar layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );

//* Force sidebar-content layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_sidebar_content' );

//* Force content-sidebar-sidebar layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar_sidebar' );

//* Force sidebar-sidebar-content layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_sidebar_sidebar_content' );

//* Force sidebar-content-sidebar layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_sidebar_content_sidebar' );

//* Force full-width-content layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );

Remove the Genesis In-Post SEO Settings (functions.php)

//* Remove Genesis in-post SEO Settings
remove_action( 'admin_menu', 'genesis_add_inpost_seo_box' );

Remove the Genesis Layout Settings (functions.php)

//* Remove Genesis Layout Settings
remove_theme_support( 'genesis-inpost-layouts' );

Remove the Genesis Menu Link (functions.php)

//* Remove Genesis menu link
remove_theme_support( 'genesis-admin-menu' );

Remove the Genesis SEO Settings Menu Link (functions.php)

//* Remove Genesis SEO Settings menu link
remove_theme_support( 'genesis-seo-settings-menu' );

Unregister the Genesis Layout Settings (functions.php)

//* Unregister content/sidebar layout setting
genesis_unregister_layout( 'content-sidebar' );
 
//* Unregister sidebar/content layout setting
genesis_unregister_layout( 'sidebar-content' );
 
//* Unregister content/sidebar/sidebar layout setting
genesis_unregister_layout( 'content-sidebar-sidebar' );
 
//* Unregister sidebar/sidebar/content layout setting
genesis_unregister_layout( 'sidebar-sidebar-content' );
 
//* Unregister sidebar/content/sidebar layout setting
genesis_unregister_layout( 'sidebar-content-sidebar' );
 
//* Unregister full-width content layout setting
genesis_unregister_layout( 'full-width-content' );

Unregister the Genesis Widgets (functions.php)

//* Unregister Genesis widgets
add_action( 'widgets_init', 'unregister_genesis_widgets', 20 );
function unregister_genesis_widgets() {
	unregister_widget( 'Genesis_eNews_Updates' );
	unregister_widget( 'Genesis_Featured_Page' );
	unregister_widget( 'Genesis_Featured_Post' );
	unregister_widget( 'Genesis_Latest_Tweets_Widget' );
	unregister_widget( 'Genesis_Menu_Pages_Widget' );
	unregister_widget( 'Genesis_User_Profile_Widget' );
	unregister_widget( 'Genesis_Widget_Menu_Categories' );
}

Author Box

Enable the Author Box on Single Posts (functions.php)

//* Display author box on single posts
add_filter( 'get_the_author_genesis_author_box_single', '__return_true' );

Enable the Author Box on Archive Pages (functions.php)

//* Display author box on archive pages
add_filter( 'get_the_author_genesis_author_box_archive', '__return_true' );

Remove the Author Box on Single Posts (functions.php)

//* Remove the author box on single posts XHTML Themes
remove_action( 'genesis_after_post', 'genesis_do_author_box_single' );

//* Remove the author box on single posts HTML5 Themes
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );

Modify the Author Box Title (functions.php)

//* Customize the author box title
add_filter( 'genesis_author_box_title', 'custom_author_box_title' );
function custom_author_box_title() {
	return '<strong>About the Author</strong>';
}

Modify the Gravatar Size (functions.php)

//* Modify the size of the Gravatar in the author box
add_filter( 'genesis_author_box_gravatar_size', 'author_box_gravatar_size' );
function author_box_gravatar_size( $size ) {
	return '80';
}

Breadcrumbs

Modify the Breadcrumbs Home Link (functions.php)

//* Modify Home breadcrumb link.
add_filter ( 'genesis_home_crumb', 'sp_breadcrumb_home_link' ); // Genesis >= 1.5
add_filter ( 'genesis_breadcrumb_homelink', 'sp_breadcrumb_home_link' ); // Genesis =< 1.4.1
function sp_breadcrumb_home_link( $crumb ) {
	return preg_replace('/href="[^"]*"/', 'href="http://example.com/home"', $crumb);
}

Reposition the Breadcrumbs (functions.php)

//* Reposition the breadcrumbs
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
add_action( 'genesis_after_header', 'genesis_do_breadcrumbs' );

Modify the Breadcrumbs Display (functions.php)

//* Modify breadcrumb arguments.
add_filter( 'genesis_breadcrumb_args', 'sp_breadcrumb_args' );
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;
}

Comments

Modify the Author Says Text (functions.php)

//* Modify the author says text in comments
add_filter( 'comment_author_says_text', 'sp_comment_author_says_text' );
function sp_comment_author_says_text() {
	return 'author says';
}

Modify the Comments Link Text (functions.php)

//* Modify the comment link text in comments
add_filter( 'genesis_post_info', 'sp_post_info_filter' );
function sp_post_info_filter( $post_info ) {
	return '[post_comments zero="Leave a Comment" one="1 Comment" more="% Comments"]';
}

Modify the Comments Headline Text (functions.php)

//* Modify comments title text in comments
add_filter( 'genesis_title_comments', 'sp_genesis_title_comments' );
function sp_genesis_title_comments() {
	$title = '<h3>Discussion</h3>';
	return $title;
}

Modify the Gravatar Size (functions.php)

//* Modify the size of the Gravatar in comments
add_filter( 'genesis_comment_list_args', 'sp_comments_gravatar' );
function sp_comments_gravatar( $args ) {
	$args['avatar_size'] = 96;
	return $args;
}

Modify the Speak Your Mind Text (functions.php)

//* Modify the speak your mind title in comments
add_filter( 'comment_form_defaults', 'sp_comment_form_defaults' );
function sp_comment_form_defaults( $defaults ) {
 	$defaults['title_reply'] = __( 'Leave a Comment' );
	return $defaults;
}

Modify the Trackbacks Headline Text (functions.php)

//* Modify trackbacks title in comments
add_filter( 'genesis_title_pings', 'sp_title_pings' );
function sp_title_pings() {
    echo '<h3>Trackbacks</h3>';
}

Modify the Submit Button Text (functions.php)

//* Customize the submit button text in comments
add_filter( 'comment_form_defaults', 'sp_comment_submit_button' );
function sp_comment_submit_button( $defaults ) { 
    $defaults['label_submit'] = __( 'Submit', 'custom' );
    return $defaults;
}

Add A Comment Policy Box (functions.php)

//* Customize the submit button text in comments
add_filter( 'comment_form_defaults', 'sp_comment_submit_button' );
function sp_comment_submit_button( $defaults ) {
    $defaults['label_submit'] = __( 'Submit', 'custom' );
    return $defaults;
}

Remove the Allowed Tags Text (functions.php)

//* Remove comment form allowed tags
add_filter( 'comment_form_defaults', 'sp_remove_comment_form_allowed_tags' );
function sp_remove_comment_form_allowed_tags( $defaults ) {
	$defaults['comment_notes_after'] = '';
	return $defaults;
}

Entry Content (HTML5)

Remove Entry Content (functions.php)

//* Remove the post content (requires HTML5 theme support)
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );

Remove Post Image (functions.php)

//* Remove the post image (requires HTML5 theme support)
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );

Remove Post Navigation (functions.php)

//* Remove the post navigation (requires HTML5 theme support)
remove_action( 'genesis_entry_content', 'genesis_do_post_content_nav', 12 );

Remove Post Permalink (functions.php)

//* Remove the post permalink (requires HTML5 theme support)
remove_action( 'genesis_entry_content', 'genesis_do_post_permalink', 14 );

Add Post Navigation (functions.php)

//* Add post navigation (requires HTML5 theme support)
add_action( 'genesis_entry_footer', 'genesis_prev_next_post_nav' );

Entry Footer (HTML5)

Remove Entry Footer Markup (functions.php)

//* Remove the entry footer markup (requires HTML5 theme support)
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );

Remove Entry Meta (functions.php)

//* Remove the entry meta in the entry footer (requires HTML5 theme support)
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );

Customize the Entry Footer (functions.php)

//* Customize the entry meta in the entry footer (requires HTML5 theme support)
add_filter( 'genesis_post_meta', 'sp_post_meta_filter' );
function sp_post_meta_filter($post_meta) {
	$post_meta = '[post_categories] [post_tags]';
	return $post_meta;
}

Entry Header (HTML5)

Remove Entry Header Markup (functions.php)

//* Remove the entry header markup (requires HTML5 theme support)
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );

Remove Entry Meta (functions.php)

//* Remove the entry meta in the entry header (requires HTML5 theme support)
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );

Remove Entry Title (functions.php)

//* Remove the entry title (requires HTML5 theme support)
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );

Remove Post Format Image (functions.php)

//* Remove the post format image (requires HTML5 theme support)
remove_action( 'genesis_entry_header', 'genesis_do_post_format_image', 4 );

Customize the Entry Header (functions.php)

//* Customize the entry meta in the entry header (requires HTML5 theme support)
add_filter( 'genesis_post_info', 'sp_post_info_filter' );
function sp_post_info_filter($post_info) {
	$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit]';
	return $post_info;
}

Trim length of featured post title (functions.php)

//* Trim length of featured post title
add_filter( 'genesis_featured_post_title', 'nl_genesis_featured_post_title_length' );
function nl_genesis_featured_post_title_length( $title ) {
	return mb_strimwidth($title, 0, 65, '...');
}

Footer

Customize the Credits Text (functions.php)

//* Change the footer text
add_filter('genesis_footer_creds_text', 'sp_footer_creds_filter');
function sp_footer_creds_filter( $creds ) {
	$creds = '[footer_copyright] &middot; <a href="http://mydomain.com">My Custom Link</a> &middot; Built on the <a href="http://www.studiopress.com/themes/genesis" title="Genesis Framework">Genesis Framework</a>';
	return $creds;
}

Customize the Site Footer (functions.php)

//* Customize the entire footer
remove_action( 'genesis_footer', 'genesis_do_footer' );
add_action( 'genesis_footer', 'sp_custom_footer' );
function sp_custom_footer() {
	?>
	<p>&copy; Copyright 2012 <a href="http://mydomain.com/">My Domain</a> &middot; All Rights Reserved &middot; Powered by <a href="http://wordpress.org/">WordPress</a> &middot; <a href="http://mydomain.com/wp-admin">Admin</a></p>
	<?php
}

Reposition the Site Footer (functions.php)

//* Reposition the footer
remove_action( 'genesis_footer', 'genesis_footer_markup_open', 5 );
remove_action( 'genesis_footer', 'genesis_do_footer' );
remove_action( 'genesis_footer', 'genesis_footer_markup_close', 15 );
add_action( 'genesis_after', 'genesis_footer_markup_open', 11 );
add_action( 'genesis_after', 'genesis_do_footer', 12 );
add_action( 'genesis_after', 'genesis_footer_markup_close', 13 );

Customize the Return to Top of Page Text (functions.php)

//* Customize the return to top of page text
add_filter( 'genesis_footer_backtotop_text', 'sp_footer_backtotop_text' );
function sp_footer_backtotop_text($backtotop) {
	$backtotop = '[footer_backtotop text="Return to Top"]';
	return $backtotop;
}

Head Section

Add Viewport Meta Tag (functions.php)

//* Add Viewport meta tag for mobile browsers (requires HTML5 theme support)
add_theme_support( 'genesis-responsive-viewport' );

Add Custom Viewport Meta Tag (functions.php)

//* Add custom Viewport meta tag for mobile browsers
add_action( 'genesis_meta', 'sp_viewport_meta_tag' );
function sp_viewport_meta_tag() {
	echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
}

Header

Remove the Site Title (functions.php)

//* Remove the site title
remove_action( 'genesis_site_title', 'genesis_seo_site_title' );

Remove the Site Description (functions.php)

//* Remove the site description
remove_action( 'genesis_site_description', 'genesis_seo_site_description' );

Remove the Header Widget Area (functions.php)

//* Remove the header right widget area
unregister_sidebar( 'header-right' );

Modify the Header URL (functions.php)

//* Modify the header URL - HTML5 Version
add_filter( 'genesis_seo_title', 'child_header_title', 10, 3 );
function child_header_title( $title, $inside, $wrap ) {
    $inside = sprintf( '<a href="http://example.com/" title="%s">%s</a>', esc_attr( get_bloginfo( 'name' ) ), get_bloginfo( 'name' ) );
    return sprintf( '<%1$s class="site-title">%2$s</%1$s>', $wrap, $inside );
}

HTML5

Enable HTML5 Markup (functions.php)

//* Add HTML5 markup structure
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );

Images

Display a Custom Gravatar (functions.php)

//* Display a custom Gravatar
add_filter( 'avatar_defaults', 'sp_gravatar' );
function sp_gravatar ($avatar) {
	$custom_avatar = get_stylesheet_directory_uri() . '/images/gravatar.png';
	$avatar[$custom_avatar] = "Custom Gravatar";
	return $avatar;
}

Add Featured Images (functions.php)

//* Add new featured image sizes
add_image_size( 'home-bottom', 150, 100, TRUE );
add_image_size( 'home-top', 400, 200, TRUE );

Miscellaneous

Show Content Above Posts on Blog Page (functions.php)

//* Template Name: Blog

//* Show page content above posts
add_action( 'genesis_loop', 'genesis_standard_loop', 5 );

genesis();

Add an After Entry Widget Area (functions.php)

//* Add support for after entry widget
add_theme_support( 'genesis-after-entry-widget-area' );

Add Custom Body Class (functions.php)

  • Add body class to all pages:
//* Add custom body class to the head
add_filter( 'body_class', 'sp_body_class' );
function sp_body_class( $classes ) {
	$classes[] = 'custom-class';
	return $classes;	
}
  • Add body class to a page with a slug of ‘sample-page’:
//* Add custom body class to the head
add_filter( 'body_class', 'sp_body_class' );
function sp_body_class( $classes ) {
	if ( is_page( 'sample-page' ) )
        $classes[] = 'custom-class';
    return $classes;
}
  • Add body class to a page with an ID of 1:
//* Add custom body class to the head
add_filter( 'body_class', 'sp_body_class' );
function sp_body_class( $classes ) {
	if ( is_page( '1' ) )
		$classes[] = 'custom-class';
    return $classes;
}
  • Add body class to a category page with a slug of ‘sample-category’:
//* Add custom body class to the head
add_filter( 'body_class', 'sp_body_class' );
function sp_body_class( $classes ) {
	if ( is_category( 'sample-category' ) )
        $classes[] = 'custom-class';
    return $classes;
}
  • Add body class to a category page with an ID of 1:
//* Add custom body class to the head
add_filter( 'body_class', 'sp_body_class' );
function sp_body_class( $classes ) {	
	if ( is_category( '1' ) )
        $classes[] = 'custom-class';
    return $classes;
}
  • Add body class to a tag page with a slug of ‘sample-tag’:
//* Add custom body class
add_filter( 'body_class', 'sp_body_class' );
function sp_body_class( $classes ) {
	if ( is_tag( 'sample-tag' ) )
        $classes[] = 'custom-class';
    return $classes;		
}
  • Add body class to a tag page with an ID of 1:
//* Add custom body class to the head
add_filter( 'body_class', 'sp_body_class' );
function sp_body_class( $classes ) {	
	if ( is_tag( '1' ) )
        $classes[] = 'custom-class';
    return $classes;	
}

Navigation Menus

Reposition the Primary Navigation Menu (functions.php)

//* Reposition the primary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_header', 'genesis_do_nav' );

Reposition the Secondary Navigation Menu (functions.php)

//* Reposition the secondary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_before_header', 'genesis_do_subnav' );

Unregister the Primary/Secondary Navigation Menus (functions.php)

//* Unregister primary/secondary navigation menus
remove_theme_support( 'genesis-menus' );

Unregister the Primary Navigation Menu (functions.php)

//* Unregister primary navigation menu
add_theme_support( 'genesis-menus', array( 'secondary' => __( 'Secondary Navigation Menu', 'genesis' ) ) );

Unregister the Secondary Navigation Menu (functions.php)

//* Unregister secondary navigation menu
add_theme_support( 'genesis-menus', array( 'primary' => __( 'Primary Navigation Menu', 'genesis' ) ) );

Add Navigation Extras (functions.php)

/**
 * Filter menu items, appending either a search form or today's date.
 *
 * @param string   $menu HTML string of list items.
 * @param stdClass $args Menu arguments.
 *
 * @return string Amended HTML string of list items.
 */
add_filter( 'wp_nav_menu_items', 'theme_menu_extras', 10, 2 );
function theme_menu_extras( $menu, $args ) {
	//* Change 'primary' to 'secondary' to add extras to the secondary navigation menu
	if ( 'primary' !== $args->theme_location )
		return $menu;
	//* Uncomment this block to add a search form to the navigation menu
	/*
	ob_start();
	get_search_form();
	$search = ob_get_clean();
	$menu  .= '<li class="right search">' . $search . '</li>';
	*/
	//* Uncomment this block to add the date to the navigation menu
	/*
	$menu .= '<li class="right date">' . date_i18n( get_option( 'date_format' ) ) . '</li>';
	*/
	return $menu;
}

Post Excerpts

Modify the Content Limit Read More Link (functions.php)

//* Modify the Genesis content limit read more link
add_filter( 'get_the_content_more_link', 'sp_read_more_link' );
function sp_read_more_link() {
	return '... <a class="more-link" href="' . get_permalink() . '">[Continue Reading]</a>';
}

Modify the Length of Post Excerpts (functions.php)

//* Modify the length of post excerpts
add_filter( 'excerpt_length', 'sp_excerpt_length' );
function sp_excerpt_length( $length ) {
	return 50; // pull first 50 words
}

Modify the Content Read More Link (functions.php)

//* Modify the WordPress read more link
add_filter( 'the_content_more_link', 'sp_read_more_link' );
function sp_read_more_link() {
	return '<a class="more-link" href="' . get_permalink() . '">[Continue Reading]</a>';
}

Post Formats

Add Post Format Images (functions.php)

//* Add support for post format images
add_theme_support( 'genesis-post-format-images' );

Add Post Formats (functions.php)

//* Add support for post formats
add_theme_support( 'post-formats', array(
	'aside',
	'audio',
	'chat',
	'gallery',
	'image',
	'link',
	'quote',
	'status',
	'video'
) );

Post Info (XHTML)

Customize the Post Info Function (functions.php)

//* Customize the post info function
add_filter( 'genesis_post_info', 'sp_post_info_filter' );
function sp_post_info_filter($post_info) {
if ( !is_page() ) {
	$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit]';
	return $post_info;
}}

Remove the Post Info Function (functions.php)

//* Remove the post info function
remove_action( 'genesis_before_post_content', 'genesis_post_info' );

Post Meta (XHTML)

Remove the Post Meta Function (functions.php)

//* Remove the post meta function
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );

Customize the Post Meta Function (functions.php)

//* Customize the post meta function
add_filter( 'genesis_post_meta', 'sp_post_meta_filter' );
function sp_post_meta_filter($post_meta) {
if ( !is_page() ) {
	$post_meta = '[post_categories before="Filed Under: "] [post_tags before="Tagged: "]';
	return $post_meta;
}}

Post Navigation

Customize the Next/Newer Page Link (functions.php)

//* Customize the next page link
add_filter ( 'genesis_next_link_text' , 'sp_next_page_link' );
function sp_next_page_link ( $text ) {
    return 'Custom Next Page Link &#x000BB;';
}

Customize the Previous/Older Page Link (functions.php)

//* Customize the previous page link
add_filter ( 'genesis_prev_link_text' , 'sp_previous_page_link' );
function sp_previous_page_link ( $text ) {
    return '&#x000AB; Custom Previous Page Link';
}

Scripts

Enable Superfish Script (functions.php)

//* Enable the superfish script
add_filter( 'genesis_superfish_enabled', '__return_true' );

Disable Superfish Script (functions.php)

//* Disable the superfish script
add_action( 'wp_enqueue_scripts', 'sp_disable_superfish' );
function sp_disable_superfish() {
	wp_deregister_script( 'superfish' );
	wp_deregister_script( 'superfish-args' );
}

Search Form

Customize the Search Form Input Button (functions.php)

//* Customize search form input button text
add_filter( 'genesis_search_button_text', 'sp_search_button_text' );
function sp_search_button_text( $text ) {
	return esc_attr( 'Go' );
}

Customize the Search Form Label (functions.php)

//* Customize search form label
add_filter( 'genesis_search_form_label', 'sp_search_form_label' );
function sp_search_form_label ( $text ) {
	return esc_attr( 'Custom Label' );
}

Customize the Search Form Input Box (functions.php)

//* Customize search form input box text
add_filter( 'genesis_search_text', 'sp_search_text' );
function sp_search_text( $text ) {
	return esc_attr( 'Search my blog...' );
}

Sidebars

Unregister Primary Sidebar (functions.php)

//* Unregister primary sidebar
unregister_sidebar( 'sidebar' );

Unregister Secondary Sidebar (functions.php)

//* Unregister secondary sidebar
unregister_sidebar( 'sidebar-alt' );

Structural Wraps

Add Structural Wraps (functions.php)

//* Add support for structural wraps
add_theme_support( 'genesis-structural-wraps', array(
    'header',
    'menu-primary',
    'menu-secondary',
    'site-inner',
    'footer-widgets',
    'footer'
) );

Remove Structural Wraps (functions.php)

//* Remove support for structural wraps
remove_theme_support( 'genesis-structural-wraps' );

Shortcodes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment