• itwork46

    (@itwork46)


    Hello!

    I want to define an array of posts from which I want to get galleries and display them in one page.

    I tried it through code acf_post_id="7291, 7297, 7299" , but it doesn’t work. I can only specify one post ID, but how do I specify an array of posts?

    My shortcode:

    [ajax_load_more acf_post_id=7291, 7297, 7299″ posts_per_page=”24″ acf=”true” acf_field_type=”gallery” acf_field_name=”coloring_gallery” seo=”true” pause=”true” scroll=”false” transition_container_classes=”row row-cols-2 row-cols-md-4 g-3 g-lg-4 mt-0 itemlist”]

    Are there any quick solutions? I tried looking at the plugin code in ajax-load-more-for-acf.php, but didn’t find anything.

    Thank you!

    • This topic was modified 2 years ago by itwork46.
    • This topic was modified 2 years ago by itwork46.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    @itwork46 You can only get a gallery from a single post ID. At this time, the plugin is not capable of fetching and merging multiple galleries in a single instance.

    Thread Starter itwork46

    (@itwork46)

    Thank you, very sorry to hear that, then I will have to look for other solutions.

    Thread Starter itwork46

    (@itwork46)

    Okay, I found a solution.

    This is the code I use in the repeater template

    <?php
    global $post; 
    $thumb_size_small = wp_get_attachment_image_src( $post->ID, 'single-coloring-thumb', true );
    $thumb_url = get_permalink( $post->ID );
    ?>
    <div class="itemlist-block hover-style-2 fancybox" data-fancybox data-type="ajax" data-link="<?php echo $thumb_url; ?>">
    	<div class="itemlist-block__top">
        	<img src="<?php echo $thumb_size_small['0']; ?>">
    	</div>
    	<div class="itemlist-block__bottom d-block ta-center fz-14 fz-sm-15 fz-xxl-16 lh-1-3">
    		<span><?php echo $post->post_excerpt; ?></span>
    	</div>
    </div>

    This is a finished shortcode. It allows me to show all the images from all the galleries of the posts I want.

    [ajax_load_more post_type="attachment" posts_per_page="24" post_status="inherit" post__in="' . $gallery_child_ids . '" post__not_in="' . $thumb__not_in . '" transition_container_classes="row row-cols-2 row-cols-md-4 g-3 g-lg-4 mt-0 itemlist" pause="true" scroll="false" preloaded="true"]

    I just get all the images that exist in the media post_type="attachment", of which I leave only those that exist in the galleries of the posts I want, and leave only the unique ones (which are not on the current page).

    Here I leave all the images from all the galleries from the different posts.

    post__in="' . $gallery_child_ids . '"

    Here I remove all images that exist in the gallery of the current post (so there are no duplicates)

    post__not_in="' . $thumb__not_in . '"
    • This reply was modified 2 years ago by itwork46.
    Thread Starter itwork46

    (@itwork46)

    However, I ran into the problem of large HTML code, which is bad. So if an update comes out that allows you to get and display a gallery from different posts, that would be cool.

    https://prnt.sc/gFwH6IMDcRvw

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Customizing gallery output’ is closed to new replies.