Support

Account

Home Forums Add-ons Gallery Field thumbnail-width and thumbnail-height

Solving

thumbnail-width and thumbnail-height

  • HI. How do I register thumbnail-width = 160px and thumbnail-height 390px? ” alt=”<?php echo $image[‘alt’]; ?>” />

    <?php 
    
    $images = get_field('gallery');
    
    if( $images ): ?>
        <ul>
            <?php foreach( $images as $image ): ?>
                <li>
                    <a href="<?php echo $image['url']; ?>">
                         <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
                    </a>
                    <p><?php echo $image['caption']; ?></p>
                </li>
            <?php endforeach; ?>
        </ul>
    <?php endif; ?>
  • add this or something similar to functions.php or your plugin
    <?php add_image_size( 'my_thumb', '160', '390', true );?>

    after that you can use your created size inside your layout-loop

    <?php 
    
    $images = get_field('gallery');
    
    if( $images ): ?>
        <ul>
            <?php foreach( $images as $image ): ?>
                <li>
                    <a href="<?php echo $image['url']; ?>">
                         <img src="<?php echo $image['sizes']['my_thumb']; ?>" alt="<?php echo $image['alt']; ?>" />
                    </a>
                    <p><?php echo $image['caption']; ?></p>
                </li>
            <?php endforeach; ?>
        </ul>
    <?php endif; ?>
  • Help me find a script that plugin Gallery. Seen references to the site, but now can not find it.

  • what did you mean with:

    Help me find a script that plugin Gallery.

    did you mean something like: simple lightbox?
    if yes look at my post inside this thread to get a sample that should work.
    primary you need :

    if ( function_exists('slb_activate') ){
    $content = slb_activate($content);
    }

    where $content is output of gallery before you echo it echo.

    but you could add any js that provide the popup-functionality when you know how to structure your output and how to apply the needed js.

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘thumbnail-width and thumbnail-height’ is closed to new replies.