• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Adding a class and id to site-container

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding a class and id to site-container

This topic is: resolved

Tagged: custom theme, template

  • This topic has 5 replies, 2 voices, and was last updated 11 years, 1 month ago by RitzyThemes.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • 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 #139708
    cultivardesigns
    Member
    genesis_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 #139710
    cultivardesigns
    Member
    genesis_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 #139737
    RitzyThemes
    Member

    hi cultivardesigns!

    you can't add class or replace id of <div class="site-container"> directly,

    take a look in the following file.
    genesis/header.php

    if 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 #139743
    cultivardesigns
    Member

    I 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 #139774
    RitzyThemes
    Member

    You 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

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble