function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { global $ti_option; $indent = $depth ? str_repeat("\t", $depth) : ''; $class_names = $value = ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item)); $class_names = ' class="' . esc_attr($class_names) . '"'; $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '>'; $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : ''; $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : ''; $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : ''; $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : ''; $item_output = $args->before; $item_output .= '<a' . $attributes . '>'; $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; $item_output .= '</a>'; if ($ti_option['site_mega_menu'] == true) { if ('category' == $item->object) { $item_output .= '<div class="sub-menu">'; } } $item_output .= $args->after; /* Add Mega menu only for: * Parent category if the option is enabled in Theme Options */ if ($ti_option['site_mega_menu'] == true) { if ($depth == 0 && $item->object == 'category') { $item_output .= '<ul class="sub-posts">'; global $post; $menuposts = get_posts(array('posts_per_page' => 3, 'category' => $item->object_id)); foreach ($menuposts as $post) { $post_title = get_the_title(); $post_link = get_permalink(); $post_image = wp_get_attachment_image_src(get_post_thumbnail_id(), "rectangle-size-small"); if ($post_image != '') { $menu_post_image = '<img src="' . $post_image[0] . '" alt="' . $post_title . '" width="' . $post_image[1] . '" height="' . $post_image[2] . '" />'; } elseif (first_post_image()) { $menu_post_image = '<img src="' . first_post_image() . '" class="wp-post-image" alt="' . $post_title . '" />'; } else { $menu_post_image = __('No image', 'themetext'); } $item_output .= ' <li> <figure> <a href="' . $post_link . '">' . $menu_post_image . '</a> </figure> <a href="' . $post_link . '">' . $post_title . '</a> </li>'; } wp_reset_postdata(); $item_output .= '</ul>'; } } $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); }
<article <?php post_class("grid-4"); ?> > <figure class="entry-image"> <a href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { the_post_thumbnail('rectangle-size'); } elseif (first_post_image()) { // Set the first image from the editor echo '<img src="' . first_post_image() . '" class="wp-post-image" alt="' . get_the_title() . '" />'; } ?> </a> </figure> <header class="entry-header"> <div class="entry-meta"> <?php ti_meta_data(); ?> </div> <h2 class="entry-title"> <a href="<?php the_permalink(); ?>
/** * Front-end display of widget **/ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', isset($instance['title']) ? esc_attr($instance['title']) : 'Category Name'); $items_num = isset($instance['items_num']) ? esc_attr($instance['items_num']) : '3'; $cat_name = isset($instance['cat_name']) ? esc_attr($instance['cat_name']) : ''; $widget_type = isset($instance['widget_type']) ? $instance['widget_type'] : 'flexslider'; /** * Latest Posts **/ global $post; $ti_latest_cat_posts = new WP_Query(array('post_type' => 'post', 'cat' => $cat_name, 'posts_per_page' => $items_num, 'post__not_in' => array($post->ID), 'ignore_sticky_posts' => 1)); if ($ti_latest_cat_posts->have_posts()) { echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <div class="<?php echo $widget_type; ?> "> <?php if ($widget_type == 'flexslider') { $slides = ' class="slides"'; } else { $slides = ' class="clearfix"'; } ?> <ul<?php echo isset($slides) ? $slides : ''; ?> > <?php while ($ti_latest_cat_posts->have_posts()) { $ti_latest_cat_posts->the_post(); ?> <li> <?php if (has_post_thumbnail()) { ?> <figure class="entry-image"> <a href="<?php the_permalink(); ?> "> <?php the_post_thumbnail('rectangle-size'); ?> </a> </figure> <?php } elseif (first_post_image()) { // Set the first image from the editor ?> <figure class="entry-image"> <a href="<?php the_permalink(); ?> "> <img src="<?php echo first_post_image(); ?> " class="wp-post-image" alt="<?php the_title(); ?> " /> </a> </figure> <?php } ?> <a class="widget-post-title" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </li> <?php } ?> </ul> </div> <?php echo $after_widget; wp_reset_postdata(); } }
while ($ti_related_posts->have_posts()) { $ti_related_posts->the_post(); ?> <div class="item"> <figure class="entry-image"> <a href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { the_post_thumbnail('rectangle-size-small'); } elseif (first_post_image()) { // Set the first image from the editor echo '<img src="' . first_post_image() . '" class="wp-post-image" />'; } ?> </a> </figure> <header class="entry-header"> <h4> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </h4> </header>
/** * Front-end display of widget **/ public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', isset($instance['title']) ? esc_attr($instance['title']) : 'Featured Posts'); $items_num = isset($instance['items_num']) ? esc_attr($instance['items_num']) : '3'; $widget_type = isset($instance['widget_type']) ? $instance['widget_type'] : 'flexslider'; /** * Latest Posts **/ echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } /** * Latest Posts **/ global $post; $ti_featured_posts = new WP_Query(array('post_type' => 'post', 'meta_key' => 'featured_post_add', 'meta_value' => '1', 'posts_per_page' => $items_num)); ?> <div class="<?php echo $widget_type; ?> "> <?php if ($widget_type == 'flexslider') { $slides = ' class="slides"'; } else { $slides = ' class="clearfix"'; } ?> <ul<?php echo isset($slides) ? $slides : ''; ?> > <?php while ($ti_featured_posts->have_posts()) { $ti_featured_posts->the_post(); ?> <li> <?php if (has_post_thumbnail()) { ?> <figure class="entry-image"> <a href="<?php the_permalink(); ?> "> <?php the_post_thumbnail('rectangle-size'); ?> </a> </figure> <?php } elseif (first_post_image()) { // Set the first image from the editor ?> <figure class="entry-image"> <a href="<?php the_permalink(); ?> "> <img src="<?php echo first_post_image(); ?> " class="wp-post-image" alt="<?php the_title(); ?> " /> </a> </figure> <?php } ?> <?php if ($widget_type == 'widget-posts-entries') { echo '<span>'; the_category(', '); echo '</span>'; } ?> <a class="widget-post-title" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </li> <?php } ?> <?php wp_reset_postdata(); ?> </ul> </div> <?php echo $after_widget; }
echo isset($twitter_user) ? '&via=' . $twitter_user : ''; ?> " target="_blank"> <i class="icomoon-twitter"></i> <?php _e('Twitter', 'themetext'); ?> </a> </li> <li class="share-pinterest"> <?php if (has_post_thumbnail()) { $pinimage = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large'); $showpinimage = $pinimage[0]; } elseif (first_post_image()) { $showpinimage = first_post_image(); } ?> <a href="//pinterest.com/pin/create/button/?url=<?php the_permalink(); ?> &media=<?php echo $showpinimage; ?> &description=<?php the_title(); ?> " target="_blank"> <i class="icomoon-pinterest"></i> <?php _e('Pinterest', 'themetext');
/** * Different image size based on layout selection for Homepage, Categories and Posts Page */ function ti_layout_based_post_image() { $itemprop = array('itemprop' => 'image'); if (has_post_thumbnail()) { // Set Featured Image // Images for Posts Page or if this page is used as Homepage with "Your latest posts" option if (is_home()) { global $ti_option; if ($ti_option['posts_page_layout'] == 'grid-layout' || $ti_option['posts_page_layout'] == 'list-layout') { the_post_thumbnail('rectangle-size', $itemprop); } elseif ($ti_option['posts_page_layout'] == 'classic-layout') { the_post_thumbnail('big-size', $itemprop); } else { the_post_thumbnail('masonry-size', $itemprop); } // Images for Homepage used with page composer and Categories } else { if (get_sub_field('latest_posts_layout') == 'list-layout' || get_field('category_posts_layout', 'category_' . get_query_var('cat')) == 'list-layout' || get_sub_field('latest_posts_layout') == 'grid-layout' || get_field('category_posts_layout', 'category_' . get_query_var('cat')) == 'grid-layout') { the_post_thumbnail('rectangle-size', $itemprop); } elseif (get_sub_field('latest_posts_layout') == 'classic-layout' || get_field('category_posts_layout', 'category_' . get_query_var('cat')) == 'classic-layout') { the_post_thumbnail('big-size', $itemprop); } else { the_post_thumbnail('masonry-size', $itemprop); } } } elseif (first_post_image()) { // Set the first image from the editor echo '<img src="' . first_post_image() . '" class="wp-post-image" alt="' . get_the_title() . '" />'; } }
echo $home_image; ?> " /></a> <?php } elseif (has_post_thumbnail()) { the_post_thumbnail('rectangle-size'); } elseif (first_post_image()) { // Set the first image from the editor ?> <a href="<?php the_permalink(); ?> " class="au_thumbnail_excerpt_image"><img src="<?php first_post_image(); ?> " alt="<?php get_the_title(); ?> " /></a> <?php } elseif (isset($video_id)) { ?> <a href="<?php the_permalink(); ?> " class="au_thumbnail_excerpt_image"><img src="http://img.youtube.com/vi/<?php echo $video_id;