An alternative to Widget Context plugin?

I rely pretty heavily on the 'Widget Context' plugin (, which allows me to show or hide widgets based on a number of criteria, and specifically I use the "target by URL" field. I use it because we have a network site of photographers, and the idea is that using Widget Context they can show an Widget that has a short bio, links, etc. on just their gallery posts, and then they can also have their own adsense codes in the widgets. Likewise, I use it to show ads on every page except for individual galleries.

As it turns out, that plugin doesn't work with Wordpress 3.3+ according to most users and the author, and for myself it works off and on. Is there an alternative or can one be created easily? I found the 'Widget Logic' plugin, but that doesn't allow me to target by URL. Any help would be much appreciated.

  • Kimberly

    Hello Tunelab!

    I'm only familiar with Widget Logic myself.

    This seems to be the code to filter the show by url

    // Check if user has specified the absolute url
    		// else strip home url and check only REQUEST_URI part
    		if ($path !== $home_url && !strstr($patterns, $_SERVER['SERVER_NAME']))
    			$path = str_replace($home_url, '', $path);

    and farther down

    // Check by current URL
    		if (!empty($vis_settings['url']['urls'])) {
    			// Split on line breaks
    			$split_urls = split("[\n ]+", (string)$vis_settings['url']['urls']);
    			$current_url = $this->get_current_url();
    			foreach ($split_urls as $id => $check_url) {
    				$check_url = trim($check_url);
    				if ($check_url !== '') {
    					if ($this->match_path($current_url, $check_url))
    						$do_show_by_url = true;
    				} else {
    					$ignore_url = true;
    			if (!$ignore_url && $do_show_by_url)
    				$do_show_by_url = true;
    				$do_show_by_url = false;

    Perhaps another member will have a suggestion on how to make this work :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.