Noptin_Post_Types::custom_filters( string $post_type )
Registers custom opt-in form filters.
Parameters Parameters
- $post_type
(string) (Required) The post type being displayed.
Return Return
(void)
Source Source
File: includes/class-noptin-post-types.php
public function custom_filters( $post_type ) { // Make sure this is our post type. if ( 'noptin-form' !== $post_type ) { return; } // Filter by form type. $form_types = array( 'sidebar' => __( 'Widget Forms', 'newsletter-optin-box' ), 'inpost' => __( 'Shortcode Forms', 'newsletter-optin-box' ), 'popup' => __( 'Popup Forms', 'newsletter-optin-box' ), 'slide_in' => __( 'Sliding Forms', 'newsletter-optin-box' ), ); $form_type = 'all'; if ( isset( $_REQUEST['form_type'] ) && ! empty( $form_types[ $_REQUEST['form_type'] ] ) ) { $form_type = $_REQUEST['form_type']; } // build a custom dropdown list of values to filter by. echo '<select id="noptin-form-type" name="form_type">'; echo '<option value="all">' . __( 'All Forms', 'newsletter-optin-box' ) . ' </option>'; foreach ( $form_types as $key => $title ) { $key = esc_attr( $key ); $title = esc_html( $title ); $selected = selected( $key, $form_type, false ); echo "<option value='$key' $selected>$title</option>"; } echo '</select>'; }
Expand full source code Collapse full source code View on GitHub