Skip to content

Instantly share code, notes, and snippets.

@taotiwordpress
Last active March 4, 2022 16:22
Show Gist options
  • Save taotiwordpress/11ecd2effd656845a5fe87d48e5a1ad7 to your computer and use it in GitHub Desktop.
Save taotiwordpress/11ecd2effd656845a5fe87d48e5a1ad7 to your computer and use it in GitHub Desktop.
[ACF Anchor id] Add Anchor link to acf page builder block #acf #php #wordpress #flex-content #deprecated
<?php
/**
* Note: If using Timber, a generated anchor is avaiable via {{ block.id }}
* This approach requires creating a custom 'anchor_id' field and/or using PHP to custom-generate one.
*/
$anchor_id = get_sub_field( 'anchor_id' );
?>
<section class="l-module form-block" <?php echo (!empty($anchor_id)) ? 'id="' . $anchor_id . '"' : ''; ?>>
<div class="inner">
</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment