Last active
August 1, 2025 09:20
-
-
Save nicmare/98611bd773cb61e58d4256182d928f20 to your computer and use it in GitHub Desktop.
blocksy dynamic data block combining two acf fields
This file contains hidden or 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
<?php | |
function blocksy_dyn_block_pricelist($html, $block){ | |
if($block["blockName"] != "blocksy/dynamic-data") return $html; | |
if(!isset($block["attrs"]["field"])) return $html; | |
if($block["attrs"]["field"] != "acf:preisliste_text") return $html; // change acf field-name "preisliste_text" here | |
if($has_link = get_field("preisliste_link")) | |
$html = '<a href="'.$has_link.'" target="_blank">'.$html.'</a>'; | |
return $html; | |
} | |
add_filter( "render_block", 'blocksy_dyn_block_pricelist', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment