Last active
October 26, 2017 01:36
-
-
Save kirasiris/8990761361478648d7ade94c9b8e86b7 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 | |
))); | |
// Aqui la manera de crear inouts de texto en el customizer | |
$wp_customize->add_setting('showcase_heading', array( | |
'default' => _x('Custom Bootstrap Wordpress Theme', 'yourthemename'), | |
'type' => 'theme_mod' | |
)); | |
$wp_customize->add_control('showcase_heading', array( | |
'label' => __('Heading', 'yourthemename'), | |
'section' => 'showcase', | |
'priority' => 2 | |
)); | |
} | |
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