Appearance Customize example code

Appearance Customize – WordPress theme Quick Start

David Nash code, wordpress 0 Comments

There’s a lot of detailed information on how to add settings under the WordPress Appearance Customize menu. It’s far too detailed if you just want to add a couple of settings.

In this example I just wanted to add some simple fields. One for the company title, which differs from the site title. And another for their logo which appears in the WordPress header.

Modifying Appearance Customize with functions.php

Once you add this, check under Appearance > Customize. If all is well you’ll see your logo and title field.

If you’re really adventurous you could create an array of social media sites. Then loop through that array to create a field for each:

Displaying the values in the theme

This is the easy part! In your theme file, you can do this:

You can now echo these variables as you usually would.

I think this makes for a much nicer experience for the end-user. It allows you to make absolutely everything in your theme editable through wp-admin. This means I spend less time on the little updates and more time on the meaty stuff.

Leave a Reply

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