project-lead.php 1.16 KB
<?php

    // Create id attribute allowing for custom "anchor" value.
    $id = 'project-lead' . $block['id'] . rand(0,100);
    if( !empty($block['anchor']) ) {
        $id = $block['anchor'];
    }

    // Create class attribute allowing for custom "className" and "align" values.
    $className = 'project-lead'  ;
    $className .= ' ' .get_field('style');
    if( !empty($block['className']) ) {
        $className .= ' ' . $block['className'];
    }

    $content = get_field('content');
    $image = get_field('image');



$thumbnail_image = get_posts(array('p' => $image['ID'], 'post_type' => 'attachment'));
;
if ($thumbnail_image && isset($thumbnail_image[0])) {
    $img_description = $thumbnail_image[0]->post_content;
	$photo_caption = $thumbnail_image[0]->post_excerpt;
    $img_alt = get_post_meta($image['ID'] , '_wp_attachment_image_alt', true);
    $img_title = $thumbnail_image[0]->post_title;
	$copy = get_field('copy', $image['ID'] );
}


?>

    <div class="<?= $className ?>">
    <div class="image">
     <img src="<?= $image['url']; ?>" alt="<?php  $img_alt; ?>">
    </div>
        <div class='content'>
          <?php echo $content; ?>
        </div>
    </div>