• Hi
    I am new to WordPress, I have developed a theme from scratch. I have created a custom post type “portfolio” and I want to load the added post into my page using below codes.

    <?php
        $args = array('post_type'=>'Portfolio');
        $query = new WP_Query($args);
    
        if($query->have_posts()) : while($query->have_posts()) : $query->the_post();?>
    
            <h1><?php the_title(); ?></h1>
            <p> <?php the_content()?></p>
    
        <?php endwhile; endif; wp_reset_postdata(); ?>

    But just the first post is loaded. I think the loop dose not work. what do you think? what is the problem?
    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom posts loading problem’ is closed to new replies.