mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-06-05 15:08:20 +09:00
Add term_meta support
Includes new helper function to retrieve a term image_id
This commit is contained in:
@@ -22,10 +22,9 @@ function display_featured_image_genesis_get_term_image_id( $image_id = '' ) {
|
||||
$terms = wp_get_object_terms( get_the_ID(), $taxonomies, $args );
|
||||
|
||||
foreach ( $terms as $term ) {
|
||||
$t_id = $term->term_id;
|
||||
$term_meta = get_option( "displayfeaturedimagegenesis_$t_id" );
|
||||
if ( ! empty( $term_meta['term_image'] ) ) {
|
||||
$image_id = displayfeaturedimagegenesis_check_image_id( $term_meta['term_image'] );
|
||||
$term_id = $term->term_id;
|
||||
$image_id = displayfeaturedimagegenesis_term_image( $term_id );
|
||||
if ( $image_id ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +33,15 @@ function display_featured_image_genesis_get_term_image_id( $image_id = '' ) {
|
||||
|
||||
}
|
||||
|
||||
function displayfeaturedimagegenesis_term_image( $term_id ) {
|
||||
$image_id = get_term_meta( $term_id, 'displayfeaturedimagegenesis', true );
|
||||
if ( ! $image_id ) {
|
||||
$term_meta = get_option( "displayfeaturedimagegenesis_$term_id" );
|
||||
$image_id = $term_meta['term_image'];
|
||||
}
|
||||
return $image_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to get the term image URL.
|
||||
* @param string $size image size
|
||||
|
||||
Reference in New Issue
Block a user