add_panel( 'impulsive_Theme_Custom_Add_Panel_Function', array( 'theme_supports' => '', 'title' => __( ' Impulsive Theme Options ', 'impulsive' ), 'priority' => 1, ) ); } add_action( 'customize_register', 'impulsive_Theme_Register_Customizer_Add_Panel_Function' ); /*** *** Register Customizer Add Panel Function Code END Here ***/ /*** *** Register Customizer 404 Page Section Code start Here ***/ class impulsive_404_Page_Section_Customizer { public static function impulsive_Register_Theme_Customizer_For_404_Page_Section( $wp_customize ) { // Add 404 Page Section $wp_customize->add_section( 'impulsive_Theme_Section_For_404_Page_Section' , array( 'title' => __(' 404 Page Section ','impulsive'), 'panel' => 'impulsive_Theme_Custom_Add_Panel_Function', ) ); /******************************************************************************* 404 Page Section Title ********************************************************************************/ $wp_customize->add_setting( 'impulsive_Setting_For_404_Page_Section_Title', array( 'sanitize_callback' => 'impulsive_404_Page_Section_Page_Sanitize_Text', ) ); // Add 04 Page Main Title Section Title Add control $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'impulsive_Setting_For_404_Page_Section_Title', array( 'label' => __( ' 404 Page Main Title ', 'impulsive' ), 'section' => 'impulsive_Theme_Section_For_404_Page_Section', 'settings' => 'impulsive_Setting_For_404_Page_Section_Title', 'type' => 'text', 'priority' => 1, ) ) ); /******************************************************************************* 404 Page Section For Button Label In 404 Page ********************************************************************************/ $wp_customize->add_setting( 'impulsive_Setting_For_404_Page_Section_Button_Label', array( 'sanitize_callback' => 'impulsive_404_Page_Section_Page_Sanitize_Text', ) ); // Add 404 Page Section Button Label Add control $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'impulsive_Theme_404_Page_Section', array( 'label' => __( ' Button Label For 404 Page ', 'impulsive' ), 'section' => 'impulsive_Theme_Section_For_404_Page_Section', 'settings' => 'impulsive_Setting_For_404_Page_Section_Button_Label', 'type' => 'text', 'priority' => 1, ) ) ); /******************************************************************************* 404 Page Section Title Description Code ********************************************************************************/ $wp_customize->add_setting( 'impulsive_Setting_For_404_Page_Section_Description', array( 'sanitize_callback' => 'impulsive_404_Page_Section_Page_Sanitize_Text', ) ); // Add 404 Page Section Description Add control $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'impulsive_Setting_For_404_Page_Section_Description', array( 'label' => __( ' 404 Page Description ', 'impulsive' ), 'section' => 'impulsive_Theme_Section_For_404_Page_Section', 'settings' => 'impulsive_Setting_For_404_Page_Section_Description', 'type' => 'textarea', 'priority' => 2, ) ) ); // Add Settings For 404 Page Button $wp_customize->add_setting( 'impulsive_404_Page_Button_background', array( 'default' => '#f4c201', 'sanitize_callback' => 'impulsive_404_Page_sanitize_color', )); // Add Controls For 404 Page Button $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'impulsive_404_Page_Button_background', array( 'label' => '404 Page Button background', 'section' => 'impulsive_Theme_Section_For_404_Page_Section', 'settings' => 'impulsive_404_Page_Button_background' ))); /** * Color sanitization callback */ function impulsive_404_Page_sanitize_color( $color ) { if ( empty( $color ) || is_array( $color ) ) { return ''; } // If string does not start with 'rgba', then treat as hex. // sanitize the hex color and finally convert hex to rgba if ( false === strpos( $color, 'rgba' ) ) { return sanitize_hex_color( $color ); } // By now we know the string is formatted as an rgba color so we need to further sanitize it. $color = str_replace( ' ', '', $color ); sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha ); return 'rgba('.$red.','.$green.','.$blue.','.$alpha.')'; } /** * Text sanitization callback */ function impulsive_404_Page_Section_Page_Sanitize_Text( $text ) { return sanitize_text_field( $text ); } } } add_action( 'customize_register', array('impulsive_404_Page_Section_Customizer', 'impulsive_Register_Theme_Customizer_For_404_Page_Section') ); /*** *** Register Customizer 404 Page Section Code End Here ***/ ?>