'alba_card',
'author' => $current_user_id,
'numberposts' => 5,
'post_status' => 'publish',
'orderby' => 'modified', // Show recently modified cards
'order' => 'DESC'
]);
// Handle empty state if the user has no assigned cards
if (empty($cards)) {
echo '
';
return;
}
echo '';
foreach ($cards as $card) {
// 2. Resolve relationships to get List and Board context
$list_id = get_post_meta($card->ID, 'alba_list_parent', true);
$board_id = 0;
$list_title = __('Unknown List', 'alba-board');
$board_title = __('Unknown Board', 'alba-board');
if ($list_id) {
$list_post = get_post($list_id);
if ($list_post) {
$list_title = $list_post->post_title;
$board_id = get_post_meta($list_id, 'alba_board_parent', true);
// Fetch the Board title
if ($board_id) {
$board_post = get_post($board_id);
if ($board_post) {
$board_title = $board_post->post_title;
}
}
}
}
// Build the direct URL to that specific board
$board_url = admin_url('admin.php?page=alba-board-visual' . ($board_id ? '&board_id=' . absint($board_id) : ''));
// HTML for each card item in the widget
echo '- ';
// Output title and context (Board Name -> List Name)
echo '
';
echo '
' . esc_html($card->post_title) . '';
/* translators: 1: Board Name, 2: List Name */
$contextual_path = sprintf(__('%1$s → %2$s', 'alba-board'), $board_title, $list_title);
echo '
' . wp_kses_post($contextual_path) . '';
echo '
';
// Show a small visual indicator for tags (Colored circles)
$tags = wp_get_post_terms($card->ID, 'alba_tag');
if (!empty($tags) && !is_wp_error($tags)) {
echo '';
$count = 0;
foreach ($tags as $tag) {
if ($count >= 3) break; // Maximum 3 colored dots per space to avoid clutter
$bg = get_term_meta($tag->term_id, 'alba_tag_bg_color', true) ?: '#eeeeee';
echo '';
$count++;
}
echo '
';
}
echo ' ';
}
echo '
';
// Button to go to the full board view
echo '';
}