Created
February 10, 2021 11:27
-
-
Save LGitHub-sprout/7d571035fd32fe75f6a0bee9a13392f3 to your computer and use it in GitHub Desktop.
Replicating GeneratePress generate_header_classes( ) function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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