forked from ItalyStrap/italystrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
128 lines (123 loc) · 4.56 KB
/
index.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
/**
* The main template file.
*
* This is an example of a custom index page
* In your home page will view a bootstrap slideshow with Custom Post Type "Prodotti" on top
* If CPT Prodotti is empty BT slide won't be showing
* In new CPT editor check meta box top-left if you want to show the new image product
* The CPT must have a feautured image
*
*
*/
get_header(); ?>
<?php $prodotti = new WP_Query(array('meta_key' => 'slide',
'meta_value' => 'on',
'post_type' => 'prodotti',
));
if ( $prodotti->have_posts() ):
?>
<!-- Carousel -->
<section id="carousel">
<div class="container hidden-xxs">
<div id="myCarousel" class="carousel slide">
<ol class="carousel-indicators">
<?php
$active = 0;
foreach ( $prodotti->posts as $post ) {
$class = ( $active == 0 ) ? 'active' : '';
echo '<li data-target="#myCarousel" data-slide-to="' . $active . '" class="' . $class . '"></li>';
$active++;
}
?>
</ol>
<div class="carousel-inner">
<?php $active = 1; while ( $prodotti->have_posts() ) : $prodotti->the_post(); ?>
<div class="item <?php if ($active == 1 ) : ?>active<?php endif; $active ++; ?>" itemscope itemtype="http://schema.org/Article">
<?php the_post_thumbnail( 'slide' ); ?><meta itemprop="image" content="<?php echo italystrap_thumb_url();?>"/>
<div class="container">
<div class="carousel-caption">
<h1><?php echo get_post_meta($post->ID, 'title_headline', true); ?></h1>
<p class="lead" itemprop="text"><?php echo get_post_meta($post->ID, 'headline', true); ?></p>
<p><a class="btn btn-large btn-primary" href="<?php the_permalink(); ?>" itemprop="url"><?php echo get_post_meta($post->ID, 'call_to_action', true); ?></a></p>
</div>
</div>
</div>
<?php endwhile;
wp_reset_query();
wp_reset_postdata();
?>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div><!-- / #myCarousel -->
<hr>
</div><!-- / .container -->
</section><!-- / .carousel -->
<?php endif; ?>
<?php
/**
* This is the standard loop for show your article
* In this case it is configured to show only 4 article because each article are configured to show using col-md-3 class
*/
?>
<!-- Main Content -->
<section id="main">
<div class="container">
<h3>Ultimi articoli</h3>
<section class="row">
<?php
/**
* Example code: If there is a stycky post the loop show only 3 articles
*/
$sticky = get_option( 'sticky_posts' );
if ( isset( $sticky[0] ) ) {
$postperpage = 3;
} else {
$postperpage = 4;
}
query_posts( "posts_per_page=$postperpage" );
if(have_posts()) :
while(have_posts()) : the_post();
?>
<div class="col-md-3" itemscope itemtype="http://schema.org/Article">
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink(); ?>" class="thumbnail" title="<?php the_title_attribute(); ?>">
<?php
the_post_thumbnail(
'article-thumb-index',
array(
'class' => 'center-block img-responsive',
'alt' => get_post_meta( get_post_thumbnail_id( $post->ID ), '_wp_attachment_image_alt', true ),
) );
?>
</a>
<meta itemprop="image" content="<?php echo italystrap_thumb_url();?>"/>
<?php } ?>
<h4 class="item-title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute() ?>" rel="bookmark"><?php the_title(); ?></a></h4>
<footer>
<ul class="list-inline">
<li><small><time datetime="<?php the_time('Y-m-d') ?>" itemprop="datePublished"><?php the_time( get_option('date_format') ) ?></time></small></li>
<li><small><?php _e('Author:', 'ItalyStrap'); ?> <span itemprop="author" itemscope itemtype="http://schema.org/Person"><?php the_author_posts_link(); ?></span></small></li>
</ul>
</footer>
<div itemprop="text"><?php the_excerpt(); ?></div>
<?php
if ( has_post_format('standard') ) {
/**
* For more improvement see http://www.wproots.com/using-wordpress-post-formats-to-their-fullest/
* and see http://www.wproots.com/using-wordpress-post-formats-to-their-fullest/#comment-868
*
*/
}
?>
</div><!-- / .col-md-3 -->
<?php
endwhile;
endif;
wp_reset_query();
?>
</section><!-- / .row -->
</div><!-- / .container -->
</section><!-- / #main -->
<?php get_footer(); ?>