I have a "normal" WordPress install. Blogposts are displayed on the homepage an there are a few pages.
Now I want to display the posts of a specific category on a page, so that I can add some additional info above the post list.
First, I created the page in the WP Admin (ex. "Awesome Posts", page ID: 31)
Then I created a new page template, named it after the page id (page-31.php) and in there I created another WP_Query to get the posts of some category.
<?php
// The default "page" content
while ( have_posts() ) : the_post();
get_template_part( 'content', 'single' );
endwhile;
// Custom category query
$awesome= new WP_Query( 'category_name=awesome' );
if ( $awesome->have_posts() ) :
while ( $awesome->have_posts() ) : $awesome->the_post();
get_template_part( 'content', 'awesome' );
endwhile;
endif;
?>
This works as expected and I get a list of awesome posts on my page.
The URL of this page is /awesome
.
My permalink structure is /%postname%/
so that normal posts on the homepage get a URL like /postname
.
Now I would like to have the posts on this specific page link to /awesome/posttitle
and this is where I get stuck.
Do you now of a way to achive this?