Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress中的类别标题显示问题_Wordpress_Wordpress Theming - Fatal编程技术网

Wordpress中的类别标题显示问题

Wordpress中的类别标题显示问题,wordpress,wordpress-theming,Wordpress,Wordpress Theming,下面是WordPress中某个类别的代码。当我希望它显示文章标题时,它会显示类别的名称。我如何让它显示文章的标题 <? query_posts('category_name=implants'); ?> <h3><?php single_cat_title(); ?></h3> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_c

下面是WordPress中某个类别的代码。当我希望它显示文章标题时,它会显示类别的名称。我如何让它显示文章的标题

<? query_posts('category_name=implants');
?>
<h3><?php single_cat_title(); ?></h3>
<?php if (have_posts()) : while (have_posts()) : 

the_post(); ?>
<?php the_content( __('Read the 

rest of this page »', 'template')); ?>
<?php endwhile; endif; ?></p>

  • 除非您打算修改 默认Wordpress循环。改用标准Wordpress 查询
  • 看看你的代码。您正在调用single_cat_title()。这意味着 就像它看起来的那样:您正在拉取被查询对象的标题 类别您想调用_title()来获取文章标题

  • 没有上面提到的那么重要,但是你的开场白是Maiorano谢谢你的回答和更正,它非常有效。
    <?php
    $query = new WP_Query('category_name=implants');
    if($query->have_posts()) : while($query->have_posts()) : $query->the_post();
    ?>
    <h3><?php the_title(); ?></h3>
    <?php
    the_content( __('Read the rest of this page »', 'template'));
    endwhile; endif;
    wp_reset_postdata();
    ?>