• Resolved codeview

    (@ryanderson)


    I’m wondering if it’s possible to show the images on a regular page?
    I have the following code in a page-regions.php file, listing all the terms and descriptions of the “Region” taxonomy, but need to add the category images (from this plugin) now:

    $siteurl = home_url('/');
    $tax = 'region';  // slug of taxonomy to list
    
    $terms = get_terms($tax);
    foreach ($terms as $term) {
    	$slug = $term->slug;
    	$description = $term->description;
    	$link = "<a href='$siteurl?$tax=$slug' ><p> $term->name </p></a>";
    
    	echo $link;
    	echo $description;
    }

    https://wordpress.org/plugins/categories-images/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Muhammad

    (@elzahlan)

    Yes you can do display term image, just update the plugin to the latest ver and do as following:

    $siteurl = home_url('/');
    $tax = 'region';  // slug of taxonomy to list
    
    $terms = get_terms($tax);
    foreach ($terms as $term) {
    	$slug = $term->slug;
    	$description = $term->description;
    	$link = "<a href='$siteurl?$tax=$slug' ><p> $term->name </p></a>";
    
    	echo $link;
    	echo $description;
    z_taxonomy_image($term->term_id);
    }

    Hello Muhammad, I can’t seem to get the above code to output the images on a page. At the moment it correctly lists all the terms of my custom taxonomy, but the photos and descriptions aren’t showing. Is there something missing from the above code or something I’m doing wrong?

    Snippet of my page code here

    Any advice would be appreciated.

    Aha! So I deactivated a taxonomy plugin that I suppose wasn’t compatible with this one and now it works. -Both image and description are showing.

    Thanks for your amazing work on this plugin 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Possible to show images on regular page (page-example.php)?’ is closed to new replies.