【发布时间】:2015-02-28 15:53:35
【问题描述】:
我的模板页面 author.php 有一个奇怪的问题 我的页面显示用户创建的所有帖子和所有自定义 post_type。
我的问题: 如果用户在自定义 post_type "evenement" 中创建了一篇文章(总共只有一篇文章) 文章没有出现在模板页面author.php中,但是现在我的用户在默认的wordpress中创建了另一篇文章,两个帖子出现在模板页面author.php中
我的代码:
<?php
if(isset($_GET['author_name'])) :
$curauth = get_userdatabylogin($author_name);
else :
$curauth = get_userdata(intval($author));
?>
<div class="info-diffusion">
<h1 class="postheader entry-title">Les tutos et astuces de <?php echo $curauth->nickname; ?></h1>
<?php if (have_posts()) : query_posts('cat=172'); while (have_posts()) : the_post(); ?>
<div class="dif-info-pack">
<?php echo the_post_thumbnail('thumbnail'); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</div>
<?php endwhile; wp_reset_query(); else :?>
<p><?php echo $curauth->nickname; ?> n'a pas encore créé de tuto et astuce !</p>
<?php endif;?>
</div>
<div class="info-diffusion">
<h1 class="postheader entry-title">Les vidéos de <?php echo $curauth->nickname; ?></h1>
<?php
global $wp_query;
$args = array_merge( $wp_query->query_vars, array( 'post_type' => 'post_video' ) );
if (have_posts()) : query_posts( $args ); while (have_posts()) : the_post(); ?>
<div class="dif-info-pack">
<?php echo the_post_thumbnail('thumbnail'); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</div>
<?php endwhile; wp_reset_query(); else :?>
<p><?php echo $curauth->nickname; ?> n'a pas encore posté de vidéo !</p>
<?php endif;?>
</div>
第二个问题是管理员的问题,“未发布文章”的信息没有显示
如果你有一个想法... 特纳克的
【问题讨论】:
标签: wordpress