Skip to content

Instantly share code, notes, and snippets.

@nielslange
Last active April 15, 2024 18:25

Revisions

  1. nielslange revised this gist Feb 19, 2017. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,6 @@

    **Enable Accessibility Features**

    * functions.php: https://gist.github.com/nielslange/07b4a92f9d147350091690aeab87a790

    * _functions.php_:
    ```php
    //* Enable Genesis Accessibility Components
  2. nielslange revised this gist Feb 19, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@

    **Enable Accessibility Features**

    * Enable Genesis Accessibility Components: https://gist.github.com/nielslange/07b4a92f9d147350091690aeab87a790
    * functions.php: https://gist.github.com/nielslange/07b4a92f9d147350091690aeab87a790

    * _functions.php_:
    ```php
  3. nielslange revised this gist Feb 19, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,8 @@

    **Enable Accessibility Features**

    * Enable Genesis Accessibility Components: https://gist.github.com/nielslange/07b4a92f9d147350091690aeab87a790

    * _functions.php_:
    ```php
    //* Enable Genesis Accessibility Components
  4. nielslange revised this gist Feb 19, 2017. 1 changed file with 301 additions and 7 deletions.
    308 changes: 301 additions & 7 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -357,36 +357,57 @@ function sp_remove_comment_form_allowed_tags( $defaults ) {

    **Remove Entry Content** (_functions.php_)
    ```php
    //* Remove the post content (requires HTML5 theme support)
    remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
    ```

    **Remove Post Image** (_functions.php_)
    ```php
    //* Remove the post image (requires HTML5 theme support)
    remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
    ```

    **Remove Post Navigation** (_functions.php_)
    ```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_)
    ```php
    //* Remove the post permalink (requires HTML5 theme support)
    remove_action( 'genesis_entry_content', 'genesis_do_post_permalink', 14 );
    ```

    **Add Post Navigation** (_functions.php_)
    ```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_)
    ```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_)
    ```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_)
    ```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)
    @@ -400,18 +421,30 @@ remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 )

    **Remove Entry Meta** (_functions.php_)
    ```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_)
    ```php
    //* Remove the entry title (requires HTML5 theme support)
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    ```

    **Remove Post Format Image** (_functions.php_)
    ```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_)
    ```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_)
    @@ -427,196 +460,452 @@ function nl_genesis_featured_post_title_length( $title ) {

    **Customize the Credits Text** (_functions.php_)
    ```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_)
    ```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_)
    ```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_)
    ```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

    ```php
    ```

    **Add Viewport Meta Tag** (_functions.php_)
    ```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_)
    ```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

    ```php
    ```

    **Remove the Site Title** (_functions.php_)
    ```php
    //* Remove the site title
    remove_action( 'genesis_site_title', 'genesis_seo_site_title' );
    ```

    **Remove the Site Description** (_functions.php_)
    ```php
    //* Remove the site description
    remove_action( 'genesis_site_description', 'genesis_seo_site_description' );
    ```

    **Remove the Header Widget Area** (_functions.php_)
    ```php
    //* Remove the header right widget area
    unregister_sidebar( 'header-right' );
    ```

    **Modify the Header URL** (_functions.php_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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:
    ```php
    //* 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’:
    ```php
    //* 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:
    ```php
    //* 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’:
    ```php
    //* 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:
    ```php
    //* 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’:
    ```php
    //* 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:
    ```php
    //* 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_)
    ```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_)
    ```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_)
    ```php
    //* Unregister primary/secondary navigation menus
    remove_theme_support( 'genesis-menus' );
    ```

    **Unregister the Primary Navigation Menu** (_functions.php_)
    ```php
    //* Unregister primary navigation menu
    add_theme_support( 'genesis-menus', array( 'secondary' => __( 'Secondary Navigation Menu', 'genesis' ) ) );
    ```

    **Unregister the Secondary Navigation Menu** (_functions.php_)
    ```php
    //* Unregister secondary navigation menu
    add_theme_support( 'genesis-menus', array( 'primary' => __( 'Primary Navigation Menu', 'genesis' ) ) );
    ```

    **Add Navigation Extras** (_functions.php_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```php
    //* Add support for post format images
    add_theme_support( 'genesis-post-format-images' );
    ```

    **Add Post Formats** (_functions.php_)
    ```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_)
    ```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_)
    ```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_)
    ```php
    //* Remove the post meta function
    remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
    ```

    **Customize the Post Meta Function** (_functions.php_)
    ```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_)
    ```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_)
    ```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_)
    ```php
    //* Enable the superfish script
    add_filter( 'genesis_superfish_enabled', '__return_true' );
    ```

    **Disable Superfish Script** (_functions.php_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```php
    //* Unregister primary sidebar
    unregister_sidebar( 'sidebar' );
    ```

    **Unregister Secondary Sidebar** (_functions.php_)
    ```php
    //* Unregister secondary sidebar
    unregister_sidebar( 'sidebar-alt' );
    ```

    ## Structural Wraps
    @@ -638,4 +927,9 @@ add_theme_support( 'genesis-structural-wraps', array(
    ```php
    //* Remove support for structural wraps
    remove_theme_support( 'genesis-structural-wraps' );
    ```
    ```

    ## Shortcodes

    * Post Shortcodes: http://my.studiopress.com/documentation/customization/shortcodes-reference/post-shortcode-reference/
    * Footer Shortcodes: http://my.studiopress.com/documentation/customization/shortcodes-reference/footer-shortcode-reference/
  5. nielslange revised this gist Feb 18, 2017. 1 changed file with 103 additions and 0 deletions.
    103 changes: 103 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -181,74 +181,176 @@ function unregister_genesis_widgets() {

    **Enable the Author Box on Single Posts** (_functions.php_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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_)
    ```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)
    @@ -532,6 +634,7 @@ add_theme_support( 'genesis-structural-wraps', array(
    ) );
    ```

    **Remove Structural Wraps** (_functions.php_)
    ```php
    //* Remove support for structural wraps
    remove_theme_support( 'genesis-structural-wraps' );
  6. nielslange revised this gist Feb 18, 2017. 1 changed file with 301 additions and 3 deletions.
    304 changes: 301 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -94,6 +94,8 @@ function child_dequeue_skip_links() {
    }
    ```

    ## Admin Management

    **Force the Genesis Layout Settings** (_functions.php_)
    ```php
    //* Force content-sidebar layout setting
    @@ -175,29 +177,141 @@ function unregister_genesis_widgets() {
    }
    ```

    ## Author Box

    ## Admin Management
    **Enable the Author Box on Single Posts** (_functions.php_)
    ```php
    ```

    ## Author Box
    **Enable the Author Box on Archive Pages** (_functions.php_)
    ```php
    ```

    **Remove the Author Box on Single Posts** (_functions.php_)
    ```php
    ```

    **Modify the Author Box Title** (_functions.php_)
    ```php
    ```

    **Modify the Gravatar Size** (_functions.php_)
    ```php
    ```

    ## Breadcrumbs

    **Modify the Breadcrumbs Home Link** (_functions.php_)
    ```php
    ```

    **Reposition the Breadcrumbs** (_functions.php_)
    ```php
    ```

    **Modify the Breadcrumbs Display** (_functions.php_)
    ```php
    ```

    ## Comments

    **Modify the Author Says Text** (_functions.php_)
    ```php
    ```

    **Modify the Comments Link Text** (_functions.php_)
    ```php
    ```

    **Modify the Comments Headline Text** (_functions.php_)
    ```php
    ```

    **Modify the Gravatar Size** (_functions.php_)
    ```php
    ```

    **Modify the Speak Your Mind Text** (_functions.php_)
    ```php
    ```

    **Modify the Trackbacks Headline Text** (_functions.php_)
    ```php
    ```

    **Modify the Submit Button Text** (_functions.php_)
    ```php
    ```

    **Add A Comment Policy Box** (_functions.php_)
    ```php
    ```

    **Remove the Allowed Tags Text** (_functions.php_)
    ```php
    ```

    ## Entry Content (HTML5)

    **Remove Entry Content** (_functions.php_)
    ```php
    ```

    **Remove Post Image** (_functions.php_)
    ```php
    ```

    **Remove Post Navigation** (_functions.php_)
    ```php
    ```

    **Remove Post Permalink** (_functions.php_)
    ```php
    ```

    **Add Post Navigation** (_functions.php_)
    ```php
    ```

    ## Entry Footer (HTML5)

    **Remove Entry Footer Markup** (_functions.php_)
    ```php
    ```

    **Remove Entry Meta** (_functions.php_)
    ```php
    ```

    **Customize the Entry Footer** (_functions.php_)
    ```php
    ```

    ## Entry Header (HTML5)

    **Remove Entry Header Markup** (_functions.php_)

    ```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_)
    ```php
    ```

    **Remove Entry Title** (_functions.php_)
    ```php
    ```

    **Remove Post Format Image** (_functions.php_)
    ```php
    ```

    **Customize the Entry Header** (_functions.php_)
    ```php
    ```

    **Trim length of featured post title** (_functions.php_)
    ```php
    //* Trim length of featured post title
    @@ -209,32 +323,216 @@ function nl_genesis_featured_post_title_length( $title ) {

    ## Footer

    **Customize the Credits Text** (_functions.php_)
    ```php
    ```

    **Customize the Site Footer** (_functions.php_)
    ```php
    ```

    **Reposition the Site Footer** (_functions.php_)
    ```php
    ```

    **Customize the Return to Top of Page Text** (_functions.php_)
    ```php
    ```

    ## Head Section

    ```php
    ```

    **Add Viewport Meta Tag** (_functions.php_)
    ```php
    ```

    **Add Custom Viewport Meta Tag** (_functions.php_)
    ```php
    ```

    ## Header

    ```php
    ```

    **Remove the Site Title** (_functions.php_)
    ```php
    ```

    **Remove the Site Description** (_functions.php_)
    ```php
    ```

    **Remove the Header Widget Area** (_functions.php_)
    ```php
    ```

    **Modify the Header URL** (_functions.php_)
    ```php
    ```

    ## HTML5

    **Enable HTML5 Markup** (_functions.php_)
    ```php
    ```

    ## Images

    **Display a Custom Gravatar** (_functions.php_)
    ```php
    ```

    **Add Featured Images** (_functions.php_)
    ```php
    ```

    ## Miscellaneous

    **Show Content Above Posts on Blog Page** (_functions.php_)
    ```php
    ```

    **Add an After Entry Widget Area** (_functions.php_)
    ```php
    ```

    **Add Custom Body Class** (_functions.php_)
    ```php
    ```

    ## Navigation Menus

    **Reposition the Primary Navigation Menu** (_functions.php_)
    ```php
    ```

    **Reposition the Secondary Navigation Menu** (_functions.php_)
    ```php
    ```

    **Unregister the Primary/Secondary Navigation Menus** (_functions.php_)
    ```php
    ```

    **Unregister the Primary Navigation Menu** (_functions.php_)
    ```php
    ```

    **Unregister the Secondary Navigation Menu** (_functions.php_)
    ```php
    ```

    **Add Navigation Extras** (_functions.php_)
    ```php
    ```

    ## Post Excerpts

    **Modify the Content Limit Read More Link** (_functions.php_)
    ```php
    ```

    **Modify the Length of Post Excerpts** (_functions.php_)
    ```php
    ```

    **Modify the Content Read More Link** (_functions.php_)
    ```php
    ```

    ## Post Formats

    **Add Post Format Images** (_functions.php_)
    ```php
    ```

    **Add Post Formats** (_functions.php_)
    ```php
    ```

    ## Post Info (XHTML)

    **Customize the Post Info Function** (_functions.php_)
    ```php
    ```

    **Remove the Post Info Function** (_functions.php_)
    ```php
    ```

    ## Post Meta (XHTML)

    **Remove the Post Meta Function** (_functions.php_)
    ```php
    ```

    **Customize the Post Meta Function** (_functions.php_)
    ```php
    ```

    ## Post Navigation

    **Customize the Next/Newer Page Link** (_functions.php_)
    ```php
    ```

    **Customize the Previous/Older Page Link** (_functions.php_)
    ```php
    ```

    ## Scripts

    **Enable Superfish Script** (_functions.php_)
    ```php
    ```

    **Disable Superfish Script** (_functions.php_)
    ```php
    ```

    ## Search Form

    **Customize the Search Form Input Button** (_functions.php_)
    ```php
    ```

    **Customize the Search Form Label** (_functions.php_)
    ```php
    ```

    **Customize the Search Form Input Box** (_functions.php_)
    ```php
    ```

    ## Sidebars

    **Unregister Primary Sidebar** (_functions.php_)
    ```php
    ```

    **Unregister Secondary Sidebar** (_functions.php_)
    ```php
    ```

    ## Structural Wraps

    **Add Structural Wraps** (_functions.php_)
    ```php
    //* Add support for structural wraps
    add_theme_support( 'genesis-structural-wraps', array(
    'header',
    'menu-primary',
    'menu-secondary',
    'site-inner',
    'footer-widgets',
    'footer'
    ) );
    ```

    ```php
    //* Remove support for structural wraps
    remove_theme_support( 'genesis-structural-wraps' );
    ```
  7. nielslange revised this gist Feb 18, 2017. 1 changed file with 81 additions and 0 deletions.
    81 changes: 81 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -94,6 +94,87 @@ function child_dequeue_skip_links() {
    }
    ```

    **Force the Genesis Layout Settings** (_functions.php_)
    ```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_)
    ```php
    //* Remove Genesis in-post SEO Settings
    remove_action( 'admin_menu', 'genesis_add_inpost_seo_box' );
    ```

    **Remove the Genesis Layout Settings** (_functions.php_)
    ```php
    //* Remove Genesis Layout Settings
    remove_theme_support( 'genesis-inpost-layouts' );
    ```

    **Remove the Genesis Menu Link** (_functions.php_)
    ```php
    //* Remove Genesis menu link
    remove_theme_support( 'genesis-admin-menu' );
    ```

    **Remove the Genesis SEO Settings Menu Link** (_functions.php_)
    ```php
    //* Remove Genesis SEO Settings menu link
    remove_theme_support( 'genesis-seo-settings-menu' );
    ```

    **Unregister the Genesis Layout Settings** (_functions.php_)
    ```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_)
    ```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' );
    }
    ```


    ## Admin Management

  8. nielslange revised this gist Feb 18, 2017. 1 changed file with 12 additions and 12 deletions.
    24 changes: 12 additions & 12 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -4,13 +4,23 @@

    **Enable Accessibility Features**

    * (_functions.php_)
    * _functions.php_:
    ```php
    //* Enable Genesis Accessibility Components
    add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) );
    ```

    * (_style.css_)
    ```php
    //* 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_:
    ```css
    /* ## Accessible Menu
    --------------------------------------------- */
    @@ -84,16 +94,6 @@ add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu',
    }
    ```

    * (_functions.php_)
    ```php
    //* Remove Skip Links from a template
    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' );
    }
    ```

    ## Admin Management

  9. nielslange revised this gist Feb 18, 2017. 1 changed file with 95 additions and 0 deletions.
    95 changes: 95 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,100 @@
    # Genesis Framework snippets

    ## Accessibility

    **Enable Accessibility Features**

    * (_functions.php_)
    ```php
    //* Enable Genesis Accessibility Components
    add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) );
    ```

    * (_style.css_)
    ```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;
    }
    ```

    ```css
    /* ## 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;
    }
    ```

    ```css
    /* 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;
    }
    ```

    * (_functions.php_)
    ```php
    //* Remove Skip Links from a template
    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' );
    }
    ```

    ## Admin Management

    ## Author Box
  10. nielslange revised this gist Feb 18, 2017. 1 changed file with 45 additions and 1 deletion.
    46 changes: 45 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,17 @@
    # Genesis Framework snippets

    ## Admin Management

    ## Author Box

    ## Breadcrumbs

    ## Comments

    ## Entry Content (HTML5)

    ## Entry Footer (HTML5)

    ## Entry Header (HTML5)

    **Remove Entry Header Markup** (_functions.php_)
    @@ -17,4 +29,36 @@ add_filter( 'genesis_featured_post_title', 'nl_genesis_featured_post_title_lengt
    function nl_genesis_featured_post_title_length( $title ) {
    return mb_strimwidth($title, 0, 65, '...');
    }
    ```
    ```

    ## Footer

    ## Head Section

    ## Header

    ## HTML5

    ## Images

    ## Miscellaneous

    ## Navigation Menus

    ## Post Excerpts

    ## Post Formats

    ## Post Info (XHTML)

    ## Post Meta (XHTML)

    ## Post Navigation

    ## Scripts

    ## Search Form

    ## Sidebars

    ## Structural Wraps
  11. nielslange revised this gist Feb 18, 2017. 1 changed file with 0 additions and 31 deletions.
    31 changes: 0 additions & 31 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -17,35 +17,4 @@ add_filter( 'genesis_featured_post_title', 'nl_genesis_featured_post_title_lengt
    function nl_genesis_featured_post_title_length( $title ) {
    return mb_strimwidth($title, 0, 65, '...');
    }
    ```

    # WooCommerce snippets

    **Access WC variables** (_functions.php_)
    ```php
    //* Get global WC object
    global $woocommerce;

    //* Access various WooCommerce cart variables, see also https://docs.woothemes.com/wc-apidocs/class-WC_Cart.html
    $woocommerce->cart->get_cart_subtotal();
    $woocommerce->cart->get_cart_tax();
    $woocommerce->cart->get_cart_total();

    //* Access various WooCommerce customer variables, see also @see https://docs.woothemes.com/wc-apidocs/class-WC_Customer.html
    $woocommerce->customer->get_country();
    $woocommerce->customer->get_default_country();
    $woocommerce->customer->get_shipping_country();
    ```

    **Forward all WC email notifications** (_functions.php_)
    ```php
    //* Forward all WC email notifications
    add_filter( 'woocommerce_email_headers', 'nl_forward_wc_email_notifocations', 10, 2);
    function nl_forward_wc_email_notifocations($headers, $object) {
    $headers = array();
    $headers[] = 'Bcc: Niels Lange <info@nielslange.com>';
    $headers[] = 'Content-Type: text/html';

    return $headers;
    }
    ```
  12. nielslange created this gist Feb 18, 2017.
    51 changes: 51 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    # Genesis Framework snippets

    ## Entry Header (HTML5)

    **Remove Entry Header Markup** (_functions.php_)

    ```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 );
    ```

    **Trim length of featured post title** (_functions.php_)
    ```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, '...');
    }
    ```

    # WooCommerce snippets

    **Access WC variables** (_functions.php_)
    ```php
    //* Get global WC object
    global $woocommerce;

    //* Access various WooCommerce cart variables, see also https://docs.woothemes.com/wc-apidocs/class-WC_Cart.html
    $woocommerce->cart->get_cart_subtotal();
    $woocommerce->cart->get_cart_tax();
    $woocommerce->cart->get_cart_total();

    //* Access various WooCommerce customer variables, see also @see https://docs.woothemes.com/wc-apidocs/class-WC_Customer.html
    $woocommerce->customer->get_country();
    $woocommerce->customer->get_default_country();
    $woocommerce->customer->get_shipping_country();
    ```

    **Forward all WC email notifications** (_functions.php_)
    ```php
    //* Forward all WC email notifications
    add_filter( 'woocommerce_email_headers', 'nl_forward_wc_email_notifocations', 10, 2);
    function nl_forward_wc_email_notifocations($headers, $object) {
    $headers = array();
    $headers[] = 'Bcc: Niels Lange <info@nielslange.com>';
    $headers[] = 'Content-Type: text/html';

    return $headers;
    }
    ```