/** * Build post slider array. * * Get all the query parameters and build an array with posts ID's as keys * and the featured image's url (in 'full size') as values. * * @since 1.5.9 * @return array the array with all the posts ID's and featured image url's. * */ public function _build_posts_array() { // checks if the post_slides array is cached if (!isset($this->post_slides)) { // if not, create it $this->post_slides = array(); // check if we have selected posts if (empty($this->settings->posts_post)) { // if not, create a default query with it $settings = !empty($this->settings) ? $this->settings : new stdClass(); // set WP_Query "fields" arg as 'ids' to return less information $settings->fields = 'ids'; // Get the query data. $query = FLBuilderLoop::query($settings); // build the post_slides array with post id's and featured image url's foreach ($query->posts as $key => $id) { $this->post_slides[$id] = $this->get_full_img_src($id); } } else { // if yes, get the selected posts and build the post_slides array $slides = explode(',', $this->settings->posts_post); foreach ($slides as $key => $id) { $this->post_slides[$id] = $this->get_full_img_src($id); } } } return $this->post_slides; }
<div class="fl-post-grid-sizer"></div> </div> <div class="fl-clear"></div> <?php } // Render the pagination. if ($settings->pagination != 'none' && $query->have_posts()) { ?> <div class="fl-builder-pagination"<?php if ($settings->pagination == 'scroll') { echo ' style="display:none;"'; } ?> > <?php FLBuilderLoop::pagination($query); ?> </div> <?php } // Render the empty message. if (!$query->have_posts() && (defined('DOING_AJAX') || isset($_REQUEST['fl_builder']))) { ?> <div class="fl-post-grid-empty"> <?php if (isset($settings->no_results_message)) { echo $settings->no_results_message; } else { _e('No posts found.', 'fl-builder'); } ?>
<?php if ($settings->show_date) { ?> <?php if ($settings->show_author) { ?> <span> | </span> <?php } ?> <span class="fl-post-feed-date" itemprop="datePublished" datetime="<?php echo the_time('Y-m-d'); ?> "> <?php FLBuilderLoop::post_date($settings->date_format); ?> </span> <?php } ?> </div> <?php } ?> <?php if ($settings->show_content) { ?> <div class="fl-post-carousel-content"> <?php
foreach (FLBuilderLoop::post_types() as $slug => $type) { ?> <table class="fl-form-table fl-loop-builder-filter fl-loop-builder-<?php echo $slug; ?> -filter" <?php if ($slug == $settings->post_type) { echo 'style="display:table;"'; } ?> > <?php // Posts FLBuilder::render_settings_field('posts_' . $slug, array('type' => 'suggest', 'action' => 'fl_as_posts', 'data' => $slug, 'label' => $type->label, 'help' => sprintf(__('Enter a comma separated list of %s. Only these %s will be shown.', 'fl-builder'), $type->label, $type->label)), $settings); // Taxonomies $taxonomies = FLBuilderLoop::taxonomies($slug); foreach ($taxonomies as $tax_slug => $tax) { FLBuilder::render_settings_field('tax_' . $slug . '_' . $tax_slug, array('type' => 'suggest', 'action' => 'fl_as_terms', 'data' => $tax_slug, 'label' => $tax->label, 'help' => sprintf(__('Enter a comma separated list of %s. Only posts with these %s will be shown.', 'fl-builder'), $tax->label, $tax->label)), $settings); } ?> </table> <?php } ?> <table class="fl-form-table"> <?php // Author FLBuilder::render_settings_field('users', array('type' => 'suggest', 'action' => 'fl_as_users', 'label' => __('Authors', 'fl-builder'), 'help' => __('Enter a comma separated list of authors usernames. Only posts with these authors will be shown.', 'fl-builder')), $settings); ?> </table> </div>
/** * Returns data for link auto suggest queries. * * @since 1.3.9 * @return array */ public static function links() { global $wpdb; $data = array(); $like = self::get_like(); $types = FLBuilderLoop::post_types(); $slugs = array(); foreach ($types as $slug => $type) { $slugs[] = esc_sql($slug); } $posts = $wpdb->get_results("\n\t\t\tSELECT ID, post_title FROM {$wpdb->posts} \n\t\t\tWHERE post_title LIKE '%{$like}%'\n\t\t\tAND post_type IN ('" . implode("','", $slugs) . "')\n\t\t\tAND post_status = 'publish'\n\t\t"); foreach ($posts as $post) { $data[] = array('name' => $post->post_title, 'value' => get_permalink($post->ID)); } return $data; }
<?php // Get the query data. $query = FLBuilderLoop::query($settings); // Render the posts. if ($query->have_posts()) { ?> <div class="fl-post-slider" itemscope="itemscope" itemtype="http://schema.org/Blog"> <div class="fl-post-slider-wrapper"> <?php while ($query->have_posts()) { $query->the_post(); include $module->dir . 'includes/post-loop.php'; } ?> </div> <?php // Render the navigation. if ($settings->navigation == 'yes' && $query->have_posts()) { ?> <div class="fl-post-slider-navigation"> <a class="slider-prev" href="#"><div class="fl-post-slider-svg-container"><?php include FL_BUILDER_DIR . 'img/svg/arrow-left.svg'; ?> </div></a> <a class="slider-next" href="#"><div class="fl-post-slider-svg-container"><?php include FL_BUILDER_DIR . 'img/svg/arrow-right.svg'; ?> </div></a>
<select name="<?php echo $name; ?> "<?php if (isset($field['class'])) { echo ' class="' . $field['class'] . '"'; } ?> > <?php foreach (FLBuilderLoop::post_types() as $slug => $type) { ?> <option value="<?php echo $slug; ?> " <?php selected($value, $slug); ?> ><?php echo $type->labels->name; ?> </option> <?php } ?> </select>