Skip to content

Commit

Permalink
fix #400
Browse files Browse the repository at this point in the history
  • Loading branch information
inc2734 committed Oct 24, 2024
1 parent 0ea5d0b commit 98f5848
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions App/Controller/Manager/Model/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,27 @@ function ( $template ) {
$all_templates
);

// Disable WooCommerce templates if WooCommerce is not enabled.
$templates = array_filter(
$templates,
function( $template ) {
if ( ! in_array( 'product', $template['postTypes'] ) ) {
return true;
}

if ( class_exists( '\woocommerce' ) ) {
return true;
}

return false;
}
);

ksort( $templates );
$templates = array_values( $templates );
wp_cache_set( $cache_key, $templates );

error_log( print_r( $templates, true ) . "\n", 3, __DIR__ . '/error_log' );
return $templates;
}

Expand Down

0 comments on commit 98f5848

Please sign in to comment.