Last active
January 21, 2019 21:39
-
-
Save deckerweb/cae6d2703400601e2e78be3a27e93cfb to your computer and use it in GitHub Desktop.
Plugin: Builder Template Categories - Code Snippet for adding a new integration:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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