Skip to content

Commit 6789b1f

Browse files
committed
Fix: shortcode generator provides an ID, but shortcode parser doesn't support for poster.
1 parent 500cec4 commit 6789b1f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/ableplayer.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,12 @@ function ableplayer_shortcode( $atts, $content = null ) {
506506
$o .= ' preload="' . esc_attr( $preload ) . '"';
507507
}
508508
if ( ! empty( $all_atts['poster'] ) ) {
509-
$o .= ' poster="' . esc_attr( $all_atts['poster'] ) . '"';
509+
// Allow passing an attachment ID as poster.
510+
$poster = $all_atts['poster'];
511+
if ( is_numeric( $poster ) ) {
512+
$poster = wp_get_attachment_image_url( $poster, 'large' );
513+
}
514+
$o .= ' poster="' . esc_attr( $poster ) . '"';
510515
}
511516
if ( ! empty( $all_atts['width'] ) ) {
512517
$o .= ' width="' . esc_attr( $all_atts['width'] ) . '"';

0 commit comments

Comments
 (0)