• Is there a way to pull the taxonomy image besides using apply_filters? I cannot get anything to print using it. I think the way our taxonomies are being pulled doesn’t allow of apply_filters, or I just don’t know where to put it.

    Below is the sample code where I need to pull the image. I need to put it right under the H3 tag. Any guidance would be greatly appreciated : )

    <?
    $args = array(
        'hide_empty'    => 0,
    	'child_of' 		=> 0,
    	'pad_counts' 	=> 1,
    	'hierarchical'	=> 1
    );
    $tax_terms = get_terms('review-categories', $args);
    $tax_terms = wp_list_filter($tax_terms,array('parent'=>0));
    
    ?>
    
    <div class="reviews-category-list row stacked">
    <?php
    foreach ($tax_terms as $tax_term) {
    
    echo '<div class="column col-half">';
    
    echo '<h3><span class="count">'. sprintf( __("%s Reviews", "framework"), $tax_term->count) .'</span><a href="' . esc_attr(get_term_link($tax_term, 'review-categories')) . '" title="' . sprintf( __( 'View all posts in %s', 'framework' ), $tax_term->name ) . '" ' . '>' . $tax_term->name.' <span>&rarr;</span></a></h3>';

    https://www.ads-software.com/plugins/taxonomy-images/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ben Huson

    (@husobj)

    Planning to add support for Term Meta introduced in WordPress 4.4 – hopefully at some point soon.

    Not quite there just yet but once that’s sorted you’ll be able to use the new WordPress get_term_meta() function to get taxonomy image IDs.

    I have written the below code to get my images when using a custom get_terms loop similar to what dvieira had above.

    $taximages = get_option( 'taxonomy_image_plugin' );
    
    $services = get_terms(array(
        'taxonomy' => 'service',
        'hide_empty' => false,
    ));
    
    foreach($services as $service) {
      $link = get_term_link(intval($service->term_id),'service');
      echo "<h2><a href="{$link}">{$service->name}</a></h2>";
      $taximageid = $taximages[intval($service->term_id)];
      echo wp_get_attachment_image ($taximageid, 'medium');
    }

    I hope it helps out someone else with this question.

    @nicole2292 the hide_empty attribute seems not to work with this plugin, or is it just my end?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pull image another way besides apply_filters ?’ is closed to new replies.