• Resolved hopemat

    (@hopemat)


    it is failing to load my images
    Warning: array_combine(): Both parameters should have an equal number of elements in /data/8/5/73/6/5399332/user/6465283/htdocs/one/start/wp-content/plugins/wpadverts/includes/gallery.php on line 547

    Warning: array_combine(): Both parameters should have an equal number of elements in /data/8/5/73/6/5399332/user/6465283/htdocs/one/start/wp-content/plugins/wpadverts/includes/gallery.php on line 547

    Warning: array_combine(): Both parameters should have an equal number of elements in /data/8/5/73/6/5399332/user/6465283/htdocs/one/start/wp-content/plugins/wpadverts/includes/gallery.php on line 547

    Warning: array_combine(): Both parameters should have an equal number of elements in /data/8/5/73/6/5399332/user/6465283/htdocs/one/start/wp-content/plugins/wpadverts/includes/gallery.php on line 547

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    any chance you have some plugin installed related to the media attachments (which would change the output of wp_get_attachment_image_src() function? If you do then please try disabling it and see if it helps.

    If not, or you are not sure, then you can add the code below in your theme functions.php file it should fix the problem.

    
    add_filter( "wp_get_attachment_image_src", function( $image, $attachment_id, $size ) {
        if( is_array( $image ) && is_singular( 'advert' ) ) {
            return array_slice( $image, 0, 4 );
        } else {
            return $image;
        }
    }, 2000, 3 );
    
    Thread Starter hopemat

    (@hopemat)

    thank you let me try

    Thread Starter hopemat

    (@hopemat)

    im still getting same errors. https://www.hopemats.com

    Plugin Author Greg Winiarski

    (@gwin)

    I am not sure, with the custom code i pasted above i am unable to reproduce the problem you are having.

    Have you tried disabling other plugins related to images which might be causing this problem?

    Also, one other way to resolve it might be to open wp-config.php file and add there the line below

    
    define( "WP_DEBUG", false );
    
    Thread Starter hopemat

    (@hopemat)

    it is still failing and i dont know what to do now. i have even started afresh but still come across same issue

    Warning: array_combine(): Both parameters should have an equal number of elements in /data/8/5/73/6/5399332/user/6465283/htdocs/one/eswa/wp-content/plugins/wpadverts/includes/gallery.php on line 547

    Plugin Author Greg Winiarski

    (@gwin)

    What do you mean by starting fresh? Did you reinstall WPAdverts or created a new WP installation with WPAdverts only?

    Reinstalling just WPAdverts most likely will not change anything.

    To help you i would need some additional troubleshooting data, please add the code below in your theme functions.php refresh the page, you should see some additional text on page copy and paste it here, then remove the custom code.

    
    add_filter( "wp_get_attachment_image_src", function( $image, $attachment_id, $size ) {
        var_dump($image);
        return $image;
    }, 1000, 3 );
    

    One other thing you might try is in the last code i pasted increase the number 2000 in the last line to some bigger number like 9999999.

    Thread Starter hopemat

    (@hopemat)

    Parse error: syntax error, unexpected ‘;’, expecting ‘(‘ in /data/8/5/73/6/5399332/user/6465283/htdocs/one/eswa/wp-content/themes/oceanwp/functions.php on line 31

    Plugin Author Greg Winiarski

    (@gwin)

    Hmm the code does not generate any error messages for me, it looks like you either have it incorrectly pasted or using an older PHP version which does support anonymous functions (although the first code i pasted would not work as well).

    Either way, you can try the version of the code which does not use anonymous functions instead:

    
    add_filter( "wp_get_attachment_image_src", "debug_wp_get_attachment_image_src", 1000, 3 );
    function debug_wp_get_attachment_image_src( $image, $attachment_id, $size ) {
        var_dump($image);
        return $image;
    }
    
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Failing to view advert with image’ is closed to new replies.