Skip to content

Commit

Permalink
fixed fatal error
Browse files Browse the repository at this point in the history
  • Loading branch information
rudlinkon committed Mar 25, 2024
1 parent d6e541f commit e8a6763
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions includes/Extensions/Table_of_Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ public function register_controls($element)

if ( ! empty( $supported_posts ) ) {
foreach ( $supported_posts as $post_type ) {
if ( ! in_array( $post_type, [ 'post', 'page' ] ) ) {
$post_type_labels = get_post_type_labels( get_post_type_object( $post_type ) );
$plural_name = $post_type_labels->name;
$display_on[ $post_type ] = sprintf( __( 'All %s', 'essential-addons-for-elementor-lite' ), $plural_name );
$post_obj = get_post_type_object( $post_type );

if ( ! in_array( $post_type, [ 'post', 'page' ] ) && is_a( $post_obj, 'WP_Post_Type' ) && $post_obj->labels ) {
$post_type_labels = get_post_type_labels( $post_obj );
$plural_name = $post_type_labels->name;
$display_on[ $post_type ] = sprintf( __( 'All %s', 'essential-addons-for-elementor-lite' ), $plural_name );
}
}
}
Expand Down

0 comments on commit e8a6763

Please sign in to comment.