Last active
April 11, 2023 16:35
-
-
Save philhoyt/f54c1bb45fe843fd38bda0ed131b1cc3 to your computer and use it in GitHub Desktop.
Revisions
-
philhoyt revised this gist
Apr 11, 2023 . 1 changed file with 10 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,20 @@ <?php $related_query = new WP_Query( array( 'post_type' => get_post_type(), 'category__in' => wp_get_post_categories( get_the_ID() ), 'post__not_in' => array( get_the_ID() ), 'posts_per_page' => 3, 'orderby' => 'date', ) ); ?> <?php if ( $related_query->have_posts() ) : ?> <ul> <?php while ( $related_query->have_posts() ) : $related_query->the_post(); ?> <li> <a href='<?php the_permalink(); ?>'><?php the_title(); ?></a> </li> <?php endwhile; ?> </ul> <?php wp_reset_postdata(); ?> <?php endif; ?> -
philhoyt created this gist
Jul 2, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ <?php $related_query = new WP_Query(array( 'post_type' => 'post', 'category__in' => wp_get_post_categories(get_the_ID()), 'post__not_in' => array(get_the_ID()), 'posts_per_page' => 3, 'orderby' => 'date', )); ?> <?php if ($related_query->have_posts()): ?> <ul> <?php while ($related_query->have_posts()): ?> <?php $related_query->the_post(); ?> <li> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </li> <?php endwhile; ?> </ul> <?php wp_reset_postdata(); ?> <?php endif; ?>