i need show my last news on special category
<?php
$my_query = new WP_Query('showposts='. dynamic_sidebar( 'lastnews' ) .'&cat=1');
$active = NULL;
while ($my_query->have_posts()):
$my_query->the_post();
$thumbnail_id = get_post_thumbnail_id();
$thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail-size', true );
$do_not_duplicate = $post->ID;
if( $active == NULL ){ $active = "active"; }else{ $active = deactive ; }
?>
<div class="item <?php echo $active; ?>">
<img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php the_title(); ?>">
<div class="carousel-caption transition">
<h3 class="text-white"><?php the_title(); ?></h3>
<div class="text-center">
<p><?php the_excerpt(); ?></p>
<a class="btn btn-danger" href="<?php the_permalink() ?>" target="_blank" > <span class="glyphicon glyphicon-sunglasses"></span> مشاهده </a>
</div>
</div>
</div>
<?php endwhile; ?>
But dynamic_sidebar( 'lastnews-right' ) Dosent Work on lane 2. I Create Widget With This Style.
function create_lastnews( $name, $id, $description ) {
register_sidebar(array(
'name' => __( $name ),
'id' => $id,
'description' => __( $description ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
));
}
create_lastnews( 'Last News Category', 'lastnews', 'Enter Id Of Your Category To Show News' );
Pls Help Me I Can Make This News With An Other Work ?
Aucun commentaire:
Enregistrer un commentaire