Friday, August 26, 2022
HomeWordPress Developmentorder - How can I make have_posts() return posts ordered DESC by...

order – How can I make have_posts() return posts ordered DESC by id?


How can I make have_posts() return posts ordered DESC by id?

Now the posts are in random order, every time I refresh web page they alter order.

Right here is my code :

<?php if ( !outlined( 'ABSPATH' ) ) exit();
get_header( );
international $publish;

?>
        <div class="ova_doc_wrap archive-doc <?php echo esc_attr( $number_column ) ?>">
            <div class="ova_doc_content">
                <div class="doc-list-item">
                <?php if( have_posts() ) : whereas ( have_posts() ) : the_post(); 
                        $id = get_the_id();
                    ?>
                    <div class="items-doc">
                        <div class="merchandise">
                            <div class="doc-icon-title">
                                <div class="icon-doc">
                                    <i class="flaticon-files-1"></i>
                                </div>
                                <div class="doc-title-item">
                                    <h2 class="doc-title">
                                        <a href="<?php echo get_the_permalink() ?>">
                                            <?php echo get_the_title()?>
                                        </a>
                                    </h2>
                                    <div class="doc-meta">
                                        <!--<span class=" doc-meta-general">
                                            <?php the_time( get_option( 'date_format' ));?>-->
                                        </span>
                                        <span class=" doc-categories">
                                            <?php get_category_doc_by_id_doc( $id ) ?>                 
                                        </span>
                                    </div>
                                </div>
                            </div>

                            <div class="doc-readmore">
                                <a category="second_font" href="<?php echo get_the_permalink() ?>">
                                    <?php echo esc_html__( 'Vezi Doc', 'ova-doc' ) ?>
                                </a>
                            </div>
                        </div>
                    </div>
                <?php endwhile; endif; wp_reset_postdata(); ?>
                
                </div>
                <?php 
                    egovt_pagination_theme();
                ?>
            </div>
            
            <!-- finish ova_doc_content -->
        </div>
        <!-- finish ova_doc_single -->


<?php get_footer( );

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments