posts – Display content from specific category

Question

Please how do I display content from a specific category instead of all stories appearing?

<?php get_header(); ?>
<header class="homepage-header">
    <div class="title-badge">
        Top Stories
    </div>
</header>
<section class="section-1">
    <div class="container">
        <div class="row">
            <?php
                query_posts(['posts_per_page'=>8]);
                if(have_posts()){
                    while(have_posts()){
                        the_post();
                        echo'
                            <article class="col-lg-6 col-xl-3 col-md-6">
                                <figure>
                                    <a href="'.get_the_permalink().'">'.get_the_post_thumbnail(get_the_ID(), "category_square", ["class"=>"post-image"]).'</a>
                                </figure>
                                <h2 class="post-title"><a href="'.get_the_permalink().'">'.get_the_title().'</a></h2>
                                <div class="post-meta">
                                    <p class="post-author">By <a href="'.get_author_posts_url(get_the_author_meta('ID')).'">'.get_the_author().'</a> </p>
                                    <p class="post-date">'.get_the_date().'</p>
                                </div>
                            </article>

0
GentleE 2 months 2022-12-07T04:38:21-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse