Skip to content

Commit

Permalink
Merge pull request #40 from City-of-Helsinki/feature/HELOSK-270-captions
Browse files Browse the repository at this point in the history
Feature/helosk 270 captions
  • Loading branch information
kimmothai-hiq authored Dec 17, 2024
2 parents ac4d9ad + ef2e39f commit b4b3ce8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
23 changes: 22 additions & 1 deletion acf-json/group_654397b9f291a.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,27 @@
"ui": 0,
"ui_on_text": "",
"ui_off_text": ""
},
{
"key": "field_675c5a8c9279f",
"label": "Show caption",
"name": "it_show_caption",
"aria-label": "",
"type": "true_false",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "",
"default_value": 0,
"allow_in_bindings": 0,
"ui": 0,
"ui_on_text": "",
"ui_off_text": ""
}
],
"min": "",
Expand Down Expand Up @@ -1355,5 +1376,5 @@
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1731056504
"modified": 1734105799
}
10 changes: 10 additions & 0 deletions partials/flexible/image_text_box.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
$side = 'left';
}

$show_caption = get_sub_field('it_show_caption');
$caption = attachment_url_to_postid( get_sub_field('it_background_image') );

$overlaid = false;
if(get_sub_field('it_image_overlaid') || get_sub_field('it_image_overlaid') === null ){
$overlaid = true;
Expand Down Expand Up @@ -161,6 +164,13 @@
</div>
</div>
</div>
<?php if ( true == $show_caption ): ?>
<figcaption class="d-flex mt-2">
<span class="font-italic <?php echo($side == 'left' ? "mr-lg-auto" : "ml-lg-auto"); ?>">
<?php echo (wp_get_attachment_caption( $caption ) ); ?>
</span>
</figcaption>
<?php endif; ?>
</div>
</div>
</div>
Expand Down

0 comments on commit b4b3ce8

Please sign in to comment.