Skip to content

Instantly share code, notes, and snippets.

@LGitHub-sprout
Created February 10, 2021 11:27
Show Gist options
  • Save LGitHub-sprout/7d571035fd32fe75f6a0bee9a13392f3 to your computer and use it in GitHub Desktop.
Save LGitHub-sprout/7d571035fd32fe75f6a0bee9a13392f3 to your computer and use it in GitHub Desktop.
Replicating GeneratePress generate_header_classes( ) function
<?php
/**
* Adds HTML markup.
*
* @package wphierarchy
*
* @since 0.1
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Adds custom classes to the header.
*
* @param array $classes The existing classes.
* @since 0.1
*
* @package wphierarchy
*
* Inspired by (but not as good as) GeneratePress.
*/
if ( ! function_exists( 'wphierarchy_create_header_classes' ) ) {
add_filter( 'wphierarchy_create_header_class', 'wphierarchy_create_header_classes' );
/**
* Adds custom classes to the header.
*/
function wphierarchy_create_header_classes( $classes ) {
$classes[] = 'site-header';
}
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment