|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+<?php
|
|
|
2
|
+/**
|
|
|
3
|
+ * Template part for displaying posts
|
|
|
4
|
+ *
|
|
|
5
|
+ * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
|
|
6
|
+ *
|
|
|
7
|
+ * @package whitesports
|
|
|
8
|
+ */
|
|
|
9
|
+
|
|
|
10
|
+?>
|
|
|
11
|
+
|
|
|
12
|
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
|
|
13
|
+
|
|
|
14
|
+ <header class="entry-header">
|
|
|
15
|
+ <?php
|
|
|
16
|
+ if ( is_singular() ) :
|
|
|
17
|
+ the_title( '<h1 class="entry-title">', '</h1>' );
|
|
|
18
|
+ else :
|
|
|
19
|
+ the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
|
|
|
20
|
+ endif;
|
|
|
21
|
+
|
|
|
22
|
+ if ( 'post' === get_post_type() ) :
|
|
|
23
|
+ ?>
|
|
|
24
|
+ <div class="entry-meta">
|
|
|
25
|
+ <?php
|
|
|
26
|
+ whitesports_posted_on();
|
|
|
27
|
+ whitesports_posted_by();
|
|
|
28
|
+ ?>
|
|
|
29
|
+ </div><!-- .entry-meta -->
|
|
|
30
|
+ <?php endif; ?>
|
|
|
31
|
+ </header><!-- .entry-header -->
|
|
|
32
|
+ <div class="entry-content">
|
|
|
33
|
+ <?php
|
|
|
34
|
+ the_content(
|
|
|
35
|
+ sprintf(
|
|
|
36
|
+ wp_kses(
|
|
|
37
|
+ /* translators: %s: Name of current post. Only visible to screen readers */
|
|
|
38
|
+ __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'whitesports' ),
|
|
|
39
|
+ array(
|
|
|
40
|
+ 'span' => array(
|
|
|
41
|
+ 'class' => array(),
|
|
|
42
|
+ ),
|
|
|
43
|
+ )
|
|
|
44
|
+ ),
|
|
|
45
|
+ wp_kses_post( get_the_title() )
|
|
|
46
|
+ )
|
|
|
47
|
+ );
|
|
|
48
|
+
|
|
|
49
|
+ wp_link_pages(
|
|
|
50
|
+ array(
|
|
|
51
|
+ 'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'whitesports' ),
|
|
|
52
|
+ 'after' => '</div>',
|
|
|
53
|
+ )
|
|
|
54
|
+ );
|
|
|
55
|
+ ?>
|
|
|
56
|
+ </div><!-- .entry-content -->
|
|
|
57
|
+
|
|
|
58
|
+</article><!-- #post-<?php the_ID(); ?> -->
|
|
|
59
|
+<hr>
|
|
|
60
|
+<p class='text-center h2'>
|
|
|
61
|
+บทความที่เกี่ยวข้อง</p><br>
|
|
|
62
|
+<div class='row'>
|
|
|
63
|
+<?php
|
|
|
64
|
+
|
|
|
65
|
+$related = get_posts( array( 'category__in' => wp_get_post_categories($post->ID), 'numberposts' => 4, 'post__not_in' => array($post->ID) ) );
|
|
|
66
|
+if( $related ) foreach( $related as $post ) {
|
|
|
67
|
+setup_postdata($post); ?>
|
|
|
68
|
+ <div class='col-md-3'>
|
|
|
69
|
+<?php
|
|
|
70
|
+the_post_thumbnail( 'medium' ); ?>
|
|
|
71
|
+ <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
|
|
|
72
|
+ </div>
|
|
|
73
|
+<?php }
|
|
|
74
|
+wp_reset_postdata(); ?>
|
|
|
75
|
+</div>
|
|
|
76
|
+<hr>
|