Home Forums General Issues AC5 Image Issue


AC5 Image Issue

  • Since upgrading from AC4 to AC5 a weird issue has happened to a couple of the images that are set from the Options location.

    They display fine on certain pages (You’ll need to log in: guest guest):

    But on others it is echoing the ID rather than the URL:

    <?php $background = get_field('background_image', 'option'); ?>
    html {
    	background-image: url('<?php echo $background['url']; ?>');
    <?php $logo = get_field('header_logo', 'option'); ?>
    <div class="logo"><a href="<?php bloginfo('url'); ?>"><img src="<?php echo $logo['url']; ?>"></a></div>

    They were working fine prior to the upgrade.

    Any ideas?

    Many thanks,

  • Is the image stored as a ID or URL on the option page?

    When de field is stored as a ID u must get the image URL of the image ID.


  • Hi Eduard,

    The Image was stored as a URL, but when the issue started occurring I switched it to object and started using [‘url’] to obtain the URL, but for some reason on the Taxonomy archives this is ignored, despite using the exact same PHP template!


  • Here is the var_dump for the home page (Where the image is displayed correctly):

    array(9) { ["ID"]=> int(6) ["alt"]=> string(0) "" ["title"]=> string(7) "LGBT-BG" ["caption"]=> string(0) "" ["description"]=> string(0) "" ["url"]=> string(68) "" ["width"]=> int(1600) ["height"]=> int(1031) ["sizes"]=> array(9) { ["thumbnail"]=> string(76) "" ["thumbnail-width"]=> int(400) ["thumbnail-height"]=> int(400) ["medium"]=> string(76) "" ["medium-width"]=> int(800) ["medium-height"]=> int(515) ["large"]=> string(77) "" ["large-width"]=> int(1200) ["large-height"]=> int(773) } }

    And taxonomy archive where it is not (Despite using same dynamic-css.php file included in the header)
    string(1) "6"

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘AC5 Image Issue’ is closed to new replies.