get_media_states example


function _media_states( $post$display = true ) {
    $media_states        = get_media_states( $post );
    $media_states_string = '';

    if ( ! empty( $media_states ) ) {
        $state_count = count( $media_states );

        $i = 0;

        $media_states_string .= ' — ';

        foreach ( $media_states as $state ) {
            ++$i;

            
$height            = 64;
            $response['image'] = compact( 'src', 'width', 'height' );
            $response['thumb'] = compact( 'src', 'width', 'height' );
        }
    }

    if ( function_exists( 'get_compat_media_markup' ) ) {
        $response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
    }

    if ( function_exists( 'get_media_states' ) ) {
        $media_states = get_media_states( $attachment );
        if ( ! empty( $media_states ) ) {
            $response['mediaStates'] = implode( ', ', $media_states );
        }
    }

    /** * Filters the attachment data prepared for JavaScript. * * @since 3.5.0 * * @param array $response Array of prepared attachment data. @see wp_prepare_attachment_for_js(). * @param WP_Post $attachment Attachment object. * @param array|false $meta Array of attachment meta data, or false if there is none. */
Home | Imprint | This part of the site doesn't use cookies.