PUM_Admin_Popups::add_popup_filters()
Add Popup Filters
Contents
Description Description
Adds taxonomy drop down filters for popups.
Source Source
File: classes/Admin/Popups.php
public static function add_popup_filters() { global $typenow; // Checks if the current post type is 'popup' if ( $typenow == 'popup' ) { if ( get_taxonomy( 'popup_category' ) ) { $terms = get_terms( 'popup_category' ); if ( count( $terms ) > 0 ) { echo "<select name='popup_category' id='popup_category' class='postform'>"; echo "<option value=''>" . __( 'Show all categories', 'popup-maker' ) . "</option>"; foreach ( $terms as $term ) { $selected = isset( $_GET['popup_category'] ) && $_GET['popup_category'] == $term->slug ? 'selected="selected"' : ''; echo '<option value="' . esc_attr( $term->slug ) . '" ' . $selected . '>' . esc_html( $term->name ) . ' (' . $term->count . ')</option>'; } echo "</select>"; } } if ( get_taxonomy( 'popup_tag' ) ) { $terms = get_terms( 'popup_tag' ); if ( count( $terms ) > 0 ) { echo "<select name='popup_tag' id='popup_tag' class='postform'>"; echo "<option value=''>" . __( 'Show all tags', 'popup-maker' ) . "</option>"; foreach ( $terms as $term ) { $selected = isset( $_GET['popup_tag'] ) && $_GET['popup_tag'] == $term->slug ? 'selected="selected"' : ''; echo '<option value="' . esc_attr( $term->slug ) . '" ' . $selected . '>' . esc_html( $term->name ) . ' (' . $term->count . ')</option>'; } echo "</select>"; } } } }
Expand full source code Collapse full source code View on Trac