Viewing 5 replies - 1 through 5 (of 5 total)
  • @testerderesta,

    Yes, the issue is that the WP Float author hasn’t utilized the do_shortcode() function when outputting the content. Thankfully, WordPress gives us a hook where we can add that in without having to make any changes to the WP Float plugin.

    Here is the code:

    add_filter( 'widget_display_callback', 'process_shortcodes_in_wp_float', 10, 3 );
    function process_shortcodes_in_wp_float( $instance, $this, $args ) {
    	if ( is_a( $this, 'WP_Float' ) ) {
    		$instance['html'] = do_shortcode( $instance['html'] );
    	}
    	return $instance;
    }

    Just drop that in your active theme’s functions.php file and it should start working for you. I’ve tested it, so I know it works.

    Thread Starter testerderesta

    (@testerderesta)

    If you wore a cape, I’d call you a superhero!

    Thanks a lot, man! Big help!

    Thanks! Glad I could help!

    Hi Micah,

    That solution doesn’t seem to want to work for me…I need to apply a floating form, so I have the WPfloat plug-in installed and working, and another plug-in called Visual Form Builder. I am using a theme called Minamaze and I copied and pasted the above code into the functions.php file on that theme. The form plug-in is working – there is even an “add form” button on the WPfloat plugin content window, but all it does is display the form shortcode in plain text in my floating widget. Any insight into what I might be doing wrong or what else might be wrong? Thanks man – I appreciate it.

    @topside,

    This thread has been marked as resolved and is specific to the mPress Image Refresh plugin. The best thing to do is to create a separate ticket, most likely on the WP Float plugin support section. This way, you’ll attract the attention of the WP Float plugin author.

    The code I provided above hooks into WordPress core and basically processes shortcodes specifically for the WP Float plugin. I can’t think of any reason why the code wouldn’t work, unless your theme or a plugin is removing actions on the ‘widget_display_callback’ hook. I’m sure there could be other reasons, but the only way to figure it out would most likely to delve into the code on your site.

    You can, however, do a bit of troubleshooting on your end to determine if there is a plugin or theme conflict. Check out steps 3 & 4 here for details: https://www.orderofbusiness.net/blog/troubleshooting-wordpress-plugins/

    Just be aware that switching themes when you’ve added the code to the theme could be a problem. ?? You’ll want to test by adding the code to a default WordPress theme and then remove it after testing.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Widget’ is closed to new replies.