Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Display the image on the front end from category taxonomy

// Get the current category ID, e.g. if we're on a category archive page
$category = get_category( get_query_var( 'cat' ) );
 $cat_id = $category->cat_ID;
// Get the image ID for the category
$image_id = get_term_meta ( $cat_id, 'category-image-id', true );
// Echo the image
echo wp_get_attachment_image ( $image_id, 'large' );

$image_id = get_term_meta ( $cat->term_id, 'author-taxonomy-image-id', true ); 
                          echo wp_get_attachment_image ( $image_id, 'thumbnail' ); ?>
 
PREVIOUS NEXT
Tagged: #Display #image #front #category #taxonomy
ADD COMMENT
Topic
Name
2+8 =