Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions inc/profiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,18 @@ function after_setup_theme() {
add_image_size( 'responsive_profile_large', $width, $height, $crop );
}
add_action( 'after_setup_theme', __NAMESPACE__ . '\after_setup_theme' );

if ( ! defined( 'BU_PROFILES_PLUGIN_ACTIVE' ) || ! BU_PROFILES_PLUGIN_ACTIVE ) {
/**
* Removes the profile template if BU profiles is not active.
*
* @param array $page_templates list of registered page templates.
* @return array $page_templates list of registered page templates.
*/
function remove_profile_template( $page_templates ) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it is legal to define a function inside an IF statement, I'd recommend moving the function declaration outside of the IF statement for clarity and consistency.

unset( $page_templates['profiles.php'] );

return $page_templates;
}
add_filter( 'theme_page_templates', __NAMESPACE__ . '\remove_profile_template' );
}