le"><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>

+ 2 - 2
app/wp-content/themes/whitesports/template-parts/content-search.php

@@ -9,7 +9,7 @@
9 9
 
10 10
 ?>
11 11
 
12
-<article id="post-<?php the_ID(); ?>" class="col-md-3" style='margin-bottom:1.5em'>
12
+<article id="post-<?php the_ID(); ?>" class="col-md-4 article-item" style='margin-bottom:1.5em'>
13 13
 	<?php whitesports_post_thumbnail(); ?>
14 14
 		<?php if ( 'post' === get_post_type() ) : ?>
15 15
 		<div class="entry-meta">
@@ -19,5 +19,5 @@
19 19
 		</div><!-- .entry-meta -->
20 20
 		<?php endif; ?>
21 21
 
22
-	<?php the_title( sprintf( '<strong><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></strong>' ); ?>
22
+	<?php the_title( sprintf( '<strong><a href="%s" rel="bookmark" class="text">', esc_url( get_permalink() ) ), '</a></strong>' ); ?>
23 23
 </article><!-- #post-<?php the_ID(); ?> -->

+ 1 - 1
app/wp-content/themes/whitesports/template-parts/content.php

@@ -62,7 +62,7 @@
62 62
 <div class='row'>
63 63
 <?php
64 64
 
65
-$related = get_posts( array( 'category__in' => wp_get_post_categories($post->ID), 'numberposts' => 5, 'post__not_in' => array($post->ID) ) );
65
+$related = get_posts( array( 'category__in' => wp_get_post_categories($post->ID), 'numberposts' => 4, 'post__not_in' => array($post->ID) ) );
66 66
 if( $related ) foreach( $related as $post ) {
67 67
 setup_postdata($post); ?>
68 68
         <div class='col-md-3'>

BIN
app/wp-content/uploads/2021/11/00-100x100.jpg


BIN
app/wp-content/uploads/2021/11/00-150x150.jpg


BIN
app/wp-content/uploads/2021/11/00-300x169.jpg


BIN
app/wp-content/uploads/2021/11/00-300x300.jpg


BIN
app/wp-content/uploads/2021/11/00-600x338.jpg


BIN
app/wp-content/uploads/2021/11/00-60x60.jpg


BIN
app/wp-content/uploads/2021/11/00-768x432.jpg


BIN
app/wp-content/uploads/2021/11/00.jpg


BIN
app/wp-content/uploads/2021/11/0000-100x100.jpg


BIN
app/wp-content/uploads/2021/11/0000-150x150.jpg


BIN
app/wp-content/uploads/2021/11/0000-300x169.jpg


BIN
app/wp-content/uploads/2021/11/0000-300x300.jpg


BIN
app/wp-content/uploads/2021/11/0000-600x338.jpg


BIN
app/wp-content/uploads/2021/11/0000-60x60.jpg


BIN
app/wp-content/uploads/2021/11/0000-768x432.jpg


BIN
app/wp-content/uploads/2021/11/0000.jpg


BIN
app/wp-content/uploads/2021/11/1-1-100x100.jpg


BIN
app/wp-content/uploads/2021/11/1-1-150x150.jpg


BIN
app/wp-content/uploads/2021/11/1-1-300x169.jpg


BIN
app/wp-content/uploads/2021/11/1-1-300x300.jpg


BIN
app/wp-content/uploads/2021/11/1-1-600x338.jpg


BIN
app/wp-content/uploads/2021/11/1-1-60x60.jpg


BIN
app/wp-content/uploads/2021/11/1-1-768x432.jpg


BIN
app/wp-content/uploads/2021/11/1-1.jpg


BIN
app/wp-content/uploads/2021/11/111-100x100.jpg


BIN
app/wp-content/uploads/2021/11/111-150x150.jpg


BIN
app/wp-content/uploads/2021/11/111-300x169.jpg


BIN
app/wp-content/uploads/2021/11/111-300x300.jpg


BIN
app/wp-content/uploads/2021/11/111-600x338.jpg


BIN
app/wp-content/uploads/2021/11/111-60x60.jpg


BIN
app/wp-content/uploads/2021/11/111-768x432.jpg


BIN
app/wp-content/uploads/2021/11/111.jpg


BIN
app/wp-content/uploads/2021/11/12-100x100.jpg


BIN
app/wp-content/uploads/2021/11/12-150x150.jpg


BIN
app/wp-content/uploads/2021/11/12-300x169.jpg


BIN
app/wp-content/uploads/2021/11/12-300x300.jpg


BIN
app/wp-content/uploads/2021/11/12-600x338.jpg


BIN
app/wp-content/uploads/2021/11/12-60x60.jpg


BIN
app/wp-content/uploads/2021/11/12-768x432.jpg


BIN
app/wp-content/uploads/2021/11/12.jpg


BIN
app/wp-content/uploads/2021/11/1212-100x100.jpg


BIN
app/wp-content/uploads/2021/11/1212-150x150.jpg


BIN
app/wp-content/uploads/2021/11/1212-300x169.jpg


BIN
app/wp-content/uploads/2021/11/1212-300x300.jpg


BIN
app/wp-content/uploads/2021/11/1212-600x338.jpg


BIN
app/wp-content/uploads/2021/11/1212-60x60.jpg


BIN
app/wp-content/uploads/2021/11/1212-768x432.jpg


BIN
app/wp-content/uploads/2021/11/1212.jpg


BIN
app/wp-content/uploads/2021/11/14-100x100.jpg


BIN
app/wp-content/uploads/2021/11/14-150x150.jpg


BIN
app/wp-content/uploads/2021/11/14-300x169.jpg


BIN
app/wp-content/uploads/2021/11/14-300x300.jpg


BIN
app/wp-content/uploads/2021/11/14-600x338.jpg


BIN
app/wp-content/uploads/2021/11/14-60x60.jpg


BIN
app/wp-content/uploads/2021/11/14-768x432.jpg


BIN
app/wp-content/uploads/2021/11/14.jpg


BIN
app/wp-content/uploads/2021/11/2-1-100x100.jpg


BIN
app/wp-content/uploads/2021/11/2-1-150x150.jpg


BIN
app/wp-content/uploads/2021/11/2-1-300x169.jpg


BIN
app/wp-content/uploads/2021/11/2-1-300x300.jpg


BIN
app/wp-content/uploads/2021/11/2-1-600x338.jpg


BIN
app/wp-content/uploads/2021/11/2-1-60x60.jpg


BIN
app/wp-content/uploads/2021/11/2-1-768x432.jpg


BIN
app/wp-content/uploads/2021/11/2-1.jpg


BIN
app/wp-content/uploads/2021/11/3-1-100x100.jpg


BIN
app/wp-content/uploads/2021/11/3-1-150x150.jpg


BIN
app/wp-content/uploads/2021/11/3-1-300x169.jpg


BIN
app/wp-content/uploads/2021/11/3-1-300x300.jpg


BIN
app/wp-content/uploads/2021/11/3-1-600x338.jpg


BIN
app/wp-content/uploads/2021/11/3-1-60x60.jpg


BIN
app/wp-content/uploads/2021/11/3-1-768x432.jpg


BIN
app/wp-content/uploads/2021/11/3-1.jpg


BIN
app/wp-content/uploads/2021/11/5-100x100.jpg


BIN
app/wp-content/uploads/2021/11/5-150x150.jpg


BIN
app/wp-content/uploads/2021/11/5-300x169.jpg


BIN
app/wp-content/uploads/2021/11/5-300x300.jpg


BIN
app/wp-content/uploads/2021/11/5-600x338.jpg


BIN
app/wp-content/uploads/2021/11/5-60x60.jpg


BIN
app/wp-content/uploads/2021/11/5-768x432.jpg


BIN
app/wp-content/uploads/2021/11/5.jpg


BIN
app/wp-content/uploads/2021/11/AD-1-100x100.jpg


BIN
app/wp-content/uploads/2021/11/AD-1-150x150.jpg


BIN
app/wp-content/uploads/2021/11/AD-1-300x169.jpg


BIN
app/wp-content/uploads/2021/11/AD-1-300x300.jpg


BIN
app/wp-content/uploads/2021/11/AD-1-600x338.jpg


BIN
app/wp-content/uploads/2021/11/AD-1-60x60.jpg


BIN
app/wp-content/uploads/2021/11/AD-1-768x432.jpg


BIN
app/wp-content/uploads/2021/11/AD-1.jpg


BIN
app/wp-content/uploads/2021/11/ADW-100x100.jpg


BIN
app/wp-content/uploads/2021/11/ADW-150x150.jpg


BIN
app/wp-content/uploads/2021/11/ADW-300x169.jpg


+ 0 - 0
app/wp-content/uploads/2021/11/ADW-300x300.jpg


Some files were not shown because too many files changed in this diff

tum/whitesports - Gogs: Simplico Git Service

Geen omschrijving

duplicate-post-common.php 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /**
  3. * Common functions.
  4. *
  5. * @package Duplicate Post
  6. * @since 2.0
  7. */
  8. use Yoast\WP\Duplicate_Post\Permissions_Helper;
  9. use Yoast\WP\Duplicate_Post\UI\Link_Builder;
  10. use Yoast\WP\Duplicate_Post\Utils;
  11. /**
  12. * Tests if post type is enabled to be copied.
  13. *
  14. * @param string $post_type The post type to check.
  15. * @return bool
  16. */
  17. function duplicate_post_is_post_type_enabled( $post_type ) {
  18. $duplicate_post_types_enabled = get_option( 'duplicate_post_types_enabled', array( 'post', 'page' ) );
  19. if ( ! is_array( $duplicate_post_types_enabled ) ) {
  20. $duplicate_post_types_enabled = array( $duplicate_post_types_enabled );
  21. }
  22. /** This filter is documented in src/class-permissions-helper.php */
  23. $duplicate_post_types_enabled = apply_filters( 'duplicate_post_enabled_post_types', $duplicate_post_types_enabled );
  24. return in_array( $post_type, $duplicate_post_types_enabled, true );
  25. }
  26. /**
  27. * Template tag to retrieve/display duplicate post link for post.
  28. *
  29. * @param int $id Optional. Post ID.
  30. * @param string $context Optional, default to display. How to write the '&', defaults to '&amp;'.
  31. * @param bool $draft Optional, default to true.
  32. * @return string
  33. */
  34. function duplicate_post_get_clone_post_link( $id = 0, $context = 'display', $draft = true ) {
  35. $post = get_post( $id );
  36. if ( ! $post ) {
  37. return '';
  38. }
  39. $link_builder = new Link_Builder();
  40. $permissions_helper = new Permissions_Helper();
  41. if ( ! $permissions_helper->should_links_be_displayed( $post ) ) {
  42. return '';
  43. }
  44. if ( $draft ) {
  45. return $link_builder->build_new_draft_link( $post, $context );
  46. } else {
  47. return $link_builder->build_clone_link( $post, $context );
  48. }
  49. }
  50. /**
  51. * Displays duplicate post link for post.
  52. *
  53. * @param string|null $link Optional. Anchor text.
  54. * @param string $before Optional. Display before edit link.
  55. * @param string $after Optional. Display after edit link.
  56. * @param int $id Optional. Post ID.
  57. */
  58. function duplicate_post_clone_post_link( $link = null, $before = '', $after = '', $id = 0 ) {
  59. $post = get_post( $id );
  60. if ( ! $post ) {
  61. return;
  62. }
  63. $url = duplicate_post_get_clone_post_link( $post->ID );
  64. if ( ! $url ) {
  65. return;
  66. }
  67. if ( null === $link ) {
  68. $link = esc_html__( 'Copy to a new draft', 'duplicate-post' );
  69. }
  70. $link = '<a class="post-clone-link" href="' . esc_url( $url ) . '">' . $link . '</a>';
  71. /**
  72. * Filter on the clone link HTML.
  73. *
  74. * @param string $link The full HTML tag of the link.
  75. * @param int $ID The ID of the post.
  76. *
  77. * @return string
  78. */
  79. echo $before . apply_filters( 'duplicate_post_clone_post_link', $link, $post->ID ) . $after; // phpcs:ignore WordPress.Security.EscapeOutput
  80. }
  81. /**
  82. * Gets the original post.
  83. *
  84. * @param int|null $post Optional. Post ID or Post object.
  85. * @param string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N.
  86. * @return mixed Post data.
  87. */
  88. function duplicate_post_get_original( $post = null, $output = OBJECT ) {
  89. return Utils::get_original( $post, $output );
  90. }