Forked from JiveDig/genesis_attr_add_class.php
Last active
September 20, 2022 13:33
-
-
Save lmartins/916a0255b3d7e9ff1f9b to your computer and use it in GitHub Desktop.
Add classes and attributes to any element in Genesis
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 class to .site-container | |
add_filter('genesis_attr_site-container', 'jive_attributes_st_container'); | |
function jive_attributes_st_container($attributes) { | |
$attributes['class'] .= ' st-container'; | |
return $attributes; | |
} | |
//* Add class to .site-inner | |
add_filter('genesis_attr_site-inner', 'jive_attributes_st_inner'); | |
function jive_attributes_st_inner($attributes) { | |
$attributes['class'] .= ' st-pusher'; | |
return $attributes; | |
} | |
//* Add class to .sidebar-wrap | |
add_filter( 'genesis_attr_content-sidebar-wrap', 'jive_attributes_st_content' ); | |
function jive_attributes_st_content( $attributes ) { | |
$attributes['class'] = $attributes['class']. ' st-content'; | |
return $attributes; | |
} | |
//* Add class to .content | |
add_filter( 'genesis_attr_content', 'jive_attributes_st_content_inner' ); | |
function jive_attributes_st_content_inner( $attributes ) { | |
$attributes['class'] = $attributes['class']. ' st-content-inner'; | |
return $attributes; | |
} |
Adittional warning but validate front page :
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'jive_attributes_st_container' not found or invalid function name in /....../wp-includes/plugin.php on line 213
Code:
add_filter('genesis_attr_site-container', 'jive_attributes_st_container');
if ( is_front_page() ) {
function jive_attributes_st_container($attributes) {
$attributes['class'] .= ' st-container';
return $attributes;
}
}
Same issue as @truetesterphp. Is there a workaround/fix?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code add class but show warning in page.
Invalid argument supplied for foreach() in /home/............../wp-content/themes/genesis/lib/functions/markup.php on line 123