Skip to content

Commit

Permalink
Merge pull request #31 from mvpspl619/feat/add-filter-to-choose-tag-type
Browse files Browse the repository at this point in the history
feat(filter): added filter to set tag type globally
  • Loading branch information
aprokopenko authored Jan 25, 2019
2 parents 36e1228 + a73ac72 commit 59c0780
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions just-rwd-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
* @param string $tag Specify which tag should be used: picture|img.
* @param array $attr Additional html attributes to be used for main tag.
*/
function rwd_attachment_image( $attachment = null, $size = 'thumbnail', $tag = 'picture', $attr = array() ) {
function rwd_attachment_image( $attachment = null, $size = 'thumbnail', $tag = null, $attr = array() ) {
if( empty( $tag ) ) {
$tag = apply_filters( 'rwd_tag_type', 'picture' );
}
echo get_rwd_attachment_image( $attachment, $size, $tag, $attr );
}

Expand All @@ -41,9 +44,13 @@ function rwd_attachment_image( $attachment = null, $size = 'thumbnail', $tag = '
*
* @return string Generated html.
*/
function get_rwd_attachment_image( $attachment = null, $size = 'thumbnail', $tag = 'picture', $attr = array() ) {
function get_rwd_attachment_image( $attachment = null, $size = 'thumbnail', $tag = null, $attr = array() ) {
$rwd_image = new RwdImage( $attachment );

if( empty( $tag ) ) {
$tag = apply_filters( 'rwd_tag_type', 'picture' );
}

$size = apply_filters( 'post_thumbnail_size', $size );

if ( 'img' != $tag ) {
Expand Down

0 comments on commit 59c0780

Please sign in to comment.