Exemplo n.º 1
0
 $prev_text = fw_get_db_customizer_option('opt_posts_block_prev_post_text');
 $small_hide_excerpt = 0;
 $show_page_numbers = fw_get_db_customizer_option('opt_posts_block_show_page_numbers');
 $layout = fw_get_db_customizer_option('opt_posts_block_layout');
 $vertical_align_columns = fw_get_db_customizer_option('opt_posts_block_vertical_align_columns');
 /** hover items **/
 $hover_top = thshpr_get_image_hover_string(fw_get_db_customizer_option('opt_image_hover_item_1'));
 $hover_bottom = thshpr_get_image_hover_string(fw_get_db_customizer_option('opt_image_hover_item_2'));
 /** image ratios **/
 $large_image_ratio = fw_get_db_customizer_option('opt_large_image_ratio');
 $small_image_ratio = fw_get_db_customizer_option('opt_small_image_ratio');
 $small_width = fw_get_db_customizer_option('opt_small_image_max_width');
 $large_width = fw_get_db_customizer_option('opt_large_image_max_width');
 //needs adding to options
 $large_height = thshpr_generate_aspect_height($large_image_ratio, $large_width);
 $small_height = thshpr_generate_aspect_height($small_image_ratio, $small_width);
 /**
  * General Options
  */
 $show_progress_indicator = fw_get_db_customizer_option('opt_show_progress_indicator');
 $sidebar_type = fw_get_db_customizer_option('opt_sidebar_type');
 $sticky_sidebar = fw_get_db_customizer_option('opt_sticky_sidebar');
 $center_title = fw_get_db_customizer_option('opt_posts_block_center_title');
 $title_overlay_image = fw_get_db_customizer_option('opt_posts_block_title_overlay_image');
 $title_overlay_image_string = "";
 /**
  * Fullscreen Image Options
  */
 $header_image_width = 1190;
 //hard set because scaling is used
 $back_image = fw_get_db_customizer_option('opt_categories_header_parallax_image');
Exemplo n.º 2
0
     /**
      * General Images Options
      */
     $offset_images = fw_get_db_customizer_option('opt_offset_images');
     $left_aligned_image_max_width = fw_get_db_customizer_option('opt_left_aligned_image_max_width');
     $right_aligned_image_max_width = fw_get_db_customizer_option('opt_right_aligned_image_max_width');
     $center_aligned_image_max_width = fw_get_db_customizer_option('opt_center_aligned_image_max_width');
     $non_aligned_image_max_width = fw_get_db_customizer_option('opt_non_aligned_image_max_width');
     /**
      * Featured Images Options
      */
     $featured_image_show = fw_get_db_customizer_option('opt_featured_image_show');
     $featured_image_link_to_full = fw_get_db_customizer_option('opt_featured_image_link_to_full');
     $width = fw_get_db_customizer_option('opt_featured_image_max_width');
     $large_image_ratio = fw_get_db_customizer_option('opt_featured_image_ratio');
     $large_height = thshpr_generate_aspect_height($large_image_ratio, $width);
     /**
      * Fullscreen Header Image Options
      */
     $header_image_width = 1190;
     //hard set because scaling is used
     $header_show_image = fw_get_db_customizer_option('opt_header_show_image');
     $header_fade_image_scroll = fw_get_db_customizer_option('opt_header_fade_image_scroll');
     $header_image_height = fw_get_db_customizer_option('opt_header_image_height');
     $background_position = fw_get_db_customizer_option('opt_background_position');
     $background_color = fw_get_db_customizer_option('opt_background_color');
     $background_repeat = fw_get_db_customizer_option('opt_background_repeat');
     $background_size = fw_get_db_customizer_option('opt_background_size');
     $background_parallax_ratio = fw_get_db_customizer_option('opt_background_parallax_ratio');
 }
 /**
Exemplo n.º 3
0
 /**
  * Front-end display of widget.
  * @since 0.1
  */
 function widget($args, $instance)
 {
     $post_categories = wp_get_post_categories(get_the_ID());
     $post_categories = array_values($post_categories);
     $post_categories = thshpr_get_category_ids_string($post_categories);
     if (function_exists('fw_get_db_customizer_option')) {
         /**
          * Variables from customizer
          */
         $widget_component_elements = fw_get_db_customizer_option('opt_widget_functionality');
         $widget_category_tag_number = fw_get_db_customizer_option('opt_widget_number_categories');
         $widget_divider_type = fw_get_db_customizer_option('opt_widget_divider_type');
         $small_image_ratio = fw_get_db_customizer_option('opt_small_image_ratio');
         $width = 390;
         $show_hover_effects = fw_get_db_customizer_option('opt_show_hover_effects');
         $small_image_ratio = fw_get_db_customizer_option('opt_small_image_ratio');
         $excerpt_length = fw_get_db_customizer_option('opt_widget_excerpt_length');
         /**
          * Hover Items
          */
         $opt_image_hover_item_top = fw_get_db_customizer_option('opt_image_hover_item_1');
         $small_height = thshpr_generate_aspect_height($small_image_ratio, $width);
         if ($opt_image_hover_item_top['template'] == 0) {
         } else {
             if ($opt_image_hover_item_top['template'] == 1) {
                 $hover_top = $opt_image_hover_item_top['1']['opt_image_hover_item_text'];
             } else {
                 if ($opt_image_hover_item_top['template'] == 2) {
                     $hover_top = '<i class="' . $opt_image_hover_item_top['2']['opt_image_hover_item_icon'] . '" data-value="' . $opt_image_hover_item_top['2']['opt_image_hover_item_1_icon'] . '"></i>';
                 } else {
                     if ($opt_image_hover_item_top['template'] == 3) {
                         $hover_top = '<img src="' . $opt_image_hover_item_top['3']['opt_image_hover_item_image']['url'] . '">';
                     }
                 }
             }
         }
         $opt_image_hover_item_bottom = fw_get_db_customizer_option('opt_image_hover_item_2');
         if ($opt_image_hover_item_bottom['template'] == 0) {
         } else {
             if ($opt_image_hover_item_bottom['template'] == 1) {
                 $hover_bottom = $opt_image_hover_item_bottom['1']['opt_image_hover_item_text'];
             } else {
                 if ($opt_image_hover_item_bottom['template'] == 2) {
                     $hover_bottom = '<i class="' . $opt_image_hover_item_bottom['2']['opt_image_hover_item_icon'] . '" data-value="' . $opt_image_hover_item_bottom['2']['opt_image_hover_item_2_icon'] . '"></i>';
                 } else {
                     if ($opt_image_hover_item_bottom['template'] == 3) {
                         $hover_bottom = '<img src="' . $opt_image_hover_item_bottom['3']['opt_image_hover_item_image']['url'] . '">';
                     }
                 }
             }
         }
     } else {
         /**
          * Variables when unyson plugin not added
          */
         $widget_component_elements = array("Image", "Title", "Categories");
         $widget_category_tag_number = 3;
         $small_image_ratio = fw_get_db_customizer_option('opt_small_image_ratio');
         $width = 390;
         $show_hover_effects = fw_get_db_customizer_option('opt_show_hover_effects');
         $small_image_ratio = 0.5625;
         $excerpt_length = 11;
         $show_hover_effects = "No";
         $hover_top = '+';
         $hover_bottom = 'N';
     }
     $cache = wp_cache_get('theme_widget_related_posts', 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     ob_start();
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Mini Blog', 'thshpr') : $instance['title'], $instance, $this->id_base);
     if (!($number = (int) $instance['number'])) {
         $number = 10;
     } else {
         if ($number < 1) {
             $number = 1;
         } else {
             if ($number > 15) {
                 $number = 15;
             }
         }
     }
     global $post;
     $tags = wp_get_post_tags($post->ID);
     $tagIDs = array();
     if ($tags) {
         $tagcount = count($tags);
         for ($i = 0; $i < $tagcount; $i++) {
             $tagIDs[$i] = $tags[$i]->term_id;
         }
         $query = array('tag__in' => $tagIDs, 'post__not_in' => array($post->ID), 'showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
         /**
          * Get category ID's
          */
         $catids = array();
         foreach ($instance['cat'] as $name) {
             $term = get_term_by("name", $name, 'category');
             $catids[] = $term->term_id;
             //store the id of each slug in $catids
         }
         $post_category = implode(',', $catids);
         if (!empty($instance['cat'])) {
             $query['cat'] = $post_category;
         }
         $the_query = new WP_Query($query);
         if ($the_query->have_posts()) {
             echo $before_widget;
             if ($title) {
                 echo $before_title . $title . $after_title;
             }
             echo '<div class="related-posts-wrap posts posts-widget">';
             echo '<ul class="thumb-list">';
             while ($the_query->have_posts()) {
                 echo '<li>';
                 $the_query->the_post();
                 $item_string = "";
                 //set it up for concat
                 $post_format = get_post_format();
                 include locate_template('widget-templates/components-string.php');
                 //generates title string from customzed options
                 echo $item_string;
                 echo '</li>';
             }
             echo '</ul>';
             echo '</div>';
             echo $after_widget;
             // Reset the global $the_post as this query will have roflstomped on it
             wp_reset_query();
         }
         $cache[$args['widget_id']] = ob_get_flush();
         wp_cache_set('theme_widget_related_posts', $cache, 'widget');
     }
 }