无法使用添加到自定义字段的自托管视频URL实现此功能。
function video() {
$self_hosted = get_post_meta( get_the_ID(), \'self_hosted\', true );
$video_self_hosted = $self_hosted ? $self_hosted : get_theme_mod( \'customizer-video\' );
$video_src_url = wp_get_attachment_url( $video_self_hosted );
if ( $video_src_url ) {
echo \'<div class="video-container">\';
$attr = array(
\'src\' => $video_src_url,
\'poster\' => $video_thumb,
\'preload\' => \'none\',
);
echo wp_video_shortcode( $attr );
echo \'</div>\';
}
}
get_theme_mod( \'video-upload\' ); equals the default video added via the customizer which displays but the URL from the custom field doesn\'t.
如果通过名为“self\\u hosted”的自定义字段添加视频URL,我需要改用它,但它不起作用。