I often develop sites on my local machine before committing and transferring to a staging/live server, so during the development phase most of my sites reside on a URL similar to http://localhost:8800.

I was recently developing a WordPress site for a client and needed to show certain widgets depending on the current page, so the Widget Context plugin seemed ideal. However on my local machine I couldn’t get it to work, and couldn’t find anyone else on the web who had the same problem as me.

So as I started routing through the code, I noticed in widget-context.php the function “get_current_url”. I’m not sure why the developer didn’t just use get_bloginfo(‘siteurl’) (I’ve asked him via a discussion on the Wordpress Site), and another alternative is to use HTTP_HOST from the $_SERVER array, instead of SERVER_NAME.

« back

Related posts

Change the first row of a view in Drupal

I was just developing a Block View in Drupal for a freelance project, where the markup on the first row was different to the subsequent rows. I needed to change the markup to display an image and teaser, while the subsequent rows just has the title (which links to the node) and published date. …

13th April 2011

read more »

Sort a view using arguments in Drupal

Being able to sort a view using URL parameters seems like the most basic functionality, but it seems this is not possible using using views without some kind of module. I have to say Symphony handles this much better than Drupal. …

10th March 2011

read more »

Get the image path of a CCK file upload field in Drupal

I often like to use template files to alter the HTML of a view to cut down on the masses of redundant markup that Drupal creates. But I just came across a problem where I was unable to get the file path of an image in my content type, despite the fact that the image was output in the view settings. …

8th March 2011

read more »