add_action( 'wp_enqueue_scripts', function() { // ✅ Re-enable core gallery styles wp_enqueue_style( 'wp-block-library' ); wp_enqueue_style( 'wp-block-library-theme' ); // ✅ PhotoSwipe CSS & JS wp_enqueue_style( 'photoswipe-css', get_stylesheet_directory_uri() . '/photoswipe/photoswipe.css' ); wp_enqueue_script( 'photoswipe-js', get_stylesheet_directory_uri() . '/photoswipe/photoswipe.min.js', [], null, true ); wp_add_inline_script( 'photoswipe-js', " document.addEventListener('DOMContentLoaded', function() { var elems = document.querySelectorAll('.gallery-item a'); elems.forEach(function(el) { el.addEventListener('click', function(e) { e.preventDefault(); // PhotoSwipe open logic here }); }); }); " ); // ✅ DataTables CSS & JS wp_enqueue_style( 'datatables-css', 'https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css' ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'datatables-js', 'https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js', [ 'jquery' ], null, true ); wp_add_inline_script( 'datatables-js', " jQuery(document).ready(function($) { $('table.datatable').DataTable(); }); " ); }, 1 ); // Priority 1 ensures these styles load early /** * re-enable core gallery styles */ add_action( 'wp_enqueue_scripts', function() { // Core block styles (includes gallery.css) wp_enqueue_style( 'wp-block-library' ); // Theme-level overrides (adds the gallery-columns-N rules) wp_enqueue_style( 'wp-block-library-theme' ); }, 1 ); // Turn WordPress’s old Link Manager back on add_filter( 'pre_option_link_manager_enabled', '__return_true' ); /** * Prepend all non-empty Tonträger custom fields to the single-post view, * formatted exactly like the legacy site. */ add_filter( 'the_content', 'cs_prepend_tontraeger_meta', 10 ); function cs_prepend_tontraeger_meta( $content ) { if ( ! is_singular( 'tontraeger' ) || ! in_the_loop() ) { return $content; } // Map meta_keys → labels $fields = [ 't_titel' => 'Titel', 't_interpret' => 'Interpret(en)', 't_medium' => 'Medium', 't_jahr' => 'Erscheinungsjahr', 't_komponisten' => 'Komponist(en)', 't_mitwirkende' => 'Mitwirkende', 't_label' => 'Label, Nr.', 't_instrumente' => 'Instrument(e)', 't_url' => 'externer Link', ]; $html = '
'; $html .= '
'; foreach ( $fields as $meta_key => $label ) { $value = get_post_meta( get_the_ID(), $meta_key, true ); if ( '' === $value ) { continue; } // Special: prepend "ca." to the year if flagged if ( 't_jahr' === $meta_key && get_post_meta( get_the_ID(), 't_ca', true ) ) { $value = 'ca. ' . $value; } // For external link, render a proper hyperlink if ( 't_url' === $meta_key ) { $value = 'externer Link'; } else { $value = esc_html( $value ); } $html .= sprintf( '
%s:
%s

', esc_html( $label ), $value ); } $html .= '
'; return $html . $content; } add_filter( 'gallery_block_image_size', function( $size, $block_attributes ) { return 'full'; }, 10, 2 ); Brigitte Zaczek – Gitarre-Archiv Österreich
Zum Inhalt