Hello. Thank you for contacting the Toolset support.
Well - you can display either post featured image or custom image field using Toolset.
To display the media gallery image, you will have to use the custom shortcode.
Here is a sandbox site and you can auto-login to it using the following link:
- hidden link
Please check the following test page:
- hidden link
To display those images as gallery with popup, I've created the following view:
- hidden link
Where I've added the following code to "Loop Editor" section:
[wpv-layout-start]
[wpv-items-found]
<div class="tb-repeating-field tb-repeating-field--crop">
<div class="tb-repeating-field--grid">
<!-- wpv-loop-start -->
<wpv-loop>
<div>
<a href='[attach-url type="url" id="[wpv-post-id]"]' rel="gallery-1" class="thickbox"> [attach-url id="[wpv-post-id]"] </a>
</div>
</wpv-loop>
</div>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
I've created the following custom shortcode and added it to "Custom Code" section offered by Toolset:
=> hidden link
//// adding thickbox
add_action('wp_enqueue_scripts', 'add_thickbox');
//// getting attachment url or attachment image
add_shortcode('attach-url', function($atts, $content){
$custom = [ 'class' => 'image', 'alt' => 'alt text', 'title' => 'my title' ];
if(isset($atts['type']) and $atts['type']=='url'){
return wp_get_attachment_url($atts['id'],'medium');
}else{
return wp_get_attachment_image($atts['id'], 'medium', false, $custom );
}
// return wp_get_attachment_url($atts['id']);
});
And added the following CSS code to CSS editor of the view:
.tb-repeating-field--grid {
grid-template-columns: 1fr 1fr 1fr ;
grid-column-gap: 2px;
grid-row-gap: 2px;
display: grid;
justify-items: center; }
.tb-repeating-field--grid img,
.tb-repeating-field--grid video {
max-width: 100%;
display: block;
box-shadow: none !important; }
.tb-repeating-field:not(.tb-repeating-field--crop) .tb-repeating-field--grid {
align-items: center; }
.tb-repeating-field--crop .tb-repeating-field--grid div,
.tb-repeating-field--crop .tb-repeating-field--flexbox div {
width: 100%; }
.tb-repeating-field--crop .tb-repeating-field--grid div img,
.tb-repeating-field--crop .tb-repeating-field--flexbox div img {
-o-object-fit: cover;
object-fit: cover;
height: 100%;
width: 100%; }
.tb-repeating-field--flexbox {
display: flex; }
.tb-repeating-field--flexbox img {
display: block;
box-shadow: none !important; }
.tb-repeating-field--masonry {
display: flex;
flex-flow: row wrap;
margin-left: -8px;
/* Adjustment for the gutter */
width: 100%; }
.tb-repeating-field--masonry-brick {
flex: auto;
height: 250px;
min-width: 150px;
margin: 0 8px 8px 0;
/* Some gutter */ }
@media only screen and (min-width: 1024px) {
.tb-repeating-field--masonry-brick:nth-child(4n+1) {
width: 250px; }
.tb-repeating-field--masonry-brick:nth-child(4n+2) {
width: 325px; }
.tb-repeating-field--masonry-brick:nth-child(4n+3) {
width: 180px; }
.tb-repeating-field--masonry-brick:nth-child(4n+4) {
width: 380px; } }
@media only screen and (max-width: 1023px) and (min-width: 768px) {
.tb-repeating-field--masonry-brick:nth-child(4n+1) {
width: 200px; }
.tb-repeating-field--masonry-brick:nth-child(4n+2) {
width: 250px; }
.tb-repeating-field--masonry-brick:nth-child(4n+3) {
width: 120px; }
.tb-repeating-field--masonry-brick:nth-child(4n+4) {
width: 280px; } }
.tb-repeating-field--masonry-brick img,
.tb-repeating-field--masonry-brick iframe,
.tb-repeating-field--masonry-brick video {
-o-object-fit: cover;
object-fit: cover;
width: 100% !important;
height: 100% !important;
display: block; }
.editor-block-list__block-edit .tb-repeating-field--masonry-brick {
height: 130px; }
.editor-block-list__block-edit .tb-repeating-field--masonry-brick:nth-child(4n+1) {
width: 150px; }
.editor-block-list__block-edit .tb-repeating-field--masonry-brick:nth-child(4n+2) {
width: 180px; }
.editor-block-list__block-edit .tb-repeating-field--masonry-brick:nth-child(4n+3) {
width: 90px; }
.editor-block-list__block-edit .tb-repeating-field--masonry-brick:nth-child(4n+4) {
width: 210px; }
More info:
- https://toolset.com/documentation/legacy-features/views-plugin/create-image-galleries-using-repeating-custom-fields/
- https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/
I hope this is enough information to drive you and display the media images as gallery.