forked from Amunds/kvarteret_theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frontpage.php
86 lines (80 loc) · 2.24 KB
/
frontpage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* Template Name: Default Frontpage
*
* A custom page template for the frontpage.
*
*
* @package WordPress
* @subpackage kvarteret
* @since Kvarteret 1.0
*/
get_header(); ?>
<?php
// Add custom excerpt length
function custom_excerpt_length($length) {
return 20;
}
add_filter('excerpt_length', 'custom_excerpt_length');
?>
<div class="left six_cols content">
<?php
global $post;
$featured = get_posts('numberposts=3&category_name=featured');
$current_news = get_posts('numberposts=10&category_name=aktuelt,featured');
?>
<div id="featured_news">
<ul class="all_cols featured news">
<?php
foreach($featured as $post) :
setup_postdata($post);
?>
<li>
<div class="wrapper post_thumbnail">
<?php if ( has_post_thumbnail() ) {?>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('featured-thumbnail'); ?>
</a>
<?php } else { ?>
<a href="<?php the_permalink(); ?>">
<img src="<?php bloginfo('template_directory'); ?>/images/featured_image_missing_<?php echo rand(1,2) ?>.png">
</a>
<?php } ?>
<h2><a href="<?php the_permalink(); ?>" class="featured_title"><?php the_title(); ?></a></h2>
</div>
<span class="excerpt">
<?php the_excerpt(); ?>
</span>
</li>
<?php endforeach; ?>
</ul>
</div>
<ul class="current_news">
<?php
$i = 0;
$odd_even = "";
foreach($current_news as $post) :
setup_postdata($post);
$i++;
if($i%2 == 0) {
$odd_even = "right";
} else {
$odd_even = "left";
}
?>
<li class="three_cols">
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'current-news-thumbnail' ); ?></a>
<?php } else { ?>
<a href="<?php the_permalink(); ?>">
<img src="<?php bloginfo('template_directory'); ?>/images/current_news_image_missing_<?php echo rand(1,2) ?>.png">
</a>
<?php } ?>
<h2><a href="<?php the_permalink(); ?>" class="current_news_title"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
</li>
<?php endforeach; ?>
</ul>
</div><!-- #content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>