【发布时间】:2014-02-23 21:26:50
【问题描述】:
我希望将自定义帖子类型提供给自定义模板。我基本上希望后端面板上有一些带有自定义(单独)帖子类型的子部分馈送到页面上,比如新闻、博客、推荐之类的东西。
我认为我的想法是正确的,但我相信我正在解决这个错误。请原谅我,因为我通常不使用 wordpess。我基本上希望(比如说新闻页面)提供自定义帖子类型“新闻”中的所有帖子。我有一个链接到一个看起来像这样的模板的博客页面 -
<?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(); ?>
我的博客页面中有 [display-posts] 插件,并且在正文中只有 [display-posts],希望它能提供博客中的所有帖子。我一直在努力解决这个问题,但没有成功,我不太在 wordpress 中工作,所以我在这里有点摸不着头脑。
【问题讨论】:
标签: wordpress wordpress-theming custom-post-type