Last active
November 20, 2023 03:08
-
-
Save chekle/78af18c95889da42869c66e1ea4be38f to your computer and use it in GitHub Desktop.
ACF Images Using ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL | |
<?php $image = get_sub_field('image'); $size = 'medium'; if( $image ) { echo wp_get_attachment_image_url( $image, $size ); } ?> | |
IMG | |
<?php $image = get_sub_field('image'); $size = 'full'; if( $image ) { echo wp_get_attachment_image( $image, $size ); } ?> | |
IMG w Class | |
<?php $image = get_sub_field('image'); $size = 'full'; if( $image ) { echo wp_get_attachment_image( $image, $size, "", array ('class' => 'rounded-4 mb-4' ) ); } ?> | |
FIGURE / IMG | |
<?php $image = get_field('banner_image'); $size = 'full'; if( $image ) { ?> | |
<figure> | |
<?php echo wp_get_attachment_image( $image, $size ); ?> | |
</figure> | |
<?php } ?> | |
PICTURE / IMG | |
<?php $image = get_field('image'); $size = 'full'; if( $image ) { ?> | |
<picture> | |
<?php echo wp_get_attachment_image( $image, $size ); ?> | |
</picture> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment