-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive.php
149 lines (104 loc) · 4.97 KB
/
archive.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php get_header(); ?>
<div id="main" >
<div class="container">
<?php
$colonna = "sinistra";
$conta = 1;
if (have_posts()) :
while (have_posts()) : the_post();
//echo $conta;
$author = get_the_author_meta('nickname');
$author_ID = get_the_author_meta('ID');
$author_url = get_the_author_meta('user_url');
$avatar = get_avatar( $author_ID, 30 );
$content = get_the_excerpt();
$permalink = get_permalink();
$id_post[] = get_the_ID();
$titolo = get_the_title();
$data = get_the_date( "c");
$copertina = get_the_post_thumbnail( get_the_ID(), "large");
$src = wp_get_attachment_image_src( get_post_thumbnail_id(), array(10,10) );
$src = $src[0];
$format = "j F, Y";
$pfx_date = get_the_date( $format, get_the_ID() );
$format = "c";
$date_iso = get_the_date( $format, get_the_ID() );
$post_categories = wp_get_post_categories( get_the_ID() );
$cats = array();
foreach($post_categories as $c){
$cat = get_category( $c );
$cats[] = array( 'name' => $cat->name, 'slug' => $cat->slug );
}
?>
<?php if ($conta === 1) : ?>
<div class="col-md-6"><div class="row">
<?php endif; ?>
<?php $numero_post = $wp_query->found_posts; $diviso = $numero_post/2; if (($conta > $diviso) && (!isset($colonna_dx)) ) : ?>
</div></div>
<div class="col-md-6"><div class="row">
<?php $colonna_dx = true; endif; ?>
<div class="col-md-12">
<?php $copertina = get_the_post_thumbnail(get_the_ID(), "thumbnail"); ?>
<div class=" block">
<article itemscope itemtype="http://schema.org/Article" class="col-md-12 block">
<div class="row">
<div itemprop="author" itemscope itemtype="http://schema.org/Person" class="col-md-12">
<?php echo $avatar ?><small itemprop="name" class="author"><a href="<?php echo $author_url ?>"><?php echo $author ?></a></small><small><i class="fa fa-caret-right"></i> </small><strong> <?php
if (is_array($cats) || is_object($cats)) {
foreach($cats as $keyval => $catval) {
// Get the ID of a given category
$category_id = get_cat_ID( $catval["name"] );
// Get the URL of this category
$category_link = get_category_link( $category_id );
if ($keyval === 0) {
echo '
<a href="'.esc_url( $category_link ).'">
<span class="cat-'.$keyval.'">'.$catval["name"].'</span>
</a>';
}
else {
get_the_author_link();
echo ',
<a href="'.esc_url( $category_link ).'">
<span class="cat-'.$keyval.'">'.$catval["name"].'</span>
</a>';
}
$keyval ++;
}
}
else return false;
?>
</strong></div>
<div class="excerptCover col-md-12 col-sm-4">
<img itemprop="image" style="width: 100%; height: auto; background: #FFF" alt="cover <?php echo $titolo ?>" src="<?php echo $src ?>">
</div>
<div class="col-md-8 col-sm-8">
<div class="row">
<div class="col-lg-12 excerpt">
<time class="hidden" itemprop="datePublished" datetime="<?php echo $data ?>"><?php the_date() ?></time>
<h3 class="titlePost">
<a itemprop="url" href="<?php echo $permalink ?>">
<span itemprop="headline"><?php echo $titolo ?></span>
</a>
</h3>
<p itemprop="description"><?php echo $content ?></p>
</div>
</div>
</div>
<div class="clearfix"></div>
</article>
</div>
</div>
<?php
$conta++;
endwhile; // fine del loop
//print_r($id_post);
//print_r(wp_count_posts()->publish);
endif;
?>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>