Skip to content

Instantly share code, notes, and snippets.

@deckerweb
Last active January 21, 2019 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deckerweb/cae6d2703400601e2e78be3a27e93cfb to your computer and use it in GitHub Desktop.
Save deckerweb/cae6d2703400601e2e78be3a27e93cfb to your computer and use it in GitHub Desktop.
Plugin: Builder Template Categories - Code Snippet for adding a new integration:
<?php
/** Do NOT include the opening php tag */
add_filter( 'btc/filter/integrations/all', 'btc_register_custom_integration' );
/**
* Plugin: Builder Template Categories - Register custom integration.
*
* @author David Decker - DECKERWEB
* @link https://gist.github.com/deckerweb/cae6d2703400601e2e78be3a27e93cfb
*
* @param array $integrations Holds array of all registered integrations.
* @return array Tweaked array of registered integrations.
*/
function btc_register_custom_integration( array $integrations ) {
$post_type = 'your-post-type';
$submenu_hook = 'your-custom-settings-page'; // as in: your-site.domain/wp-admin/admin.php?page=your-custom-settings-page;
// or alternative: $submenu_hook = 'edit.php?post_type=' . $post_type;
$template_label = 'template'; // or: library, layout, element, popup, lightbox, block, listing, post-type, field, box, bar, hook, filter, section, flow, snippet
$integrations[ 'your-custom-handle-lowercase' ] = array(
'label' => __( 'My Custom Templates', 'your-textdomain' ),
'submenu_hook' => $submenu_hook,
'post_type' => $post_type,
'template_label' => $template_label,
'admin_url' => 'edit.php?post_type=' . $post_type,
);
return $integrations;
} // end function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment