Support » Plugin: Best WordPress Gallery Plugin – FooGallery » Template for list of full-size images

  • Resolved Anastasia Che

    (@anastasia-che)


    Hi, everybody,
    can you please help me to figure out – how can I output simple list of full-size images of a gallery?

    I created a new foo-template extension for simple list of images, without options.

    My template file currently looks this way:

    <?php
    /**
     * FooGallery Plain Images gallery template
     * This is the template that is run when a FooGallery shortcode is rendered to the frontend
     */
    //the current FooGallery that is currently being rendered to the frontend
    global $current_foogallery;
    //the current shortcode args
    global $current_foogallery_arguments;
    
    ?>
    <ul class="gal large">
    	<?php foreach ( $current_foogallery->attachments() as $attachment ) {
    		echo '<li>' . $attachment->html( $args ) . '</li>';
    	} ?>
    </ul>

    What should I write inside my LI tags (instead of this default code which outputs thumbnail with a link to full-size image) in order to create <IMG> tag with full-size image inside of it?

    It should be really easy for programmers, but I’m not one of them unfortunately, that’s why I can’t find this solution myself. 🙁 Maybe anybody can help with it?

    Thank you so much!

    https://wordpress.org/plugins/foogallery/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Anastasia Che

    (@anastasia-che)

    Thanks to this topic https://wordpress.org/support/topic/how-to-display-the-image-on-a-gallery-template?replies=5 I managed to get the result I was looking for.

    This is template’s code for displaying list of full-size images:

    <?php
    /**
     * FooGallery Plain Images gallery template
     * This is the template that is run when a FooGallery shortcode is rendered to the frontend
     */
    //the current FooGallery that is currently being rendered to the frontend
    global $current_foogallery;
    //the current shortcode args
    global $current_foogallery_arguments;
    ?>
    <ul class="gal large">
    	<?php foreach ( $current_foogallery->attachments() as $attachment ) {
    		echo '<li><img src='. $attachment->url .' alt='. $attachment->alt .'></li>';
    	} ?>
    </ul>

    If you see any improvements here – I’ll appreciate if you share your thoughts!

    Thank you!

    Plugin Author bradvin

    (@bradvin)

    That looks great! Nice work.

    My only suggestion would be to give the UL a unique ID:

    <ul class="gal large"  id="foogallery-gallery-<?php echo $current_foogallery->ID; ?>">

    This will allow you to target the specific gallery with any custom CSS you may have ccaptured

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Template for list of full-size images’ is closed to new replies.