I am looking to feed a custom post type onto a custom template. I basically want a few sub sections with custom (seperate) post types on the backend panel feed out onto a page, like a news, blog, testimonials kind of thing.
I think have the right idea but I believe I am going around this wrong. Please forgive me, as I do not normally work on wordpess. I basically want (let’s say the news page) to feed all the posts in the custom post type “news”. I have a blog page linked to a template that looks like so –
<?php
/*
Template Name:News*/
?>
<?php get_header(); ?>
<ul id="News">
<?php global $post; query_posts( 'post_type=newst&orderby=ID&order=desc' ); while (have_posts()) : the_post(); ?>
<li>
<div class="fea_del">
<h1><?php the_title(); ?></h1>
<p><?php the_field('post_content',$post->ID); ?></p>
<a <?php $p=get_permalink( $post->ID ); ?> href="<?php echo $p; ?>"class="entire_job">SEE ENTIRE ARTICLE</a>
</div>
</li>
<?php endwhile; wp_reset_query(); ?>
</ul>
<?php get_footer(); ?>
I have the [display-posts] plugin in my blog page and just have [display-posts] in the body in hopes it would just feed in all the posts in blog. I’ve been banging my head against this for a while with no success, I don’t work in wordpress much so I’m a bit in the dark here.
You have to pass the
$args
array toWP_Query
, try: