the excerpt function not work in my custom post template using WordPress default posts in the query loop, but they work fine with custom post type.
I enabled the display of excerpt by checking the "excerpt" option in the post options fields.
I also added "add_post_type_support(‘page’ ‘excerpt’)" in my function.php file but it doesn’t working.
I suspect a problem coming from the database because the excerpts are displayed when I test the website locally with Xampp.
Here is a snippet of the code used in my page template:
<div class="container"> <div class="row"> <div class="col-lg-9 col-mg-9 mp-blog" style="padding-right: 24px;"> <div class="row"> <?php $ paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $ args = array( 'post_type'=>'post', // Your post type name 'posts_per_page' => 6, 'cat' => 26, 'paged' => $ paged, ); $ loop = new WP_Query( $ args ); if ( $ loop->have_posts() ) { while ( $ loop->have_posts() ) : $ loop->the_post();?> <?php the_excerpt();?> <?php endwhile; $ total_pages = $ loop->max_num_pages; if ($ total_pages > 1){ $ current_page = max(1, get_query_var('paged')); ?> <div class="custom_pagination"> <?php echo paginate_links(array( 'base' => get_pagenum_link(1) . '%_%', 'format' => '/page/%#%', 'current' => $ current_page, 'total' => $ total_pages, 'prev_text' => __('« précédent'), 'next_text' => __('suivant »'), ));?> </div> <?php } } wp_reset_postdata();?> </div> </div><!-------------- end of col-8 ------------------> <div class="col-lg-3 col-mg-3" style="padding: 0;"> <div id="tching" class="blog_right_sidebar" style="padding: 0 15px;"> <?php get_sidebar(); ?> </div> </div> </div> </div>