Home › Forums › Add-ons › Gallery Field › 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.
The topic ‘thumbnail-width and thumbnail-height’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.