Create your own custom variables to manage information on your website such as:
- Phone numbers
- Social media links
- HTML snippets
- And anything else
Easily access them globally in WordPress and PHP.
Why you need it
Rather than having to change something like an email address across multiple pages, you can do it in one place. Avoid the pitfalls of hard coding information in your WordPress theme that is likely to change.
Why it’s better
- Your variables are stored and retrieved locally without any calls to the database. That means faster load times for your pages!
- Variables can be accessed easily in PHP from the global scope.
Display your variables using the shortcode syntax:
Or using the superglobal in PHP:
<?php echo $GLOBALS['cgv']['variable-name'] ?>
- Upload the plugin files to the
/wp-content/plugins/plugin-namedirectory, or install the plugin through the WordPress plugins screen directly.
- Activate the plugin through the ‘Plugins’ screen in WordPress
- Use the
Settings -> Custom Global Variablesscreen to define your variables