• Resolved pagol

    (@pagol)


    it was totally full oneday i took find out my problem. my code was work before nicely but after i install this plugins. my code not work. i had no idea what wrong my code.. then lot of RnD i did then found this is for this plugins… my code is custom gallery. bellow is my code.. any idea why and how to fix it ?

    function custom_gallery_shortcode( $attr = array(), $content = '' )
    
    {
    
            $attr['itemtag']        = "li";
            $attr['icontag']        = "";
            $attr['captiontag']     = "p";
    
            // Run the native gallery shortcode callback:
            $html = gallery_shortcode( $attr );
            // Remove all tags except a, img,li, p
            $html = strip_tags( $html, '<a><img><li><p>' );
            // Some trivial replacements:
            $from = array(  
    
                "class='gallery-item'",
                "class='gallery-icon landscape'",
                'class="attachment-thumbnail"',
                'a href=', 
    
            );              
    
            $to = array( 
    
                '',
    
                '',
    
                '', 
    
                'a class="lightbox" href=', 
    
            );
    
            $html = str_replace( $from, $to, $html );
    
            // Remove width/height attributes:
    
            $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
            // Wrap the output in ul tags:
    
            $html = sprintf( '<ul class="gallery">%s</ul>', $html );
    
            return $html;
    
    }
    
    add_shortcode( 'gallery', 'custom_gallery_shortcode' );
    add_filter( 'use_default_gallery_style', '__return_false' );

    https://wordpress.org/plugins/events-manager/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    sorry but not familiar with your code, can I know what is happening before and what is happening now (what are the errors and where are you using this)?

    Thread Starter pagol

    (@pagol)

    normally when you add gallery in any page or post then html format like beloow

    <div id="gallery-1" class="gallery galleryid-123 gallery-columns-3 gallery-size-thumbnail">
    <dl class="gallery-item">
    <dt class="gallery-icon landscape">
    <a href="..../banner-41.jpg"><img width="250" height="150" src="...../banner-41-250x150.jpg" class="attachment-thumbnail" alt="banner-4"></a>
    </dt>
    </dl>
    
    <dl class="gallery-item">
    <dt class="gallery-icon landscape">
    <a href="..../banner-41.jpg"><img width="250" height="150" src="...../banner-41-250x150.jpg" class="attachment-thumbnail" alt="banner-4"></a>
    </dt>
    </dl>
    
    <dl class="gallery-item">
    <dt class="gallery-icon landscape">
    <a href="..../banner-41.jpg"><img width="250" height="150" src="...../banner-41-250x150.jpg" class="attachment-thumbnail" alt="banner-4"></a>
    </dt>
    </dl>
    ....
    </div>

    but if you add my code then html format will change to..

    <ul class="gallery">
    <li> <a data-caption="Snack bar" class="ilightbox" href="...../Snack-bar-1024x682.jpg"><img src="..../Snack-bar-1024x682-150x150.jpg" alt="Snack bar"></a></li>
    
    <li> <a data-caption="Snack bar" class="ilightbox" href="...../Snack-bar-1024x682.jpg"><img src="..../Snack-bar-1024x682-150x150.jpg" alt="Snack bar"></a></li>
    
    <li> <a data-caption="Snack bar" class="ilightbox" href="...../Snack-bar-1024x682.jpg"><img src="..../Snack-bar-1024x682-150x150.jpg" alt="Snack bar"></a></li>
    
    ....
    </ul>

    but i have no idea why conflict with that gallery shortcode

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘one of function code conflict with this plugins’ is closed to new replies.