• dave

    (@mozdzanowski)


    I’ve uploaded a category image successfully in the back-end. I’m using the following code to pull the image in a category archive, but it’s not working:


    <?php
    $category = get_category( get_query_var( 'cat' ) );
    $cat_id = $category->cat_ID;
    ?>

    <div class="page-banner" style="background-image: url(<?php Categories_Multiple_Images::get_image( $cat_id, 1, 'full', false ); ?>); background-size: cover; background-position: center top;"></div>

    No url is being inserted where the tag is in the div background. Is this the correct way to do it?

Viewing 1 replies (of 1 total)
  • You have to echo out the call to the image

    <div class="page-banner" style="background-image: url(<?php echo Categories_Multiple_Images::get_image( $cat_id, '1', 'full', false ); ?>); background-size: cover; background-position: center top;"></div>

    I used get_queried_object()->term_id on the archive page to get the category id. Hope that helps!

Viewing 1 replies (of 1 total)
  • The topic ‘supplied template tag not working’ is closed to new replies.