-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentry.php
More file actions
44 lines (44 loc) · 2.51 KB
/
entry.php
File metadata and controls
44 lines (44 loc) · 2.51 KB
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
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php edit_post_link(); ?>
<header>
<?php if ( is_singular() ) { echo '<h1 class="entry-title">'; } else { echo '<h3 class="entry-title">'; } ?>
<?php
/* add icon to title
* folder: img/infographics/
* report: pie-chart3.png / chart.png / certified-document.png (tag_ID=18)
* data: data-blue.png / data-green.png (tag_ID=3)
*/
// get post categories and filters for data or report
$cat = array_reduce(get_the_category(), function ($carry, $cat){
// if category found
if($carry){return $carry;}
// search for category
if($cat->slug === 'data'){return 'data';}
if($cat->slug === 'report'){return 'report';}
if($cat->slug === 'news'){return 'news';}
if($cat->slug === 'essential'){return 'essential';}
// default false
return false;
});
switch($cat) {
case 'report':
echo '<img class="title-icon" style="height:.8em;vertical-align: baseline;" src="'.get_template_directory_uri().'/assets/img/infographics/certified-document.png">';
break;
case 'data':
echo '<img class="title-icon" style="height:.8em;vertical-align: baseline;" src="'.get_template_directory_uri().'/assets/img/infographics/pie-chart3.png">';
break;
default:
if(get_post_type() == 'idea'){
echo '<img class="title-icon" style="height:.8em;vertical-align: baseline;" src="'.get_template_directory_uri().'/assets/img/infographics/light-bulb-green.png">';
} else {
echo '<img class="title-icon" style="height:.8em;vertical-align: baseline;" src="'.get_template_directory_uri().'/assets/img/infographics/document.png">';
}
}
?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a>
<?php if ( is_singular() ) { echo '</h1>'; } else { echo '</h3>'; } ?>
<?php if ( !is_search() ) get_template_part( 'entry', 'meta' ); ?>
</header>
<?php get_template_part( 'entry', ( is_archive() || is_search() ? 'summary' : 'content' ) ); ?>
<?php //if ( !is_search() ) get_template_part( 'entry-footer' ); ?>
</article>