Support » Plugins » WPG2 & Shadowbox

  • Resolved grosbouff


    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’);

Viewing 2 replies - 1 through 2 (of 2 total)
  • Where exactly do you add this line ?

    Many thanks.

    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');

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WPG2 & Shadowbox’ is closed to new replies.