
1) Add this to your functinos.php
// ========================================================================= // REGISTER CUSTOMIZER - PANEL, SECTION, SETTINGS AND CONTROL // ========================================================================= function theme_name_register_theme_customizer( $wp_customize ) { // Create custom panel. $wp_customize->add_panel( 'text_blocks', array( 'priority' => 10, 'theme_supports' => '', 'title' => __( 'Text Blocks', 'theme_name' ), 'description' => __( 'Set editable text for certain content.', 'theme_name' ), ) ); // Add section. $wp_customize->add_section( 'custom_title_text' , array( 'title' => __('Custom Text','theme-name'), 'panel' => 'text_blocks', 'priority' => 10 ) ); // Add setting $wp_customize->add_setting( 'title_text_block', array( 'default' => __( 'Default text', 'theme-name' ), 'sanitize_callback' => 'sanitize_text' ) ); // Add control $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'custom_title_text', array( 'label' => __( 'Custom Text', 'theme_name' ), 'section' => 'custom_title_text', 'settings' => 'title_text_block', 'type' => 'text' ) ) ); // Sanitize text function sanitize_text( $text ) { return sanitize_text_field( $text ); } } add_action( 'customize_register', 'theme_name_register_theme_customizer' );
2) Show in the Front End with a hook
function add_custom_field(){ echo get_theme_mod( 'title_text_block'); } add_action('genesis_site_description', 'add_custom_field');
In this case I’ve placed the custom text in the site-description, but You can put it anywhere You want using the Genesis Visual Hook Guide.
I am new to wordpress, and was very confuse about adding text control, Your post solve my problem. Thank you so much
Best Wishes
Thanks for this tutorial, it helped me a lot.