While working with a variety of WordPress custom themes and building sites through WordPress system, we are often being asked of how to change the small text titles on the page. For example the call-center number is put on the top of the page and it has just changed, or the footer has an address or link to social networks.

There are two options to make these titles editable:

  1. The easiest way is to change the text in template directly through «Appearance – Editor» section, or through FTP access, but you will need the basic knowledge of PHP and HTML codes. And the very point of the content management system is to let you work with your web-sites without these skills.
  2. You can also create various areas (sidebars) and use text widgets for each title. This option is quite volumed and not so user-friendly. Again the HTML code could also be present in the widget code to make block looks correctly.

Which way is better? When choosing the solution of this problem you should care about the usability and convenience of editing firstly. User should see intuitive user interface! So none of these options is user-friendly!

We often make experiments with different interface types while editing custom data for WordPress based sites. One of the results is Just Custom Fields plugin, which became quite popular among bloggers and developers. Now we present another plugin which we expect to be even more popular – Just WordPress Variables. This plugin allows you to create a set of text variables, which can be easily edited all in one menu. These variables can be used in a theme through special functions or in content of your posts and pages with the use of shortcodes.

Installation:

  1. Download, unzip and upload to your WordPress plugins directory
  2. Activate the plugin within your WordPress Administration Backend
  3. Go to Settings > Just Variables
  4. Create text variables you want to edit in your theme. Press “Save changes”
  5. Now new menu item is available Appearance > Theme Variables. Here you can set values for your variables.
  6. Insert special function into your theme template or insert shortcode into the post content to see that all works fine.

Screenshots:

First screenshot: Create/edit variables page. You can create variables of two types: textbox (single line textbox) and textarea (multi-line textbox). You can also setup the default value and variables order for convenience.

Second screenshot: Variable values edit page. The main user’s menu. Here you can change the value of the text. The entered value appears on the site after you save the form (if you already pasted the special function into your template)

Variables usage:

For now the plugin supports only two types of variables usage:

Template function:
To print the value inside the template you will need simply to insert the following code:

<?php just_variable( "code for variable" ); ?>

Note: The variable code can be found on values edit page (see screenshot below)

Shortcode:
The value output can also be inserted in post or page content, or in content of text widget. You will need to enter the following shortcode:

[justvar code="code for variable"]

Download

Our plugin is available for download on WordPress.org plugin directory:
download Just WordPress Variables
You can also follow the development of this plugin on github.com social GIT repository (features/bugs also listed there under Issues tab)

The script is free for use, but if you want to buy some beer to the script author please use the form below, thanks in advance.

Leave a Reply