Esempio n. 1
0
        </td>
        <td><?php 
_e('Only show selected terms in the filter.', 'wp-ultimate-post-grid');
?>
</td>
    </tr>
    <tbody class="wpupg_limit_terms">
    <?php 
$post_types = get_post_types('', 'objects');
unset($post_types[WPUPG_POST_TYPE]);
unset($post_types['revision']);
unset($post_types['nav_menu_item']);
$taxonomies_in_form = array();
foreach ($post_types as $post_type => $options) {
    $taxonomies = get_object_taxonomies($post_type, 'objects');
    $limit_terms = $grid->filter_limit_terms();
    foreach ($taxonomies as $taxonomy => $tax_options) {
        if (!in_array($taxonomy, $taxonomies_in_form)) {
            $taxonomies_in_form[] = $taxonomy;
            echo '<tr id="wpupg_filter_terms_taxonomy_' . $taxonomy . '" class="wpupg_filter_terms_taxonomy">';
            echo '<td><label for="wpupg_filter_limit_terms_' . $taxonomy . '">' . $tax_options->labels->name . '</label></td>';
            echo '<td>';
            echo '<select name="wpupg_filter_limit_terms_' . $taxonomy . '[]" id="wpupg_filter_limit_terms_' . $taxonomy . '" class="wpupg-select2" multiple>';
            foreach (get_terms($taxonomy) as $term) {
                $selected = isset($limit_terms[$taxonomy]) && in_array($term->term_id, $limit_terms[$taxonomy]) ? ' selected="selected"' : '';
                echo '<option value="' . esc_attr($term->term_id) . '"' . $selected . '>' . $term->name . '</option>';
            }
            echo '</td>';
            echo '<td>&nbsp;</td>';
            echo '</tr>';
        }