feat(user-center): upgrade posts panel to creator center

This commit is contained in:
kate522 committed 2026-08-06 16:24:59 +08:00
1 parent 7891ce7096
commit 2f9384f368
7 files changed
+123 -36

No files matched your search

@@ -21,27 +21,37 @@ $ps_args = [
'update_post_term_cache' => true,
];
$q = new WP_Query($ps_args);
$front_submit = class_exists('\\AKSRT\\Core\\FrontSubmit') ? \AKSRT\Core\FrontSubmit::get_instance() : null;
if ($q->have_posts()) :
?>
<div class="profile-list">
<div class="profile-list creator-center-post-list">
<?php
while ($q->have_posts()) :
$q->the_post();
$st = get_post_status();
$status_label = '';
if ('publish' !== $st) {
$st_map = [
'draft' => __('草稿', 'aksrt'),
'pending' => __('待审', 'aksrt'),
'private' => __('私密', 'aksrt'),
'future' => __('定时', 'aksrt'),
];
$status_label = $st_map[$st] ?? $st;
}
$edit_link = get_edit_post_link();
$status_map = [
'publish' => __('已发布', 'aksrt'),
'draft' => __('草稿', 'aksrt'),
'pending' => __('待审', 'aksrt'),
'private' => __('私密', 'aksrt'),
'future' => __('定时', 'aksrt'),
];
$status_label = $status_map[$st] ?? $st;
$can_delete = $front_submit && $front_submit->can_delete_post(get_the_ID(), (int) $user_id);
$edit_link = $front_submit && $front_submit->can_edit_post(get_the_ID(), (int) $user_id)
? aksrt_get_new_post_url(get_the_ID())
: '';
$view_link = get_permalink();
$action = $edit_link
? ['type' => 'edit', 'url' => $edit_link, 'label' => __('编辑', 'aksrt')]
: ('publish' === $st && $view_link ? ['type' => 'view', 'url' => $view_link, 'label' => __('预览', 'aksrt')] : []);
get_template_part('templates/parts/content', 'profile-list-item', [
'action' => $edit_link ? ['type' => 'edit', 'url' => $edit_link, 'label' => __('编辑', 'aksrt')] : [],
'status' => $status_label,
'action' => $action,
'status' => $status_label,
'delete_action' => [
'enabled' => $can_delete,
'nonce' => wp_create_nonce('aksrt_submit'),
],
]);
endwhile;
?>
@@ -54,7 +64,7 @@ else :
$svg_empty_post,
__('还没有文章', 'aksrt'),
__('试试发布你的第一篇文章吧。', 'aksrt'),
admin_url('post-new.php'),
!empty($new_post_url) ? $new_post_url : '',
__('写文章', 'aksrt')
);
endif;