Skip to content

Commit

Permalink
Add Customizer login and admin section, files renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
neilgee committed May 10, 2020
1 parent 04edd25 commit cd07797
Show file tree
Hide file tree
Showing 10 changed files with 446 additions and 38 deletions.
13 changes: 7 additions & 6 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Not working for theme if inside after_setup_theme function - so thats why it is here.
* @since 1.7.0
*/
require_once( get_stylesheet_directory() . '/includes-child/customizer-filtered.php' );
require_once( get_stylesheet_directory() . '/includes-child/customizer-defaults.php' );


add_action( 'after_setup_theme', 'bt_theme_setup', 15 );
Expand All @@ -40,7 +40,7 @@ function bt_theme_setup() {
*/
define( 'CHILD_THEME_NAME', 'beavertron' );
define( 'CHILD_THEME_URL', 'http://wpbeaches.com' );
define( 'CHILD_THEME_VERSION', '1.7.0' );
define( 'CHILD_THEME_VERSION', '1.7.1' );
define( 'FL_CHILD_THEME_DIR', get_stylesheet_directory() );
define( 'FL_CHILD_THEME_URL', get_stylesheet_directory_uri() );
// Allow SVG Upload
Expand Down Expand Up @@ -71,14 +71,15 @@ function bt_theme_setup() {
* Add Customizer Options and CSS output.
* @since 1.0.0
*/
require_once( get_stylesheet_directory() . '/includes-child/customizer.php' );
require_once( get_stylesheet_directory() . '/includes-child/output.php' );
require_once( get_stylesheet_directory() . '/includes-child/customizer-panels.php' );
require_once( get_stylesheet_directory() . '/includes-child/inline-css-style.php' );
require_once( get_stylesheet_directory() . '/includes-child/inline-css-style-login.php' );

/**
* Client Logo for WP Login and backend admin clean up.
* Client Logo for WP Login and backend dashboard admin clean up.
* @since 1.0.0
*/
include_once( get_stylesheet_directory() . '/includes-child/client-file.php' );
include_once( get_stylesheet_directory() . '/includes-child/dashboard.php' );

/**
* Remove Default BB Mobile Menu.
Expand Down
File renamed without changes.
159 changes: 155 additions & 4 deletions includes-child/customizer.php → includes-child/customizer-panels.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ function sanitize_text( $text ) {
*/
//$wp_customize->get_section( 'background_image' )->title = __( 'Background Styles', 'beavertron' );


/**
* Add WooCommerce Colors Section
* @since 2.0.0
Expand Down Expand Up @@ -501,6 +500,158 @@ function sanitize_text( $text ) {
) );


/**
* Create login panel
* Add setting
* Add control
* Also can be done with FLCustomizer::add_panel - see example commented further down
* @since 1.0.0
*/
// Add Panel
// $wp_customize->add_panel( 'login_page', array(
// 'priority' => 70,
// 'theme_supports' => '',
// 'title' => __( 'Login', 'beavertron' ),
// 'description' => __( 'Set login page styles', 'beavertron' ),
// ) );

// Add Login Styles
// Add in Settings section with 'fl-settings'.
$wp_customize->add_section( 'bt_login_styles' , array(
'title' => __( 'Login Styles','beavertron' ),
'panel' => 'fl-settings',
'priority' => 120,
)
);

$wp_customize->add_setting( 'bt_login_accent_color', array(
'default' => '#007cba', // Give it a default
)
);

$wp_customize->add_control( new WP_Customize_Color_Control(
$wp_customize,
'bt_login_custom_accent_color', //give it an ID
array(
'label' => __( 'Login accent color', 'beavertron' ), //set the label to appear in the Customizer
'section' => 'bt_login_styles', //select the section for it to appear under
'settings' => 'bt_login_accent_color' //pick the setting it applies to
)
)
);

$wp_customize->add_setting( 'bt_login_accent_hover_color', array(
'default' => '#0071a1', // Give it a default
)
);

$wp_customize->add_control( new WP_Customize_Color_Control(
$wp_customize,
'bt_login_custom_accent_hover_color', //give it an ID
array(
'label' => __( 'Login accent hover color', 'beavertron' ), //set the label to appear in the Customizer
'section' => 'bt_login_styles', //select the section for it to appear under
'settings' => 'bt_login_accent_hover_color' //pick the setting it applies to
)
)
);

$wp_customize->add_setting( 'bt_login_link_color', array(
'default' => '#555d66', // Give it a default
)
);

$wp_customize->add_control( new WP_Customize_Color_Control(
$wp_customize,
'bt_login_custom_link_color', //give it an ID
array(
'label' => __( 'Login link color', 'beavertron' ), //set the label to appear in the Customizer
'section' => 'bt_login_styles', //select the section for it to appear under
'settings' => 'bt_login_link_color' //pick the setting it applies to
)
)
);

$wp_customize->add_setting( 'bt_login_link_hover_color', array(
'default' => '#00a0d2', // Give it a default
)
);

$wp_customize->add_control( new WP_Customize_Color_Control(
$wp_customize,
'bt_login_custom_link_hover_color', //give it an ID
array(
'label' => __( 'Login link hover color', 'beavertron' ), //set the label to appear in the Customizer
'section' => 'bt_login_styles', //select the section for it to appear under
'settings' => 'bt_login_link_hover_color' //pick the setting it applies to
)
)
);

$wp_customize->add_setting( 'bt_login_background_color', array(
'default' => '#f1f1f1', // Give it a default
)
);

$wp_customize->add_control( new WP_Customize_Color_Control(
$wp_customize,
'bt_login_custom_background_color', //give it an ID
array(
'label' => __( 'Login background color', 'beavertron' ), //set the label to appear in the Customizer
'section' => 'bt_login_styles', //select the section for it to appear under
'settings' => 'bt_login_background_color' //pick the setting it applies to
)
)
);

$wp_customize->add_setting( 'bt_login_form_color', array(
'default' => '#ffffff', // Give it a default
)
);

$wp_customize->add_control( new WP_Customize_Color_Control(
$wp_customize,
'bt_login_form_color', //give it an ID
array(
'label' => __( 'Login form background color', 'beavertron' ), //set the label to appear in the Customizer
'section' => 'bt_login_styles', //select the section for it to appear under
'settings' => 'bt_login_form_color' //pick the setting it applies to
)
)
);

$wp_customize->add_setting( 'bt_login_form_text', array(
'default' => '#444444', // Give it a default
)
);

$wp_customize->add_control( new WP_Customize_Color_Control(
$wp_customize,
'bt_login_form_text', //give it an ID
array(
'label' => __( 'Login form text color', 'beavertron' ), //set the label to appear in the Customizer
'section' => 'bt_login_styles', //select the section for it to appear under
'settings' => 'bt_login_form_text' //pick the setting it applies to
)
)
);

$wp_customize->add_setting( 'bt_admin_font',
array(
'default' => 0,
)
);

$wp_customize->add_control( 'bt_admin_font',
array(
'label' => __( 'Make WP Dashboard font same as frontend' ),
'section' => 'bt_login_styles',
'priority' => 10, // Optional. Order priority to load the control. Default: 10
'type' => 'checkbox',
)
);


/**
* Remove Panels and Sections by uncommenting.
* Create Custom Section
Expand Down Expand Up @@ -706,7 +857,7 @@ function sanitize_text( $text ) {

add_filter( 'fl_default_theme_mods', 'bt_default_theme_preset');
/**
* Sey Active Preset Theme Mods
* Set Active Preset Theme Mods
* @since 1.0.0
*/
function bt_default_theme_preset( $mods ) {
Expand Down Expand Up @@ -829,7 +980,7 @@ function bt_default_theme_preset( $mods ) {
//add_action( 'after_setup_theme', 'bt_add_customizer_panel', 35 );
/**
* Create Custom Customizer Panel with FLCustomizer::add_panel
* 7 Panel Examples with a range of controls
* 7 Panel Examples with a range of controls ... informational
* @since 1.7.0
*/
function bt_add_customizer_panel() {
Expand Down Expand Up @@ -1098,5 +1249,5 @@ function bt_add_customizer_panel() {
$data = FLTheme::get_setting('bt-body-bg-color');


var_dump ($data);
// var_dump ($data);
}
31 changes: 9 additions & 22 deletions includes-child/client-file.php → includes-child/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@
* @link http://wpbeaches.com/
*/



add_action( 'login_head', 'bt_custom_login_logo' );
/**
* Client Logo for Backend Login - Home link and Image Description
*
* @since 1.0.0
*/
function bt_custom_login_logo() {
echo '<style type="text/css">
.login h1 a { background-image:url(' . get_stylesheet_directory_uri() . '/images/logo.png) !important; width: 260px; !important; height: 60px !important; background-size: 100% 100% !important; margin-bottom: 60px !important;}
.login form {margin-top: -50px;}
</style>';
}

add_filter( 'login_headerurl', 'bt_custom_login_url', 10, 4 );
/**
* Logo Backend Home link
Expand Down Expand Up @@ -77,10 +62,18 @@ function bt_remove_dashboard_widgets() {
// remove_meta_box('dashboard_activity','dashboard', 'normal'); //Activity
remove_action( 'welcome_panel','wp_welcome_panel' );
remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel'); // Try Gutenberg

remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' ); // Remove Site Health Widget
}


add_filter( 'wp_fatal_error_handler_enabled', '__return_false' );
/**
* Stop Site Health Emails from beng sent to Admin
*
* @since 1.0.0
*/


add_action( 'admin_head', 'bt_hide_tabs' );
/**
* Hide 'Screen Option' and 'Help' tab for non-Admins
Expand Down Expand Up @@ -118,12 +111,6 @@ function wsl_edit_text() {
return "<em>Site by <a href='https://websitelove.com.au' rel='nofollow'>WebsiteLove</a>, contact <a href='mailto:[email protected]' rel='nofollow'>us</a></em>";
}

/**
* Stop Site Health Emails from beng sent to Admin
*
* @since 1.0.0
*/
add_filter( 'wp_fatal_error_handler_enabled', '__return_false' );


/**
Expand Down
Loading

0 comments on commit cd07797

Please sign in to comment.