• Resolved Back to Front

    (@traverser11)


    Hi first of all thanks for the beautiful plugin, I’ve successfully got this working on another site, and I hope to use it on many more, its a really great way to show off category archives.

    However this time I seem to have messed something up.

    I can’t seem to get the Image src=”” to show get the category image.
    I’m guessing its an issue of my syntax of getting php to function within the the html tags?

    Here is a test page

    I’ve tried 2 ways to get the image, but as you can see everything works except for getting the image.

    <?php foreach (get_terms('artist') as $cat) : ?>
    
     <img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />
     <a href="<?php echo get_term_link($cat->slug, 'artist'); ?>"><?php echo $cat->name; ?></a>
    
     <?php endforeach; ?>
    
    </br>
    
    <?php
    // Set your args
    $args = array(
        'hide_empty' => 0   // Show terms that are not associated with any posts
    );
    
    // Get the terms
    $artists= get_terms('artist', $args);
    
    // Loop through and use terms
    foreach($artists as $artist)
    {
    
        echo get_category_link($artist->term_id);
        echo '<img src="' , z_taxonomy_image_url(NULL, 'thumbnail') , '">'; 
    
    }
    
    ?>

    Thanks in advance if you can help me learn this punctuation, so much appreciated 🙂

    https://ww.wp.xz.cn/plugins/categories-images/

Viewing 1 replies (of 1 total)
  • Thread Starter Back to Front

    (@traverser11)

    Sorry! its just the images got uploaded to a sub directory of uploads – putting them back in uploads directory fixed it.

    Works beautifully love this plugin

Viewing 1 replies (of 1 total)

The topic ‘Img src="empty" –’ is closed to new replies.