Show category names in custom callback
-
Hi there – I’m trying to output the media-tag category name in a custom callback. I can’t seem to get anything to work. I’ve tried variations of using single_mediatag_title and the_mediatags – but I can’t get any values. Any help much appreciated.
function im_mediatags($post_item, $size='card-image') { if (wp_attachment_is_image($post_item->ID)) { $image_src = wp_get_attachment_image_src($post_item->ID, $size); return '<li class="media-tag-list" id="media-tag-item-'.$post_item->ID.'">'. wp_get_attachment_image($post_item->ID, $size) .$media_meta.'</li>'; } else { $media_meta = get_post_meta($post_item->ID, 'pub-month', true); return '<li class="card"><div class="card-meta">'. $media_meta. '</div><h2 itemprop="name" class="card-title">'.wp_get_attachment_link($post_item->ID).' </h2> <div class="card-body">'.$post_item->post_content.'</div></li>'; } }
- The topic ‘Show category names in custom callback’ is closed to new replies.