Now it’s showing like this: now it’s showing like this
I want it to look like this: I want it to look like this
2
There are two ways to do:
In your WordPress dashboard, go to Appearance » Widgets and add the ‘Recent Posts’ widget to your sidebar. https://prnt.sc/1rhjdc4
Using wp query
$args = array( 'post_type' => 'product', 'posts_per_page' => 10, ); $loop = new WP_Query($args); while ( $loop->have_posts() ) { $loop->the_post(); ?> <div class="entry-content"> <?php the_title(); ?> <?php the_content(); ?> </div> <?php }
wp_get_recent_posts( array $args = array(), string $output = ARRAY_A ) Please read this article https://developer.wordpress.org/reference/functions/wp_get_recent_posts/
<?php $recent_posts = wp_get_recent_posts(); foreach( $recent_posts as $recent ) { printf( '<li><a href="%1$s">%2$s</a></li>', esc_url( get_permalink( $recent['ID'] ) ), apply_filters( 'the_title', $recent['post_title'], $recent['ID'] ) ); }
?>
Click here to cancel reply.
2
Answers
There are two ways to do:
In your WordPress dashboard, go to Appearance » Widgets and add the ‘Recent Posts’ widget to your sidebar.
https://prnt.sc/1rhjdc4
Using wp query
wp_get_recent_posts( array $args = array(), string $output = ARRAY_A )
Please read this article
https://developer.wordpress.org/reference/functions/wp_get_recent_posts/
?>