Skip to content

Instantly share code, notes, and snippets.

@nicmare
Last active August 1, 2025 09:22
Show Gist options
  • Select an option

  • Save nicmare/cf0aca4ea3af4a5c9640b271532d5cf0 to your computer and use it in GitHub Desktop.

Select an option

Save nicmare/cf0aca4ea3af4a5c9640b271532d5cf0 to your computer and use it in GitHub Desktop.
<?php
// change blocksy_blocks layout
add_filter("do_shortcode_tag",function($output, $tag, $attr, $m ){
if($tag != "blocksy_posts") return $output;
if(!empty($attr["layout"]) && in_array($attr["layout"],["grid","enhanced-grid","simple","classic","gutenberg"])){
$p = new \WP_HTML_Tag_Processor( $output );
if ( $p->next_tag(array( 'class_name' => 'entries' )) ) {
if($p->get_attribute( 'data-layout' )){
$p->set_attribute( 'data-layout', $attr["layout"] );
$output = $p->get_updated_html();
}
}
}
return $output;
},10,4);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment