Skip to content

Instantly share code, notes, and snippets.

@deckerweb
Last active October 2, 2018 08:30
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/dd00884e81783e7d21046ae0a72ed683 to your computer and use it in GitHub Desktop.
Save deckerweb/dd00884e81783e7d21046ae0a72ed683 to your computer and use it in GitHub Desktop.
Plugin: Builder Template Categories - Register regular WordPress Pages as an integration. That means to you categorize even those pages with your template categories ;-).
<?php
/** Do NOT include the opening php tag */
add_filter( 'btc/filter/integrations/all', 'btc_register_integration_wordpress_pages' );
/**
* Plugin: Builder Template Categories - Register custom integration.
*
* @author David Decker - DECKERWEB
* @link https://gist.github.com/deckerweb/dd00884e81783e7d21046ae0a72ed683
*
* @param array $integrations Holds array of all registered integrations.
* @return array Tweaked array of registered integrations.
*/
function btc_register_integration_wordpress_pages( array $integrations ) {
$post_type = 'page';
$submenu_hook = 'edit.php?post_type=' . $post_type;
$template_label = 'template'; // or: library, layout, element, popup, lightbox, block, listing, post-type
$integrations[ 'your-custom-handle-lowercase' ] = array(
'label' => __( 'WordPress Pages as 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