Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 15e5fdfe07 | |||
| 55f9e9ee8c | |||
| 017f1d1c40 | |||
| ec8a8d3ca1 | |||
| f31ac0da4e |
@@ -5,9 +5,14 @@
|
||||
.kgv-termin-title{margin:0 0 10px;font-size:1.3rem;line-height:1.2}
|
||||
.kgv-termin-meta{display:flex;gap:14px;flex-wrap:wrap;color:#4b5563;font-size:14px;margin-bottom:12px}
|
||||
.kgv-termin-excerpt,.kgv-termin-content{color:#374151;line-height:1.65}
|
||||
.kgv-termin-actions{margin-top:16px}.kgv-termin-btn,.kgv-termin-back{display:inline-block;padding:10px 14px;border-radius:10px;text-decoration:none;background:#e5e7eb;color:#111827}
|
||||
.kgv-termin-actions{margin-top:16px;display:flex;gap:10px;flex-wrap:wrap;align-items:center}
|
||||
.kgv-termine-wrap .kgv-termin-btn,
|
||||
.kgv-termin-single .kgv-termin-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px 12px;min-height:38px;border:0;border-radius:5px;text-decoration:none !important;background-color:var(--kgv-accent,#245c4f) !important;color:#fff !important;font-weight:700;line-height:1.2}
|
||||
.kgv-termine-wrap .kgv-termin-btn:hover,
|
||||
.kgv-termin-single .kgv-termin-btn:hover{text-decoration:none !important;filter:brightness(.95)}
|
||||
.kgv-termin-single-hero{padding:20px;background:#f3f4f6;border-bottom:1px solid #e5e7eb}.kgv-termin-single-hero h2{margin:0 0 10px}
|
||||
.kgv-termin-back{margin-bottom:14px}
|
||||
.kgv-termin-back{display:inline-block;margin-bottom:14px;color:var(--kgv-accent,#245c4f);font-weight:600;text-decoration:none}
|
||||
.kgv-termin-back:hover{text-decoration:underline}
|
||||
.kgv-termine-empty,.kgv-termine-notice{padding:16px;border:1px solid #e5e7eb;border-radius:12px;background:#fff}
|
||||
|
||||
.kgv-termin-single-hero {
|
||||
|
||||
@@ -25,6 +25,7 @@ class KGV_Termine_Plugin {
|
||||
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_assets'));
|
||||
add_action('wp_enqueue_scripts', array($this, 'enqueue_front_assets'));
|
||||
add_action('init', array($this, 'register_shortcodes'));
|
||||
add_action('init', array($this, 'maybe_upgrade_table'));
|
||||
add_action('admin_post_kgv_save_termin', array($this, 'handle_save_termin'));
|
||||
add_action('admin_post_kgv_delete_termin', array($this, 'handle_delete_termin'));
|
||||
add_filter('query_vars', array($this, 'register_query_vars'));
|
||||
@@ -51,6 +52,7 @@ class KGV_Termine_Plugin {
|
||||
is_published TINYINT(1) NOT NULL DEFAULT 1,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
post_id BIGINT UNSIGNED NULL DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
KEY event_date (event_date),
|
||||
KEY is_published (is_published)
|
||||
@@ -59,6 +61,40 @@ class KGV_Termine_Plugin {
|
||||
dbDelta($sql);
|
||||
}
|
||||
|
||||
public function maybe_upgrade_table() {
|
||||
global $wpdb;
|
||||
|
||||
$col = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
"SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = 'post_id'",
|
||||
DB_NAME,
|
||||
$this->table_name
|
||||
)
|
||||
);
|
||||
|
||||
if ( empty( $col ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
||||
$charset_collate = $wpdb->get_charset_collate();
|
||||
$sql = "CREATE TABLE {$this->table_name} (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
event_date DATETIME NOT NULL,
|
||||
owner VARCHAR(255) NULL,
|
||||
location VARCHAR(255) NULL,
|
||||
summary TEXT NULL,
|
||||
description LONGTEXT NULL,
|
||||
is_published TINYINT(1) NOT NULL DEFAULT 1,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
post_id BIGINT UNSIGNED NULL DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
KEY event_date (event_date),
|
||||
KEY is_published (is_published)
|
||||
) {$charset_collate};";
|
||||
dbDelta($sql);
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue_admin_assets($hook) {
|
||||
if (strpos((string) $hook, 'kgv-termine') === false) {
|
||||
return;
|
||||
@@ -161,6 +197,8 @@ class KGV_Termine_Plugin {
|
||||
$description = wp_kses_post(wp_unslash($_POST['description'] ?? ''));
|
||||
$is_published = isset($_POST['is_published']) ? (int) wp_unslash($_POST['is_published']) : 1;
|
||||
$is_published = $is_published === 1 ? 1 : 0;
|
||||
$post_id = isset($_POST['post_id']) ? absint($_POST['post_id']) : 0;
|
||||
$post_id = $post_id > 0 ? $post_id : null;
|
||||
|
||||
if ($title === '' || $event_date === '' || strtotime($event_date) === false) {
|
||||
$target = $id ? admin_url('admin.php?page=kgv-termine-new&termin_id=' . $id . '&message=missing') : admin_url('admin.php?page=kgv-termine-new&message=missing');
|
||||
@@ -179,10 +217,11 @@ class KGV_Termine_Plugin {
|
||||
'summary' => $summary,
|
||||
'description' => $description,
|
||||
'is_published' => $is_published,
|
||||
'post_id' => $post_id,
|
||||
'updated_at' => $now,
|
||||
);
|
||||
|
||||
$formats = array('%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s');
|
||||
$formats = array('%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s');
|
||||
|
||||
if ($id) {
|
||||
$wpdb->update($this->table_name, $data, array('id' => $id), $formats, array('%d'));
|
||||
@@ -191,7 +230,7 @@ class KGV_Termine_Plugin {
|
||||
}
|
||||
|
||||
$data['created_at'] = $now;
|
||||
$wpdb->insert($this->table_name, $data, array('%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%s'));
|
||||
$wpdb->insert($this->table_name, $data, array('%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%s'));
|
||||
|
||||
wp_safe_redirect(admin_url('admin.php?page=kgv-termine&message=created'));
|
||||
exit;
|
||||
@@ -269,6 +308,8 @@ class KGV_Termine_Plugin {
|
||||
$summary = $row ? $row->summary : '';
|
||||
$description = $row ? $row->description : '';
|
||||
$is_published = $row ? (int) $row->is_published : 1;
|
||||
$post_id = $row && !empty($row->post_id) ? (int) $row->post_id : 0;
|
||||
$posts = get_posts(array('post_type' => 'post', 'post_status' => 'publish', 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC'));
|
||||
?>
|
||||
<div class="wrap kgv-admin-wrap">
|
||||
<div class="kgv-admin-header">
|
||||
@@ -312,6 +353,16 @@ class KGV_Termine_Plugin {
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="kgv-form-field">
|
||||
<label for="kgv-post-id">Verknüpfter Beitrag</label>
|
||||
<select id="kgv-post-id" name="post_id">
|
||||
<option value="0">— kein Beitrag —</option>
|
||||
<?php foreach ($posts as $p) : ?>
|
||||
<option value="<?php echo esc_attr($p->ID); ?>" <?php selected($post_id, $p->ID); ?>><?php echo esc_html($p->post_title); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="kgv-form-field kgv-form-field-full">
|
||||
<label for="kgv-summary">Kurzbeschreibung</label>
|
||||
<textarea id="kgv-summary" name="summary" rows="3"><?php echo esc_textarea($summary); ?></textarea>
|
||||
@@ -411,7 +462,14 @@ class KGV_Termine_Plugin {
|
||||
if (!empty($row->summary)) {
|
||||
echo '<div class="kgv-termin-excerpt">' . esc_html($row->summary) . '</div>';
|
||||
}
|
||||
echo '<div class="kgv-termin-actions"><a class="kgv-termin-btn" href="' . esc_url($link) . '">Details ansehen</a></div>';
|
||||
echo '<div class="kgv-termin-actions"><a class="kgv-termin-btn" href="' . esc_url($link) . '">Details ansehen</a>';
|
||||
if (!empty($row->post_id)) {
|
||||
$post_url = get_permalink((int) $row->post_id);
|
||||
if ($post_url) {
|
||||
echo '<a class="kgv-termin-btn kgv-termin-btn-secondary" href="' . esc_url($post_url) . '">Mehr Infos</a>';
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</article>';
|
||||
}
|
||||
@@ -461,6 +519,12 @@ class KGV_Termine_Plugin {
|
||||
echo '<p class="kgv-termin-summary"><strong>' . esc_html($row->summary) . '</strong></p>';
|
||||
}
|
||||
echo '<div class="kgv-termin-content">' . wpautop(wp_kses_post($row->description)) . '</div>';
|
||||
if (!empty($row->post_id)) {
|
||||
$post_url = get_permalink((int) $row->post_id);
|
||||
if ($post_url) {
|
||||
echo '<div class="kgv-termin-more-info"><a class="kgv-termin-btn" href="' . esc_url($post_url) . '">Mehr Infos</a></div>';
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</article>';
|
||||
return ob_get_clean();
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
* Description: Eigene Terminverwaltung mit separatem Admin-Interface, Frontend-Liste und Detailansicht per Shortcode.
|
||||
* Update URI: https://git.apex-project.de/Wordpress_Plugins/KGV-Termine.git
|
||||
* Gitea Plugin URI: https://git.apex-project.de/Wordpress_Plugins/KGV-Termine.git
|
||||
* Version: 1.0.7
|
||||
* Version: 1.0.9
|
||||
* Author: Ronny Grobel
|
||||
* Author URI: https://apex-project.de/
|
||||
* License: GPL v2 or later
|
||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Text Domain: kgv-termine-admin
|
||||
* Requires Plugins: KGV-Updater
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@ Contributors: ronnygrobel
|
||||
Tags: events, termine, kalender, verein, shortcode
|
||||
Requires at least: 6.0
|
||||
Tested up to: 6.8
|
||||
Stable tag: 1.0.7
|
||||
Stable tag: 1.0.9
|
||||
Requires PHP: 7.2
|
||||
License: GPLv2 or later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
@@ -40,6 +40,13 @@ Ja, mit `[kgv_termine_sidebar]`.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.0.9 =
|
||||
* Terminuebersicht: Buttons "Details ansehen" und "Mehr Infos" im Stil des Such-Buttons vereinheitlicht und mit mehr Abstand dargestellt.
|
||||
* Termindetail: Layout-Verschiebung im Header behoben, indem der Zurueck-Link nicht mehr wie ein Aktionsbutton gestylt wird.
|
||||
|
||||
= 1.0.8 =
|
||||
* Feature: Verknüpfung zu WordPress-Beiträgen. Im Termin kann ein Beitrag ausgewählt werden, der im Frontend als "Mehr Infos"-Button angezeigt wird.
|
||||
|
||||
= 1.0.7 =
|
||||
* Versionsabgleich zwischen Plugin-Header und Readme.
|
||||
* WordPress-Readme-Format weiter vereinheitlicht.
|
||||
|
||||
Reference in New Issue
Block a user