• Hi,

    Icons do not appear for mobile devices with WP 4.6

    And I think you can improve the way the main script is included, like checking if jquery is included before calling the script. I had to do a small modification with my theme so it can work. Not a big issue, just an idea how you can improve this plugin.

    Nice work btw,
    Cheers,
    Clément

    https://www.ads-software.com/plugins/selection-sharer/

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

    (@jcvangent)

    Care to share the changes you made? Were they part of changes in your theme or in the plugin code?

    Always willing to include suggestions of other people of course to make the experience better for everyone ??

    Thread Starter clemart

    (@clemart)

    Yes of course !

    In the plugin : I add a jquery dependency on wp_enqueue_script and delete the echo line.

    function enqueue_footer_scripts() {
    	wp_enqueue_script( 'selection-sharer-js', plugins_url('/js/selection-sharer.js', __FILE__),array('script-jquery'), false, '0.1');
    	//echo "<script>jQuery(document).ready(function ($) { $('p').selectionSharer();});</script>";
    }

    ‘script-jquery’ is the jquery script from my theme.

    In my theme : I call the selectionSharer() function in a javascript file

    $(function(){
        $('p').selectionSharer();
    });

    What are your thoughts ?

    Clément.

    Plugin Author jcvangent

    (@jcvangent)

    Why did you delete the echo line from the plugin and put the same thing straight into your theme file?

    The reason I add it with “jQuery(document).ready(function ($)” is exactly because of WordPress, as suggested here for example:

    https://premium.wpmudev.org/blog/adding-jquery-scripts-wordpress/

    Adding that extra jquery dependency seems like a best practice as well though, so might be a good thing to add that one.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘some things do not work with 4.6’ is closed to new replies.