ThemeAwesome / WP-Forge

WP-Forge - A Foundation for Sites WordPress Theme
https://themeawesome.com/wp-forge-wordpress-foundation-for-sites-theme/
85 stars 28 forks source link

Customizer for .contain-to-grid background-color #36

Closed badcat closed 9 years ago

badcat commented 9 years ago

Wish there was a way in the WP Customizer to alter the background color on ".contain-to-grid" so the menu background is in better keeping with the color work done on the menu items. Note the defaults of the #333333 grey/black containtogrid

badcat commented 9 years ago

Well - not sure if this passes the muster, but I added this to customizer.php ;

    // Nav Stickygrid Background Color   @ line 135
  $wp_customize->add_setting('contain_to_grid_color', array(
    'default' => '#333333',
    'type' => 'theme_mod',
    'capability' => 'manage_options',
    'sanitize_callback' => 'sanitize_hex_color',
    'priority' => 5,    
  ));
  $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'contain_to_grid_color',array(
    'label' => __('Select Container Background Color', 'wpforge'),
    'section' => 'nav_content',
    'settings' => 'contain_to_grid_color',
  )));

  //  @line 1173
.contain-to-grid{background:<?php echo get_theme_mod('contain_to_grid_color','#333333'); ?>;}

Seems to work even with Child Themes.

tsquez commented 9 years ago

@badcat thanks for bringing this to my attention.

Good work on the customizer code as well, works as it should. However you do not need to add all of that code to make the .contain-to-grid element follow the same color you set for the top-bar.

All you have to do is open up customizer.php, scroll all the way down to the following function function wpforge_customize_css() and look for the following declaration (should come right after nav_wrap):

.top-bar,.top-bar-section ul li,.top-bar-section li:not(.has-form) a:not(.button),.top-bar-section ul li:hover:not(.has-form) > a,.top-bar-section .dropdown li:not(.has-form):not(.active) > a:not(.button)

and add contain-to-grid at the very end, like this:

.top-bar,.top-bar-section ul li,.top-bar-section li:not(.has-form) a:not(.button),.top-bar-section ul li:hover:not(.has-form) > a,.top-bar-section .dropdown li:not(.has-form):not(.active) > a:not(.button),.containt-to-grid

You will notice that the .contain-to-grid element will now take on the same color as the top-bar.

Now if you want the .contain-to-grid element to have a different color then yes you would use the code you created above. Hope this helps and again thank you for bringing this to my attention. I will make sure it makes it into the next version of WP-Forge.

badcat commented 9 years ago

Hah! Yep that's certainly more elegant. Thanks. Will update mine in the meanwhile.

tsquez commented 9 years ago

Just wanted you to know that I did add it to the next version of WP-Forge which is 5.5.1.8 - the latest version waiting for final admin approval is 5.5.1.7 (https://themes.trac.wordpress.org/query?status=approved&group=priority&col=id&col=summary&col=reporter&col=owner&col=priority&col=changetime&col=keywords&report=24&order=changetime)