If thumbnail doesn’t exist, show more post content
-
Here is my code for frontpage.php. Iam trying to make the box type home. Screenshot here https://i.imgur.com/DavVING.jpg
<?php while ( have_posts() ) : the_post(); ?> <div class="col-md-4"> <div class="sok-blog-box"> <?php if ( has_post_thumbnail() ) { ?> <figure class="sok-thumb"> <?php echo get_the_post_thumbnail(); ?> </figure> <?php } ?> <div class="sok-blog-summary"> <?php the_title( sprintf( '<h2 class="blog-entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?> <?php the_excerpt(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'understrap' ), 'after' => '</div>', ) ); ?> </div> </div><!-- .sok-blog-listing --> </div>
I need to show more text if post doesnot have thumbnail. In screenshot here https://i.imgur.com/DavVING.jpg you can see many empty space in a box that doesn’t have thumbnail.
Now I limitted the excerpt in functions.php using below code.
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘If thumbnail doesn’t exist, show more post content’ is closed to new replies.