fix(widgets): align tabbed post layouts with reference

This commit is contained in:
kate522 committed 2026-10-29 20:31:39 +08:00
1 parent 17515cf9c5
commit fd034ff055
16 files changed
+1256 -37

No files matched your search

+2 -1
View File
@@ -38,6 +38,7 @@ if (!function_exists('aksrt_renderer_config')) {
* @return array<string,mixed>
*/
function aksrt_renderer_config(array $args = []): array {
$has_no_margin = array_key_exists('no_margin', $args);
$args = wp_parse_args($args, aksrt_renderer_defaults());
$list = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_post_list_style_settings()
@@ -74,7 +75,7 @@ if (!function_exists('aksrt_renderer_config')) {
$args['list_type'] = $list_type;
$args['style'] = $style;
$args['img_position'] = sanitize_key((string) ($list_option['img_position'] ?? 'left')) === 'right' ? 'right' : 'left';
$args['no_margin'] = !empty($args['no_margin']) || (($list['list_show_type'] ?? 'separate') === 'no_margin');
$args['no_margin'] = $has_no_margin ? !empty($args['no_margin']) : (($list['list_show_type'] ?? 'separate') === 'no_margin');
$args['no_author'] = !empty($args['no_author']) || !empty($args['is_author']);
$args['target_blank'] = !empty($list['target_blank']);
$args['heading_bold'] = !empty($list['item_heading_bold']);
+3 -1
View File
@@ -93,7 +93,7 @@ if (!function_exists('aksrt_renderer_mini')) {
$show_time = !empty($cfg['show_time']);
if (!empty($cfg['show_author'])) {
$author_value = $show_time ? (string) $data['time_ago'] : (string) $data['author_name'];
$meta_left = '<item class="meta-author flex ac"><img class="avatar-mini" src="' . esc_url((string) $data['avatar_url']) . '" alt="" width="20" height="20"><span class="ml6">' . esc_html($author_value) . '</span></item>';
$meta_left = '<item class="meta-author flex ac">' . aksrt_get_avatar_box((int) $data['author_id'], 'avatar-mini') . '<span class="ml6">' . esc_html($author_value) . '</span></item>';
} else {
$meta_left = $show_time ? '<item title="' . esc_attr((string) $data['time_title']) . '" class="icon-circle mln3">' . esc_html((string) $data['time_ago']) . '</item>' : '';
}
@@ -186,6 +186,8 @@ if (!function_exists('aksrt_render_post_list')) {
if (!function_exists('aksrt_render_mini_list')) {
function aksrt_render_mini_list(WP_Query $query, array $args = [], bool $echo = true): string {
$cfg = aksrt_renderer_config($args);
// The reference mini rows follow the site's list ordering time source.
$cfg['time_source'] = $cfg['list_orderby'] === 'modified' ? 'modified' : 'date';
$html = '';
$number = max(0, (int) ($args['number_offset'] ?? 0));
while ($query->have_posts()) {
+1 -2
View File
@@ -87,7 +87,6 @@ if (!function_exists('aksrt_renderer_collect_post_data')) {
'tags' => $tags,
'author_id' => $author_id,
'author_name' => $author instanceof WP_User ? $author->display_name : '',
'avatar_url' => get_avatar_url($author_id, ['size' => 40]),
'time_title' => $time_value,
'time_ago' => human_time_diff($time_timestamp, current_time('timestamp')) . __('前', 'aksrt'),
'views' => (int) aksrt_get_post_views($post_id),
@@ -256,7 +255,7 @@ if (!function_exists('aksrt_renderer_meta')) {
$time = $show_time
? '<span title="' . esc_attr((string) $data['time_title']) . '" class="' . ($is_card ? 'ml6' : 'icon-circle') . '">' . esc_html((string) $data['time_ago']) . '</span>'
: '';
$avatar = '<img class="avatar-mini" src="' . esc_url((string) $data['avatar_url']) . '" alt="" width="20" height="20">';
$avatar = aksrt_get_avatar_box((int) $data['author_id'], 'avatar-mini');
$meta_left = '<item class="meta-author flex ac">' . $avatar . $name . $time . '</item>';
} elseif ($show_time) {
$meta_left = '<item title="' . esc_attr((string) $data['time_title']) . '" class="icon-circle mln3">' . esc_html((string) $data['time_ago']) . '</item>';