Custom Global Variables | Abdullah Khalfan | options

Custom Global Variables | Abdullah Khalfan | options,settings,shortcodes,variables

Description

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

  • Phone numbers
  • Addresses
  • 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.

Usage

Display your variables using the shortcode syntax:

[cgv variable-name]

Or using the superglobal in PHP:

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

Installation

  1. Upload the plugin files to the /wp-content/plugins/plugin-name directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress
  3. Use the Settings -> Custom Global Variables screen to define your variables

Plugin author

Abdullah Khalfan

Plugin official website address

https://wordpress.org/plugins/custom-global-variables/
If you encounter problems in using the Custom Global Variables plugin, you can comment below, and I will try my best to help you solve the problem

Leave a Comment

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