samedi 28 février 2015

Display post and custom post type by user in wordpress

I have a strange problem with my template page author.php My page display all post and all custom post_type created by the user.


My problem: If the user creat an article (just one article in total ) in the custom post_type " evenement " The article not appear in the template page author.php, but now my user creat another article in default post wordpress, two post appear in the template page author.php


My code:



<?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>


And the second problem it's for the admin, the information "no posted article" not diplayed


If you have an idea... Thnak's


Aucun commentaire:

Enregistrer un commentaire