WordPress.org

Ready to get started?Download WordPress

Forums

Weather Forecast - WP Wunderground
Passing Location Variable (2 posts)

  1. Mark
    Member
    Posted 2 years ago #

    I love the look and feel of this plugin, but was hoping I could pass a variable to it. Is this possible? I've tried passing it with shortcode too but that didn't work:

    <?php echo do_shortcode('[forecast location="'.the_resort_location_weather().'"]'); ?>

    Does anyone know how I could accomplish this?

    Thanks for the help!

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

  2. owens310
    Member
    Posted 2 years ago #

    After about 4.5 hours of banging my head, I finally found out how to pass parameters to this plugin. Your bit of code up top helped me.

    I am pulling locations from a database, so my variables are obviously being defined prior to the call. The code is as follows:

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

    The syntax that kept tripping me up is the need to include spaces before and after the period where the variable is named. Notice right after the first equals sign above there is a double-quote, a single quote, a space, a period, another space, the variable name, a space, and a single quote. I had tried many times without the spaces, and I could not get it to work.

    Hope this helps.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic