Support

Account

Home Forums Front-end Issues Image not showing correctly Reply To: Image not showing correctly

  • Hi @micromaniac

    Because PHP runs on the server and is not browser dependent, the issue cannot be related to a browser.

    The fact that it works on ie, and not firefox is down to something else. Perhaps some JS running on the page or some caching going on.

    Lets fix your code logically. First, lets debug the value returned by get_field. You can do this by:

    
    <?php 
    
    echo '<pre>';
    	print_r( get_field('image_bloc_2') );
    echo '</pre>';
    die; 
    
    ?>
    

    What do you get from that?

    Next is to debug the returned value from the wp_get_attachment_image_src function.
    What do you get for that?

    You can find docs on that function here:
    http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src

    Please note that this function returns an array and the src is actually at $image[0]. This means that your code won’t work because you are trying to echo an array.

    Please read over the image field documentation to get a better understanding of how to use this function.

    Thanks
    E