I got a wp theme that can display a category page with thumbs (of posts)
$cat_args = array(
'orderby' => 'name',
'order' => 'ASC',
// 'number' => $num,
'child_of' => 0,
'show_count' => 1
);
$categories = get_categories($cat_args);
foreach($categories as $category) {
echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "Toutes les vidéos de %s" ), $category->name ) . '" ' . '><div class="video video_">';
echo '<h3>' . $category->name.'</h3>';
$post_args = array(
'numberposts' => 1,
'category' => $category->term_id
);
$posts = get_posts($post_args);
foreach($posts as $post) {
?>
<div class="thumbnail">
<?php if ( has_post_thumbnail() ) { echo the_post_thumbnail();}else{ ?>
<img src="<?php echo get_post_meta($post->ID, get_option('wptuber_thumbs'), true); ?>" alt="<?php the_title(); ?>" />
<?php } ?>
</div>
<?php
}
echo '<em>Toutes les videos ('.$category->count.')</em>';
echo '</div></a>';
}
?>
but when I try to change it to get the same with "tag" every thing works fine but the thumb is not showing. Can someone help me?
$tag_args = array(
'orderby' => 'name',
'order' => 'ASC',
// 'number' => $num,
'child_of' => 0,
'show_count' => 1
);
$tags = get_tags($tag_args);
foreach($tags as $tag) {
echo '<a href="' . get_tag_link( $tag->term_id ) . '" title="' . sprintf( __( "Toutes les videos de %s" ), $tag->name ) . '" ' . '><div class="video video_">';
echo '<h3>' . $tag->name.'</h3>';
$post_args = array(
'numberposts' => 1,
'tag' => $tag->term_id
);
$posts = get_posts($post_args);
foreach($posts as $post) {
?>
<div class="thumbnail">
<?php if ( has_post_thumbnail() ) { echo the_post_thumbnail();}else{ ?>
<img src="<?php echo get_post_thumbnail($post->ID, get_option('wptuber_thumbs'), true); ?>" alt="<?php the_title(); ?>" />
<?php } ?>
</div>
<?php
}
echo '<em>Toutes les videos de ('.$tag->count.')</em>';
echo '</div></a>';
}
What am I missing?