The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] WPG2 & Shadowbox (3 posts)

  1. grosbouff
    Posted 7 years ago #

    This is just for me to remember...
    But I found a way to make WPG2 work with Shadowbox (using jquery).
    There are two problems :
    1) changing rel="lightbox[x]" attribute to rel="shadowbox[x]" : not really necessary because shadowbox understands makes it compatible.

    2) gallery generates php images. Shadowbox thinks that it has to show a web page and so the size of the box is not the size of the picture.
    So we have to tell it it's a picture.
    To do it; we have to add ";player=img" to the rel attribute.

    SOLUTION (one line !)
    $(".wpg2tag-image a").attr('rel',$(".wpg2tag-image a").attr('rel')+';player=img');

  2. supergab
    Posted 7 years ago #

    Where exactly do you add this line ?

    Many thanks.

  3. grosbouff
    Posted 7 years ago #

    In a JS file that call from functions.php in my theme :


    if (!is_admin()) { //so it's not loaded in the admin part
    	add_action('wp_head', 'myOwnTheme_css');
    	add_action( 'wp_print_scripts', 'myOwnTheme_init' );
    function myOwnTheme_css() {
    //echo style here if you want to
    function myOwnTheme_init() {
    		wp_register_script( 'myscripts-wp', get_template_directory_uri().'/js/javascript.js', array( 'jquery'), '1' );
    		wp_enqueue_script( 'myscripts-wp' );


    $(document).ready(function() {
    		/*SHADOWBOX + WPG2*/
    		$(".wpg2tag-image a").attr('rel',$(".wpg2tag-image a").attr('rel')+';player=img');

Topic Closed

This topic has been closed to new replies.

About this Topic