php - Issues wih the Wordpress API Customization -
i'm making first wordpress theme , i'm learning api customization. there's wrong code made. what's wrong? when load wp-admin page, it's shown blank.
this php code
//welcome message settings $wp_customize->add_setting( 'welcome_message' , array( 'default' => 'hi', )); $wp_customize->add_section( 'test_welcomemessage' , array( 'title' => __('welcome message','my_test'), 'description' => 'write own welcome message visitors' )); $wp_customize->add_control( 'welcome_message', array( 'label' => __( 'welcome messagee', 'mytheme' ), 'section' => 'test_welcomemessage', 'settings' => 'welcome_message' ))); }
and html structure
<div id="welcomecontainer"> <div class="welcomemessage"><?php echo get_theme_mod('welcome_message'); ?></div> </div>
what's wrong in code? thank you
in order make use of $wp_customize->..
need make use of customize_register
hook:
add_action( 'customize_register', 'register_my_settings' ); function register_my_settings( $wp_customize ){ $wp_customize->add_section( 'test_welcomemessage' , array( 'title' => __('welcome message','my_test'), 'description' => 'write own welcome message visitors' )); }
(i'm not sure if order important here, need have: add_section
, add_setting
add_control
)
besides that, when developing, make sure have wp_debug
set true (edit wp-config.php
in project's root, , end of file find setting) in order see errors (also, make sure server set display errors)
Comments
Post a Comment