Support » Plugins and Hacks » Autograb 2nd image instead of 1st

Autograb 2nd image instead of 1st

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Anshul


    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

    Plugin Author Anshul


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


    Line 80 : Change $cg_img = $matches [1] [0];
    $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

    @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.

    Plugin Author Anshul


    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

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

    Here is the link to the project:

    I really appriciate this!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Autograb 2nd image instead of 1st’ is closed to new replies.