WordPress.org

Forums

Weather Underground
PHP Widget and do_shortcode (1 post)

  1. bst
    Member
    Posted 2 years ago #

    I am trying to use custom fields to pull through the location from a post/page and use as a widget in the sidebar

    I have found the following thread where someone has got it working but the code doesnt appear to work for me:

    <?php echo do_shortcode('[forecast location="' . $city . ' , ' . $state . '" caption="' . $city . ' , ' . $state . '" numdays="3" iconset="Cartoon" class="css_table_class" cache="true"]'); ?>

    This is what I have and it works:

    <?php
    $city = get_the_title();
    $country = UK;
    echo do_shortcode ('[forecast location= "London, ' . $country . '" caption=" ' . $city. ', ' . $country . '" numdays="2" iconset="Cartoon" class="css_table_class" cache="true"]'
    );
    ?>

    HOWEVER, as soon as I try to pull in the $city and replace the above code for the forecast location= with

    "' . $city . ', ' . $country . '" it stops working

    Anyone have any ideas please?

    http://wordpress.org/extend/plugins/wunderground/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Weather Underground
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic