Created
January 30, 2023 13:00
-
-
Save diggeddy/3ed2334b55f67f64f7d2274744f1deac to your computer and use it in GitHub Desktop.
Add GeneratePress Element Class to body tag
This file contains hidden or 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 | |
add_filter( 'body_class', function( $classes ) { | |
global $generate_elements; | |
foreach ( $generate_elements as $element => $data ) { | |
$element_title = 'gp-elem-' . strtolower(str_replace(' ', '-', get_the_title( $data['id'] ) )); | |
$classes[] = $element_title; | |
} | |
return $classes; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In GeneratePress premium, add a class to the
body
tag for each element on page.