PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / templates / widgets / campaign-terms-dropdown.php

campaign-terms-dropdown.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at templates/widgets/campaign-terms-dropdown.php

67 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 /**
9 * Display a list of campaign categories or tags.
10 *
11 * Override this template by copying it to yourtheme/charitable/widgets/campaign-terms.php
12 *
13 * @package Charitable/Templates/Widgets
14 * @author WP Charitable LLC
15 * @since 1.5.4
16 * @version 1.6.54
17 * @version 1.8.8.6
18 */
19
20 $taxonomy_name = isset( $view_args['taxonomy'] ) ? $view_args['taxonomy'] : 'campaign_category'; // phpcs:ignore
21 $taxonomy = get_taxonomies( array( 'name' => $taxonomy_name ), 'objects' ); // phpcs:ignore
22 $title = ! empty( $view_args['title'] ) ? $view_args['title'] : ''; // phpcs:ignore
23 $charitable_dropdown_id = $view_args['widget_id'] . '-dropdown';
24 $charitable_dropdown_args = array(
25 'taxonomy' => $taxonomy_name,
26 'name' => $taxonomy_name,
27 'show_count' => isset( $view_args['show_count'] ) && $view_args['show_count'],
28 'hide_empty' => isset( $view_args['hide_empty'] ) && $view_args['hide_empty'],
29 'id' => $charitable_dropdown_id,
30 'show_option_none' => sprintf(
31 /* translators: %s: taxonomy label */
32 _x( 'Select %s', 'select campaign category/tag', 'charitable' ),
33 $taxonomy[ $taxonomy_name ]->label
34 ),
35 'value_field' => 'slug',
36 'selected' => is_tax( $taxonomy_name ) ? get_query_var( $taxonomy_name ) : 0,
37 );
38
39 echo $view_args['before_widget']; // phpcs:ignore
40
41 if ( ! empty( $title ) ) :
42
43 echo $view_args['before_title'] . esc_html( $title ) . $view_args['after_title']; // phpcs:ignore
44
45 endif;
46 ?>
47 <form action="<?php echo esc_url( home_url() ); ?>" method="get">
48 <label class="screen-reader-text" for="<?php echo esc_attr( $charitable_dropdown_id ); ?>"><?php echo esc_html( $title ); ?></label>
49 <?php wp_dropdown_categories( $charitable_dropdown_args ); ?>
50 </form>
51 <script type='text/javascript'>
52 /* <![CDATA[ */
53 (function() {
54 var dropdown = document.getElementById( "<?php echo esc_js( $charitable_dropdown_id ); ?>" );
55 function onCatChange() {
56 if ( dropdown.options[ dropdown.selectedIndex ].value !== -1 ) {
57 dropdown.parentNode.submit();
58 }
59 }
60 dropdown.onchange = onCatChange;
61 })();
62 /* ]]> */
63 </script>
64 <?php
65
66 echo $view_args['after_widget']; // phpcs:ignore
67