Skip to content

Instantly share code, notes, and snippets.

@nicmare
Last active August 1, 2025 09:20
Show Gist options
  • Save nicmare/98611bd773cb61e58d4256182d928f20 to your computer and use it in GitHub Desktop.
Save nicmare/98611bd773cb61e58d4256182d928f20 to your computer and use it in GitHub Desktop.
blocksy dynamic data block combining two acf fields
<?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