Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding a class and id to site-container
Tagged: custom theme, template
- This topic has 5 replies, 2 voices, and was last updated 11 years, 1 month ago by
RitzyThemes.
-
AuthorPosts
-
February 4, 2015 at 12:40 pm #139675
cultivardesigns
Member$(".site-container").attr('id', 'site-container'); $(".site-container").addClass('intro-effect-push');How can I replace this jquery code with a proper template code?
Ask us about Custom Genesis WordPress Themes
February 4, 2015 at 3:42 pm #139708cultivardesigns
Membergenesis_markup( array( 'html5' => '<div id="site-container" %s>', 'xhtml' => '<div id="wrap">', 'context' => 'site-container', ) );I edited the markup to add the ID to the site-container, but I can't seem to figure out how to add the class.
Ask us about Custom Genesis WordPress Themes
February 4, 2015 at 3:48 pm #139710cultivardesigns
Membergenesis_markup( array( 'html5' => '<div id="site-container" class="site-container intro-effect-push">', 'xhtml' => '<div id="wrap">', ) );I think this works, although I'm not sure if I am doing this correctly. I get the right output now, but I am running this in my header.php, and I want to use this in my custom template. I wonder if I have to make a separate header, or if I can unload the markup and replace it on the custom template page itself.
Ask us about Custom Genesis WordPress Themes
February 4, 2015 at 5:46 pm #139737RitzyThemes
Memberhi cultivardesigns!
you can't add class or replace id of <div class="site-container"> directly,
take a look in the following file.
genesis/header.phpif you want to do that, but with the help of jQuery you can add after loading DOM.
(function($){ // adding #id $('.site-container').prop('id', 'new'); // adding .class $('.site-container').addClass('new2'); })(jQuery);🙂
Get free and premium Genesis Child Themes
February 4, 2015 at 6:45 pm #139743cultivardesigns
MemberI wasn't trying to remove the site-container class, I was just appending it with another and adding an id of site-container. Here is what the results are:
<div id="site-container" class="site-container intro-effect-fadeout">Here is what is on my template:
add_filter( 'genesis_attr_site-container', 'aie_attr_content' ); function aie_attr_content( $attr ) { $attr['class'] .= ' intro-effect-fadeout'; return $attr; } add_filter( 'body_class', 'sp_body_class' ); function sp_body_class( $classes ) { $classes[] = 'aie'; return $classes; }There you have it: how to add classes and ids to site-container
Ask us about Custom Genesis WordPress Themes
February 5, 2015 at 4:10 am #139774RitzyThemes
MemberYou can try this
add_filter( 'genesis_attr_site-container', 'aie_attr_content' ); function aie_attr_content( $attr ) { $attr['id'] .= 'site-container'; $attr['class'] .= ' intro-effect-fadeout'; return $attr; }
Get free and premium Genesis Child Themes
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.