• Resolved coffeeandmore23

    (@coffeeandmore23)


    Hi there,

    I`, in a very odd situation. I installed the plugin and everything looks superb, but only on the second load….?

    So the first time i load the site it only shows some text (size etc.) without any form of interaction.

    If i load again, the plugin with all its functions shows up. It’s very strange. Do you have an idea what could be the issue here? Something isn’t loading but why..?

    I use the semplice theme and haven’t activated any cache plugins – nothing.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter coffeeandmore23

    (@coffeeandmore23)

    You can see the TEST site here:
    https://lakelovetravel.com/shop/sauvage

    Plugin Author kontur

    (@kontur)

    I recall another user reporting issues once with using the Semplice theme.

    The problem seems to be that Semplice loads part of the page via AJAX requests (e.g. not loading the entire page, but only parts of it). Fontsampler libraries are only getting loaded when a WordPress page uses the shortcode. The problem with Semplice thus is that it fetches only part of the page (where Fontsampler is used) and does not trigger this loading of Fontsampler libraries. One thinkable approach would be to force loading the Fontsampler libraries on any page, so that when Semplice loads a partial page with a Fontsampler on it, the libraries are available. For this, you’d want to add these to your theme’s functions.php:

    add_action('wp_enqueue_scripts', function () {
        wp_enqueue_style('fontsampler-css', '/wp-content/plugins/fontsampler/css/fontsampler-css.css');
        wp_register_script('fontsampler-js', '/wp-content/plugins/fontsampler/js/fontsampler.js', array('jquery'), false, false);
    });

    (Untested code, but it should point you in the right direction).

    You might also want to contact Semplice support, since essentially it is their violation of WordPress standards that is the root cause of this problem.

    Hope this helps you out,
    -Johannes

    As for your second question, you set the default size of the text under the Features > Font size (even if you do not use the font size slider feature you can set the initial font size there).

    Plugin Author kontur

    (@kontur)

    I’ll close this issue for now. It’s a shame Semplice is being a somewhat unconventional at the cost of other plugins, sometimes.

    Hi @kontur

    Thank you for support and this nice plugin.
    I’m developping a theme using ajax page load. I tried to figure out how to load Fontsampler correctly had troubles to get it working.
    Using the code you provided doesn’t load the JS file but the CSS does.
    Using wp_enqueue_script instead of wp_register_script do load the JS file, obviously.
    But then Fontsampler is not initialized (cf. https://www.pepite.world/wp-content/uploads/2020/04/Annotation-2020-04-16-164054.png).
    Then I managed to initialize by calling fontsamplerSetup() in Chrome debug console.
    How should I use this function to gracefully initialize all samplers in page ? Or is the function to use and nothing else ?

    Thank you again for this masterpiece of plugin for WordPress.

    Plugin Author kontur

    (@kontur)

    Hey there,

    pretty good detective work ??

    I added the “fontsamplerSetup()” at one point specifically for this use with AJAX driven sites. That method will check and not re-initialize any fontsamplers that are already initialized, so you should be able to call it whenever the shortcode html has loaded into the DOM (how that event is triggered depends on your theme and what events it exposes for you to interface with). You can use the “fontsampler.events.init” and the CSS classes on the wrapper element itself to interact with the Fontsampler and show/hide it depending on status.

    Best,
    Johannes

    Working great!
    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Not showing up when loading the first time’ is closed to new replies.