• Resolved enekoprins

    (@enekoprins)


    Another quick question.

    We are using King Composer as a visual editor and it includes by default prettyPhoto (which is a lot worse than SwipeBox :). I have already raised the same question in the KC forum but wanted to launch it here also.

    Is it possible to let swipebox take over the images included with the King Composer editor?

    The code generated by KC is:

    <a rel="prettyPhoto" class="kc-pretty-photo swipebox kc-pt-loaded" href="https://../wordpress/wp-content/uploads/2017/02/file-11.jpg" title="" target="">

    As you can see, “swipebox” is included in the tag but the rel=”prettyPhoto” seems to take the upper hand.

    Any help would be really appreciated.

    Thanks,
    Eneko

    • This topic was modified 7 years, 8 months ago by enekoprins.
    • This topic was modified 7 years, 8 months ago by enekoprins.
    • This topic was modified 7 years, 8 months ago by enekoprins.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Leonardo Giacone

    (@leopeo)

    Hi @enekoprins,
    King Composer is enqueueing PrettyPhoto stylesheet and Javascript.
    Unfortunately, I haven’t found any option to disable them within plugin settings…I might be wrong.

    I would try to dequeue those files how WordPress suggests:

    https://codex.www.ads-software.com/Function_Reference/wp_deregister_style
    https://codex.www.ads-software.com/Function_Reference/wp_dequeue_style

    https://codex.www.ads-software.com/Function_Reference/wp_deregister_script
    https://codex.www.ads-software.com/Function_Reference/wp_dequeue_script

    1) Open your theme/child theme functions.php file using a text editor (backup it first…)

    2) Copy and paste the following function:

    add_action( 'wp_enqueue_scripts', 'remove_prettyPhoto', 99999 );
    function prettyPhoto() {
        wp_dequeue_style( 'prettyPhoto' );
        wp_deregister_style( 'prettyPhoto' );
        wp_dequeue_script( 'prettyPhoto' );
        wp_deregister_script( 'prettyPhoto' );
    }

    3) Save and upload

    This function is dequeuing and deregistering all the prettyPhoto files (CSS and scripts).

    With the number at the and of this string (99999):
    add_action( 'wp_enqueue_scripts', 'remove_prettyPhoto', 99999 );
    we try to come after the function used by King Composer to set prettyPhoto.
    Unfortunately, it happens very late in the code execution, so it’s harder for us to overwrite it.

    Please let me know if this is working.
    Thank you,

    Leonardo

    Thread Starter enekoprins

    (@enekoprins)

    This code actually does not remove the (rel=”prettyPhoto”) tag which King Composer still includes, but it doesn’t do anything with it. So I have SwipeBox combined with the “Responsive Lightbox” plugin just look for and handle the prettyPhoto tag.

    A bit of a workaround but it works for now. The people at King Composer replied that they will try in future releases to have King Composer be flexible in what lightbox tag to use.

    Until then, I can continue like this. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Having swipebox take over from King Composer’s prettyPhoto’ is closed to new replies.