diff --git a/admin/partials/articles-list.php b/admin/partials/articles-list.php new file mode 100644 index 0000000..200dd47 --- /dev/null +++ b/admin/partials/articles-list.php @@ -0,0 +1,103 @@ +prefix . 'peptide_news_articles'; +$page = isset( $_GET['paged'] ) ? max( 1, absint( $_GET['paged'] ) ) : 1; +$per_page = 25; +$offset = ( $page - 1 ) * $per_page; + +$total = $wpdb->get_var( "SELECT COUNT(*) FROM {$table}" ); +$articles = $wpdb->get_results( $wpdb->prepare( + "SELECT * FROM {$table} ORDER BY published_at DESC LIMIT %d OFFSET %d", + $per_page, + $offset +) ); + +$total_pages = ceil( $total / $per_page ); +?> + +
+

()

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID
id ); ?> + + title, 12 ) ); ?> + + source ); ?> + tags ) ) : ?> + tags, 10 ) ); ?> + + + + + ai_summary ) ) : ?> + ai_summary, 15 ) ); ?> + + + + published_at ) ) ); ?>fetched_at ) ) ); ?> + thumbnail_url ) ) : ?> + + + + + is_active ? '✓' : '✗'; ?>
+ + 1 ) : ?> +
+
+ add_query_arg( 'paged', '%#%' ), + 'format' => '', + 'current' => $page, + 'total' => $total_pages, + ) ); + ?> +
+
+ +