-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent-image.php
executable file
·89 lines (57 loc) · 2.08 KB
/
content-image.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
<?php
/**
* The template for displaying the image post format on archives.
*
* @package Patch Lite
* @since Patch Lite 1.1.6
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<div class="grid__item">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-meta"><?php patch_lite_card_meta(); ?></div><!-- .entry-meta -->
<?php if ( has_post_thumbnail() ) : ?>
<a class="entry-image entry-image--landscape" href="<?php the_permalink(); ?>">
<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
<span class="sticky-post"></span>
<?php endif; ?>
<div class="entry-image-wrapper">
<?php the_post_thumbnail( 'patch-masonry-image' ); ?>
</div>
</a>
<?php else : // we need to search in the content for an image - maybe we find one
$first_image = patch_lite_get_post_format_first_image();
if ( ! empty( $first_image ) ) :
//we need to determine if this is a linked image
$linked = ( false === strpos( $first_image, '</a>' ) ) ? false : true ;
if ( $linked ) : ?>
<div class="entry-image entry-image--landscape">
<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
<span class="sticky-post"></span>
<?php endif; ?>
<div class="entry-image-wrapper">
<?php echo $first_image; ?>
</div>
</div>
<?php else : ?>
<a class="entry-image entry-image--landscape" href="<?php the_permalink(); ?>">
<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
<span class="sticky-post"></span>
<?php endif; ?>
<div class="entry-image-wrapper">
<?php echo $first_image; ?>
</div>
</a>
<?php endif;
endif;
endif; ?>
<header <?php patch_lite_post_title_class(); ?>>
<?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
</header><!-- .entry-header -->
<footer class="entry-footer">
<?php patch_lite_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->
</div><!-- .grid__item -->