Let’s say that you need a second logo image to be added in your header. And let’s assume that this should be editable feature. The easiest way to manage this task is to make a new option in the Customize panel (Appearance -> Customize) to upload a logo image and add a link to it. This tutorial will show you how you can do this.

On the back end we have tree different steps to make: we need to register a section, we need to set settings to the controls of this section, and of course we need to set the controls. All this is going to use the customize_api and will be hooked to customize_register.

First we have the $wp_customize->add_section($id, $args) more details here.

Second $wp_customize->add_setting($id, $args) for more references here.

And last $wp_customize->add_control($id, $args) check this details.

Now we have all these options in the Customize panel but how can we use them in the code. The way I get them from the database is by using get_theme_mods(). In our case we will have the following code to get the settings and assign them to some variables.

 

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *