PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0.3
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0.3
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.7.0.3, at templates/widgets/campaign-terms-dropdown.php

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