BACK TO DIRECTORY

Custom Global Variables

by akirak

5.0
(10 ratings)

Create your own custom variables to manage information on your website such as:

  • Phone numbers
  • Addresses
  • Social media links
  • HTML snippets
  • And anything else
    test

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.

Usage

Display your variables using the shortcode syntax:

[cgv variable-name]

Or using the superglobal in PHP:

<?php echo $GLOBALS['cgv']['variable-name'] ?>

Screenshots

Settings -&gt; Custom Global Variables

Settings -> Custom Global Variables

Plugin Details

Active Installs
5K+
Total Downloads
21,955
Version
1.1.2
Requires WP
3.0.1
Requires PHP
5.6
Tested Up To
6.1.12
Added
2016-04-07
Last Updated
2023-03-22 9:22pm GMT

Ratings

5
10
4
0
3
0
2
0
1
0