Support » Plugins » [Plugin: Widget Context] can't target page by URL

Viewing 15 replies - 1 through 15 (of 38 total)
  • it works for me
    please don’t include the ending slash and than try i.e use only page

    Thank you! The examples should mention NOT using a trailing slash UNLESS it’s being used in combination with a wildcard. I tried everything (or so I thought) and was going mad! I could not get it to work at all. I was using the following:


    but thanks to this post I tried the below and it now works! Thank you!


    I’m trying to use this plugin with WP 3.0 Multisite, but for some reason, the target by url approach isn’t working at all. This is my setup:

    1. I have two blogs:

    2. I’m attempting to show a widget *only* on a page as such:
    – using the following rule in WidgetContext:
    – some-page-name
    – some-page-name/*
    – No such luck.

    3. I have even tried with the following rules:
    – en/some-page-name
    – en/some-page-name/*
    – fr/some-page-name
    – fr/some-page-name/*

    Is this plugin compatible with WP Multisite? I have had great success with it on standalone installations of WP, but this is the first time I’ve tried using it with MultiSite. Any suggestions would be most welcome.

    I think it must be something buggy with the plugin (or it has something to do with the WordPress install?).

    It’s strange, I was running WordPress 3.0.1 on a Window XP localhost install. This pluging (ver0.7) was working great.

    A coworkder migrated the site to a Server 2003 machine, using IIS, I reinstalled all the plugins I used on the previous box, and now I Widget Context isn’t working. All the widgets I want on the front page are there, however, when I select a TEXT box widget, SHOW ON SELECTED (all unchecked) –> TARGET BY URL:

    It won’t show. I tried many combinations, but this was the format I used on my XP box, and as I said, it worked fine that way.

    I even tried DISPLAY WIDGETS plugin too, and that won’t work. I’m guessing it might have something with the IIS configuration?

    I’m curious, are the rest of you also using IIS?

    Sorry I don’t know how to update plugins in the wordpress plugin database, but here’s a fix:

    In widget-context.php change this function:

    function get_current_url() {
    if ($_SERVER[‘REQUEST_URI’] == ”)
    $uri = $_SERVER[‘REDIRECT_URL’];
    $uri = $_SERVER[‘REQUEST_URI’];

    $url = (!empty($_SERVER[‘HTTPS’]))
    ? “http://”.$_SERVER[‘SERVER_NAME’].$uri
    : “http://”.$_SERVER[‘SERVER_NAME’].$uri;

    if (substr($url, -1) == ‘/’)
    $url = substr($url, 0, -1);

    return $url;

    To this one:

    function get_current_url() {
    $uri = $_SERVER[‘REQUEST_URI’];
    if (substr($uri, -1) == ‘/’) $uri = substr($uri, 0, -1);
    return $uri;

    You won’t be able to use the http or https versions of the target by URL anymore, but you shouldn’t be able to anyway because all the widgets are on the same domain.

    If I had more time I’d do a proper debug, but I’m in a hurry and wanted to share this because it’s the only plugin that offers this solution and I know plenty of others need it to work!!

    Hi. Thanks for posting this. I wasn’t able to get this working based on your code. 🙁

    What are you entering as the URL(s)?

    Finally somebody got it right…Big thank you jpmorganjr
    🙂 worked like a charm… show or hide with url entering as follows:
    /blogname/pageid…basicly everything but the http and domain name.
    repeat as many page as you like… Cheers

    Aha! –

    everything but the http and domain name.

    It DOES seem to work correctly. I’m likin’ this a lot, it came installed on a new clients site, so just stumbled across it – I’m donating the author something right now, (and you should too) 😉

    +1 to jpmorganjr. This did fix it.

    Just to be clear for others doing this, the syntax for targeting URLs differs from the widget-context documentation. Instead of “pagename” you enter “/pagename”.

    Thanks again!

    Try */?page_id=123
    or */pagename

    Nice Plugin – install and it works! Thanks for your coding time! Makes my WPMU site look and run a LOT better.



    +2 to jpmorganjr. Did the trick. Really appreciate your time and efforts!

    +3 to jpmorganjr. What a hero.

    Thanks jpmorganjr! The fix posted got this plugin working for me.

Viewing 15 replies - 1 through 15 (of 38 total)
  • The topic ‘[Plugin: Widget Context] can't target page by URL’ is closed to new replies.