Custom Global Variables

Описание

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:

[cgv variable-name]

Or using the superglobal in PHP:

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

Скриншоты

  • Settings -> Custom Global Variables

Установка

  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

Отзывы

26.05.2017
I needed a way of presenting some data in multiple locations, being a web developer I knew I could use variables but didn't want to edit the core app or theme, so this fitted my requirements like a glove, only one bug, when you enter a variable name but not a value and save, it says save successful, but it doesn't actually save, this need a check for data, its a minor thing, once I figured out why my newly entered variables.
03.09.2016
By far the best one "Variables" plugin. I tested some others, those were based on database and because of failed caching I experienced problems. Since the day I moved to this plugin, all problems disappeared 🙂 I love the simplicity 🙂
Посмотреть все 8 отзывов

Участники и разработчики

«Custom Global Variables» — проект с открытым исходным кодом. В развитие плагина внесли свой вклад следующие участники:

Участники

Перевести «Custom Global Variables» на ваш язык.

Заинтересованы в разработке?

Посмотрите код, проверьте SVN репозиторий, или подпишитесь на журнал разработки по RSS.

Журнал изменений

1.0.5

  • Updated accreditation
  • Updated stylesheet
  • Tested up to WordPress 5.1

1.0.4

  • Fixed folder path in error message

1.0.3

  • Changed file path to where variables are stored

1.0.2

  • Support for older versions of PHP that handle object referencing differently

1.0.1

  • Support for older versions of PHP (< 5.4) that do not allow the short array syntax