• Resolved maltco

    (@maltco)


    Trying to use this with a block that contains shortcode, and hide based on screen size. Unfortunately, it doesn’t work on either desktop or mobile. Not working at all. Please advise.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Nick Diego

    (@ndiego)

    Hi @maltco,

    I sincerely apologize for the trouble. I need to add this to the documentation and will include a notice in the next release of the plugin. The screen size control does not work with the shortcode block. All other controls will work though. The reason is that the control adds a CSS class to the selected block that then shows or hides the block based on the size of the screen. Because the shortcode block just renders whatever is in the shortcode, there is no way to add the necessary class to the shortcode content.

    That said, there is an easy work around!

    If you put your shortcode block inside of a Group block, you can apply the screen size settings to the Group block. Then everything should work as you expect it to.

    Let me know if I can answer any additional question or provide further assistance!

    Best,
    Nick

    Thread Starter maltco

    (@maltco)

    Nick, thanks for the very quick reply. I figured it had something to do with the shortcode.

    Just an FYI. I also tried the plugin Responsive Block Control, which didn’t work either, probably for the same reason. Interestingly, I also tried Conditional Blocks, which did work.

    Plugin Author Nick Diego

    (@ndiego)

    Thanks for the followup @maltco.

    Yes, Conditional Blocks wraps the shortcode block content in a div with the appropriate CSS classes attached to that div. This definitely work, but can have some unintended consequences as well since it potentially adds unexpected markup to the page. Obviously requiring a shortcode block to be nested in a group block is also not ideal ??, but I have decided to not add any additional markup with this plugin.

    In the upcoming version, I will add a notice that pops up when a user adds the screen size control to the shortcode block which outlines the situation and directs them towards the workaround. Someday, all shortcodes might become blocks themselves!

    Again I apologize for any frustrations this may have caused and thanks for giving Block Visibility a try.

    Best,
    Nick

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pugin not working for mobile and desktop controls’ is closed to new replies.