Initial commit

This commit is contained in:
Alexander Agnarson 2020-03-11 14:44:42 +01:00
commit b0607606ae
369 changed files with 85494 additions and 0 deletions

23
inc/featured.php Normal file
View file

@ -0,0 +1,23 @@
<?php
// Query featured entries
$featured = new WP_Query(
array(
'no_found_rows' => false,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'ignore_sticky_posts' => 1,
'posts_per_page' => absint( get_theme_mod('featured-posts-count','3') ),
'cat' => absint( get_theme_mod('featured-category','') )
)
);
?>
<?php if ( is_home() && !is_paged() && ( get_theme_mod('featured-posts-count','3') !='0') && $featured->have_posts() ): ?>
<?php while ( $featured->have_posts() ): $featured->the_post(); ?>
<?php get_template_part('content-featured'); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_postdata(); ?>

24
inc/front-comments.php Normal file
View file

@ -0,0 +1,24 @@
<?php if ( !is_paged()) : ?>
<?php $comments = get_comments(array('number'=>3,'status'=>'approve','post_status'=>'publish')); ?>
<div class="stripe">
<div class="container pad group">
<div class="stripe-title"><i class="fas fa-comments"></i> <?php esc_html_e('Recent Comments','magaziner'); ?></div>
<ul class="stripe-comments group">
<?php foreach ($comments as $comment): ?>
<li>
<a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?>" class="group">
<span class="stripe-comments-avatar"><?php echo get_avatar($comment->comment_author_email,$size='96'); ?></span>
<?php $str=explode(' ',get_comment_excerpt($comment->comment_ID)); $comment_excerpt=implode(' ',array_slice($str,0,11)); if(count($str) > 11 && substr($comment_excerpt,-1)!='.') $comment_excerpt.='...' ?>
<span class="stripe-comments-inner">
<strong class="stripe-comments-title"><?php echo esc_attr( $comment->comment_author ); ?>:</strong>
<i class="stripe-comments-excerpt"><?php echo esc_attr( $comment_excerpt ); ?></i>
</span>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div><!--/.stripe-->
<?php endif; ?>

34
inc/front-popular.php Normal file
View file

@ -0,0 +1,34 @@
<?php if ( !is_paged()) : ?>
<?php
$popular = new WP_Query( array(
'post_type' => array( 'post' ),
'showposts' => 3,
'ignore_sticky_posts' => true,
'orderby' => 'comment_count',
'order' => 'dsc',
'date_query' => array(
array(
'after' => 'all time',
),
),
) );
?>
<div class="stripe">
<div class="container pad group">
<div class="stripe-title"><i class="fas fa-fire"></i> <?php esc_html_e('Popular Posts','magaziner'); ?></div>
<ol class="stripe-popular group">
<?php while ( $popular->have_posts() ): $popular->the_post(); ?>
<li>
<div class="stripe-popular-category"><?php the_category(' / '); ?></div>
<a class="stripe-popular-title" href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
<div class="stripe-popular-date"><i class="far fa-clock"></i><?php the_time( get_option('date_format') ); ?></div>
</li>
<?php endwhile; ?>
</ol>
</div>
</div><!--/.stripe-->
<?php wp_reset_postdata(); ?>
<?php endif; ?>

View file

@ -0,0 +1,17 @@
<?php if ( is_home() && !is_paged() && get_theme_mod('frontpage-widgets-bottom') == 'on' ): ?>
<div class="front-widgets group">
<div class="front-widget-col">
<div class="front-widget-inner">
<?php dynamic_sidebar( 'frontpage-bottom-1' ); ?>
</div>
</div>
<div class="front-widget-col">
<div class="front-widget-inner">
<?php dynamic_sidebar( 'frontpage-bottom-2' ); ?>
</div>
</div>
</div><!--/.front-widgets-->
<?php endif; ?>

17
inc/front-widgets-top.php Normal file
View file

@ -0,0 +1,17 @@
<?php if ( is_home() && !is_paged() && get_theme_mod('frontpage-widgets-top') == 'on' ): ?>
<div class="front-widgets group">
<div class="front-widget-col">
<div class="front-widget-inner">
<?php dynamic_sidebar( 'frontpage-top-1' ); ?>
</div>
</div>
<div class="front-widget-col">
<div class="front-widget-inner">
<?php dynamic_sidebar( 'frontpage-top-2' ); ?>
</div>
</div>
</div><!--/.front-widgets-->
<?php endif; ?>

27
inc/highlight.php Normal file
View file

@ -0,0 +1,27 @@
<?php
// Query highlight entries
$highlight = new WP_Query(
array(
'no_found_rows' => false,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'ignore_sticky_posts' => 1,
'posts_per_page' => absint( get_theme_mod('highlight-posts-count','7') ),
'cat' => absint( get_theme_mod('highlight-category','') )
)
);
?>
<?php if ( is_home() && !is_paged() && ( get_theme_mod('highlight-posts-count','7') !='0') || is_single() || is_archive() || is_search() || is_404() || is_page() ): ?>
<div class="bg-line"></div>
<div class="featured-highlights">
<div class="clear"></div>
<div id="owl-featured" class="owl-carousel owl-theme">
<?php while ( $highlight->have_posts() ): $highlight->the_post(); ?>
<?php get_template_part('content-highlight'); ?>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
<?php wp_reset_postdata(); ?>

53
inc/page-title.php Normal file
View file

@ -0,0 +1,53 @@
<div class="page-title">
<div class="container pad group">
<?php if ( is_home() ) : ?>
<h2><i class="fas fa-star"></i><?php echo magaziner_blog_title(); ?></h2>
<?php elseif ( is_single() ): ?>
<?php elseif ( is_page() ): ?>
<h2><?php the_title(); ?></h2>
<?php elseif ( is_search() ): ?>
<h1>
<?php if ( have_posts() ): ?><i class="fas fa-search"></i><?php endif; ?>
<?php if ( !have_posts() ): ?><i class="fas fa-exclamation-circle"></i><?php endif; ?>
<?php $search_results=$wp_query->found_posts;
if ($search_results==1) {
echo $search_results.' '.esc_html__('Search result','magaziner');
} else {
echo $search_results.' '.esc_html__('Search results','magaziner');
}
?>
</h1>
<?php elseif ( is_404() ): ?>
<h1><i class="fas fa-exclamation-circle"></i><?php esc_html_e('Error 404.','magaziner'); ?> <span><?php esc_html_e('Page not found!','magaziner'); ?></span></h1>
<?php elseif ( is_author() ): ?>
<?php $author = get_userdata( get_query_var('author') );?>
<h1><i class="far fa-user"></i><?php esc_html_e('Author:','magaziner'); ?> <span><?php echo esc_attr( $author->display_name );?></span></h1>
<?php elseif ( is_category() ): ?>
<h1><i class="far fa-folder"></i><?php esc_html_e('Category:','magaziner'); ?> <span><?php echo single_cat_title('', false); ?></span></h1>
<?php elseif ( is_tag() ): ?>
<h1><i class="fas fa-tags"></i><?php esc_html_e('Tagged:','magaziner'); ?> <span><?php echo single_tag_title('', false); ?></span></h1>
<?php elseif ( is_day() ): ?>
<h1><i class="far fa-calendar"></i><?php esc_html_e('Daily Archive:','magaziner'); ?> <span><?php echo esc_html( get_the_time('F j, Y') ); ?></span></h1>
<?php elseif ( is_month() ): ?>
<h1><i class="far fa-calendar"></i><?php esc_html_e('Monthly Archive:','magaziner'); ?> <span><?php echo esc_html( get_the_time('F Y') ); ?></span></h1>
<?php elseif ( is_year() ): ?>
<h1><i class="far fa-calendar"></i><?php esc_html_e('Yearly Archive:','magaziner'); ?> <span><?php echo esc_html( get_the_time('Y') ); ?></span></h1>
<?php else: ?>
<h2><?php the_title(); ?></h2>
<?php endif; ?>
</div><!--/.container-->
</div><!--/.page-title-->

10
inc/pagination.php Normal file
View file

@ -0,0 +1,10 @@
<nav class="pagination group">
<?php if ( function_exists('wp_pagenavi') ): ?>
<?php wp_pagenavi(); ?>
<?php else: ?>
<ul class="group">
<li class="prev left"><?php previous_posts_link(); ?></li>
<li class="next right"><?php next_posts_link(); ?></li>
</ul>
<?php endif; ?>
</nav><!--/.pagination-->

108
inc/post-formats.php Normal file
View file

@ -0,0 +1,108 @@
<?php $format = get_post_format(); ?>
<?php $meta = get_post_custom($post->ID); ?>
<?php if ( has_post_format( 'audio' ) ): // Audio ?>
<div class="post-format">
<?php
if ( isset($meta['_audio_url'][0]) && !empty($meta['_audio_url'][0]) ) {
global $wp_embed;
$audio = $wp_embed->run_shortcode('[embed]'.esc_attr($meta['_audio_url'][0]).'[/embed]');
echo $audio;
}
?>
</div>
<?php endif; ?>
<?php if ( has_post_format( 'gallery' ) ): // Gallery ?>
<div class="post-format">
<?php $images = magaziner_post_images(); if ( !empty($images) ): ?>
<script type="text/javascript">
// Check if first slider image is loaded, and load flexslider on document ready
jQuery(document).ready(function(){
var firstImage = jQuery('#flexslider-<?php echo the_ID(); ?>').find('img').filter(':first'),
checkforloaded = setInterval(function() {
var image = firstImage.get(0);
if (image.complete || image.readyState == 'complete' || image.readyState == 4) {
clearInterval(checkforloaded);
jQuery('#flexslider-<?php echo the_ID(); ?>').flexslider({
animation: "fade",
slideshow: false,
directionNav: true,
controlNav: false,
pauseOnHover: true,
slideshowSpeed: 7000,
animationSpeed: 600,
smoothHeight: true,
touch: false
});
}
}, 20);
});
</script>
<div class="flex-container">
<div class="flexslider" id="flexslider-<?php the_ID(); ?>">
<ul class="slides">
<?php if ( comments_open() && ( get_theme_mod( 'comment-count','on' ) == 'on' ) ): ?>
<a class="post-comments" href="<?php comments_link(); ?>"><span><i class="fas fa-comments"></i><?php comments_number( '0', '1', '%' ); ?></span></a>
<?php endif; ?>
<?php foreach ( $images as $image ): ?>
<li>
<?php $imageid = wp_get_attachment_image_src($image->ID,'large'); ?>
<img src="<?php echo esc_attr( $imageid[0] ); ?>" alt="<?php echo esc_attr( $image->post_title ); ?>">
<?php if ( $image->post_excerpt ): ?>
<div class="image-caption"><?php echo $image->post_excerpt; ?></div>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ( has_post_format( 'image' ) ): // Image ?>
<div class="post-format">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail('magaziner-large');
$caption = get_post(get_post_thumbnail_id())->post_excerpt;
if ( isset($caption) && $caption ) echo '<div class="image-caption">'.$caption.'</div>';
} ?>
<?php if ( comments_open() && ( get_theme_mod( 'comment-count','on' ) == 'on' ) ): ?>
<a class="post-comments" href="<?php comments_link(); ?>"><span><i class="fas fa-comments"></i><?php comments_number( '0', '1', '%' ); ?></span></a>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ( has_post_format( 'video' ) ): // Video ?>
<div class="post-format">
<?php
if ( isset($meta['_video_url'][0]) && !empty($meta['_video_url'][0]) ) {
global $wp_embed;
$video = $wp_embed->run_shortcode('[embed]'.esc_attr($meta['_video_url'][0]).'[/embed]');
echo $video;
}
?>
</div>
<?php endif; ?>
<?php if ( has_post_format( 'quote' ) ): // Quote ?>
<?php endif; ?>
<?php if ( has_post_format( 'chat' ) ): // Chat ?>
<?php endif; ?>
<?php if ( has_post_format( 'link' ) ): // Link ?>
<?php endif; ?>

6
inc/post-nav.php Normal file
View file

@ -0,0 +1,6 @@
<?php if ( is_single() ): ?>
<ul class="post-nav group">
<li class="next"><?php next_post_link('%link', '<i class="fas fa-chevron-right"></i><strong>'.esc_html__('Next story', 'magaziner').'</strong> <span>%title</span>'); ?></li>
<li class="previous"><?php previous_post_link('%link', '<i class="fas fa-chevron-left"></i><strong>'.esc_html__('Previous story', 'magaziner').'</strong> <span>%title</span>'); ?></li>
</ul>
<?php endif; ?>

48
inc/related-posts.php Normal file
View file

@ -0,0 +1,48 @@
<?php $related = magaziner_related_posts(); ?>
<?php if ( $related->have_posts() ): ?>
<h4 class="heading">
<i class="fas fa-hand-point-right"></i><?php esc_html_e('You may also like...','magaziner'); ?>
</h4>
<ul class="related-posts group">
<?php while ( $related->have_posts() ) : $related->the_post(); ?>
<li class="related post-hover">
<article <?php post_class(); ?>>
<div class="post-thumbnail">
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ): ?>
<?php the_post_thumbnail('magaziner-medium'); ?>
<?php if ( has_post_format('video') && !is_sticky() ) echo'<span class="thumb-icon small"><i class="fas fa-play"></i></span>'; ?>
<?php if ( has_post_format('audio') && !is_sticky() ) echo'<span class="thumb-icon small"><i class="fas fa-volume-up"></i></span>'; ?>
<?php if ( is_sticky() ) echo'<span class="thumb-icon small"><i class="fas fa-star"></i></span>'; ?>
<?php else: ?>
<?php endif; ?>
</a>
<?php if ( comments_open() && ( get_theme_mod( 'comment-count','on' ) == 'on' ) ): ?>
<a class="post-comments" href="<?php comments_link(); ?>"><span><i class="fas fa-comments"></i><?php comments_number( '0', '1', '%' ); ?></span></a>
<?php endif; ?>
</div><!--/.post-thumbnail-->
<div class="related-inner">
<h4 class="post-title">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
</h4><!--/.post-title-->
</div><!--/.related-inner-->
</article>
<a class="more-link-custom" href="<?php the_permalink(); ?>" /><i class="fas fa-arrow-right"></i></a>
</li><!--/.related-->
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</ul><!--/.post-related-->
<?php endif; ?>
<?php wp_reset_postdata(); ?>