<h2 class="entry-title">
                <a href="<?php 
the_permalink();
?>
"
                   title="<?php 
echo esc_attr(sprintf(__('Permalink to %s', 'maxflat'), the_title_attribute('echo=0')));
?>
"
                   rel="bookmark"><?php 
the_title();
?>
</a>
            </h2>
					<?php 
maxflat_display_meta_post();
?>

        </header>
        <!-- .entry-header -->
        <div class="row">
            <div class="columns large-16">
                <?php 
$post_format = get_post_format();
if ('' != get_the_post_thumbnail()) {
    ?>

                   <div class="smartlib-thumbnail-outer"><?php 
    maxflat_get_format_ico($post_format);
    ?>
<a href="<?php 
/**
 *
 * Display related posts component
 * @param     $category
 * @param     $post_ID
 * @param     $display_post_limit
 * @param int $columns_per_slide
 *
 * @return mixed
 */
function maxflat_get_related_post_box($category, $post_ID, $display_post_limit, $columns_per_slide = 4)
{
    $query = __MAXFLAT::layout()->get_related_post_box($category, $post_ID, $display_post_limit, $columns_per_slide);
    $limit = $query->found_posts;
    if ($limit != 0) {
        ?>

	<section class="smartlib-related-posts">
	    <h3><?php 
        _e('Related posts', 'maxflat');
        ?>
</h3>
			<div class="smartlib-slider-container">
				<ul class="smartlib-slides slider-list slides">
					<?php 
        $i = 1;
        $j = 1;
        while ($query->have_posts()) {
            $query->the_post();
            $post_format = get_post_format();
            if ($i == 1) {
                ?>

								<li class="row">
								<?php 
            }
            ?>

						<div class="columns large-4">
							<?php 
            if ('' != get_the_post_thumbnail()) {
                ?>


									<a href="<?php 
                the_permalink();
                ?>
" class="smartlib-thumbnail-outer"
										 title="<?php 
                echo esc_attr(sprintf(__('Permalink to %s', 'maxflat'), the_title_attribute('echo=0')));
                ?>
"
											><?php 
                maxflat_get_format_ico($post_format);
                the_post_thumbnail('medium-image-thumb');
                ?>
</a>

								<?php 
            } elseif ($post_format == 'gallery') {
                $featured_image = maxflat_get_featured_image('medium-image-thumb');
                if (!empty($featured_image)) {
                    ?>



										<a href="<?php 
                    the_permalink();
                    ?>
" class="smartlib-thumbnail-outer"
											 title="<?php 
                    echo esc_attr(sprintf(__('Permalink to %s', 'maxflat'), the_title_attribute('echo=0')));
                    ?>
"
												><?php 
                    maxflat_get_format_ico($post_format);
                    echo $featured_image;
                    ?>
</a>

									<?php 
                }
            }
            ?>

							<h4><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h4>
							<?php 
            if (empty($featured_image) && '' == get_the_post_thumbnail()) {
                ?>

						<?php 
                maxflat_display_meta_post('author');
                ?>

							<?php 
            }
            ?>

						</div>

						<?php 
            if ($i % $columns_per_slide == 0 || $j == $limit) {
                ?>

						</li>
								<?php 
                $i = 1;
            } else {
                $i++;
            }
            $j++;
        }
        // end while
        wp_reset_postdata();
        ?>

				</ul>
			</div>


	</section>
		<?php 
    }
}
Example #3
0
		</div>
		<div class="columns large-14 medium-2">
			<article id="post-<?php 
the_ID();
?>
" <?php 
post_class();
?>
>
				<header class="entry-header">
					<h1 class="entry-title"><?php 
the_title();
?>
</h1>
					<?php 
maxflat_display_meta_post('date');
?>
				</header>
				<?php 
echo get_avatar(get_the_author_meta('ID'), apply_filters('maxflat_status_avatar', '48'));
?>
	<h5><?php 
the_author();
?>
</h5>

				<div class="entry-content">
					<?php 
the_content();
?>
				</div>
    function widget($args, $instance)
    {
        $cache = wp_cache_get('smartlib-recent-posts', 'widget');
        /*
        		if ( ! is_array( $cache ) )
        			$cache = array();
        
        		if ( ! isset( $args['widget_id'] ) )
        			$args['widget_id'] = $this->id;
        
        		if ( isset( $cache[$args['widget_id']] ) ) {
        			echo $cache[$args['widget_id']];
        			return;
        		}
        
        		ob_start();
        */
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts', 'maxflat') : $instance['title'], $instance, $this->id_base);
        if (empty($instance['number']) || !($number = absint($instance['number']))) {
            $number = 10;
        }
        $show_date = isset($instance['show_date']) ? $instance['show_date'] : false;
        $show_post_thumbnail = isset($instance['show_post_thumbnail']) ? $instance['show_post_thumbnail'] : false;
        $show_post_author = isset($instance['show_post_author']) ? $instance['show_post_author'] : false;
        $r = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true)));
        if ($r->have_posts()) {
            ?>

		<?php 
            echo $before_widget;
            ?>

		<?php 
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>

		<ul class="no-bullet">
			<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>

			<li>

					<?php 
                if ('' != get_the_post_thumbnail() && $show_post_thumbnail) {
                    ?>


                        <a href="<?php 
                    the_permalink();
                    ?>
" class="smartlib-widget-image-outer"><?php 
                    the_post_thumbnail('small-image');
                    ?>
</a>

						<?php 
                }
                ?>

				<header class="smartlib-widget-header">
					<h5 class="widget-post-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                if (get_the_title()) {
                    the_title();
                } else {
                    the_ID();
                }
                ?>
</a></h5>
				</header>
				<?php 
                if ($show_date) {
                    ?>

				<?php 
                    maxflat_display_meta_post('date');
                    ?>

				<?php 
                }
                ?>

					<?php 
                if ($show_post_author) {
                    ?>

				  <?php 
                    maxflat_author_line();
                    ?>

					<?php 
                }
                ?>



			</li>
			<?php 
            }
            ?>

		</ul>
		<?php 
            echo $after_widget;
            ?>

		<?php 
            // Reset the global $the_post as this query will have stomped on it
            wp_reset_postdata();
        }
        /*
        		$cache[$args['widget_id']] = ob_get_flush();
        		wp_cache_set( 'widget_recent_posts', $cache, 'widget' );
        */
    }