Skip to content

Instantly share code, notes, and snippets.

@aalimran07
Last active June 3, 2018 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aalimran07/e6bac0f24a47cb3af195fb2e67332f03 to your computer and use it in GitHub Desktop.
Save aalimran07/e6bac0f24a47cb3af195fb2e67332f03 to your computer and use it in GitHub Desktop.
Make function with a global variable for getting data
<!-- Use this code instead including every file global $opt_name
You just copy this code and past it in your theme function.php and then change your options global veriable.
-->
if (! function_exists('redux_options')) {
function redux_options($id, $fallback = false, $key = false)
{
global $industryall;
if ($fallback == false) {
$fallback = '';
}
$output = ( isset($industryall[ $id ]) && $industryall[ $id ] !== '' ) ? $industryall[ $id ] : $fallback;
if (! empty($industryall[ $id ]) && $key) {
$output = $industryall[ $id ][ $key ];
}
return $output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment