• Hi, I’m having some trouble using this plugin to display the custom field content from multiple posts on the archive. I’m creating a media hosting site and the trailers are accessed by clicking on a button on the archive which opens a lightbox containing that trailer. My theme uses a template part content-box to display the posts on the archive page, and this is where I’ve included the php to link to the trailer, though I’ve had to use <?php echo do_shortcode to get it to display the video, rather than just the url of the video.

    Does this plugin support multiple instances of the same field for different posts on the archive page?

    For some reason, no matter which post’s trailer button I click on, the video is always the video if the latest post, rather than the video for that post.

    here is the code I used in my template part:

    <div class="trailer-button">
    
                        <a href="#" data-featherlight="#trailer-lightbox"><p>Trailer</p></a>
                        <div id="trailer-lightbox">
    
                              <?php
    echo do_shortcode('[types field="trailer" autoplay="on" width="1280" height="720"][/types]');
    ?> 
    
                        </div>
                    </div>

    https://www.ads-software.com/plugins/types/

Viewing 1 replies (of 1 total)
  • Plugin Author Christian

    (@christianglingener)

    Hi,

    the problem here is not related to Types. ??

    For each post you create a button which opens the container with the id “trailer-lightbox”. Now with your code all containers have the id “trailer-lightbox” and so each button will open the last container.

    Here this should solve your issue (by adding the post id to trigger and container):

    <div class="trailer-button">
    
    	<a href="#" data-featherlight="#trailer-lightbox-<?php the_ID();?>"><p>Trailer</p></a>
    	<div id="trailer-lightbox-<?php the_ID();?>" style="display:none;">
    
    		<?php
    		echo do_shortcode('[types field="trailer" autoplay="on" width="1280" height="720"][/types]');
    		?>
    
    	</div>
    </div>

    Best,
    Christian

Viewing 1 replies (of 1 total)
  • The topic ‘Field displays content of latest post for all posts on archive page’ is closed to new replies.