Answers for "link to show all posts wordpress"

0

wordpress get all custom posts

$posts = get_posts([
  'post_type' => 'custom',
  'post_status' => 'publish',
  'numberposts' => -1
  // 'order'    => 'ASC'
]);
Posted by: Guest on July-23-2021
1

wordpress show similar posts

<ul class="some-class">
  <?php
  $related = get_posts( array( 'category__in' => wp_get_post_categories($post->ID), 'numberposts' => 3, 'post__not_in' => array($post->ID) ) );
  if( $related ) foreach( $related as $post ) {
  setup_postdata($post); ?>
    <li>
    	<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
        <div><?php the_excerpt();?></div>
    </li>
  <?php }
  wp_reset_postdata(); ?>
</ul>
Posted by: Guest on October-17-2021

Code answers related to "link to show all posts wordpress"

Browse Popular Code Answers by Language