here $softhopper_pick; is Redux Global variable.
We know that to get redux value need to call redux Global variable. And sometimes in Wordpress post looping need to call $post etc global variable outside of a function or class. But themeforest reviewer said to me All global variables should be within a function or class.
I searched in google but I got no solution. If anyone know the solution please inform me.
I donāt know how Redux stores its options but I use get_theme_mod() to get values saved by options framework (SMOF), alternatively it can be get_option().
It can be something like this: $value = get_theme_mod( 'option_name' ); if ( ! empty( $value ) { echo $value; // or do anything else }
Hello Webdenim,
Thanks your help, Temporary I solve this problem like this:-
$softhopper_pick = get_option(āsofthopper_pickā); // here softhopper_pick is the redux global option name;
But I donāt yet understand why reviewer soft reject this issue.
Wordpress theme standard isā¦ Uhmmā¦ How should I put it? Stupid as !@#$. Donāt use global, except inside functions or classes? Oh ok, fine, seems justifiable, but there is an inci tinci tiny problem. The footer.php file for example is included from WITHIN A FUNCTION called get_footer. Thus does it make any sense to you? Cause it sure doesnāt to meā¦
Meeh fine, lets take another exampleā¦
Hook me up babyā¦ o.O
No really, use an overloaded action / filter system, so that you can hook up together and dance a bit and just break someone elseās ( !@#$ ) code, while your at it. A classic do{ } while(); in terms of php.
God Iām pissedā¦ Do any of these reviewers actually have any idea about code optimization and PHP itself? I mean Iām no expert on all of the matters, but some of the things that are required by WordPress to make a theme are just plain old stupid.
I didnāt mean to trash anyone, but god I had to get it out.
Regarding your original questionā¦ I did it with a do action and made the logic inside the function.
For example, Iām using global variables to pass some information from a template ( single.php ) to a ātemplate partā ( get_template_part() ). How would I go about putting that in a function?