Shortcode Variables

Descriere

Documentation / UPGRADE

Shortcode Variables Website

WHAT IS SHORTCODE VARIABLES?

Do you want to use the same snippet of text or HTML throughout your site but only have to change the value in one location? If so, this plugin maybe just what you need.

Create your own Shortcodes and assign content to them. Using the standard WP editor, you can add text, HTML, JavaScript, images or other elements that your WordPress install and plugins allow. The main advantage is ability to create a shortcode once and re-use it throughout your site.

[ sv slug=”your-slug-name”]

FEATURES

  • Create a shortcode once and place in multiple locations.
  • Update the shortcode in one location and it changes throughout your site.
  • Parameters to extend your shortcodes.
  • Free and Premium helper shortcodes to make life easier.
  • Multi-site support.
  • Process shortcodes within WordPress menu titles.

SPECIFY PARAMETERS

In some cases you may wish to make your shortcodes more extendable. This is where parameters come in. For example, you may have a shortcode that renders a HTML table, however, depending on where you place that shortcode on your site, you may wish to specify additional arguments. Take the example below, you can see the additional arguments passed into shortcode, “border”, “background” etc.

[ sv slug=”render-table” border=”0″ background=”#FFFFFF” width=”50%” site-title=”YeKen”]

Each argument can be rendered into the shortcode in the with the following syntax %%background%%, %%width%%, etc. Below is an example:

Welcome to our site, %%site-title%%.

Premium Shortcodes

The plugin comes with the following premium shortcodes:

  • sc-date – A shortcode that displays today’s date with the ability to add or subtract days, months and years. To specify an interval to add or subtract onto the date use the parameter „interval” e.g. [sv slug=”sc-date” interval=”-1 year”], [sv slug=”sc-date” interval=”+5 days”], [sv slug=”sc-date” interval=”+3 months”]. Intervals are based upon PHP intervals and are outlined here https://www.php.net/manual/en/dateinterval.createfromdatestring.php. Default is UK format (DD/MM/YYYY). Format can be changed by adding the parameter format=”m/d/Y” onto the shortcode. Format syntax is based upon PHP date: http://php.net/manual/en/function.date.php
  • sc-site-language – Language code for the current site
  • sc-site-description – Site tagline (set in Settings > General)
  • sc-site-wp-url – The WordPress address (URL) (set in Settings > General)
  • sc-site-charset – The „Encoding for pages and feeds” (set in Settings > Reading)
  • sc-site-wp-version – The current WordPress version
  • sc-site-html-type – The content-type (default: „text/html”). Themes and plugins
  • sc-site-stylesheet-url – URL to the stylesheet for the active theme.
  • sc-site-stylesheet_directory – Directory path for the active theme.
  • sc-site-template-url – The URL of the active theme’s directory.
  • sc-site-pingback-url – The pingback XML-RPC file URL (xmlrpc.php)
  • sc-site-atom-feed – The Atom feed URL (/feed/atom)
  • sc-site-rdf-url – The RDF/RSS 1.0 feed URL (/feed/rfd)
  • sc-site-rss-url – The RSS 0.92 feed URL (/feed/rss)
  • sc-site-rss2-url – The RSS 2.0 feed URL (/feed)
  • sc-site-comments-atom-url – The comments Atom feed URL (/comments/feed)
  • sc-site-comments-rss2-url – The comments RSS 2.0 feed URL (/comments/feed)
  • sc-php-server-info – Display data from the PHP $_SERVER global e.g. [sv slug=”sc-server-info” field=”SERVER_SOFTWARE”]. Allowed values for field attribute.
  • sc-php-unique-id – Generate a unique ID. Based upon uniqid(). If you wish the unique ID to be prefixed, add a the prefix attribute e.g. [sv slug=”sc-php-unique-id” prefix=”yeken”]
  • sc-php-timestamp – Display the current unix timestamp. Based upon time().
  • sc-php-random-number – Display a random number. Based upon rand(). It also supports the optional arguments of min and max e.g. [sv slug=”sc-php-random-number” min=”5″ max=”20″ ]
  • sc-php-random-string – Display a random string of characters. It also supports the optional argument of „length”. This specifies the number of characters you wish to display (default is 10) [sv slug=”sc-php-random-string” length=”15″]
  • sc-php-post-value – Display a value from the $_POST array. The „key” arguments specifies which array value to render. It also supports the optional arguments of „default”. If there is no value in the array for the given „key” then the „default” will be displayed. [sv slug=”sc-php-post-value” key=”username” default=”Not Found”]
  • sc-php-get-value – Display a value from the $_GET array. The „key” arguments specifies which array value to render. It also supports the optional arguments of „default”. If there is no value in the array for the given „key” then the „default” will be displayed. [sv slug=”sc-php-get-value” key=”username” default=”Not Found”]
  • sc-php-info – Display PHP Info
  • sc-post-id – Display ID for the current post.
  • sc-post-author – Display the author’s display name or ID. The optional argument „field” allows you to specify whether you wish to display the author’s „display-name” or „id”. [sv slug=”sc-post-author” field=”id” ]
  • sc-post-counts – Display a count of posts for certain statuses. Using the argument status, specify whether to return a count for all posts that have a status of „publish” (default), „future”, „draft”, „pending” or „private”. [sv slug=”sc-post-counts” status=”draft”]
  • sc-user-counts – Display a count of all WordPress users or the number of WordPress users for a given role e.g. [sv slug=”sc-user-counts” role=”subscriber”] or [sv slug=”sc-user-counts”].

Free Shortcodes

The plugin comes with the following free shortcodes:

  • sc-todays-date – Displays today’s date. Default is UK format (DD/MM/YYYY). Format can be changed by adding the parameter format=”m/d/Y” onto the shortcode. Format syntax is based upon PHP date: http://php.net/manual/en/function.date.php
  • sc-user-ip – Display the current user’s IP address.
  • sc-user-agent – Display the current user’s User Agent
  • sc-site-url – The Site address (URL) (set in Settings > General)
  • sc-site-title – Displays the site title.
  • sc-admin-email – Admin email (set in Settings > General)
  • sc-page-title – Displays the page title.
  • sc-login-page – WordPress login page. Add the parameter „redirect” to specify where the user is taken after a successful login e.g. redirect=”http://www.google.co.uk”.
  • sc-privacy-url – Displays the privacy page URL.
  • sc-username – Display the logged in username.
  • sc-user-id – Display the current user’s ID.
  • sc-user-email – Display the current user’s email address.
  • sc-first-name – Display the current user’s username.
  • sc-last-name – Display the current user’s last name.
  • sc-display-name – Display the current user’s display name.

Features

  • Insert the same piece of data, HTML, text, etc throughout your site and change in only one place.
  • TinyMCE editor
  • Place other WordPress shortcodes within yours
  • Comes with a range of pre-made shortcodes
  • Pass your own parameters into a shortcode

  • Developed by YeKen.uk *

Paypal Donate: email@YeKen.uk

Capturi ecran

  • View all shortcode variables created.
  • Add a new shortcode variable
  • Edit an existing shortcode variable
  • Using the shortcode variables into a page
  • Shortcode variables rendered in a page

Instalare

  1. Login into WordPress Admin Panel
  2. Goto Plugins > Add New
  3. Search for „Shortcode Variables”
  4. Click Install now and activate plugin
  5. Goto Settings > Shortcode Variables

Întrebări frecvente

How do I add / edit / delete Shortcode Variables

Login into WordPress Admin Panel and goto Settings > Shortcode Variables

Verificări

iulie 18, 2019
Great plugin. Have everything I need.
iunie 3, 2019
I was updating the same data on many different pages and was so happy to find this wonderful plugin. Due to an update on my website, something went wrong and I opened a ticket. The author answered within hours and proposed to fix it directly on my website I trusted him with the keys of my website and he was totally worth my trust. Well done!
decembrie 24, 2018
The ability to create variables by WordPress designers that are not php coders should be built into WP itself. It isn't ... and amazingly this function is not easy to find in a plugin either. 'Shortcode Variables' is both simple to use and incredibly useful even if you never create your own shortcode. Its ready-to-use shortcodes such as username and useremail and such were exactly what I was looking for. Instructions on how to code this yourself can be found on the web BUT Shortcode Variables makes it simple and no coding necessary. Am =^)
august 4, 2017
I maintain a site for a once a year event, and I have for many years now had to scour each of the many pages and look for dates which needed updating for the next event. Inevitably, I would miss one or two which of course caused confusion. I am in the process now of re-writing the entire site in wordpress because I've had problems with the joomla site getting hacked. In the process of re-writing, I thought to myself, it sure would be nice to have a place to store variables which could be referenced by short-code, so I did a plug-in search and found Shortcode Variables. This is exactly what I was envisioning. I will now be able to update this website each year in a matter of minutes, instead of that may hours. PERFECT!
iulie 5, 2017
Very nice and usefull. The only thing I really wish, is to be able to change the content in the overview area. There are textareas with the content. I'm able to edit the content there but cant submit the change. Why not? Both options would be nice. For simple content direct at the overview area, for further formatting the edit button.
Citește toate cele 16 recenzii

Contributori și dezvoltatori

„Shortcode Variables” este un software open-source. La acest modul au contribuit următoarele persoane.

Contributori

Istoric modificări

3.0.4

  • Improvement: Fetch license price from YeKen API

3.0.3

  • Bug fix: Removed debug data altogether as causing unintended behaviour.

3.0.2

  • Bug fix: Only display HTML caching comment on pages / posts. Currently rendering on things like AJAX responses and causing unintended behaviour.

3.0.1

  • Bug fix: Fix error being thrown when not a multi site and DB table missing.

3.0

  • Improvement: Support for multi-site variables.
  • Improvement: Replace shortcodes within menu titles.

2.4.1

  • Bug fix: fixed save_result undeclared variable error.

2.4

  • New Feature: Added a button to the WordPress text editor (classic mode) to allow users to easily insert shortcodes.
  • New Fetaure: Added a new shortcode sc-date. Allows you to do render today’s date and add or subtract days, months and years.

2.3

  • Improvement: sc-user-counts – Display a count of all WordPress users or the number of WordPress users for a given role e.g. [sv slug=”sc-user-counts” role=”subscriber”] or [sv slug=”sc-user-counts”].

2.2.1

  • Bug fix: Fixed issue with clone.

2.2

  • Improvement: Slugs can now be edited.

2.1

  • New Feature: Added the ability to clone your own shortcodes.

2.0.1

  • Bug fix: Fixed broken menu

2.0

  • New Feature: Added additional premium shortcodes.
  • New Feature: Inline editing of shortcodes from the main list screen.
  • New Feature: Able to disable / enable shortcodes from shortcode list.
  • Improvement: Refactoring and optimisation of the entire plugin code.
  • Improvement: Added Fooicons.
  • Improvement: Added simple form validation when adding a record.

1.8

  • Improvement: Added escaping for premade shortcodes.
  • Improvement: Added new shortcode „sc-privacy-url” for rendering Privacy URL link.

1.7.4

  • Version and readme.txt updated to reflect 4.8 compatibility.

1.7.3

  • BUG FIX: On the very first load of a variable it would return nothing. This was due to a bug in the code. The first load would display nothing to the user, however it would cache the shortcode correctly. Upon the next visit, the shortcode would render correctly!

1.7.2

  • When creating a new shortcode, „Disabled” is set by default to „No”.
  • Additional upgrade check added. This compares the previously stored version number against the new version number. If there is a difference, it will run the DB table check again.

1.7.1

  • BUG FIX: Tweak made to „on activate” so the code required to change the relevant database tables is called correctly.

1.7

  • Disable a variable. You can now disable a variable via the admin panel – if a shortcode is disabled nothing will be rendered in it’s place (will remove the shortcode though).

1.6.1

  • BUG FIX: Array declaration caused 500 error on non PHP 7

1.6

  • Now supports custom parameters. You can now add parameters when inserting a shortcode and specify where in the shortcode those parameters should appear.
  • BUG FIX: Removed a stray var_dump()

1.5.1

  • BUG FIX: „Add new” link for message „You haven’t created any shortcodes yet.” wasn’t working correctly
  • BUG FIX: Typo – „Shotcodes” instead of „Shortcodes” on „Your Shortcodes” page

1.5

  • Added a shorter shortcode slug. So, instead of [shortcode-variables slug=”your-slug-name”] you can also use [s-var slug=”your-slug-name”]
  • BUG FIX: Some pre-made shortcodes weren’t being rendered in the correct place. Fixed.

1.4

  • Added the new pre-made shortcodes:
    • sc-login-page – WordPress login page. Add the parameter „redirect” to specify where the user is taken after a successful login e.g. redirect=”http://www.google.co.uk”.
    • sc-username – Display the logged in username.
    • sc-user-id – Display the current user’s ID
    • sc-user-ip – Display the current user’s IP address.
    • sc-user-email – Display the current user’s email address.
    • sc-username – Display the current user’s username.
    • sc-first-name – Display the current user’s first name.
    • sc-last-name – Display the current user’s last name.
    • sc-display-name – Display the current user’s display name.
    • sc-user-agent – Display the current user’s user agent
  • BUG FIX: Deleting a shortcode from cache when deleted from Admin panel. This stops it getting rendered when removed from the plugin.

1.3.1

  • Added some messages to encourage people to suggest premade tags.
  • Added version numbers. These are stored in DB to aid future upgrades.

1.3

This was a dummy release to fix an SVN issue with the 1.2 release!

1.2

  • Added Premade shortcodes and framework to add additional ones
  • Added Top Level menu item to support two sub pages. One for user defined shortcodes and another for premade shortcodes.

1.1

  • Added caching to SQL queries. Therefore making shortcode rendering faster and reduce load on mySQL.
  • TinyMCE editor for editing shortcode content.
  • You can now specify other shortcodes within your shortcode variables.
  • Readme.txt fixes

1.0

  • Initial Release