Title: Shortcode Issues
Last modified: September 27, 2017

---

# Shortcode Issues

 *  [Brett Wysocki](https://wordpress.org/support/users/socki03/)
 * (@socki03)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/shortcode-issues-11/)
 * I think there are a couple of issues with the shortcode part of the plugin. I
   attempted to swap out the widget for just a simple shortcode, and a few things
   broke in the transition. Notably, I could not get it to load, kept returning 
   the ‘keep refreshing’ error message. I believe I figured out the reason for this
   issue, after doing some digging.
 * On lines 175 and 182, the same line of code reads:
    `$results = icit_fetch_open_weather(
   $appid, $city, $country, $display );`
 * But, according to the function in the helper class, the last parameter should
   be `$breakdown`, and not `$display`.
 * Line 9 of `/includes/helpers.php` reads:
    `function icit_fetch_open_weather( 
   $appid, $city = 'liverpool', $country = 'uk', $extended = false ) {`
 * And, I’m pretty sure, `$extended` is supposed to be `$breakdown`, since it was
   never passing a simple boolean false, but ‘none’ which should be only for the
   CSS.
 * On a different note, I simplified, and extended the parameters able to be passed
   in the shortcode by changing a few lines of code in icit-weather-widget.php. 
   Lines 103 – 110 read test individual shortcode atts to see if they read false
   and then set them appropriately to ‘false’.
 * I simplified the code to run a foreach loop on the defaults, tested if they were
   boolean by default, and if so, applied a filter_var on the current attribute 
   to verify it is indeed boolean, and, if not, doesn’t re-set the attribute.
 *     ```
       foreach( $this->defaults as $key => $default ) {
       	if ( is_bool( $default ) && !is_null( filter_var( $attributes[$key], FILTER_VALIDATE_BOOLEAN ) ) )
       		$attributes[$key] = filter_var( $attributes[$key], FILTER_VALIDATE_BOOLEAN );
       }
       ```
   
 * This worked for me, and extended the boolean variables in the shortcode.

The topic ‘Shortcode Issues’ is closed to new replies.

 * ![](https://ps.w.org/interconnect-it-weather-widget/assets/icon-256x256.png?rev
   =1003896)
 * [ICIT Weather Widget](https://wordpress.org/plugins/interconnect-it-weather-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/interconnect-it-weather-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/interconnect-it-weather-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/interconnect-it-weather-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/interconnect-it-weather-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/interconnect-it-weather-widget/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Brett Wysocki](https://wordpress.org/support/users/socki03/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/shortcode-issues-11/)
 * Status: not resolved