forked from emmgfx/material-for-coders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontext.php
50 lines (45 loc) · 1.41 KB
/
context.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
<?PHP
$max_categories = 2;
$max_tags = 3;
?>
<ul class="context list-unstyled list-inline">
<li class="date"><i class="material-icons"></i> <?PHP the_time(get_option( 'date_format' )); ?></li>
<li class="date"><i class="material-icons"></i> <?PHP the_modified_time('j F Y'); ?></li>
<?PHP $categories = get_the_category(); ?>
<?PHP if($categories){ ?>
<li class="categories"><i class="material-icons"></i>
<?PHP
foreach($categories as $index => $category) {
if($index < $max_categories){
echo '<a href="'.get_category_link($category->cat_ID).'">'.$category->name.'</a>';
if($index+1 < count($categories)){
echo ', ';
}
}else if($index == $max_categories){
echo '...';
}
}
?>
</li>
<?PHP } ?>
<?PHP $posttags = get_the_tags(); ?>
<?PHP if($posttags){ ?>
<li class="tags"><i class="material-icons"></i>
<?PHP
foreach($posttags as $index => $tag) {
if($index < $max_tags){
echo '<a href="'.get_tag_link($tag->term_id).'">#'.$tag->name.'</a>';
if($index+1 < count($posttags)){
echo ', ';
}
}else if($index == $max_tags){
echo '...';
}
}
?>
</li>
<?PHP } ?>
<?PHP if(get_comments_number() > 0){ ?>
<li><i class="material-icons"></i> <a href="<?php the_permalink() ?>/#comments"><?PHP comments_number( 'Sin comentarios', '1 comentario', '% comentarios' ) ?></a></li>
<?PHP } ?>
</ul>