Support » Plugin: Business Hours Indicator » PHP code not working after update

  • Resolved Niels Tieman

    (@niels-tieman)


    Hi,

    I downloaded the update tonight and update-ted to the new PHP code. After that, and with the old code, it wouldn’t display anything. The WP shortcode is working in a post I tested, but the PHP code doesn’t seem to work correctly (or I’ve done something wrong.)

    The code used: <?php do_shortcode(‘[mbhi location=”atoriana”]’) ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Maarten Belmans

    (@maartenbelmans)

    Hi Niels,

    Thanks for reporting this. It’s fixed but you’ll have to update to version 1.7.1 🙂

    Sorry for the inconvenience!

    Maarten

    Hi Maarten,

    I have update-ted it once again and the newest update is working like a charm.

    Thanks for the quick update.

    Niels

    Hello Niels, Maarten, I think this is intended WordPress behavior. do_shortcode does not echo html, it only returns it. You have to echo it yourself. See documentation on example usage: https://developer.wordpress.org/reference/functions/do_shortcode/

    If you modified the code to be <?php echo do_shortcode(‘[mbhi location=”atoriana”]’) ?> it should work properly. Before the 1.7.0 update, this plugin had a bug where it echoed the html and returned nothing, but that is a bug and not a feature. So you have two wrongs making a right here.

    You can make that modification and it’ll work both before and after the bug is fixed.

    If this is the issue then I propose the fix be reimplemented in 1.7.2.

    Hello!

    I used your echo code on the new 1.7.2 update and that works for the mbhi and mbhi_hours.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP code not working after update’ is closed to new replies.