Skip to content

Commit

Permalink
Issue 559 (#567)
Browse files Browse the repository at this point in the history
* change color classes for header & footer templates

* fix 'in_array'

* add correct color classes to sticky templates

* add template-footer a to link selectors
  • Loading branch information
jamesros161 authored Dec 16, 2021
1 parent 300d2ad commit 92d0082
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/assets/js/customizer/color/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Preview {
this.classControls = [
{
name: 'bgtfw_footer_color',
selector: '#colophon, .footer-content',
selector: '#colophon:not(.template-footer), .footer-content:not(.template-footer)',
properties: [ 'background-color', 'text-default' ]
},
{
Expand Down Expand Up @@ -50,7 +50,7 @@ export class Preview {
},
{
name: 'bgtfw_footer_links',
selector: '.footer-content',
selector: '.footer-content:not(.template-footer)',
properties: [ 'link-color' ]
}
];
Expand Down
3 changes: 3 additions & 0 deletions src/assets/scss/boldgrid/_header.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@import "header/slide-in";

#masthead, #masthead-sticky, #colophon {
&[class^=sticky-template-] {
background-color:none;
}
aside.sidebar {
margin-left: -15px;
margin-right: -15px;
Expand Down
27 changes: 20 additions & 7 deletions src/includes/class-boldgrid-framework-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ public function title_content_container( $classes ) {
* @return array $classes array of classes to be applied to the #masthead element.
*/
public function header_classes( $classes ) {
$classes = array_merge( $classes, $this->get_background_color( 'bgtfw_header_color' ) );
if ( ! in_array( 'template-sticky-header', $classes, true ) ) {
$classes = array_merge( $classes, $this->get_background_color( 'bgtfw_header_color' ) );
}
return $classes;
}

Expand All @@ -348,7 +350,13 @@ public function navi_classes( $classes ) {
*/
public function footer_classes( $classes ) {
$classes[] = get_theme_mod( 'bgtfw_footer_layouts' );
$classes = array_merge( $classes, $this->get_background_color( 'bgtfw_footer_color' ) );
if ( ! in_array( 'template-footer', $classes, true ) ) {
$classes = array_merge( $classes, $this->get_background_color( 'bgtfw_footer_color' ) );
} else {
$classes[] = 'color-neutral-background-color';
$classes[] = 'color-neutral-text-color';
}

return $classes;
}

Expand All @@ -360,11 +368,13 @@ public function footer_classes( $classes ) {
* @return array $classes array of classes to be applied to the #masthead element.
*/
public function inner_footer_classes( $classes ) {
$classes = array_merge(
$classes,
$this->get_background_color( 'bgtfw_footer_color' ),
$this->get_link_color( 'bgtfw_footer_links' )
);
if ( ! in_array( 'template-footer', $classes, true ) ) {
$classes = array_merge(
$classes,
$this->get_background_color( 'bgtfw_footer_color' ),
$this->get_link_color( 'bgtfw_footer_links' )
);
}

return $classes;
}
Expand Down Expand Up @@ -1380,6 +1390,9 @@ public static function dynamic_sticky_header( $preset = null ) {

if ( ! empty( $sticky_template_class ) ) {
$header_classes[] = $sticky_template_class;
$header_classes[] = 'template-sticky-header';
$header_classes[] = 'color-neutral-background-color';
$header_classes[] = 'color-neutral-text-contrast';
}

$markup = '';
Expand Down
5 changes: 0 additions & 5 deletions src/includes/class-boldgrid-framework-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,6 @@ public function tinymce_body_class( $mce ) {
}

$api = new BoldGrid( $this->configs );
$mce['body_class'] .= ' ' . implode( ' ', $api->get_background_color( 'boldgrid_background_color' ) );

if ( 'pattern' === get_theme_mod( 'boldgrid_background_type' ) && ! empty( $pattern ) ) {
$mce['body_class'] .= ' custom-background';
}

// Get the current post, check if it's a page and add our body classes.
if ( $post = get_post() ) {
Expand Down
2 changes: 2 additions & 0 deletions src/includes/class-boldgrid-framework-links.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public function __construct( $configs ) {
'.page-header-wrapper a',
'.mce-content-body a',
'.template-header a',
'.template-footer a',
'.template-sticky-header a',
];

/**
Expand Down

0 comments on commit 92d0082

Please sign in to comment.