Support » Plugin: Business Hours Indicator » [mbhi] and [mbhi_hours] Bug

  • Resolved JProffitt3G

    (@jproffitt3g)


    I am using Beaver Builder with this plugin, and I noticed that the [mbhi] and [mbhi_hours] shortcodes would not display anything when I inserted them into a Beaver Builder module.

    I took a look at the code and noticed class-bhi-public.php includes templates to output the html, however it doesn’t capture and return their output, but echos them directly. This breaks the shortcode in certain cases. I was able to fix the issue by wrapping the require statements like so:

    public function createShortcode($atts)
    {
    ...
    ob_start();
    
    require 'partials/shortcode.php';
    
    return ob_get_clean();
    }
    • This topic was modified 7 years, 6 months ago by JProffitt3G.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Maarten

    (@maartenbelmans)

    Thanks for letting me know and even better to include a fix! 🙂 I’ll patch this into the next version.

    Plugin Author Maarten

    (@maartenbelmans)

    This is done. Patched in v 1.7

    Plugin Author Maarten

    (@maartenbelmans)

    Just a heads up, I reverted back the code in 1.7.1 because other people were reporting that using output buffering didn’t make it work for them.

    I’ll have to find another way to make it work for Beaver builder. The weird thing is: for me it works. I downloaded the free BB plugin and I see the output in a HTML module. Can you give me some more info to debug this?

    Thread Starter JProffitt3G

    (@jproffitt3g)

    Sure, what I noticed is it would appear on the page, but in the wrong location. Here is an example:

    It should be appearing in the yellow box, but instead its the first child of the fl-post-content element. It appeared behind the map, so I lowered the opacity of the map for the purpose of the screenshot.

    You should be able to recreate it with a text/html module that has a large top-margin (to leave some space at top of post) and this shortcode as the content.

    This makes sense because the way Beaver Builder works is it hijacks the WordPress “the_content” filter, which expects an html string to be returned, which it’ll then echo. When Beaver Builder gets to this shortcode, the shortcode echoes html immediately to the page, and then Beaver Builder returns its html which gets echoed afterwards.

    Thread Starter JProffitt3G

    (@jproffitt3g)

    Alternatively you can create a WordPress page (no beaver builder required) with this markup:

    <p>I should be the first line</p>
    
    [mbhi]

    It should exhibit the same behavior and show the shortcode does not work as intended right now.

    • This reply was modified 7 years, 5 months ago by JProffitt3G.
    • This reply was modified 7 years, 5 months ago by JProffitt3G.
    Plugin Author Maarten

    (@maartenbelmans)

    Thanks for this!

    I was able to fix it and if you update to version 1.7.2, it should work for you 🙂

    Maarten

    Thread Starter JProffitt3G

    (@jproffitt3g)

    All looking good! Thank you very much Maarten, I’m loving this plugin! 🙂

    • This reply was modified 7 years, 5 months ago by JProffitt3G.
    Plugin Author Maarten

    (@maartenbelmans)

    Yay, thanks! :-). I’m thinking about future updates. I should add the ability to add a break in between the opening hours.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[mbhi] and [mbhi_hours] Bug’ is closed to new replies.