【发布时间】:2014-12-21 14:54:24
【问题描述】:
我正在使用Types 插件创建 Wordpress 自定义帖子类型 (CPT),现在我需要显示该内容。我创建了一个名为:category-legislaciones.php 的页面,其中legislaciones 是类别,来自 CPT 本身,使用 Types 插件创建。这是我在该页面上的代码:
<?php
$args = array( 'post_type' => 'legislaciones', 'posts_per_page' => 15 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<h1 class="post-title"><?php the_title(); ?></h1>
<?php $options = get_option( 'responsive_theme_options' ); ?>
<?php if ( $options['breadcrumb'] == 0 ): ?>
<?php echo responsive_breadcrumb_lists(); ?>
<?php endif; ?>
<div id="post-<?php the_ID(); ?>">
<div class="post-entry">
<?php the_content( __( 'Read more ›', 'responsive' ) ); ?>
<?php wp_link_pages( array(
'before' => '<div class="pagination">' . __( 'Pages:', 'responsive' ),
'after' => '</div>'
)); ?>
</div>
<?php if ( comments_open() ) : ?>
<div class="post-data">
<?php the_tags( __( 'Tagged with:', 'responsive' ) . ' ', ', ', '<br />' ); ?>
<?php the_category( __( 'Posted in %s', 'responsive' ) . ', ' ); ?>
</div><!-- end of .post-data -->
<?php endif; ?>
<div class="post-edit"><?php edit_post_link( __( 'Edit', 'responsive' ) ); ?></div>
</div><!-- end of #post-<?php the_ID(); ?> -->
<?php comments_template( '', true ); ?>
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<?php if ( function_exists( 'wp_paginate' ) ) {
wp_paginate();
} ?>
<?php endif; ?>
<?php get_search_form(); ?>
<?php endwhile; ?>
但是即使我将内容分配给该类别,也不会显示任何内容,我做错了什么?显示该内容的正确方法是什么?
【问题讨论】: