Skip to content

Commit

Permalink
for articles with existing apple news ids display update instead of p…
Browse files Browse the repository at this point in the history
…ublish
  • Loading branch information
scottnelle committed Dec 10, 2024
1 parent 5468f9a commit af6c39f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions admin/class-admin-apple-news-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ public function column_title( $item ) {
return;
}

$apple_news_api_id = get_post_meta( $item->ID, 'apple_news_api_id', true );

// Build the base URL.
$base_url = add_query_arg(
[
Expand Down Expand Up @@ -202,7 +204,7 @@ public function column_title( $item ) {
$actions['push'] = sprintf(
"<a href='%s'>%s</a>",
esc_url( Admin_Apple_Index_Page::action_query_params( 'push', $base_url ) ),
esc_html__( 'Publish', 'apple-news' )
$apple_news_api_id ? esc_html__( 'Update', 'apple-news' ) : esc_html__( 'Publish', 'apple-news' )
);
}

Expand All @@ -216,7 +218,7 @@ public function column_title( $item ) {
}

// Add the delete action, if required.
if ( get_post_meta( $item->ID, 'apple_news_api_id', true ) ) {
if ( $apple_news_api_id ) {
$actions['delete'] = sprintf(
"<a title='%s' href='%s' class='delete-button'>%s</a>",
esc_html__( 'Delete from Apple News', 'apple-news' ),
Expand Down

0 comments on commit af6c39f

Please sign in to comment.