';
foreach ($categories as $cat) {
$output .= '
' . esc_html($cat->name) . '
';
$posts = get_posts(array(
'post_type' => 'parish-council', // ✅ your CPT
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'council-category', // ✅ your taxonomy
'field' => 'term_id',
'terms' => $cat->term_id,
),
),
));
if ($posts) {
$output .= '
';
}
}
$output .= '
';
return $output;
}
add_shortcode('parish_council_list', 'parish_council_shortcode');
function next_two_months_events_list() {
ob_start();
$today = date( 'Y-m-d' );
$end_date = date( 'Y-m-d', strtotime( '+2 year' ) );
$args = array(
'post_type' => 'tribe_events',
'posts_per_page' => -1,
'meta_key' => '_EventStartDate',
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => '_EventStartDate',
'value' => array( $today, $end_date ),
'compare' => 'BETWEEN',
'type' => 'DATE'
),
),
);
$events = new WP_Query( $args );
if ( $events->have_posts() ) {
echo 'No upcoming events in the next 2 months.
';
}
wp_reset_postdata();
return ob_get_clean();
}
add_shortcode( 'next_2_months_events', 'next_two_months_events_list' );
// Add UserWay script in footer
function add_userway_widget_script() {
?>