Skip to content

Commit

Permalink
Add scaffolding code for the acf block generated using CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
aslamdoctor committed Sep 29, 2023
1 parent 2cc09c0 commit de00980
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions inc/wpcli/block-starter/block.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,19 @@
*
* @package wd_s
*/

// Add classes to block.
$wds_classes = [];
if ( ! empty( $block['className'] ) ) {
$wds_classes[] = $block['className'];
}
if ( ! empty( $block['align'] ) ) {
$wds_classes[] = 'align' . $block['align'];
}

// Add anchor to the block.
$wds_anchor = ( ! empty( $block['anchor'] ) ) ? 'id="' . esc_attr( $block['anchor'] ) . '" ' : '';
?>
<section <?php echo $wds_anchor; //phpcs:ignore ?>class="<?php echo esc_attr( implode ( ' ', $wds_classes ) ); ?>">
<!-- Your block render code goes here. -->
</section>

0 comments on commit de00980

Please sign in to comment.