WordPress.org

Ready to get started?Download WordPress

Forums

Category Grid View Gallery
Autograb 2nd image instead of 1st (6 posts)

  1. Electromas
    Member
    Posted 1 year ago #

    Thank you for sharing this great plugin!
    I have one (odd) question.
    Is it possible for the thumbnail gallery to automatically grab the second image of the post instead of the first one?
    It would help me a lot.
    Thank you very much.

    http://wordpress.org/extend/plugins/category-grid-view-gallery/

  2. Anshul
    Member
    Plugin Author

    Posted 1 year ago #

    I would say yes. there is. it works on a preg_match php function. Modifying the logic in php should do the trick. Unfortunately, i do not have much time these days to work on customizations

  3. Anshul
    Member
    Plugin Author

    Posted 1 year ago #

    go to PLUGIN_DIR/category-grid-view-gallery/includes/CatGridView.php
    Make the following changes :
    Line 45 : Change $cg_img = $matches [1] [0];
    to
    $cg_img = $matches [1] [1] ? $matches [1] [1]: $matches [1] [0];

    and

    Line 80 : Change $cg_img = $matches [1] [0];
    to
    $cg_img = $matches [1] [1] ? $matches [1] [1]: $matches [1] [0];

    This will first look for the 2nd image. If its not available, it will look for the first image.

    In case of the featured image option checked, the order for search of image would be featured image -> 2nd Image -> 1st Image

  4. Electromas
    Member
    Posted 1 year ago #

    @Anshul: Thank you so much for helping me!

    But unfortunately the changes did not grabbed the second image but still the first one.
    Also in my PLUGIN_DIR/category-grid-view-gallery/includes/CatGridView.php file the 2 lines $cg_img = $matches [1] [0]; were located on line 74 and 79 instead of 45 and 80.

    Could it be I installed a different version than yours?
    I have Version 2.3

    Thank you in advance.

  5. Anshul
    Member
    Plugin Author

    Posted 1 year ago #

    Can you post the link of the page where you have used the plugin?

    You are correct about the line numbers. My bad. But this change works for me. Is it cache problem? Unlikely, but clear your cache and see if there is any difference

  6. Electromas
    Member
    Posted 1 year ago #

    I cleared the cache and tested in IE, Chrome, Firefox and Safari, but still the first image.

    Here is the link to the project:
    http://www.bestwelhip.nl/meubels

    I really appriciate this!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.