• Resolved simon2902

    (@simon2902)


    Hi all,

    I am trying to show all posts of a specific category on one page. For this, I was trying yo query the posts with the relevant category ID. The problem is that the code doesn’t seem to include the link to the post. See below:

    <?php
    get_header(); ?>
    
    	<section id="primary" class="content-single content-area">
    
    		<main id="main" class="site-main" role="main">	
    
    			<?php
    			query_posts('cat=31');
    			while (have_posts()) : the_post();
    			get_template_part( 'template-parts/content', 'page' );
    
    				comments_template();
    
    			endwhile; ?>
    
    		</main><!-- #main -->
    
    	</section><!-- #primary -->
    
    	<?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Any help would be appreciated.

    Thanks,
    Simon

Viewing 4 replies - 1 through 4 (of 4 total)
  • im not sure how your site looks, but what you can do, is go to appearance > menus

    and just add a categorie as a menu item

    Theme Author ThemeZee

    (@themezee)

    Hi there,

    As mentioned WordPress Core already allows to display posts from a single category, no need for custom code.

    Best,
    Thomas

    Garbonso

    (@garyupham)

    Categories in menu already … I suddenly feel really, really dumb.

    Glad you asked, @garyupham — because there’s more than one of us feeling dumb (and relieved).

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display the posts of one category in a Page’ is closed to new replies.