inside a // comment — PHP parses it as a closing tag // [committee_link] — renders committee name as a link to the committee CPT page add_shortcode('committee_link', function() { $post_id = get_the_ID(); $committee = get_post_meta($post_id, 'committee', true); if (!$committee) return ''; $posts = get_posts([ 'post_type' => 'committee', 'title' => $committee, 'posts_per_page' => 1, 'post_status' => 'publish', ]); if ($posts) { return '' . esc_html($committee) . ''; } return esc_html($committee); }); // [committee_contact] — contact info block for committee CPT pages add_shortcode('committee_contact', function() { $post_id = get_the_ID(); $email = get_post_meta($post_id, 'committee_email', true); $phone = get_post_meta($post_id, 'committee_phone', true); $clerk = get_post_meta($post_id, 'committee_clerk', true); $out = ''; if ($clerk) $out .= '

Clerk: ' . esc_html($clerk) . '

'; if ($phone) $out .= '

Phone: ' . esc_html($phone) . '

'; if ($email) $out .= '

Email: ' . esc_html($email) . '

'; return $out; }); // [committee_page_header] — two-column flexbox header: contact left, hearing alert + nav button right add_shortcode('committee_page_header', function() { $post_id = get_the_ID(); $email = get_post_meta($post_id, 'committee_email', true); $phone = get_post_meta($post_id, 'committee_phone', true); $clerk = get_post_meta($post_id, 'committee_clerk', true); $title = get_the_title($post_id); // Left column — contact info $contact = '

Contact Information

'; if ($clerk) $contact .= '

Clerk: ' . esc_html($clerk) . '

'; if ($phone) $contact .= '

Phone: ' . esc_html($phone) . '

'; if ($email) $contact .= '

Email: ' . esc_html($email) . '

'; // Right column — scheduled hearing alert (if any) + nav button global $wpdb; $scheduled = $wpdb->get_results($wpdb->prepare( "SELECT pm.meta_value AS bill_number, pm2.meta_value AS hearing_date FROM {$wpdb->posts} p JOIN {$wpdb->postmeta} pm ON pm.post_id = p.ID AND pm.meta_key = 'bill_number' JOIN {$wpdb->postmeta} pm2 ON pm2.post_id = p.ID AND pm2.meta_key = 'hearing_date' JOIN {$wpdb->postmeta} pm3 ON pm3.post_id = p.ID AND pm3.meta_key = 'committee' JOIN {$wpdb->term_relationships} tr ON tr.object_id = p.ID JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id AND tt.taxonomy = 'bill-status' JOIN {$wpdb->terms} t ON t.term_id = tt.term_id AND t.slug = 'scheduled-for-hearing' WHERE p.post_type = 'legislation' AND p.post_status = 'publish' AND pm3.meta_value = %s", $title )); $right = ''; if ($scheduled) { $bill_list = implode(', ', array_map(function($r) { return esc_html($r->bill_number); }, $scheduled)); $hearing_date = esc_html($scheduled[0]->hearing_date); $right .= '
'; $right .= '

Hearing Scheduled: ' . $hearing_date . '

'; $right .= '

Bills: ' . $bill_list . '

'; $right .= '
'; } $right .= 'View Bills in Committee'; return '
' . '
' . $contact . '
' . '
' . $right . '
' . '
'; }); // [committee_hearing_alert] — standalone alert + nav button (kept for backward compat) add_shortcode('committee_hearing_alert', function() { $post_id = get_the_ID(); $title = get_the_title($post_id); global $wpdb; $scheduled = $wpdb->get_results($wpdb->prepare( "SELECT pm.meta_value AS bill_number, pm2.meta_value AS hearing_date FROM {$wpdb->posts} p JOIN {$wpdb->postmeta} pm ON pm.post_id = p.ID AND pm.meta_key = 'bill_number' JOIN {$wpdb->postmeta} pm2 ON pm2.post_id = p.ID AND pm2.meta_key = 'hearing_date' JOIN {$wpdb->postmeta} pm3 ON pm3.post_id = p.ID AND pm3.meta_key = 'committee' JOIN {$wpdb->term_relationships} tr ON tr.object_id = p.ID JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id AND tt.taxonomy = 'bill-status' JOIN {$wpdb->terms} t ON t.term_id = tt.term_id AND t.slug = 'scheduled-for-hearing' WHERE p.post_type = 'legislation' AND p.post_status = 'publish' AND pm3.meta_value = %s", $title )); $out = ''; if ($scheduled) { $bill_list = implode(', ', array_map(function($r) { return esc_html($r->bill_number); }, $scheduled)); $hearing_date = esc_html($scheduled[0]->hearing_date); $out .= '
'; $out .= '

Hearing Scheduled: ' . $hearing_date . '

'; $out .= '

Bills: ' . $bill_list . '

'; $out .= '
'; } $out .= 'View Bills in Committee'; return $out; }); // [committee_bills] — bill list for committee CPT pages, with status + position badges add_shortcode('committee_bills', function() { $post_id = get_the_ID(); global $wpdb; $bill_ids = $wpdb->get_col($wpdb->prepare( "SELECT child_object_id FROM {$wpdb->prefix}jet_rel_default WHERE rel_id = 29 AND parent_object_id = %d", $post_id )); if (empty($bill_ids)) return '

No tracked bills currently in this committee.

'; $status_colors = [ 'in-committee' => ['bg' => '#6b7280', 'label' => 'In Committee'], 'scheduled-for-hearing' => ['bg' => '#d97706', 'label' => 'Scheduled for Hearing'], 'passed-committee' => ['bg' => '#1d4ed8', 'label' => 'Passed Committee'], 'passed-chamber' => ['bg' => '#7c3aed', 'label' => 'Passed Chamber'], 'signed-into-law' => ['bg' => '#15803d', 'label' => 'Signed into Law'], 'failed-committee' => ['bg' => '#991b1b', 'label' => 'Failed Committee'], 'vetoed' => ['bg' => '#991b1b', 'label' => 'Vetoed'], 'withdrawn' => ['bg' => '#6b7280', 'label' => 'Withdrawn'], ]; $position_colors = [ 'pro-gun-rights' => ['bg' => '#15803d', 'label' => 'Pro-Rights'], 'anti-gun-rights' => ['bg' => '#991b1b', 'label' => 'Anti-Rights'], 'neutral' => ['bg' => '#d97706', 'label' => 'Neutral'], ]; $out = '
'; foreach ($bill_ids as $bill_id) { $bill_number = get_post_meta($bill_id, 'bill_number', true); $bill_title = get_the_title($bill_id); $bill_url = get_permalink($bill_id); $hearing_date = get_post_meta($bill_id, 'hearing_date', true); $status_terms = wp_get_object_terms($bill_id, 'bill-status'); $status_slug = (!is_wp_error($status_terms) && $status_terms) ? $status_terms[0]->slug : 'in-committee'; $status_info = $status_colors[$status_slug] ?? $status_colors['in-committee']; $pos_terms = wp_get_object_terms($bill_id, 'gun-rights-position'); $pos_slug = (!is_wp_error($pos_terms) && $pos_terms) ? $pos_terms[0]->slug : ''; $pos_info = $position_colors[$pos_slug] ?? null; $out .= '
'; $out .= '
'; $out .= '' . esc_html($bill_number) . ''; $out .= ' — ' . esc_html($bill_title); if ($hearing_date) { $out .= '
Hearing: ' . esc_html($hearing_date) . ''; } $out .= '
'; $out .= '
'; if ($pos_info) { $out .= '' . $pos_info['label'] . ''; } $out .= '' . $status_info['label'] . ''; $out .= '
'; } $out .= '
'; return $out; }); // [committee_members] — member roster for committee CPT pages, sorted by role add_shortcode('committee_members', function() { $post_id = get_the_ID(); global $wpdb; $member_ids = $wpdb->get_col($wpdb->prepare( "SELECT child_object_id FROM {$wpdb->prefix}jet_rel_default WHERE rel_id = 28 AND parent_object_id = %d", $post_id )); if (empty($member_ids)) return '

No members listed.

'; $role_order = ['Chair', 'Vice Chair', 'Senate Majority Whip', 'Member']; $members = []; foreach ($member_ids as $mid) { $members[] = [ 'id' => $mid, 'name' => get_the_title($mid), 'role' => get_post_meta($mid, 'committee_role', true), 'party' => get_post_meta($mid, 'party', true), 'district' => get_post_meta($mid, 'district', true), 'phone' => get_post_meta($mid, 'phone', true), 'email' => get_post_meta($mid, 'email', true), 'photo' => get_post_thumbnail_id($mid), 'url' => get_permalink($mid), ]; } usort($members, function($a, $b) use ($role_order) { $ai = array_search($a['role'], $role_order); $bi = array_search($b['role'], $role_order); if ($ai === false) $ai = 99; if ($bi === false) $bi = 99; if ($ai !== $bi) return $ai - $bi; return strcmp($a['name'], $b['name']); }); $out = '
'; foreach ($members as $m) { $photo_url = $m['photo'] ? wp_get_attachment_image_url($m['photo'], 'thumbnail') : ''; $out .= '
'; if ($photo_url) { $out .= '' . esc_attr($m['name']) . ''; } $out .= '
'; $out .= '

' . esc_html($m['name']) . '

'; if ($m['role']) $out .= '

' . esc_html($m['role']) . '

'; $parts = array_filter([$m['party'], $m['district'] ? 'District ' . $m['district'] : '']); if ($parts) $out .= '

' . esc_html(implode(' — ', $parts)) . '

'; if ($m['phone']) $out .= '

' . esc_html($m['phone']) . '

'; if ($m['email']) $out .= '

' . esc_html($m['email']) . '

'; $out .= '
'; } $out .= '
'; return $out; }); // [person_committees] — committees a person belongs to (rel_id=28, person is child) add_shortcode('person_committees', function() { $post_id = get_the_ID(); global $wpdb; $committee_ids = $wpdb->get_col($wpdb->prepare( "SELECT parent_object_id FROM {$wpdb->prefix}jet_rel_default WHERE rel_id = 28 AND child_object_id = %d", $post_id )); if (empty($committee_ids)) return ''; $out = ''; return $out; }); https://rigunrights.com/wp-sitemap-posts-post-1.xmlhttps://rigunrights.com/wp-sitemap-posts-page-1.xmlhttps://rigunrights.com/wp-sitemap-posts-podcast-1.xmlhttps://rigunrights.com/wp-sitemap-posts-jet-theme-core-1.xmlhttps://rigunrights.com/wp-sitemap-posts-committee-1.xmlhttps://rigunrights.com/wp-sitemap-posts-legislation-1.xmlhttps://rigunrights.com/wp-sitemap-posts-listings-1.xmlhttps://rigunrights.com/wp-sitemap-posts-government-org-1.xmlhttps://rigunrights.com/wp-sitemap-posts-government-positions-1.xmlhttps://rigunrights.com/wp-sitemap-posts-people-1.xmlhttps://rigunrights.com/wp-sitemap-taxonomies-category-1.xmlhttps://rigunrights.com/wp-sitemap-taxonomies-post_tag-1.xmlhttps://rigunrights.com/wp-sitemap-taxonomies-bill-status-1.xmlhttps://rigunrights.com/wp-sitemap-taxonomies-chamber-1.xmlhttps://rigunrights.com/wp-sitemap-taxonomies-gun-rights-position-1.xmlhttps://rigunrights.com/wp-sitemap-taxonomies-focus-1.xmlhttps://rigunrights.com/wp-sitemap-taxonomies-listing-type-1.xmlhttps://rigunrights.com/wp-sitemap-taxonomies-jurisdiction-cities-1.xmlhttps://rigunrights.com/wp-sitemap-taxonomies-political-affiliation-1.xmlhttps://rigunrights.com/wp-sitemap-users-1.xmlhttps://rigunrights.com/community/site-maps/index.xmlhttps://rigunrights.com/wp-sitemap-1.xml