Skip to content

Instantly share code, notes, and snippets.

@eudesgit
Last active February 13, 2018 19:28
Show Gist options
  • Save eudesgit/a6aff39d2cbbcd2378327faccaf2ff73 to your computer and use it in GitHub Desktop.
Save eudesgit/a6aff39d2cbbcd2378327faccaf2ff73 to your computer and use it in GitHub Desktop.
How to make outside the theme page templates available for use
<?php
/**
* theme_page_templates Filter callback
*
* Merges plugins' template with theme's, making them available for the user
*
* @param array $theme_templates
* @return array $theme_templates
*/
function register_plugin_templates ( $theme_templates ) {
// Merging the WP templates with this plugin's active templates
$theme_templates = array_merge($theme_templates, $this->templates);
return $theme_templates;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment