Auswahl hinzugefügt.
'; } // Einzelnen Eintrag entfernen if ( isset( $_GET['remove'] ) ) { $remove_id = intval( $_GET['remove'] ); $current = get_option( 'ait_selected_posts', [] ); if ( ( $key = array_search( $remove_id, $current ) ) !== false ) { unset( $current[ $key ] ); update_option( 'ait_selected_posts', $current ); echo 'Eintrag entfernt.
Keine Einträge ausgewählt.
'; } echo ''; return ob_get_clean(); } /** * Gibt für einen Beitrag alle Begriffe aus den hierarchischen Taxonomien zurück. */ function ait_get_post_categories( $post_id, $post_type ) { $taxonomies = get_object_taxonomies( $post_type, 'objects' ); $category_names = []; foreach ( $taxonomies as $taxonomy ) { if ( $taxonomy->hierarchical ) { $terms = get_the_terms( $post_id, $taxonomy->name ); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { foreach ( $terms as $term ) { $category_names[] = $term->name; } } } } return $category_names; } /** * Ermittelt die erste hierarchische Taxonomie für den Post Type. */ function ait_get_category_taxonomy( $post_type ) { $taxonomies = get_object_taxonomies( $post_type, 'objects' ); foreach ( $taxonomies as $taxonomy ) { if ( $taxonomy->hierarchical ) { return $taxonomy->name; } } return ''; } /** * Zeigt eine Tabelle mit Beiträgen, Seiten oder Custom Post Types inklusive Pagination und Kategorie‑Filter. * Die Tabelle enthält ein Formular, das per POST abgeschickt wird, um ausgewählte Beiträge zur Auswahl hinzuzufügen. */ function ait_display_table( $post_type ) { $paged = max( 1, intval( $_GET['paged'] ?? 1 ) ); $posts_per_page = 10; $selected_category = intval( $_GET['category'] ?? 0 ); ?>