Created
October 26, 2017 00:15
-
-
Save kirasiris/b1e1eae83dc65d5220bc6bb180f05659 to your computer and use it in GitHub Desktop.
This file contains 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 | |
function mytheme_customize_register( $wp_customize ) { | |
//Aqui es donde crearemos nuestros add sections, add setting, y add controls. | |
//Primero van los seccion, dentro de ellos van los add setting y despues los add controls. | |
// Si deseas crear otra seccion se deben seguir los mismos pasos nuevqamente. | |
$wp_customize->add_section('showcase', array( | |
'title' => __('yourseccionname', 'yourthemename'), | |
'description' => sprintf(__('Options for youthemename','yourthemename')), | |
'priority' => 130 // aqui puedes controlar el orden en el cual quieras que aparesca. | |
//Nota que no se puede mostrar antes que las secciones que estan por default en Wordpress | |
)); | |
//Seguimos con nuestros add settigs y add controls. Estos trabajan en par, si haces un setting necesitaras crear un control tambien. | |
// Cada par de setting y controsl cuenta como UN input en el customizer. | |
$wp_customize->add_setting('showcase_image', array( | |
'default' => get_bloginfo('template_directory').'/img/showcase.jpg', | |
'type' => 'theme_mod' | |
)); | |
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'showcase_image', array( | |
'label' => __('Showcase Image', 'yourthemename'), | |
'section' => 'yourseccionname', | |
'settings' => 'showcase_image', | |
'priority' => 1 | |
))); | |
} | |
add_action( 'customize_register', 'mytheme_customize_register' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment