Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Tips, Tricks & Tutorials
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Important - The support forums are now in "read-only" mode as we transition to an alternative help desk solution. Feel free to contact us here with any of your questions or search the forums for an existing solution.
 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 10th, 2012, 02:26 PM
worldcorponline worldcorponline is offline
 
Join Date: Mar 2012
Posts: 5
Default Widget Context Fix

This seems like it would have come up by now, but I somehow can't find a reference to it on the site so I thought I'd post it as a Tip.

On my site using WP 3.3.1 and the Argentum Theme by WooThemes, I couldn't get the Widget Context plugin to work. Curiously, if I set it to show by URL it would be hidden on every URL, and if I set it to hide by URL it would show on every URL. No level of filtering by URL seemed to work.

The fix is this:

1. Open widget-context.php in your plugins/widget-context/ folder

2. Find the get_current_url() function:

Code:
function get_current_url() {
 if ($_SERVER['REQUEST_URI'] == '')
 $uri = $_SERVER['REDIRECT_URL'];
 else
 $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;
 }
3. Replace the function with this updated one:

Code:
function get_current_url() {
 $uri = $_SERVER['REQUEST_URI'];
 if (substr($uri, -1) == '/') $uri = substr($uri, 0, -1);
 return
This does remove some flexibility in specifying http or https, but it was not an issue on my site. This tip was found on the wordpress.org support forum and was originally written by jpmorganjr.
__________________
wco12
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
widget magnifeco Problems 3 October 2nd, 2011 10:14 AM
Hide Widget schemjo Questions 2 July 14th, 2011 06:30 PM
Widget context plugin issue.... gutfeelboy Questions 3 June 29th, 2011 04:43 PM
Filtering with widgets and Widget Context plugin error feri Problems 6 February 22nd, 2011 01:54 PM


All times are GMT -5. The time now is 05:59 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.