Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
848 views
in Plugins by
I have a value set in an advanced theme and would like to access it from a plugin.

Is that basically possible?

I have tried in the theme:

   class qa_html_theme extends qa_html_theme_base {
        var $blockaccess = false;

And in the plugin page:

   var_dump($this->blockaccess);

without success.
by
Is this a layer plugin or a different type?
by
It is a page module, not a layer.

1 Answer

+1 vote
by
selected by
 
Best answer

No, that's not really possible because page plugins are only supposed to define the content of the page, not the look. In fact they run before the theme is even initialised (see the bottom of qa-page.php).

The opposite is possible however - if you've modified something in the $qa_content array in your plugin, that will be available in the theme. So depending on what your variable is, that could work.

Your best bet might be an option that you retrieve in both the page plugin and theme using qa_opt().

by
Finally I also thought of qa_opt() as the best option.
by
What is your "blockaccess" variable and what do you use it for? You may not need to use the theme at all.
by
Nope, was just an example name...
...