المتحدثون 2024
UNVEILING SOON…
function esc_display_event_schedule($atts) { // Set default attributes $atts = shortcode_atts( array( 'category' => '', // Optional category filter 'limit' => 5, // Default limit of events to show 'orderby' => 'date', // Default order by date 'order' => 'ASC', // Default order ASC ), $atts, 'event_schedule'); // Query for custom post type 'tcode_event' (adjust the slug if needed) $args = array( 'post_type' => 'tcode_event', // Make sure this is correct 'posts_per_page' => $atts['limit'], 'orderby' => $atts['orderby'], 'order' => $atts['order'], ); // If a category is passed, filter by category (make sure the taxonomy exists) if (!empty($atts['category'])) { $args['tax_query'] = array( array( 'taxonomy' => 'event_category', // Make sure the taxonomy is correct 'field' => 'slug', 'terms' => $atts['category'], 'operator' => 'IN', ) ); } // Run the query to get events $query = new WP_Query($args); // Debugging: Output the query results $output = '
'; $output .= print_r($query, true); $output .= ''; // If events exist, display them in the Event Schedule template format if ($query->have_posts()) { $output .= '
Categories: ' . implode(', ', $terms) . '
'; } else { $output .= 'No categories found for this event.
'; } $output .= '' . get_the_date('F j, Y') . '
'; $output .= 'Event Time: ' . esc_html($event_time) . '
'; } if ($artist_name = get_field('artist_name')) { $output .= 'Artist: ' . esc_html($artist_name) . '
'; } // Display event excerpt if (has_excerpt()) { $output .= '' . get_the_excerpt() . '
'; } // Link to event page (optional) $output .= 'View Event Details'; $output .= 'No events found.
'; } return $output; }