wp-multi-team-card.php aktualisiert

This commit is contained in:
M_Viper 2025-04-20 11:20:16 +00:00
parent 7f09b4896d
commit 193119cc2d

View File

@ -1,359 +1,410 @@
<?php <?php
/** /**
* Plugin Name: WP Multi Team-Card * Plugin Name: WP Multi Team-Card
* Plugin URI: https://git.viper.ipv64.net/M_Viper/wp-multi * Plugin URI: https://git.viper.ipv64.net/M_Viper/wp-multi
* Description: Erstellt Teamkarten mit Name, Funktion, Zuständigkeit, Bild und Kategorie. Ausgabe per Shortcode [teamcards]. * Description: Erstellt Teamkarten mit Name, Funktion, Zuständigkeit, Bild und Kategorie. Ausgabe per Shortcode [teamcards].
* Version: 1.0 * Version: 1.0
* Author: M_Viper * Author: M_Viper
* Author URI: https://m-viper.de * Author URI: https://m-viper.de
* Requires at least: 6.7.2 * Requires at least: 6.7.2
* Tested up to: 6.7.2 * Tested up to: 6.7.2
* PHP Version: 7.2 * PHP Version: 7.2
* License: GPL2 * License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html * License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-multi-team-card * Text Domain: wp-multi-team-card
* Tags: team, card, shortcodes, team-management, customizable, responsive * Tags: team, card, shortcodes, team-management, customizable, responsive
* Support: [Microsoft Teams Support](https://teams.live.com/l/community/FEAzokphpZTJ2u6OgI) * Support: [Microsoft Teams Support](https://teams.live.com/l/community/FEAzokphpZTJ2u6OgI)
* Support: [Telegram Support](https://t.me/M_Viper04) * Support: [Telegram Support](https://t.me/M_Viper04)
*/ */
if (!defined('ABSPATH')) exit; if (!defined('ABSPATH')) exit;
// Check if the PHP version is sufficient // Check if the PHP version is sufficient
if (version_compare(PHP_VERSION, '7.2', '<')) { if (version_compare(PHP_VERSION, '7.2', '<')) {
die('This plugin requires PHP 7.2 or higher.'); die('This plugin requires PHP 7.2 or higher.');
} }
// CPT registrieren // Get the current version of the plugin from the plugin header dynamically
function teamcard_register_post_type() { function get_current_plugin_version() {
register_post_type('teamcard', [ // Get the plugin data
'labels' => [ $plugin_data = get_plugin_data(__FILE__);
'name' => 'Teammitglieder', return $plugin_data['Version']; // Return the version from the plugin header
'singular_name' => 'Teammitglied', }
'add_new' => 'Neues Teammitglied',
'add_new_item' => 'Teammitglied hinzufügen', $gitea_api_url = 'https://git.viper.ipv64.net/api/v1/repos/M_Viper/wp-multi-teamcard/releases/latest'; // Gitea API URL
'edit_item' => 'Teammitglied bearbeiten',
], function check_for_new_release() {
'public' => true, global $gitea_api_url;
'show_ui' => false, // Standard-UI ausblenden
'show_in_menu' => false, // Nicht im Hauptmenü anzeigen // Get the current version dynamically from the plugin header
'menu_icon' => 'dashicons-groups', $current_version = get_current_plugin_version();
'supports' => ['title'],
'has_archive' => false, // Fetch the latest release data from Gitea
'show_in_admin_bar' => false, $response = wp_remote_get($gitea_api_url);
]);
// Check if there was an error with the API request
register_taxonomy('teamcard_kategorie', 'teamcard', [ if (is_wp_error($response)) {
'labels' => [ return;
'name' => 'Kategorien', }
'singular_name' => 'Kategorie',
], $body = wp_remote_retrieve_body($response);
'hierarchical' => true, $release_data = json_decode($body);
'public' => true,
'show_admin_column' => true, // If release data is valid
]); if (isset($release_data->tag_name)) {
} $latest_version = $release_data->tag_name;
add_action('init', 'teamcard_register_post_type');
// If the latest version differs from the current version, show the banner
// Admin-Menü hinzufügen if ($latest_version !== $current_version) {
function teamcard_add_admin_menu() { // Display the banner in the admin area
add_menu_page( add_action('admin_notices', function() use ($latest_version) {
'Teammitglieder verwalten', echo '<div class="notice notice-info is-dismissible">
'Teamkarten', <p><strong>⚠️ Neue Version von WP Multi Teamcard verfügbar:</strong> Version ' . esc_html($latest_version) . ' ist jetzt auf Gitea verfügbar. <a href="https://git.viper.ipv64.net/M_Viper/wp-multi-teamcard/releases" target="_blank">Hier klicken, um die neue Version herunterzuladen. ⚠️</a></p>
'manage_options', </div>';
'teamcard_management', });
'teamcard_admin_page', }
'dashicons-groups', }
30 }
);
} // Hook into the admin init to check for updates
add_action('admin_menu', 'teamcard_add_admin_menu'); add_action('admin_init', 'check_for_new_release');
// Die Hauptverwaltungsseite
function teamcard_admin_page() {
?>
<div class="wrap teamcard-admin">
<h1>Teammitglieder verwalten</h1>
<!-- Formular zum Hinzufügen neuer Teammitglieder --> // CPT registrieren
<div class="teamcard-add-new-form"> function teamcard_register_post_type() {
<h2>Neues Teammitglied hinzufügen</h2> register_post_type('teamcard', [
<div class="form-fields"> 'labels' => [
<div class="form-field"> 'name' => 'Teammitglieder',
<label for="new-teamcard-name">Name:</label> 'singular_name' => 'Teammitglied',
<input type="text" id="new-teamcard-name" placeholder="Name eingeben"> 'add_new' => 'Neues Teammitglied',
</div> 'add_new_item' => 'Teammitglied hinzufügen',
<div class="form-field"> 'edit_item' => 'Teammitglied bearbeiten',
<label for="new-teamcard-funktion">Funktion:</label> ],
<input type="text" id="new-teamcard-funktion" placeholder="Funktion eingeben"> 'public' => true,
</div> 'show_ui' => false, // Standard-UI ausblenden
<div class="form-field"> 'show_in_menu' => false, // Nicht im Hauptmenü anzeigen
<label for="new-teamcard-zustaendigkeit">Zuständigkeit:</label> 'menu_icon' => 'dashicons-groups',
<input type="text" id="new-teamcard-zustaendigkeit" placeholder="Zuständigkeit eingeben"> 'supports' => ['title'],
</div> 'has_archive' => false,
<div class="form-field"> 'show_in_admin_bar' => false,
<label>Bild:</label> ]);
<div class="image-preview-container">
<img id="new-teamcard-bild-vorschau" src="" style="display:none; max-width:100px;"> register_taxonomy('teamcard_kategorie', 'teamcard', [
</div> 'labels' => [
<input type="hidden" id="new-teamcard-bild-id" value=""> 'name' => 'Kategorien',
<button type="button" class="button" id="new-teamcard-bild-button">Bild auswählen</button> 'singular_name' => 'Kategorie',
</div> ],
<div class="form-field"> 'hierarchical' => true,
<button type="button" id="add-teamcard-button" class="button button-primary">Teammitglied hinzufügen</button> 'public' => true,
</div> 'show_admin_column' => true,
</div> ]);
</div> }
add_action('init', 'teamcard_register_post_type');
<h2>Vorhandene Teammitglieder</h2>
<p>Ziehe die Zeilen, um die Reihenfolge zu ändern. Klicke auf die Felder, um sie zu bearbeiten.</p> // Admin-Menü hinzufügen
function teamcard_add_admin_menu() {
<!-- Liste der vorhandenen Teammitglieder --> add_menu_page(
<table class="wp-list-table widefat fixed striped"> 'Teammitglieder verwalten',
<thead> 'Teamkarten',
<tr> 'manage_options',
<th width="10%">Bild</th> 'teamcard_management',
<th width="20%">Name</th> 'teamcard_admin_page',
<th width="20%">Funktion</th> 'dashicons-groups',
<th width="30%">Zuständigkeit</th> 30
<th width="20%">Aktionen</th> );
</tr> }
</thead> add_action('admin_menu', 'teamcard_add_admin_menu');
<tbody id="teamcard-list">
<?php // Die Hauptverwaltungsseite
$teamcards = get_posts([ function teamcard_admin_page() {
'post_type' => 'teamcard', ?>
'posts_per_page' => -1, <div class="wrap teamcard-admin">
'orderby' => 'menu_order', <h1>Teammitglieder verwalten</h1>
'order' => 'ASC'
]); <!-- Formular zum Hinzufügen neuer Teammitglieder -->
<div class="teamcard-add-new-form">
foreach ($teamcards as $teamcard) { <h2>Neues Teammitglied hinzufügen</h2>
$funktion = get_post_meta($teamcard->ID, '_teamcard_funktion', true); <div class="form-fields">
$zustaendigkeit = get_post_meta($teamcard->ID, '_teamcard_zustaendigkeit', true); <div class="form-field">
$bild_id = get_post_meta($teamcard->ID, '_teamcard_bild_id', true); <label for="new-teamcard-name">Name:</label>
$bild_url = $bild_id ? wp_get_attachment_image_url($bild_id, 'thumbnail') : ''; <input type="text" id="new-teamcard-name" placeholder="Name eingeben">
?> </div>
<tr data-id="<?php echo $teamcard->ID; ?>" class="teamcard-item"> <div class="form-field">
<td class="teamcard-bild"> <label for="new-teamcard-funktion">Funktion:</label>
<div class="image-preview-container"> <input type="text" id="new-teamcard-funktion" placeholder="Funktion eingeben">
<?php if ($bild_url): ?> </div>
<img src="<?php echo esc_url($bild_url); ?>" class="teamcard-bild-vorschau"> <div class="form-field">
<?php endif; ?> <label for="new-teamcard-zustaendigkeit">Zuständigkeit:</label>
</div> <input type="text" id="new-teamcard-zustaendigkeit" placeholder="Zuständigkeit eingeben">
<button type="button" class="button teamcard-bild-button" data-id="<?php echo $teamcard->ID; ?>">Bild ändern</button> </div>
</td> <div class="form-field">
<td> <label>Bild:</label>
<div class="editable" data-field="title" data-id="<?php echo $teamcard->ID; ?>"><?php echo esc_html($teamcard->post_title); ?></div> <div class="image-preview-container">
</td> <img id="new-teamcard-bild-vorschau" src="" style="display:none; max-width:100px;">
<td> </div>
<div class="editable" data-field="funktion" data-id="<?php echo $teamcard->ID; ?>"><?php echo esc_html($funktion); ?></div> <input type="hidden" id="new-teamcard-bild-id" value="">
</td> <button type="button" class="button" id="new-teamcard-bild-button">Bild auswählen</button>
<td> </div>
<div class="editable" data-field="zustaendigkeit" data-id="<?php echo $teamcard->ID; ?>"><?php echo esc_html($zustaendigkeit); ?></div> <div class="form-field">
</td> <button type="button" id="add-teamcard-button" class="button button-primary">Teammitglied hinzufügen</button>
<td> </div>
<button type="button" class="button button-small teamcard-delete" data-id="<?php echo $teamcard->ID; ?>">Löschen</button> </div>
</td> </div>
</tr>
<?php <h2>Vorhandene Teammitglieder</h2>
} <p>Ziehe die Zeilen, um die Reihenfolge zu ändern. Klicke auf die Felder, um sie zu bearbeiten.</p>
?>
</tbody> <!-- Liste der vorhandenen Teammitglieder -->
</table> <table class="wp-list-table widefat fixed striped">
<thead>
<div id="teamcard-message" class="notice" style="display:none;"></div> <tr>
</div> <th width="10%">Bild</th>
<?php <th width="20%">Name</th>
} <th width="20%">Funktion</th>
<th width="30%">Zuständigkeit</th>
// AJAX-Handler zum Speichern der Teammitglieder <th width="20%">Aktionen</th>
function teamcard_ajax_handlers() { </tr>
// Neues Teammitglied hinzufügen </thead>
add_action('wp_ajax_add_teamcard', function() { <tbody id="teamcard-list">
$name = sanitize_text_field($_POST['name']); <?php
$funktion = sanitize_text_field($_POST['funktion']); $teamcards = get_posts([
$zustaendigkeit = sanitize_text_field($_POST['zustaendigkeit']); 'post_type' => 'teamcard',
$bild_id = intval($_POST['bild_id']); 'posts_per_page' => -1,
'orderby' => 'menu_order',
// Höchste menu_order finden 'order' => 'ASC'
$max_order = 0; ]);
$posts = get_posts([
'post_type' => 'teamcard', foreach ($teamcards as $teamcard) {
'posts_per_page' => 1, $funktion = get_post_meta($teamcard->ID, '_teamcard_funktion', true);
'orderby' => 'menu_order', $zustaendigkeit = get_post_meta($teamcard->ID, '_teamcard_zustaendigkeit', true);
'order' => 'DESC' $bild_id = get_post_meta($teamcard->ID, '_teamcard_bild_id', true);
]); $bild_url = $bild_id ? wp_get_attachment_image_url($bild_id, 'thumbnail') : '';
?>
if (!empty($posts)) { <tr data-id="<?php echo $teamcard->ID; ?>" class="teamcard-item">
$max_order = $posts[0]->menu_order; <td class="teamcard-bild">
} <div class="image-preview-container">
<?php if ($bild_url): ?>
// Neuen Post erstellen <img src="<?php echo esc_url($bild_url); ?>" class="teamcard-bild-vorschau">
$post_id = wp_insert_post([ <?php endif; ?>
'post_type' => 'teamcard', </div>
'post_title' => $name, <button type="button" class="button teamcard-bild-button" data-id="<?php echo $teamcard->ID; ?>">Bild ändern</button>
'post_status' => 'publish', </td>
'menu_order' => $max_order + 1 <td>
]); <div class="editable" data-field="title" data-id="<?php echo $teamcard->ID; ?>"><?php echo esc_html($teamcard->post_title); ?></div>
</td>
if ($post_id) { <td>
update_post_meta($post_id, '_teamcard_funktion', $funktion); <div class="editable" data-field="funktion" data-id="<?php echo $teamcard->ID; ?>"><?php echo esc_html($funktion); ?></div>
update_post_meta($post_id, '_teamcard_zustaendigkeit', $zustaendigkeit); </td>
<td>
if ($bild_id > 0) { <div class="editable" data-field="zustaendigkeit" data-id="<?php echo $teamcard->ID; ?>"><?php echo esc_html($zustaendigkeit); ?></div>
update_post_meta($post_id, '_teamcard_bild_id', $bild_id); </td>
} <td>
<button type="button" class="button button-small teamcard-delete" data-id="<?php echo $teamcard->ID; ?>">Löschen</button>
$bild_url = $bild_id ? wp_get_attachment_image_url($bild_id, 'thumbnail') : ''; </td>
</tr>
wp_send_json_success([ <?php
'id' => $post_id, }
'bild_url' => $bild_url ?>
]); </tbody>
} else { </table>
wp_send_json_error(['message' => 'Fehler beim Erstellen des Teammitglieds']);
} <div id="teamcard-message" class="notice" style="display:none;"></div>
}); </div>
<?php
// Teammitglied aktualisieren }
add_action('wp_ajax_update_teamcard', function() {
$post_id = intval($_POST['id']); // AJAX-Handler zum Speichern der Teammitglieder
$field = sanitize_text_field($_POST['field']); function teamcard_ajax_handlers() {
$value = sanitize_text_field($_POST['value']); // Neues Teammitglied hinzufügen
add_action('wp_ajax_add_teamcard', function() {
if ($field === 'title') { $name = sanitize_text_field($_POST['name']);
wp_update_post([ $funktion = sanitize_text_field($_POST['funktion']);
'ID' => $post_id, $zustaendigkeit = sanitize_text_field($_POST['zustaendigkeit']);
'post_title' => $value $bild_id = intval($_POST['bild_id']);
]);
} else { // Höchste menu_order finden
update_post_meta($post_id, '_teamcard_' . $field, $value); $max_order = 0;
} $posts = get_posts([
'post_type' => 'teamcard',
wp_send_json_success(); 'posts_per_page' => 1,
}); 'orderby' => 'menu_order',
'order' => 'DESC'
// Teammitglied löschen ]);
add_action('wp_ajax_delete_teamcard', function() {
$post_id = intval($_POST['id']); if (!empty($posts)) {
$max_order = $posts[0]->menu_order;
if (wp_delete_post($post_id, true)) { }
wp_send_json_success();
} else { // Neuen Post erstellen
wp_send_json_error(['message' => 'Fehler beim Löschen des Teammitglieds']); $post_id = wp_insert_post([
} 'post_type' => 'teamcard',
}); 'post_title' => $name,
'post_status' => 'publish',
// Bild aktualisieren 'menu_order' => $max_order + 1
add_action('wp_ajax_update_teamcard_image', function() { ]);
$post_id = intval($_POST['id']);
$bild_id = intval($_POST['bild_id']); if ($post_id) {
update_post_meta($post_id, '_teamcard_funktion', $funktion);
update_post_meta($post_id, '_teamcard_bild_id', $bild_id); update_post_meta($post_id, '_teamcard_zustaendigkeit', $zustaendigkeit);
$bild_url = wp_get_attachment_image_url($bild_id, 'thumbnail');
if ($bild_id > 0) {
wp_send_json_success(['bild_url' => $bild_url]); update_post_meta($post_id, '_teamcard_bild_id', $bild_id);
}); }
// Reihenfolge aktualisieren $bild_url = $bild_id ? wp_get_attachment_image_url($bild_id, 'thumbnail') : '';
add_action('wp_ajax_update_teamcard_order', function() {
$order = $_POST['order']; wp_send_json_success([
'id' => $post_id,
foreach ($order as $position => $post_id) { 'bild_url' => $bild_url
wp_update_post([ ]);
'ID' => intval($post_id), } else {
'menu_order' => $position wp_send_json_error(['message' => 'Fehler beim Erstellen des Teammitglieds']);
]); }
} });
wp_send_json_success(); // Teammitglied aktualisieren
}); add_action('wp_ajax_update_teamcard', function() {
} $post_id = intval($_POST['id']);
add_action('init', 'teamcard_ajax_handlers'); $field = sanitize_text_field($_POST['field']);
$value = sanitize_text_field($_POST['value']);
// Admin-Skripte und Styles laden
function teamcard_admin_scripts($hook) { if ($field === 'title') {
if ($hook !== 'toplevel_page_teamcard_management') return; wp_update_post([
'ID' => $post_id,
wp_enqueue_media(); 'post_title' => $value
wp_enqueue_script('jquery-ui-sortable'); ]);
} else {
wp_enqueue_style( update_post_meta($post_id, '_teamcard_' . $field, $value);
'teamcard-admin-style', }
plugin_dir_url(__FILE__) . 'teamcard-admin.css',
[], wp_send_json_success();
'1.0' });
);
// Teammitglied löschen
wp_enqueue_script( add_action('wp_ajax_delete_teamcard', function() {
'teamcard-admin-script', $post_id = intval($_POST['id']);
plugin_dir_url(__FILE__) . 'teamcard-admin.js',
['jquery', 'jquery-ui-sortable'], if (wp_delete_post($post_id, true)) {
'1.0', wp_send_json_success();
true } else {
); wp_send_json_error(['message' => 'Fehler beim Löschen des Teammitglieds']);
}
wp_localize_script('teamcard-admin-script', 'teamcard_data', [ });
'ajax_url' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('teamcard_nonce') // Bild aktualisieren
]); add_action('wp_ajax_update_teamcard_image', function() {
} $post_id = intval($_POST['id']);
add_action('admin_enqueue_scripts', 'teamcard_admin_scripts'); $bild_id = intval($_POST['bild_id']);
// Shortcode für die Frontend-Anzeige update_post_meta($post_id, '_teamcard_bild_id', $bild_id);
function teamcard_shortcode($atts) { $bild_url = wp_get_attachment_image_url($bild_id, 'thumbnail');
$atts = shortcode_atts([
'kategorie' => '', wp_send_json_success(['bild_url' => $bild_url]);
], $atts); });
$args = [ // Reihenfolge aktualisieren
'post_type' => 'teamcard', add_action('wp_ajax_update_teamcard_order', function() {
'posts_per_page' => -1, $order = $_POST['order'];
'orderby' => 'menu_order',
'order' => 'ASC', foreach ($order as $position => $post_id) {
]; wp_update_post([
'ID' => intval($post_id),
if ($atts['kategorie']) { 'menu_order' => $position
$args['tax_query'] = [[ ]);
'taxonomy' => 'teamcard_kategorie', }
'field' => 'slug',
'terms' => $atts['kategorie'], wp_send_json_success();
]]; });
} }
add_action('init', 'teamcard_ajax_handlers');
$query = new WP_Query($args);
if (!$query->have_posts()) return '<p>Keine Teammitglieder gefunden.</p>'; // Admin-Skripte und Styles laden
function teamcard_admin_scripts($hook) {
ob_start(); if ($hook !== 'toplevel_page_teamcard_management') return;
echo '<div class="teamcard-grid" style="display: flex; flex-wrap: wrap; gap: 20px;">';
while ($query->have_posts()) { wp_enqueue_media();
$query->the_post(); wp_enqueue_script('jquery-ui-sortable');
$funktion = get_post_meta(get_the_ID(), '_teamcard_funktion', true);
$zustaendigkeit = get_post_meta(get_the_ID(), '_teamcard_zustaendigkeit', true); wp_enqueue_style(
$bild_id = get_post_meta(get_the_ID(), '_teamcard_bild_id', true); 'teamcard-admin-style',
$bild_url = $bild_id ? wp_get_attachment_url($bild_id) : ''; plugin_dir_url(__FILE__) . 'teamcard-admin.css',
echo '<div class="teamcard" style="display: flex; flex-wrap: wrap; border:1px solid #ccc; border-radius:10px; padding:15px; width:48%; align-items: center;">'; [],
'1.0'
// Bild links );
if ($bild_url) {
echo '<div style="flex: 1; text-align: center; display: flex; justify-content: center; align-items: center; margin-right: 10px;">'; wp_enqueue_script(
echo '<img src="' . esc_url($bild_url) . '" style="max-width:100px; border-radius:50%; margin-bottom:0;">'; 'teamcard-admin-script',
echo '</div>'; plugin_dir_url(__FILE__) . 'teamcard-admin.js',
} ['jquery', 'jquery-ui-sortable'],
'1.0',
// Text rechts true
echo '<div style="flex: 2; padding-left: 10px;">'; );
echo '<h3>' . get_the_title() . '</h3>';
echo '<p><strong>' . esc_html($funktion) . '</strong></p>'; wp_localize_script('teamcard-admin-script', 'teamcard_data', [
echo '<p>' . esc_html($zustaendigkeit) . '</p>'; 'ajax_url' => admin_url('admin-ajax.php'),
echo '</div>'; 'nonce' => wp_create_nonce('teamcard_nonce')
]);
echo '</div>'; // Schließt die Teamcard-Div }
} add_action('admin_enqueue_scripts', 'teamcard_admin_scripts');
echo '</div>'; // Schließt die Teamcard-Grid-Div
// Shortcode für die Frontend-Anzeige
wp_reset_postdata(); function teamcard_shortcode($atts) {
return ob_get_clean(); $atts = shortcode_atts([
} 'kategorie' => '',
], $atts);
$args = [
'post_type' => 'teamcard',
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
];
if ($atts['kategorie']) {
$args['tax_query'] = [[
'taxonomy' => 'teamcard_kategorie',
'field' => 'slug',
'terms' => $atts['kategorie'],
]];
}
$query = new WP_Query($args);
if (!$query->have_posts()) return '<p>Keine Teammitglieder gefunden.</p>';
ob_start();
echo '<div class="teamcard-grid" style="display: flex; flex-wrap: wrap; gap: 20px;">';
while ($query->have_posts()) {
$query->the_post();
$funktion = get_post_meta(get_the_ID(), '_teamcard_funktion', true);
$zustaendigkeit = get_post_meta(get_the_ID(), '_teamcard_zustaendigkeit', true);
$bild_id = get_post_meta(get_the_ID(), '_teamcard_bild_id', true);
$bild_url = $bild_id ? wp_get_attachment_url($bild_id) : '';
echo '<div class="teamcard" style="display: flex; flex-wrap: wrap; border:1px solid #ccc; border-radius:10px; padding:15px; width:48%; align-items: center;">';
// Bild links
if ($bild_url) {
echo '<div style="flex: 1; text-align: center; display: flex; justify-content: center; align-items: center; margin-right: 10px;">';
echo '<img src="' . esc_url($bild_url) . '" style="max-width:100px; border-radius:50%; margin-bottom:0;">';
echo '</div>';
}
// Text rechts
echo '<div style="flex: 2; padding-left: 10px;">';
echo '<h3>' . get_the_title() . '</h3>';
echo '<p><strong>' . esc_html($funktion) . '</strong></p>';
echo '<p>' . esc_html($zustaendigkeit) . '</p>';
echo '</div>';
echo '</div>'; // Schließt die Teamcard-Div
}
echo '</div>'; // Schließt die Teamcard-Grid-Div
wp_reset_postdata();
return ob_get_clean();
}
add_shortcode('teamcards', 'teamcard_shortcode'); add_shortcode('teamcards', 'teamcard_shortcode');