Simplify: Refactor functions to just include one function that adds the 3 required filters/actions
This commit is contained in:
parent
5fc14b6351
commit
ca1ba9919f
8 changed files with 32 additions and 91 deletions
|
@ -103,19 +103,9 @@ if ( ! function_exists( 'alves_setup' ) ) :
|
|||
)
|
||||
);
|
||||
|
||||
// Add .mobile-nav-side body class.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side' ) ) {
|
||||
add_filter( 'body_class', 'varia_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the mobile nav on side on theme switch.
|
||||
if ( function_exists( 'varia_enable_mobile_nav_on_side' ) ) {
|
||||
add_action( 'after_switch_theme', 'varia_enable_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the customizer control toggle for the mobile nav on the side.
|
||||
if ( function_exists( 'varia_register_mobile_nav_on_side_customizer_control' ) ) {
|
||||
add_action( 'customize_register' , 'varia_register_mobile_nav_on_side_customizer_control' );
|
||||
// Setup nav on side toggle support.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side_setup' ) ) {
|
||||
varia_mobile_nav_on_side_setup();
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
|
|
@ -103,19 +103,9 @@ if ( ! function_exists( 'barnsbury_setup' ) ) :
|
|||
)
|
||||
);
|
||||
|
||||
// Add .mobile-nav-side body class.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side' ) ) {
|
||||
add_filter( 'body_class', 'varia_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the mobile nav on side on theme switch.
|
||||
if ( function_exists( 'varia_enable_mobile_nav_on_side' ) ) {
|
||||
add_action( 'after_switch_theme', 'varia_enable_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the customizer control toggle for the mobile nav on the side.
|
||||
if ( function_exists( 'varia_register_mobile_nav_on_side_customizer_control' ) ) {
|
||||
add_action( 'customize_register' , 'varia_register_mobile_nav_on_side_customizer_control' );
|
||||
// Setup nav on side toggle support.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side_setup' ) ) {
|
||||
varia_mobile_nav_on_side_setup();
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
|
|
@ -120,19 +120,9 @@ if ( ! function_exists( 'dalston_setup' ) ) :
|
|||
)
|
||||
);
|
||||
|
||||
// Add .mobile-nav-side body class.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side' ) ) {
|
||||
add_filter( 'body_class', 'varia_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the mobile nav on side on theme switch.
|
||||
if ( function_exists( 'varia_enable_mobile_nav_on_side' ) ) {
|
||||
add_action( 'after_switch_theme', 'varia_enable_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the customizer control toggle for the mobile nav on the side.
|
||||
if ( function_exists( 'varia_register_mobile_nav_on_side_customizer_control' ) ) {
|
||||
add_action( 'customize_register' , 'varia_register_mobile_nav_on_side_customizer_control' );
|
||||
// Setup nav on side toggle support.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side_setup' ) ) {
|
||||
varia_mobile_nav_on_side_setup();
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
|
|
@ -100,19 +100,9 @@ if ( ! function_exists( 'hever_setup' ) ) :
|
|||
)
|
||||
);
|
||||
|
||||
// Add .mobile-nav-side body class.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side' ) ) {
|
||||
add_filter( 'body_class', 'varia_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the mobile nav on side on theme switch.
|
||||
if ( function_exists( 'varia_enable_mobile_nav_on_side' ) ) {
|
||||
add_action( 'after_switch_theme', 'varia_enable_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the customizer control toggle for the mobile nav on the side.
|
||||
if ( function_exists( 'varia_register_mobile_nav_on_side_customizer_control' ) ) {
|
||||
add_action( 'customize_register' , 'varia_register_mobile_nav_on_side_customizer_control' );
|
||||
// Setup nav on side toggle support.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side_setup' ) ) {
|
||||
varia_mobile_nav_on_side_setup();
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
|
|
@ -103,19 +103,9 @@ if ( ! function_exists( 'mayland_setup' ) ) :
|
|||
)
|
||||
);
|
||||
|
||||
// Add .mobile-nav-side body class.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side' ) ) {
|
||||
add_filter( 'body_class', 'varia_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the mobile nav on side on theme switch.
|
||||
if ( function_exists( 'varia_enable_mobile_nav_on_side' ) ) {
|
||||
add_action( 'after_switch_theme', 'varia_enable_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the customizer control toggle for the mobile nav on the side.
|
||||
if ( function_exists( 'varia_register_mobile_nav_on_side_customizer_control' ) ) {
|
||||
add_action( 'customize_register' , 'varia_register_mobile_nav_on_side_customizer_control' );
|
||||
// Setup nav on side toggle support.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side_setup' ) ) {
|
||||
varia_mobile_nav_on_side_setup();
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
|
|
@ -100,19 +100,9 @@ if ( ! function_exists( 'morden_setup' ) ) :
|
|||
)
|
||||
);
|
||||
|
||||
// Add .mobile-nav-side body class.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side' ) ) {
|
||||
add_filter( 'body_class', 'varia_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the mobile nav on side on theme switch.
|
||||
if ( function_exists( 'varia_enable_mobile_nav_on_side' ) ) {
|
||||
add_action( 'after_switch_theme', 'varia_enable_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the customizer control toggle for the mobile nav on the side.
|
||||
if ( function_exists( 'varia_register_mobile_nav_on_side_customizer_control' ) ) {
|
||||
add_action( 'customize_register' , 'varia_register_mobile_nav_on_side_customizer_control' );
|
||||
// Setup nav on side toggle support.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side_setup' ) ) {
|
||||
varia_mobile_nav_on_side_setup();
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
|
|
@ -112,19 +112,9 @@ if ( ! function_exists( 'rivington_setup' ) ) :
|
|||
// Remove footer menu
|
||||
unregister_nav_menu( 'menu-2' );
|
||||
|
||||
// Add .mobile-nav-side body class.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side' ) ) {
|
||||
add_filter( 'body_class', 'varia_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the mobile nav on side on theme switch.
|
||||
if ( function_exists( 'varia_enable_mobile_nav_on_side' ) ) {
|
||||
add_action( 'after_switch_theme', 'varia_enable_mobile_nav_on_side' );
|
||||
}
|
||||
|
||||
// Enable the customizer control toggle for the mobile nav on the side.
|
||||
if ( function_exists( 'varia_register_mobile_nav_on_side_customizer_control' ) ) {
|
||||
add_action( 'customize_register' , 'varia_register_mobile_nav_on_side_customizer_control' );
|
||||
// Setup nav on side toggle support.
|
||||
if ( function_exists( 'varia_mobile_nav_on_side_setup' ) ) {
|
||||
varia_mobile_nav_on_side_setup();
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
|
|
@ -336,6 +336,17 @@ if ( ! function_exists( 'varia_register_mobile_nav_on_side_customizer_control' )
|
|||
}
|
||||
}
|
||||
|
||||
function varia_mobile_nav_on_side_setup() {
|
||||
// Add .mobile-nav-side body class.
|
||||
add_filter( 'body_class', 'varia_mobile_nav_on_side' );
|
||||
|
||||
// Enable the mobile nav on side on theme switch.
|
||||
add_action( 'after_switch_theme', 'varia_enable_mobile_nav_on_side' );
|
||||
|
||||
// Enable the customizer control toggle for the mobile nav on the side.
|
||||
add_action( 'customize_register' , 'varia_register_mobile_nav_on_side_customizer_control' );
|
||||
}
|
||||
|
||||
/**
|
||||
* SVG Icons class.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue