Closed davidshq closed 8 years ago
If you're in the series taxonomy page, you should be able to do something like this:
$series = gc_sermons()->taxonomies->series->get( get_queried_object_id(), array(
'image_size' => 'large', // image size here.
) );
if ( $series->image ) {
echo $series->image;
}
Thanks, that works! Follow-up question: is there a way for me to attach a CSS class to this image?
If you needed to modify those attributes, you'd need to do something like this:
$series = gc_sermons()->taxonomies->series->get( get_queried_object_id() );
if ( $series->image_id ) {
echo wp_get_attachment_image( $series->image_id, 'large', false, array(
'class' => 'custom-class',
) );
}
Thanks, that did it!
I've created an archive template for a single series (e.g., displaying the messages associated with the series).
I'd like to add the image associated with the series term at the top of the archive as a sort of header with the individual sermons below it, but I'm unsure how to pull this information. Can you provide some guidance on this?
I found gc_get_sermon_series_info() and tried echoing that, which returns all of the info. associated with the sermon series term, but I only want the image. I thought maybe something like this would work:
$series_info = gc_get_sermon_series_info(); $series_img = $series_info->sermon_series_image;
But it doesn't, as it appears $series_info is return as a string, not an array.