Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #1031743

    Victor D
    Participant

    Hello,

    I need to create galleries from image folders uploaded to my site in bulk. I’d like add a new instance of The Grid plugin and specify the directory it should pull images from. Is this possible with the plugin? Is there a way to accomplish this task? It will be a pain to set up each image individually as there will be potentially hundreds of images to set up.

    Thanks!

    #1032344

    Christian
    Moderator

    Hey Victor,

    Sorry but that is not a supported source in the Grid. It would be technically possible however, implementation of it is outside the scope of our support.

    Thanks.

    #1032385

    Victor D
    Participant

    Hello,

    I can write PHP and JavaScript if I have to, just the need pseudo instructions.

    Should I edit the functions php for a template, create a new php file in my web directory, copy a template file into my child template?

    I know how to read in files from a server directory with PHP but how would I tie it to the plugin. Or should I skip the plugin and use jQuery masonry plugin or similar?

    Any direction will be helpful please.

    Thanks!

    #1032829

    Rad
    Moderator

    Hi there,

    The Grid is the different author and we can’t provide customization related to it. It’s provided as is and can’t be overloaded through templates or functions.php. It’s much easier to re-create a masonry layout using javascript than modifying the existing The Grid functionality.

    And about the javascript, it’s doable but we can’t really provide instruction. I can only is provide recommendation.

    1. Create a shortcode version of your gallery

    eg.

    add_shortcode('my_gallery', 'my_gallery');
    
    function my_gallery ( $atts ) {
    
    }

    2. Add your loop that picks your image

    eg.

    add_shortcode('my_gallery', 'my_gallery');
    
    function my_gallery ( $atts ) {
    
    foreach( $images as $image) {
    
    echo $image;
    
    }
    
    }

    3. Then add your masonry script.

    add_shortcode('my_gallery', 'my_gallery');
    
    function my_gallery ( $atts ) {
    
    foreach( $images as $image) {
    
    echo $image;
    
    }
    
    echo '<script>start masonry here</script>';
    
    }

    4. Then add [my_gallery] to your content.

    There are still more to do, but you can use this as a guide.

    Thanks!

    #1033009

    Victor D
    Participant

    Awesome. Greatly appreciated!

    #1033302

    Prasant Rai
    Moderator

    You are most welcome. 🙂