$WP_Query: How to display excerpt on first post only

Pull it out of the content-part. That would be the easiest. <section id=”featured”> <?php // Start custom loop $args = array( ‘post_type’ => ‘project’, ‘posts_per_page’ => 5, ); $featured_query = new WP_Query( $args ); while ( $featured_query->have_posts() ) : $featured_query->the_post(); ?> <article class=”project”> <?php if ( has_post_thumbnail() ) { the_post_thumbnail( ‘post-thumbnail’, array( ‘class’ => ‘featured’ … Read more

Limit length of first excerpt in the loop

To determine where you are inside the loop in this filter, you will have to access the global main query. Like this: add_filter (‘excerpt_length’, ‘wpse268679_custom_excerpt_length’); function wpse268679_custom_excerpt_length ($length) { // access main query global $wp_query; // do this only for the main loop and the first post in the query if (is_main_query() && ($wp_query->current_post == … Read more

Excerpts on category page

Try this and place in your functions.php file: function custom_excerpt_length( $length ) { return 35; } add_filter( ‘excerpt_length’, ‘custom_excerpt_length’, 999 ); function excerpt_more( $more ) { return sprintf( ‘%2$s’, get_permalink( get_the_ID() ), __( ‘Read More’, ‘textdomain’ ) ); } add_filter( ‘excerpt_more’, ‘excerpt_more’ );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)