public function shortcode($options) { $output = ''; $options = shortcode_atts(array('id' => false), $options); $slug = strtolower(trim($options['id'])); if ($slug) { $post = get_page_by_path($slug, OBJECT, WPUPG_POST_TYPE); if (!is_null($post)) { $grid = new WPUPG_Grid($post); $filter_type = $grid->filter_type(); $filter = ''; if ($filter_type == 'isotope') { $filter_style = $grid->filter_style(); $filter_style = $filter_style[$filter_type]; $style_data = 'data-filter-type="' . $filter_type . '"'; $style_data .= ' data-margin-vertical="' . $filter_style['margin_vertical'] . '"'; $style_data .= ' data-margin-horizontal="' . $filter_style['margin_horizontal'] . '"'; $style_data .= ' data-padding-vertical="' . $filter_style['padding_vertical'] . '"'; $style_data .= ' data-padding-horizontal="' . $filter_style['padding_horizontal'] . '"'; $style_data .= ' data-border-width="' . $filter_style['border_width'] . '"'; $style_data .= ' data-background-color="' . $filter_style['background_color'] . '"'; $style_data .= ' data-text-color="' . $filter_style['text_color'] . '"'; $style_data .= ' data-border-color="' . $filter_style['border_color'] . '"'; $style_data .= ' data-active-background-color="' . $filter_style['background_active_color'] . '"'; $style_data .= ' data-active-text-color="' . $filter_style['text_active_color'] . '"'; $style_data .= ' data-active-border-color="' . $filter_style['border_active_color'] . '"'; $style_data .= ' data-hover-background-color="' . $filter_style['background_hover_color'] . '"'; $style_data .= ' data-hover-text-color="' . $filter_style['text_hover_color'] . '"'; $style_data .= ' data-hover-border-color="' . $filter_style['border_hover_color'] . '"'; $multiselect = $grid->filter_multiselect() ? 'true' : 'false'; $filter .= '<div id="wpupg-grid-' . esc_attr($slug) . '-filter" class="wpupg-filter wpupg-filter-' . $filter_type . '" style="text-align: ' . $filter_style['alignment'] . ';" data-grid="' . esc_attr($slug) . '" data-type="' . $filter_type . '" data-multiselect="' . $multiselect . '" data-multiselect-type="' . $grid->filter_multiselect_type() . '"' . $style_data . '>'; $filter .= $grid->filter(); $filter .= '</div>'; } $output = apply_filters('wpupg_filter_shortcode', $filter, $grid); } } return $output; }
public function shortcode($options) { $output = ''; $slug = strtolower(trim($options['id'])); if ($slug) { unset($options['id']); $post = get_page_by_path($slug, OBJECT, WPUPG_POST_TYPE); if (!is_null($post)) { $grid = new WPUPG_Grid($post); // Check if we need to filter the grid dynamically $dynamic_rules = array(); if (count($options) > 0 && WPUltimatePostGrid::is_premium_active()) { foreach ($options as $taxonomy => $terms) { if (taxonomy_exists($taxonomy)) { $dynamic_rules[] = array('post_type' => 'wpupg_dynamic', 'taxonomy' => $taxonomy, 'values' => explode(';', str_replace(',', ';', $terms)), 'type' => 'restrict'); } } } if (count($dynamic_rules) > 0) { $grid->set_dynamic_rules($dynamic_rules); } $link_type = $grid->link_type(); $link_target = $grid->link_target(); $layout_mode = $grid->layout_mode(); $centered = $grid->centered() ? 'true' : 'false'; $posts = '<div id="wpupg-grid-' . esc_attr($slug) . '" class="wpupg-grid" data-grid="' . esc_attr($slug) . '" data-grid-id="' . $grid->ID() . '" data-link-type="' . $link_type . '" data-link-target="' . $link_target . '" data-layout-mode="' . $layout_mode . '" data-centered="' . $centered . '">'; $posts .= $grid->draw_posts(); $posts .= '</div>'; $output = apply_filters('wpupg_posts_shortcode', $posts, $grid); $pagination = ''; if ($grid->pagination_type() == 'pages') { $pagination_type = $grid->pagination_type(); $pagination_style = $grid->pagination_style(); $style_data = ' data-margin-vertical="' . $pagination_style['margin_vertical'] . '"'; $style_data .= ' data-margin-horizontal="' . $pagination_style['margin_horizontal'] . '"'; $style_data .= ' data-padding-vertical="' . $pagination_style['padding_vertical'] . '"'; $style_data .= ' data-padding-horizontal="' . $pagination_style['padding_horizontal'] . '"'; $style_data .= ' data-border-width="' . $pagination_style['border_width'] . '"'; $style_data .= ' data-background-color="' . $pagination_style['background_color'] . '"'; $style_data .= ' data-text-color="' . $pagination_style['text_color'] . '"'; $style_data .= ' data-border-color="' . $pagination_style['border_color'] . '"'; $style_data .= ' data-active-background-color="' . $pagination_style['background_active_color'] . '"'; $style_data .= ' data-active-text-color="' . $pagination_style['text_active_color'] . '"'; $style_data .= ' data-active-border-color="' . $pagination_style['border_active_color'] . '"'; $style_data .= ' data-hover-background-color="' . $pagination_style['background_hover_color'] . '"'; $style_data .= ' data-hover-text-color="' . $pagination_style['text_hover_color'] . '"'; $style_data .= ' data-hover-border-color="' . $pagination_style['border_hover_color'] . '"'; $pagination .= '<div id="wpupg-grid-' . esc_attr($slug) . '-pagination" class="wpupg-pagination wpupg-pagination-' . $pagination_type . '" style="text-align: ' . $pagination_style['alignment'] . ';" data-grid="' . esc_attr($slug) . '" data-type="' . $pagination_type . '"' . $style_data . '>'; $pagination .= $grid->draw_pagination(); $pagination .= '</div>'; } $output .= apply_filters('wpupg_pagination_shortcode', $pagination, $grid); wp_localize_script('wpupg_grid', 'wpupg_grid_' . $grid->ID(), array('posts' => $grid->posts())); } } return $output; }
public function ajax_get_page() { if (check_ajax_referer('wpupg_grid', 'security', false)) { $grid = $_POST['grid']; $page = intval($_POST['page']); $post = get_page_by_path($grid, OBJECT, WPUPG_POST_TYPE); if (!is_null($post)) { $grid = new WPUPG_Grid($post); echo $grid->draw_posts($page); } } die; }
public function content_filter($content) { $ignore_query = !is_main_query(); if (apply_filters('wpupg_content_loop_check', $ignore_query)) { return $content; } if (get_post_type() == WPUPG_POST_TYPE) { remove_filter('the_content', array($this, 'content_filter'), 10); $grid = new WPUPG_Grid(get_post()); $content .= '[wpupg-filter id="' . $grid->slug() . '"]'; $content .= '[wpupg-grid id="' . $grid->slug() . '"]'; add_filter('the_content', array($this, 'content_filter'), 10); } return $content; }
public function updated_term($term_id, $taxonomy) { $args = array('post_type' => WPUPG_POST_TYPE, 'post_status' => 'any', 'posts_per_page' => -1, 'nopaging' => true); $query = new WP_Query($args); $posts = $query->have_posts() ? $query->posts : array(); $grid_ids = array(); foreach ($posts as $post) { $grid = new WPUPG_Grid($post); if (in_array($taxonomy, $grid->filter_taxonomies())) { $grid_ids[] = $grid->ID(); } } if (count($grid_ids) > 0) { update_option('wpupg_regenerate_grids_check', $grid_ids); } }
public function content_filter($content) { $ignore_query = !is_main_query(); if (apply_filters('wpupg_content_loop_check', $ignore_query)) { return $content; } if (get_post_type() == WPUPG_POST_TYPE) { remove_filter('the_content', array($this, 'content_filter'), 10); $grid = new WPUPG_Grid(get_post()); $content .= '<div class="wpupg-grid">'; $content .= $grid->draw_posts(); $content .= '</div>'; add_filter('the_content', array($this, 'content_filter'), 10); } return $content; }
public function shortcode($options) { $output = ''; $slug = strtolower(trim($options['id'])); if ($slug) { unset($options['id']); $post = get_page_by_path($slug, OBJECT, WPUPG_POST_TYPE); if (!is_null($post)) { $grid = new WPUPG_Grid($post); // Check if we need to filter the grid dynamically $dynamic_rules = array(); if (count($options) > 0 && WPUltimatePostGrid::is_premium_active()) { foreach ($options as $taxonomy => $terms) { if (taxonomy_exists($taxonomy)) { $dynamic_rules[] = array('post_type' => 'wpupg_dynamic', 'taxonomy' => $taxonomy, 'values' => explode(';', str_replace(',', ';', $terms)), 'type' => 'restrict'); } } } if (count($dynamic_rules) > 0) { $grid->set_dynamic_rules($dynamic_rules); } $filter_type = $grid->filter_type(); $filter = ''; if ($filter_type == 'isotope') { $filter_style = $grid->filter_style(); $filter_style = $filter_style[$filter_type]; $style_data = ' data-filter-type="' . $filter_type . '"'; $style_data .= ' data-margin-vertical="' . $filter_style['margin_vertical'] . '"'; $style_data .= ' data-margin-horizontal="' . $filter_style['margin_horizontal'] . '"'; $style_data .= ' data-padding-vertical="' . $filter_style['padding_vertical'] . '"'; $style_data .= ' data-padding-horizontal="' . $filter_style['padding_horizontal'] . '"'; $style_data .= ' data-border-width="' . $filter_style['border_width'] . '"'; $style_data .= ' data-background-color="' . $filter_style['background_color'] . '"'; $style_data .= ' data-text-color="' . $filter_style['text_color'] . '"'; $style_data .= ' data-border-color="' . $filter_style['border_color'] . '"'; $style_data .= ' data-active-background-color="' . $filter_style['background_active_color'] . '"'; $style_data .= ' data-active-text-color="' . $filter_style['text_active_color'] . '"'; $style_data .= ' data-active-border-color="' . $filter_style['border_active_color'] . '"'; $style_data .= ' data-hover-background-color="' . $filter_style['background_hover_color'] . '"'; $style_data .= ' data-hover-text-color="' . $filter_style['text_hover_color'] . '"'; $style_data .= ' data-hover-border-color="' . $filter_style['border_hover_color'] . '"'; $multiselect = $grid->filter_multiselect() ? 'true' : 'false'; $inverse = $grid->filter_inverse() ? 'true' : 'false'; $filter .= '<div id="wpupg-grid-' . esc_attr($slug) . '-filter" class="wpupg-filter wpupg-filter-' . $filter_type . '" style="text-align: ' . $filter_style['alignment'] . ';" data-grid="' . esc_attr($slug) . '" data-type="' . $filter_type . '" data-multiselect="' . $multiselect . '" data-multiselect-type="' . $grid->filter_multiselect_type() . '" data-inverse="' . $inverse . '"' . $style_data . '>'; $filter .= $grid->filter(); $filter .= '</div>'; } $output = apply_filters('wpupg_filter_shortcode', $filter, $grid); } } return $output; }
public function shortcode($options) { $output = ''; $options = shortcode_atts(array('id' => false), $options); $slug = strtolower(trim($options['id'])); if ($slug) { $post = get_page_by_path($slug, OBJECT, WPUPG_POST_TYPE); if (!is_null($post)) { $grid = new WPUPG_Grid($post); $link_type = $grid->link_type(); $layout_mode = $grid->layout_mode(); $centered = $grid->centered() ? 'true' : 'false'; $posts = '<div id="wpupg-grid-' . esc_attr($slug) . '" class="wpupg-grid" data-grid="' . esc_attr($slug) . '" data-link-type="' . $link_type . '" data-layout-mode="' . $layout_mode . '" data-centered="' . $centered . '">'; $posts .= $grid->draw_posts(); $posts .= '</div>'; $output = apply_filters('wpupg_posts_shortcode', $posts, $grid); $pagination = ''; if ($grid->pagination_type() == 'pages') { $pagination_type = $grid->pagination_type(); $pagination_style = $grid->pagination_style(); $style_data = ' data-margin-vertical="' . $pagination_style['margin_vertical'] . '"'; $style_data .= ' data-margin-horizontal="' . $pagination_style['margin_horizontal'] . '"'; $style_data .= ' data-padding-vertical="' . $pagination_style['padding_vertical'] . '"'; $style_data .= ' data-padding-horizontal="' . $pagination_style['padding_horizontal'] . '"'; $style_data .= ' data-border-width="' . $pagination_style['border_width'] . '"'; $style_data .= ' data-background-color="' . $pagination_style['background_color'] . '"'; $style_data .= ' data-text-color="' . $pagination_style['text_color'] . '"'; $style_data .= ' data-border-color="' . $pagination_style['border_color'] . '"'; $style_data .= ' data-active-background-color="' . $pagination_style['background_active_color'] . '"'; $style_data .= ' data-active-text-color="' . $pagination_style['text_active_color'] . '"'; $style_data .= ' data-active-border-color="' . $pagination_style['border_active_color'] . '"'; $style_data .= ' data-hover-background-color="' . $pagination_style['background_hover_color'] . '"'; $style_data .= ' data-hover-text-color="' . $pagination_style['text_hover_color'] . '"'; $style_data .= ' data-hover-border-color="' . $pagination_style['border_hover_color'] . '"'; $pagination .= '<div id="wpupg-grid-' . esc_attr($slug) . '-pagination" class="wpupg-pagination wpupg-pagination-' . $pagination_type . '" style="text-align: ' . $pagination_style['alignment'] . ';" data-grid="' . esc_attr($slug) . '" data-type="' . $pagination_type . '"' . $style_data . '>'; $pagination .= $grid->draw_pagination(); $pagination .= '</div>'; } $output .= apply_filters('wpupg_pagination_shortcode', $pagination, $grid); } } return $output; }
<?php // Grid should never be null. Construct just allows easy access to WPUPG_Grid functions in IDE. if (is_null($grid)) { $grid = new WPUPG_Grid(0); } $premium_only = WPUltimatePostGrid::is_premium_active() ? '' : ' (' . __('Premium only', 'wp-ultimate-post-grid') . ')'; ?> <input type="hidden" name="wpupg_nonce" value="<?php echo wp_create_nonce('grid'); ?> " /> <table id="wpupg_form_data_source" class="wpupg_form"> <tr> <td><label for="wpupg_post_types"><?php _e('Post Types', 'wp-ultimate-post-grid'); ?> </label></td> <td> <select name="wpupg_post_types" id="wpupg_post_types" class="wpupg-select2"> <?php $post_types = get_post_types('', 'objects'); unset($post_types[WPUPG_POST_TYPE]); unset($post_types['revision']); unset($post_types['nav_menu_item']); foreach ($post_types as $post_type => $options) { $selected = in_array($post_type, $grid->post_types()) ? ' selected="selected"' : ''; echo '<option value="' . esc_attr($post_type) . '"' . $selected . '>' . $options->labels->name . '</option>'; } ?>
<?php // Grid should never be null. Construct just allows easy access to WPUPG_Grid functions in IDE. if (is_null($grid)) { $grid = new WPUPG_Grid(0); } $premium_only = WPUltimatePostGrid::is_premium_active() ? '' : ' (' . __('Premium only', 'wp-ultimate-post-grid') . ')'; $pagination = $grid->pagination(); ?> <table id="wpupg_form_pagination" class="wpupg_form"> <tbody class="wpupg_pagination_none"> <tr> <td><label for="wpupg_pagination_type"><?php _e('Type', 'wp-ultimate-post-grid'); ?> </label></td> <td> <select name="wpupg_pagination_type" id="wpupg_pagination_type" class="wpupg-select2"> <?php $pagination_type_options = array('none' => __('No pagination (all posts visible at once)', 'wp-ultimate-post-grid'), 'pages' => __('Divide posts in pages', 'wp-ultimate-post-grid'), 'infinite_load' => __('Infinite Scroll Load', 'wp-ultimate-post-grid') . $premium_only, 'load_more' => __('Use a "Load More" button', 'wp-ultimate-post-grid') . $premium_only, 'load_filter' => __('Load more posts on filter', 'wp-ultimate-post-grid') . $premium_only, 'load_more_filter' => __('Use a "Load More" button', 'wp-ultimate-post-grid') . ' & ' . __('Load more posts on filter', 'wp-ultimate-post-grid') . $premium_only); foreach ($pagination_type_options as $pagination_type => $pagination_type_name) { $selected = $pagination_type == $grid->pagination_type() ? ' selected="selected"' : ''; echo '<option value="' . esc_attr($pagination_type) . '"' . $selected . '>' . $pagination_type_name . '</option>'; } ?> </select> </td> <td><?php _e('Type of pagination to be used for this grid.', 'wp-ultimate-post-grid'); ?> </td>
public function save($post_id, $post) { if ($post->post_type == WPUPG_POST_TYPE) { if (!isset($_POST['wpupg_nonce']) || !wp_verify_nonce($_POST['wpupg_nonce'], 'grid')) { return; } $grid = new WPUPG_Grid($post_id); // Basic metadata $fields = $grid->fields(); foreach ($fields as $field) { $old = get_post_meta($post_id, $field, true); $new = isset($_POST[$field]) ? $_POST[$field] : null; // Field specific adjustments if (isset($new) && $field == 'wpupg_post_types') { $new = array($new); } // Update or delete meta data if changed if (isset($new) && $new != $old) { update_post_meta($post_id, $field, $new); } elseif ($new == '' && $old) { delete_post_meta($post_id, $field, $old); } } // Limit rules $limit_rules = array(); if (isset($_POST['wpupg_limit_posts_rule'])) { foreach ($_POST['wpupg_limit_posts_rule'] as $id => $limit_rule) { if ($id != 0) { $field = $limit_rule['field']; $type = $limit_rule['type']; $field_parts = explode('|', $field); $values_name = 'values_' . $field_parts[0] . '_' . $field_parts[1]; if (isset($limit_rule[$values_name]) && $limit_rule[$values_name]) { $values = $limit_rule[$values_name]; if (!is_array($values)) { $values = explode(';', $values); } $limit_rules[] = array('field' => $field, 'post_type' => $field_parts[0], 'taxonomy' => $field_parts[1], 'values' => $values, 'type' => $type); } } } } update_post_meta($post_id, 'wpupg_limit_rules', $limit_rules); // Filter Taxonomies $post_type = $_POST['wpupg_post_types']; if (isset($_POST['wpupg_filter_taxonomy_' . $post_type])) { update_post_meta($post_id, 'wpupg_filter_taxonomies', $_POST['wpupg_filter_taxonomy_' . $post_type]); } // Filter style metadata $styles = $grid->filter_style_fields(); $filter_style = array(); foreach ($styles as $style => $fields) { $filter_style[$style] = array(); foreach ($fields as $field => $default) { $field_name = 'wpupg_' . $style . '_filter_style_' . $field; if (isset($_POST[$field_name])) { $filter_style[$style][$field] = $_POST[$field_name]; } } } update_post_meta($post_id, 'wpupg_filter_style', $filter_style); // Pagination metadata $pagination_fields = $grid->pagination_fields(); $pagination = array(); foreach ($pagination_fields as $type => $fields) { $pagination[$type] = array(); foreach ($fields as $field => $default) { $field_name = 'wpupg_pagination_' . $type . '_' . $field; if (isset($_POST[$field_name])) { $pagination[$type][$field] = $_POST[$field_name]; } } } update_post_meta($post_id, 'wpupg_pagination', $pagination); // Pagination style metadata $pagination_style_fields = $grid->pagination_style_fields(); $pagination_style = array(); foreach ($pagination_style_fields as $field => $default) { $field_name = 'wpupg_pagination_style_' . $field; if (isset($_POST[$field_name])) { $pagination_style[$field] = $_POST[$field_name]; } } update_post_meta($post_id, 'wpupg_pagination_style', $pagination_style); // Cache gets automatically generated in WPUPG_Grid_Cache } }
<?php /* * -> 1.2 * * Set active colors to hover colors */ $args = array('post_type' => WPUPG_POST_TYPE, 'post_status' => 'any', 'posts_per_page' => -1, 'nopaging' => true); $query = new WP_Query($args); $posts = $query->have_posts() ? $query->posts : array(); foreach ($posts as $grid_post) { $grid = new WPUPG_Grid($grid_post); $filter_type = $grid->filter_type(); if ($filter_type == 'isotope') { $filter_style = $grid->filter_style(); $filter_style['isotope']['background_active_color'] = $filter_style['isotope']['background_hover_color']; $filter_style['isotope']['text_active_color'] = $filter_style['isotope']['text_hover_color']; $filter_style['isotope']['border_active_color'] = $filter_style['isotope']['border_hover_color']; update_post_meta($grid->ID(), 'wpupg_filter_style', $filter_style); } } // Successfully migrated to 1.2 $migrate_version = '1.2'; update_option('wpupg_migrate_version', $migrate_version); if ($notices) { WPUltimatePostGrid::get()->helper('notices')->add_admin_notice('<strong>WP Ultimate Post Grid</strong> Successfully migrated to 1.2+'); }
public function generate($grid_id) { $grid = new WPUPG_Grid($grid_id); // Get Posts $args = array('post_type' => $grid->post_types(), 'post_status' => $grid->post_status(), 'posts_per_page' => -1, 'nopaging' => true, 'fields' => 'ids'); // Images Only if ($grid->images_only()) { $args['meta_query'] = array(array('key' => '_thumbnail_id', 'value' => '0', 'compare' => '>')); } $query = new WP_Query($args); $posts = $query->have_posts() ? $query->posts : array(); $post_ids = array_map('intval', $posts); $post_ids = apply_filters('wpupg_grid_cache_post_ids', $post_ids, $grid); $cache = array('all' => $post_ids); $taxonomies = $grid->filter_taxonomies(); // Cache arrays $posts_per_term = array(); $terms_per_post = array(); $filter_terms = array(); // Loop over all terms foreach ($post_ids as $post_id) { if (!isset($terms_per_post[$post_id])) { $terms_per_post[$post_id] = array(); } foreach ($taxonomies as $taxonomy) { if (!isset($posts_per_term[$taxonomy])) { $posts_per_term[$taxonomy] = array(); } $terms = wp_get_post_terms($post_id, $taxonomy); // Get parent terms if enabled if ($grid->filter_match_parents()) { $parent_ids = array(); $parents = array(); foreach ($terms as $term) { if ($term->parent != 0) { $parent_ids[] = $term->parent; } } while (count($parent_ids) > 0) { $children_ids = $parent_ids; $parent_ids = array(); foreach ($children_ids as $child) { $term = get_term($child, $taxonomy); $parents[] = $term; if ($term->parent != 0) { $parent_ids[] = $term->parent; } } } $terms = array_merge($terms, $parents); $handled_terms = array(); } $post_taxonomy_term_ids = array(); foreach ($terms as $term) { // Make sure we only handle each term once if ($grid->filter_match_parents()) { if (in_array($term->slug, $handled_terms)) { continue; } $handled_terms[] = $term->slug; } // Posts per term if (!isset($posts_per_term[$taxonomy][$term->slug])) { $posts_per_term[$taxonomy][$term->slug] = array(); } $posts_per_term[$taxonomy][$term->slug][] = $post_id; // Terms per post $post_taxonomy_term_ids[] = $term->slug; // Filter terms $filter_terms[$term->slug] = array('taxonomy' => $taxonomy, 'name' => $term->name); } $terms_per_post[$post_id][$taxonomy] = $post_taxonomy_term_ids; } } $cache['taxonomies'] = $posts_per_term; $cache['terms'] = $terms_per_post; // Generate Filter $filter = ''; if (count($filter_terms) > 0 && $grid->filter_type() == 'isotope') { $filter .= '<div class="wpupg-filter-item wpupg-filter-isotope-term wpupg-filter-tag- active">' . __('All', 'wp-ultimate-post-grid') . '</div>'; ksort($filter_terms); foreach ($filter_terms as $slug => $options) { $filter .= '<div class="wpupg-filter-item wpupg-filter-isotope-term wpupg-filter-tag-' . $slug . '" data-taxonomy="' . $options['taxonomy'] . '" data-filter="' . $slug . '">' . $options['name'] . '</div>'; } } // Update Metadata $cache = apply_filters('wpupg_grid_cache_posts', $cache, $grid); $filter = apply_filters('wpupg_grid_cache_filter', $filter, $cache, $grid); update_post_meta($grid_id, 'wpupg_posts', $cache); update_post_meta($grid_id, 'wpupg_filter', $filter); }
<?php // Grid should never be null. Construct just allows easy access to WPUPG_Grid functions in IDE. if (is_null($grid)) { $grid = new WPUPG_Grid(0); } $pagination_style = $grid->pagination_style(); ?> <table id="wpupg_form_pagination_style" class="wpupg_form"> <tr> <td> </td> <td><span class="wpupg_label_prefix"><?php _e('Background Color', 'wp-ultimate-post-grid'); ?> </span></td> <td><span class="wpupg_label_prefix"><?php _e('Text Color', 'wp-ultimate-post-grid'); ?> </span></td> <td><span class="wpupg_label_prefix"><?php _e('Border Color', 'wp-ultimate-post-grid'); ?> </span></td> </tr> <tr> <td><span class="wpupg_label_prefix"><?php _e('Default', 'wp-ultimate-post-grid'); ?> </span></td> <td>
<?php // Grid should never be null. Construct just allows easy access to WPUPG_Grid functions in IDE. if (is_null($grid)) { $grid = new WPUPG_Grid(0); } ?> <?php if ($grid->post()->post_status !== 'publish') { _e('You have to publish the grid first.', 'wp-ultimate-post-grid'); } else { ?> <strong>Grid</strong><br/> [wpupg-grid id="<?php echo $grid->post()->post_name; ?> "] <?php if ($grid->filter_type() !== 'none') { ?> <br/><br/> <strong>Filter</strong><br/> [wpupg-filter id="<?php echo $grid->post()->post_name; ?> "] <?php } }
<?php // Grid should never be null. Construct just allows easy access to WPUPG_Grid functions in IDE. if (is_null($grid)) { $grid = new WPUPG_Grid(0); } $premium_only = WPUltimatePostGrid::is_premium_active() ? '' : ' (' . __('Premium only', 'wp-ultimate-post-grid') . ')'; ?> <div id="wpupg_no_taxonomies"><?php _e('There are no taxonomies associated with this post type', 'wp-ultimate-post-grid'); ?> </div> <table id="wpupg_form_filter" class="wpupg_form"> <tr class="wpupg_no_filter"> <td><label for="wpupg_filter_type"><?php _e('Type', 'wp-ultimate-post-grid'); ?> </label></td> <td> <select name="wpupg_filter_type" id="wpupg_filter_type" class="wpupg-select2"> <?php $filter_type_options = array('none' => __('No Filter', 'wp-ultimate-post-grid'), 'isotope' => __('Isotope', 'wp-ultimate-post-grid'), 'dropdown' => __('Dropdown', 'wp-ultimate-post-grid') . $premium_only); foreach ($filter_type_options as $filter_type => $filter_type_name) { $selected = $filter_type == $grid->filter_type() ? ' selected="selected"' : ''; echo '<option value="' . esc_attr($filter_type) . '"' . $selected . '>' . $filter_type_name . '</option>'; } ?> </select> </td> <td><?php _e('Type of filter to be used for this grid.', 'wp-ultimate-post-grid');
<?php // Grid should never be null. Construct just allows easy access to WPUPG_Grid functions in IDE. if (is_null($grid)) { $grid = new WPUPG_Grid(0); } ?> <table id="wpupg_form_limit_posts" class="wpupg_form"> <thead> <tr> <td>Field/Term</td> <td>Values</td> <td>Type</td> <td> </td> </tr> </thead> <tbody id="wpupg_rule_placeholder"> <tr id="wpupg_rule_0" data-rule="0"> <td> <select name="wpupg_limit_posts_rule[0][field]" id="wpupg_limit_posts_rule_field_0" class="wpupg_rule_field"> <optgroup label="<?php _e('General', 'wp-ultimate-post-grid'); ?> "> <?php $rule_field_options = array('wpupg_general|author' => __('Author', 'wp-ultimate-post-grid'), 'wpupg_general|date' => __('Date', 'wp-ultimate-post-grid'), 'wpupg_general|id' => __('Post ID', 'wp-ultimate-post-grid')); foreach ($rule_field_options as $rule_field => $rule_field_name) { $selected = ''; //$rule_field == $grid->filter_type() ? ' selected="selected"' : ''; echo '<option value="' . esc_attr($rule_field) . '"' . $selected . '>' . $rule_field_name . '</option>';
<?php // Grid should never be null. Construct just allows easy access to WPUPG_Grid functions in IDE. if (is_null($grid)) { $grid = new WPUPG_Grid(0); } $filter_style = $grid->filter_style(); $isotope_style = $filter_style['isotope']; ?> <table id="wpupg_form_isotope_filter_style" class="wpupg_form"> <tr> <td> </td> <td><span class="wpupg_label_prefix"><?php _e('Background Color', 'wp-ultimate-post-grid'); ?> </span></td> <td><span class="wpupg_label_prefix"><?php _e('Text Color', 'wp-ultimate-post-grid'); ?> </span></td> <td><span class="wpupg_label_prefix"><?php _e('Border Color', 'wp-ultimate-post-grid'); ?> </span></td> </tr> <tr> <td><span class="wpupg_label_prefix"><?php _e('Default', 'wp-ultimate-post-grid'); ?> </span></td>
<?php // Grid should never be null. Construct just allows easy access to WPUPG_Grid functions in IDE. if (is_null($grid)) { $grid = new WPUPG_Grid(0); } ?> <table id="wpupg_form_grid" class="wpupg_form"> <tr> <td><label for="wpupg_link_type"><?php _e('Links', 'wp-ultimate-post-grid'); ?> </label></td> <td> <select name="wpupg_link_type" id="wpupg_link_type" class="wpupg-select2"> <?php $link_type_options = array('_self' => __('Open in same tab', 'wp-ultimate-post-grid'), '_blank' => __('Open in new tab', 'wp-ultimate-post-grid'), 'none' => __("Don't use links", 'wp-ultimate-post-grid')); foreach ($link_type_options as $link_type => $link_type_name) { $selected = $link_type == $grid->link_type() ? ' selected="selected"' : ''; echo '<option value="' . esc_attr($link_type) . '"' . $selected . '>' . $link_type_name . '</option>'; } ?> </select> </td> <td><?php _e('Options for links surrounding the grid items.', 'wp-ultimate-post-grid'); ?> </td> </tr> <tr>