Skip to content

Commit

Permalink
fix(admin): Make sure $selected_styles is an array before running in_…
Browse files Browse the repository at this point in the history
…array, adding link to Global Design Settings page in the callout
  • Loading branch information
fischfood committed Apr 12, 2021
1 parent ab33603 commit e725427
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Controller/Admin/Courier_Notice_Metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function post_submitbox_misc_actions() {
if ( ! in_array( $pagenow, array( 'post-new.php' ) ) ) {

$courier_options = get_option( 'courier_design', array() );
$selected_styles = $courier_options['enable_title'];
$selected_styles = ( is_array( $courier_options['enable_title'] ) ) ? $courier_options['enable_title'] : [];

if ( has_term( '', 'courier_style' ) ) {
$selected_courier_style = get_the_terms( $post->ID, 'courier_style' );
Expand All @@ -225,7 +225,7 @@ public function post_submitbox_misc_actions() {
$show_hide = 'hide';
?>
<div id="show-hide-info" class="courier-admin-notice notice inline">
<p>The <strong>Notice Style</strong> (<span id="selected-courier-notice-type" data-enable-title="<?php echo implode( ',', $selected_styles ); ?>"><?php echo esc_html( $selected_courier_style[0]->name ); ?></span>) is displaying this Notice's Title by default in the <a href="">global design settings</a>. Use the "Hide title" toggle below to override for this notice.</p>
<p>The <strong>Notice Style</strong> (<span id="selected-courier-notice-type" data-enable-title="<?php echo implode( ',', $selected_styles ); ?>"><?php echo esc_html( $selected_courier_style[0]->name ); ?></span>) is displaying this Notice's Title by default in the <a href="<?php echo esc_url( site_url('/wp-admin/edit.php?post_type=courier_notice&page=courier&tab=design&subtab=global') ); ?>">global design settings</a>. Use the "Hide title" toggle below to override for this notice.</p>
</div>
<?php
}
Expand Down

0 comments on commit e725427

Please # to comment.