Skip to content

Instantly share code, notes, and snippets.

@themeblvd
Last active February 5, 2017 21:54
Show Gist options
  • Save themeblvd/9ecdad56e4b868044c0e93defba23470 to your computer and use it in GitHub Desktop.
Save themeblvd/9ecdad56e4b868044c0e93defba23470 to your computer and use it in GitHub Desktop.
Add template part option to post display elements in Theme Blvd Layout Builder. -- Later, we can add to this a way to actually apply the option by creatively filtering themeblvd_template_part or with new filter proposed #224 in Jump Start repo.
<?php
/**
* Add template part option to post display
* elements.
*/
function my_elements( $elements ) {
$option = array(
'id' => 'part',
'name' => __('Template Part (Optional)'),
'desc' => __('Enter in a custom template part for this element. For example, entering "foo" will pull content-foo.php from your child theme for each post in the loop.'),
'type' => 'text'
);
$elements['blog']['options']['part'] = $option;
$elements['post_grid']['options']['part'] = $option;
$elements['post_list']['options']['part'] = $option;
$elements['post_showcase']['options']['part'] = $option;
return $elements;
}
add_filter( 'themeblvd_elements', 'my_elements' );
// @TODO ... Now, how to implement option? Possibly through
// new propsed themeblvd_{$element_type}_options filter,
// Jump Start issue #224.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment