Support » Plugin: Widget for Google Reviews » Shortcode: Values boolean falsy values are ignored.

  • Hello,

    I discovered by using your Plugin inside my theme as shortcode the following:
    Whether I disable lazy loading via the shortcode arguments it stays enabled.
    I use this code:
    [grw place_photo="/wp-content/themes/binary-theme/assets/images/logo-builder.png" place_name="binary-factory" place_id="ChIJ46PF1CIlv0cRqyRePX31mIg" reviews_lang="de" title="binary-factory" pagination="5" text_size="120" max_width="150" refresh_reviews=true dark_theme=true lazy_load_img=false reduce_avatars_size=true open_link=true nofollow_link=true view_mode="none"

    The problem here is that in grw-reviews.php you just use

    if ($lazy_load_img) {
        wp_register_script('rplg_blazy', plugins_url('/static/js/blazy.min.js', __FILE__));
        wp_enqueue_script('rplg_blazy', plugins_url('/static/js/blazy.min.js', __FILE__));

    Here the value is a string when using the shortcode.
    So this will always be truthy. Better would be
    if ($lazy_load_img === 'true' || $lazy_load_img === true)

    Or better add a block to transform the variables with a boolean value.

    $lazy_load_img = $lazy_load_img === 'true' || $lazy_load_img === true;
    $refresh_reviews = refresh_reviews === 'true' || $refresh_reviews === true;
Viewing 1 replies (of 1 total)
  • Plugin Author richplugins


    Hi @binaryfactory,

    Thank you for help us to improve the plugin, it’s great!

    We will investigate your solution and and consider adding this in the next version.


Viewing 1 replies (of 1 total)
  • The topic ‘Shortcode: Values boolean falsy values are ignored.’ is closed to new replies.