Skip to content

Commit bb73a3e

Browse files
committed
Added new filters for get_attachment_preview function
1 parent 7717621 commit bb73a3e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

includes/class-dco-ca-base.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,18 @@ public function get_attachment_preview( $attachment_id ) {
164164
}
165165

166166
$attachment_content = '<p class="dco-attachment dco-image-attachment">' . $img . '</p>';
167+
168+
/**
169+
* Filters the HTML markup for the image attachment.
170+
*
171+
* @since 2.1.1
172+
*
173+
* @param string $attachment_content HTML markup for the attachment.
174+
* @param int $attachment_id The attachment ID.
175+
* @param string $thumbnail_size The thumbnail size of the attachment image.
176+
*/
177+
$attachment_content = apply_filters( 'dco_ca_get_attachment_preview_image', $attachment_content, $attachment_id, $thumbnail_size );
178+
167179
break;
168180
case 'video':
169181
$attachment_content = '<div class="dco-attachment dco-video-attachment">' . do_shortcode( '[video src="' . esc_url( $url ) . '"]' ) . '</div>';
@@ -176,6 +188,18 @@ public function get_attachment_preview( $attachment_id ) {
176188
$attachment_content = '<p class="dco-attachment dco-misc-attachment"><a href="' . esc_url( $url ) . '">' . esc_html( $title ) . '</a></p>';
177189
}
178190

191+
/**
192+
* Filters the HTML markup for the attachment.
193+
*
194+
* @since 2.1.1
195+
*
196+
* @param string $attachment_content HTML markup for the attachment.
197+
* @param int $attachment_id The attachment ID.
198+
* @param string $embed_type The embed type (image, video, audio, misc)
199+
* of the attachment.
200+
*/
201+
$attachment_content = apply_filters( 'dco_ca_get_attachment_preview', $attachment_content, $attachment_id, $embed_type );
202+
179203
return $attachment_content;
180204
}
181205

0 commit comments

Comments
 (0)