Categories

Friday, March 29, 2024
#919814419350 therichposts@gmail.com
Wordpress HooksWordpress Tricks

How to add more panel or section into your WordPress customizer?

How to add custom meta title and meta description in Wordpress?

add more panel or section into your Wordpress customizer

Hello, welcome to therichpost.com. In this post, I will tell you How to add more panel or section into your WordPress customizer? WordPress is the best cms. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress.

WordPress give customizer options to make dynamic content add and edit easily for anyone and here is working example of it.

Here is code add more panel or section into your WordPress customizer and you need to add this code into your theme’s functions.php file:
function my_customize_register( $wp_customize ) {
$wp_customize->add_control(
        'footercopyrighttxt',
        array(
            'label'      => 'Footer Copyright Text',
            'section'    => 'theme_setting',
            'settings'   => 'footercopyright',
            'type'		 => 'textarea'
        )
);
$wp_customize->add_control(
       new WP_Customize_Image_Control(
           $wp_customize,
           'logoimg',
           array(
               'label'      => __( 'Upload a logo', 'els' ),
               'section'    => 'theme_setting',
               'settings'   => 'logoimage'
           )
       )
   );
}
}
add_action( 'customize_register' , 'my_customize_register' );

 After added above code, you can new sections into your wordpress customize section( Footer Copyright text and Upload A logo) and for get all values you need to add below code into your theme’s php template file:

<span><?php echo get_option('footercopyright'); ?></span>

<?php if(get_option('logoimage') != ""){ ?>
               <a href="<?php echo site_url(); ?>">
                <img src="<?php echo get_option('logoimage'); ?>" alt="#"/>
              </a>
              <?php } ?>

 That is it.

There are so many tricks in wordpress and I will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.