Use custom image size in bootstrap slider
-
I know you can set custom image sizes in functions.php using the add_image_size() function.
So I’ve added this to my functions.php:
add_image_size('portfolioSlider', 1110, 667, true);
How can you use this custom size in a bootstrap slider? I have this bootstrap slider that works fine:
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <?php $indicatorCount = 0; foreach ($projectPhotos as $projectPhoto): ?> <li data-target="#carouselExampleIndicators" data-slide-to="<?php echo $indicatorCount; ?>" class="<?php if ($indicatorCount == 0) echo 'active'; ?>"></li> <?php $indicatorCount++; endforeach; ?> </ol> <div class="carousel-inner"> <?php $slideCount = 0; foreach ($projectPhotos as $projectPhoto): ?> <div class="carousel-item <?php if ($slideCount == 0) echo 'active'; ?>"> <img src="<?php echo esc_url($projectPhoto); ?>" /> </div> <?php $slideCount++; endforeach; ?> </div> <a href="#carouselExampleIndicators" role="button" class="carousel-control-prev" data-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div>
What is the syntax for accessing the custom image size, all the examples I see are only focused on the featured image or post thumbnail.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Use custom image size in bootstrap slider’ is closed to new replies.