LLMS_Admin_Post_Tables::get_post_type_filter_html( string $name, string $post_type = 'course', int[] $selected = array() )

Get the HTML for a post type select2 filter

Parameters Parameters


(string) (Required) Name of the select element.


(string) (Optional) Post type to search by.

Default value: 'course'


(int[]) (Optional) Array of POST IDs to use for the pre-selected options on page load.

Default value: array()

Top ↑

Return Return


Top ↑

Source Source

File: includes/admin/post-types/class.llms.post.tables.php

	public static function get_post_type_filter_html( $name, $post_type = 'course', $selected = array() ) {

		$id = sprintf( 'filter-by-llms-post-%s', $post_type );

		$obj = get_post_type_object( $post_type );
		// Translators: %s = the singular post type name.
		$label = sprintf( __( 'Filter by %s', 'lifterlms' ), $obj->labels->singular_name );
		<span class="llms-post-table-post-filter">
			<label for="<?php echo $id; ?>" class="screen-reader-text">
				<?php echo esc_html( $label ); ?>
				data-placeholder="<?php echo esc_attr( $label ); ?>"
				data-post-type="<?php echo $post_type; ?>"
				name="<?php echo $name; ?>"
				id="<?php echo $id; ?>"
				<?php if ( $selected ) : ?>
					<?php foreach ( llms_make_select2_post_array( $selected ) as $data ) : ?>
						<option value="<?php echo $data['key']; ?>"><?php echo $data['title']; ?></option>
					<?php endforeach; ?>
				<?php endif; ?>
		return ob_get_clean();

Top ↑

Changelog Changelog

Version Description
6.0.0 Don't display a dynamic view post button.
3.12.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.