Last active
February 26, 2024 19:29
-
-
Save fahidjavid/0b2fc36dbd4e0ec96f98e80eba745008 to your computer and use it in GitHub Desktop.
A custom customizer control that provide a nice separator between the customizer fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! class_exists( 'Prefix_Separator_Control' ) ) { | |
return null; | |
} | |
/** | |
* Class Prefix_Separator_Control | |
* | |
* Custom control to display separator | |
*/ | |
class Prefix_Separator_Control extends WP_Customize_Control { | |
public function render_content() { | |
?> | |
<label> <br> | |
<hr> | |
<br> </label> | |
<?php | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// separator | |
$wp_customize->add_setting( 'prefix_sample_separator', array( | |
'sanitize_callback' => 'themename_sanitize', | |
) ); | |
$wp_customize->add_control( | |
new Prefix_Separator_Control( | |
$wp_customize, | |
'prefix_sample_separator', | |
array( | |
'section' => 'prefix_sample_section', | |
) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the class you're creating doesn't exist... return null?