List taxonomies with images
-
Hello,
In order to attach an image to every taxonomy, I added an extra field to a taxonomy called “albums” via this function:
add_action( 'albums_edit_form_fields', 'albums_taxonomy_edit_meta_field', 10, 2 ); function save_taxonomy_custom_meta( $term_id ) { if ( isset( $_POST['term_meta'] ) ) { $t_id = $term_id; $term_meta = get_option( "taxonomy_$t_id" ); $cat_keys = array_keys( $_POST['term_meta'] ); foreach ( $cat_keys as $key ) { if ( isset ( $_POST['term_meta'][$key] ) ) { $term_meta[$key] = $_POST['term_meta'][$key]; } } // Save the option array. update_option( "taxonomy_$t_id", $term_meta ); } }
The metadata of the taxonomy is saving fine and now I’d like to list my taxonomies in a page by displaying next to the taxonomy’s name the value of the metadata (in this case, the image related to every taxonomy).
Anybody knows how to do it ?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘List taxonomies with images’ is closed to new replies.