73 lines
2.8 KiB
PHP
Executable File
73 lines
2.8 KiB
PHP
Executable File
<?php
|
|
/*
|
|
Template Name: Blog Page
|
|
*/
|
|
get_header();
|
|
$args = array(
|
|
'post_type' => 'post',
|
|
'posts_per_page' => 9,
|
|
'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1)
|
|
/*'category_name' => 'blog'*/
|
|
);
|
|
$blog = new WP_Query($args);
|
|
?>
|
|
<div class="content">
|
|
<div class="container">
|
|
<div class="post_content">
|
|
<?php if ( $blog->have_posts() ) : ?>
|
|
<div class="blog">
|
|
<div class="blog-posts">
|
|
<?php
|
|
while ( $blog->have_posts() ) : $blog->the_post();
|
|
?>
|
|
<div class="featured-box">
|
|
<div class="port-image">
|
|
<?php
|
|
$type = get_post_meta($post->ID,'page_featured_type',true);
|
|
switch ($type) {
|
|
case 'youtube':
|
|
echo '<iframe src="http://www.youtube.com/embed/'.get_post_meta( get_the_ID(), 'page_video_id', true ).'?wmode=transparent" frameborder="0" allowfullscreen></iframe>';
|
|
break;
|
|
case 'vimeo':
|
|
echo '<iframe src="http://player.vimeo.com/video/'.get_post_meta( get_the_ID(), 'page_video_id', true ).'?title=0&byline=0&portrait=0&color=03b3fc" width="500" height="338" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
|
|
break;
|
|
default:
|
|
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array(600,600) );
|
|
echo '<a href="'.get_permalink().'" style="background-image: url('.$thumbnail[0].')"></a>';
|
|
break;
|
|
}
|
|
?>
|
|
</div>
|
|
<div class="port-body">
|
|
<p class="port-date"><?php //the_time('F d, Y'); ?><?php RelativeTime(); ?></p>
|
|
<h3><a href="<?php the_permalink(); ?>"><?php echo the_title(); ?></a></h3>
|
|
<p><?php echo dess_get_excerpt(230); ?></p>
|
|
<a class="read-more" href="<?php the_permalink(); ?>"><?php _e('Read More','CreatorThemeRes-child'); ?></a>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
endwhile;
|
|
?>
|
|
</div><!-- blog-posts -->
|
|
<div class="blog-pagination">
|
|
<?php
|
|
$big = 999999999; // need an unlikely integer
|
|
echo paginate_links( array(
|
|
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
|
|
'format' => '?paged=%#%',
|
|
'current' => max( 1, get_query_var('paged') ),
|
|
'total' => $blog->max_num_pages,
|
|
'prev_text' => '←',
|
|
'next_text' => '→'
|
|
) );
|
|
?>
|
|
</div>
|
|
</div><!-- blog -->
|
|
<?php else: echo '<p>'.__('Sorry, no blog posts found. Please create a post and assign it in "blog" category.','creator').'</p>'; endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
get_footer();
|
|
?>
|