Skip to content

Instantly share code, notes, and snippets.

@themeblvd
Created February 20, 2017 20:52
Show Gist options
  • Save themeblvd/c0101c3b3022b324e4e05f164c0e408b to your computer and use it in GitHub Desktop.
Save themeblvd/c0101c3b3022b324e4e05f164c0e408b to your computer and use it in GitHub Desktop.
How to display section labels from the layout builder interface on the frontend of your website when the custom layouts are displayed.
<?php
/**
* Print labels at the start of a section
* in the layout builder.
*
* @param string $section_id ID of current section.
* @param string $layout_id ID of current layout the section is in.
* @param array $data All of the section's display opion data.
*/
function my_section_top( $section_id, $layout_name, $data ) {
echo '<div class="section-label">' . esc_html( $data['label'] ) . '</div>';
}
add_action( 'themeblvd_section_top', 'my_section_top', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment