Support » Plugins » getting variable set in widget to display in .php style sheet

  • Hi
    I have written a drag and drop widget to display in the widgetized areas. The widget collects and saves all of the data that is input perfectly.

    I have added a style sheet style.php and but no matter what I try I am not getting the variables set in the widget to display in the style sheet.

    I have stripped my code down to where it will fetch the php style sheet and add the stylesheet to the head, when I click on it it is displaying the css but blank values.

    I know the widget is saving the data / variables in the wp_options table under “widget_text-style-widget”. I have tried all sort of tut I have found on the net but none have worked.

    My style.php code is below stripped down, please can someone help me to get it to fetch the variables.

    <?php header("Content-type: text/css"); ?>
    .text-desc .Arial {
    font-family:<?php echo $instance['p_font']; ?>
    color:<?php echo $instance['p_color']; ?>

    Thanks for the help

Viewing 1 replies (of 1 total)
  • I have added this to the php code

    add_action("parse_request", array(&$this, "process_request"));
    add_filter("query_vars", array(&$this, "add_wg2_query_vars"));

    public function add_wg2_query_vars ($qvars) {
    $qvars[] = "widget_text-style-widget";

    return $qvars;

    public function process_request($wp) {
    if (array_key_exists ("widget_text-style-widget", $wp->query_vars))
    $this->query["widget_text-style-widget"] = $wp->query_vars["widget_text-style-widget"];


    Unfortunately it gives me a T_PUBLIC parse error 🙁

Viewing 1 replies (of 1 total)
  • The topic ‘getting variable set in widget to display in .php style sheet’ is closed to new replies.