Browse Source

Updates to take into accout the theme switch.

Enej Bajgoric 4 years ago
parent
commit
626ba8c1b6
7 changed files with 75 additions and 7 deletions
  1. 11 1
      alves/functions.php
  2. 10 1
      barnsbury/functions.php
  3. 11 1
      dalston/functions.php
  4. 11 1
      hever/functions.php
  5. 11 1
      mayland/functions.php
  6. 11 1
      morden/functions.php
  7. 10 1
      rivington/functions.php

+ 11 - 1
alves/functions.php

@@ -237,6 +237,16 @@ add_action( 'enqueue_block_editor_assets', 'alves_editor_styles' );
 // This makes it possible to define the function in earlier to alter if the class should be applied or not.
 if ( ! function_exists( 'varia_mobile_nav_on_side' ) ) {
 	function varia_mobile_nav_on_side( $classes ) {
-		return array_merge( $classes, array( 'mobile-nav-side' ) );
+		if ( get_theme_mod( 'enable_side_menu' ) === 1 || ( isset( $_GET['customize_theme'] ) && get_stylesheet() === $_GET['customize_theme'] ) ) {
+			return array_merge( $classes, array( 'mobile-nav-side' ) );
+		}
+		return $classes;
+	}
+}
+
+add_action( 'after_switch_theme', 'varia_enable_side_menu_on_mobile' );
+if ( ! function_exists( 'varia_enable_side_menu_on_mobile' ) ) {
+	function varia_enable_side_menu_on_mobile() {
+		set_theme_mod( 'enable_side_menu', 1 );
 	}
 }

+ 10 - 1
barnsbury/functions.php

@@ -193,7 +193,16 @@ add_action( 'enqueue_block_editor_assets', 'barnsbury_editor_styles' );
 // This makes it possible to define the function in earlier to alter if the class should be applied or not.
 if ( ! function_exists( 'varia_mobile_nav_on_side' ) ) {
 	function varia_mobile_nav_on_side( $classes ) {
-		return array_merge( $classes, array( 'mobile-nav-side' ) );
+		if ( get_theme_mod( 'enable_side_menu' ) === 1 || ( isset( $_GET['customize_theme'] ) && get_stylesheet() === $_GET['customize_theme'] ) ) {
+			return array_merge( $classes, array( 'mobile-nav-side' ) );
+		}
+		return $classes;
 	}
 }
 
+add_action( 'after_switch_theme', 'varia_enable_side_menu_on_mobile' );
+if ( ! function_exists( 'varia_enable_side_menu_on_mobile' ) ) {
+	function varia_enable_side_menu_on_mobile() {
+		set_theme_mod( 'enable_side_menu', 1 );
+	}
+}

+ 11 - 1
dalston/functions.php

@@ -263,6 +263,16 @@ function dalston_is_amp() {
 // This makes it possible to define the function in earlier to alter if the class should be applied or not.
 if ( ! function_exists( 'varia_mobile_nav_on_side' ) ) {
 	function varia_mobile_nav_on_side( $classes ) {
-		return array_merge( $classes, array( 'mobile-nav-side' ) );
+		if ( get_theme_mod( 'enable_side_menu' ) === 1 || ( isset( $_GET['customize_theme'] ) && get_stylesheet() === $_GET['customize_theme'] ) ) {
+			return array_merge( $classes, array( 'mobile-nav-side' ) );
+		}
+		return $classes;
+	}
+}
+
+add_action( 'after_switch_theme', 'varia_enable_side_menu_on_mobile' );
+if ( ! function_exists( 'varia_enable_side_menu_on_mobile' ) ) {
+	function varia_enable_side_menu_on_mobile() {
+		set_theme_mod( 'enable_side_menu', 1 );
 	}
 }

+ 11 - 1
hever/functions.php

@@ -186,6 +186,16 @@ add_action( 'enqueue_block_editor_assets', 'hever_editor_styles' );
 // This makes it possible to define the function in earlier to alter if the class should be applied or not.
 if ( ! function_exists( 'varia_mobile_nav_on_side' ) ) {
 	function varia_mobile_nav_on_side( $classes ) {
-		return array_merge( $classes, array( 'mobile-nav-side' ) );
+		if ( get_theme_mod( 'enable_side_menu' ) === 1 || ( isset( $_GET['customize_theme'] ) && get_stylesheet() === $_GET['customize_theme'] ) ) {
+			return array_merge( $classes, array( 'mobile-nav-side' ) );
+		}
+		return $classes;
+	}
+}
+
+add_action( 'after_switch_theme', 'varia_enable_side_menu_on_mobile' );
+if ( ! function_exists( 'varia_enable_side_menu_on_mobile' ) ) {
+	function varia_enable_side_menu_on_mobile() {
+		set_theme_mod( 'enable_side_menu', 1 );
 	}
 }

+ 11 - 1
mayland/functions.php

@@ -191,6 +191,16 @@ add_action( 'enqueue_block_editor_assets', 'mayland_editor_styles' );
 // This makes it possible to define the function in earlier to alter if the class should be applied or not.
 if ( ! function_exists( 'varia_mobile_nav_on_side' ) ) {
 	function varia_mobile_nav_on_side( $classes ) {
-		return array_merge( $classes, array( 'mobile-nav-side' ) );
+		if ( get_theme_mod( 'enable_side_menu' ) === 1 || ( isset( $_GET['customize_theme'] ) && get_stylesheet() === $_GET['customize_theme'] ) ) {
+			return array_merge( $classes, array( 'mobile-nav-side' ) );
+		}
+		return $classes;
+	}
+}
+
+add_action( 'after_switch_theme', 'varia_enable_side_menu_on_mobile' );
+if ( ! function_exists( 'varia_enable_side_menu_on_mobile' ) ) {
+	function varia_enable_side_menu_on_mobile() {
+		set_theme_mod( 'enable_side_menu', 1 );
 	}
 }

+ 11 - 1
morden/functions.php

@@ -185,6 +185,16 @@ add_action( 'enqueue_block_editor_assets', 'morden_editor_styles' );
 // This makes it possible to define the function in earlier to alter if the class should be applied or not.
 if ( ! function_exists( 'varia_mobile_nav_on_side' ) ) {
 	function varia_mobile_nav_on_side( $classes ) {
-		return array_merge( $classes, array( 'mobile-nav-side' ) );
+		if ( get_theme_mod( 'enable_side_menu' ) === 1 || ( isset( $_GET['customize_theme'] ) && get_stylesheet() === $_GET['customize_theme'] ) ) {
+			return array_merge( $classes, array( 'mobile-nav-side' ) );
+		}
+		return $classes;
+	}
+}
+
+add_action( 'after_switch_theme', 'varia_enable_side_menu_on_mobile' );
+if ( ! function_exists( 'varia_enable_side_menu_on_mobile' ) ) {
+	function varia_enable_side_menu_on_mobile() {
+		set_theme_mod( 'enable_side_menu', 1 );
 	}
 }

+ 10 - 1
rivington/functions.php

@@ -200,7 +200,16 @@ add_action( 'enqueue_block_editor_assets', 'rivington_editor_styles' );
 // This makes it possible to define the function in earlier to alter if the class should be applied or not.
 if ( ! function_exists( 'varia_mobile_nav_on_side' ) ) {
 	function varia_mobile_nav_on_side( $classes ) {
-		return array_merge( $classes, array( 'mobile-nav-side' ) );
+		if ( get_theme_mod( 'enable_side_menu' ) === 1 || ( isset( $_GET['customize_theme'] ) && get_stylesheet() === $_GET['customize_theme'] ) ) {
+			return array_merge( $classes, array( 'mobile-nav-side' ) );
+		}
+		return $classes;
 	}
 }
 
+add_action( 'after_switch_theme', 'varia_enable_side_menu_on_mobile' );
+if ( ! function_exists( 'varia_enable_side_menu_on_mobile' ) ) {
+	function varia_enable_side_menu_on_mobile() {
+		set_theme_mod( 'enable_side_menu', 1 );
+	}
+}