Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #915959

    Hi,

    I use AdvancedCustomFields for several things with ENFOLD.
    In this case I would like to show a category image in the archive.php of ENFOLD.
    So far, so good – it works in that way fine, that I can upload a category image in the backend.

    But something with my PHP output in the archive.php seems to be not right: it does not show the image.

    What I have done:

    1. adding a field group in ACF for category images as described in the documentation.

    2. The settings are (pay attention to the “Return Value”!):

    View post on imgur.com

    3. Then I added in archive.php directly after get_header(); this:

    //	get the current taxonomy term
    	$term = get_queried_object();
    //	vars - ACF for showing Images and Color in Category Backend
    	$image = get_field('image', $term);
    	$color = get_field('color', $term);

    4. also in archive.php I added as described in the documentation this snippet wit ENFOLD’s CSS:

    <style type="text/css">
    .entry-content-wrapper .post-title {
    color: <?php echo $color; ?>;
    }
    <?php if( $image ): ?>
    .categoryheaderimage {
    background-image: url(<?php echo $image['url']; ?>);
    }
    <?php endif; ?>
    </style>
    <div class="categoryheaderimage"> </div>

    Since my PHP is not so good, there seems to be a mistake in the output of the image, if you could please take a look.
    Maybe my trial to output the image via
    <div class=”categoryheaderimage”> </div>
    is not so ideal for ENFOLD?

    My site is not yet online, so please login, see data below.

    Thank you.

    #916334

    Update:

    I figured it out, it was just a mistake in the CSS for the category image – it needed a height value.

    — SOLVED —

    #916706

    Hi,

    Glad you figured it out! Let us know if you have any other questions or issues and enjoy your weekend :)

    Best regards,
    Yigit

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘AdvancedCustomFields and ENFOLD's archive.php’ is closed to new replies.