WordPress.org

Ready to get started?Download WordPress

Forums

List taxonomies with images (2 posts)

  1. evo252
    Member
    Posted 2 years ago #

    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 ?

  2. evo252
    Member
    Posted 2 years ago #

    Nobody has an idea...?

Topic Closed

This topic has been closed to new replies.

About this Topic