简体   繁体   中英

wordpress the_date('d F y') not working in query_posts

in my template I want to show and specific category posts in side bar (cat = 17) so I use this code :

<?php $cat=17; ?>
<?php $pp = query_posts("cat=$cat&showposts=3"); ?>
<?php if( $pp )
    { 
?>
        <section class="sidebar_boxes_container">
            <div class="sidebar_headers" > اطلاعیه ها &nbsp<img src="<?php bloginfo( 'template_url'); ?>/img/notification.png"></div> 
            <?php while (have_posts()) : the_post(); ?>
                <div class="notification_item" >
                    <span class='thumbnail' > <?php if ( has_post_thumbnail() ) { the_post_thumbnail('small_thumbnail');} ?> </span>
                        <a href="<?php the_permalink(); ?>"> <h5><?php the_title(); ?> </h5></a>     
                        <div  style='width:100%'>
                            <div class='noti_divs' >
                                <img src="<?php bloginfo( 'template_url'); ?>/img/calender.png"><?php the_date('d F y') ;?>
                            </div>
                            <div class='noti_divs' id="noti_divs_author">
                                <img src="<?php bloginfo( 'template_url'); ?>/img/author.png"> 
                                <?php the_author_posts_link();?>
                            </div>
                        </div>                                    
                        <?php the_excerpt(); ?>
                </div>
            <?php endwhile;?>
        </section>
        <?php wp_reset_query(); ?>
<?php
    }  
else
    {
        echo "empty";
    } ?> 

all wordpress functions work well but the : <?php the_date('d F y') ;?> returns null for all ; while if I change the post category to another one , <?php the_date('d F y') ;?> returns true date in posts what should I do ?

please add this code <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?> <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?> <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?> instead of this <?php the_date('d F y') ;?>

it will also show same result as per the date wise.

Thankx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM