How to display posts on custom a Wordpress page open

How to display posts on custom a Wordpress page

1 Step you need Create custom page template

2 Step Add an output loop to it


<?php 
if ( have_posts() ) {
	while ( have_posts() ) {
		the_post();?>
		
        <?php
        get_template_part('parts/content');
        ?>
		
	<?php 
} else {
   echo "No Post";
}
?>

3 Step Create content.php file on you theme directory

4 Step Define the appearance of your posts, for example the code below will display links to posts with their titles


<a href="<?php the_permalink() ?>"><?php the_title() ?></a>

0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation