-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent-single.php
77 lines (66 loc) · 2.39 KB
/
content-single.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
<?php
/**
* @package Pottery
*/
$format = get_post_format();
$formats = get_theme_support( 'post-formats' );
if ( 'image' == $format || 'video' == $format ) //If Image or Video, put the_content() in a variable for regex
$content = apply_filters( 'the_content', get_the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'pottery' ) ) );
else
$content = '';
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<?php if ( has_post_thumbnail() && 'image' == $format ) : ?>
<figure class="entry-thumbnail">
<?php the_post_thumbnail( 'pottery-featured' ); ?>
</figure>
<?php elseif ( 'image' == $format ) : ?>
<?php
$image = pottery_get_first_image( $content );
$content = preg_replace( '!<img.*src=[\'"]([^"]+)[\'"].*/?>!iUs', '', $content ); //Strip out all images from content
if ( ! empty( $image ) ) : ?>
<figure class="entry-thumbnail">
<?php printf( '<img src="%1$s" />', esc_url( $image['src'] ) ); ?>
</figure>
<?php endif; ?>
<?php endif; ?>
<?php if ( 'video' == $format ) :
$media = get_media_embedded_in_content( $content, array( 'video', 'object', 'embed', 'iframe' ) );
?>
<?php if ( ! empty( $media ) ) : ?>
<?php
foreach( $media as $embed_html ) {
$content = str_replace( $embed_html, '', $content );
} ?>
<div class="entry-video jetpack-video-wrapper">
<?php
foreach ( $media as $embed_html ) {
printf( '%1$s', $embed_html );
} ?>
</div>
<?php endif; ?>
<?php endif; ?>
<div class="entry-content">
<?php if ( 'video' == $format || 'image' == $format ) : ?>
<?php echo $content; ?>
<?php else : ?>
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'pottery' ) ); ?>
<?php endif; ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'pottery' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<footer class="entry-footer">
<div class="entry-meta">
<?php pottery_posted_on(); ?>
</div><!-- .entry-meta -->
<?php the_tags( '<span class="tags-links">', '', '</span>' ); ?>
<?php edit_post_link( __( 'Edit', 'pottery' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->