Skip to content

Commit

Permalink
Tweak the error cases for primary calendar ID
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Jan 20, 2025
1 parent 6fb0eb4 commit 62dd62a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/my-calendar-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,11 +728,13 @@ function my_calendar_settings() {
$page_title = '';
$edit_link = '';
$note = '';
if ( mc_get_option( 'uri_id' ) ) {
if ( mc_get_option( 'uri_id' ) && 'publish' === get_post_status( mc_get_option( 'uri_id' ) ) ) {
$page_title = get_post( absint( mc_get_option( 'uri_id' ) ) )->post_title;
$edit_link = esc_url( get_edit_post_link( absint( mc_get_option( 'uri_id' ) ) ) );
// Translators: Editing URL for calendar page.
$note = sprintf( __( 'Search for a different page or <a href="%s">edit the current calendar page</a>.', 'my-calendar' ), $edit_link );
} elseif ( mc_get_option( 'uri_id' ) && 'trash' === get_post_status( mc_get_option( 'uri_id' ) ) ) {
$note = __( 'Your primary My Calendar page is set, but the page is in the Trash.', 'my-calendar' );
}
?>
<li id="mc-pages-autocomplete" class="mc-autocomplete autocomplete">
Expand Down

0 comments on commit 62dd62a

Please sign in to comment.