I’m trying to fix our website and could use some help. On our front page, we have a section that pulls the most current post and displays that. If it is too long, it will cut off and display a […] at the end. You used to be able to click that and be taken to the full post, however, after a WordPress update about a year ago, it no longer lets you click for the full post. It still shows the […] but its not a link.

I’m not the one who made the site but I know a little bit about code and after researching WordPress code, I believe I’ve found the section of code that controls this. The problem is, everything I find to try doesn’t seem to make a difference.

Below is the section of code that pertains to the latest post appearing on the front page. Any suggestions of what I can do to get this working again? Thanks.

<?php 
global $post;
$args = array('numberposts' => 1);
$posts = get_posts($args);

foreach ($posts as $post) {
setup_postdata($post); ?>
<img src="https://wordpress.stackexchange.com/questions/252138/<?php the_field("featured_image', $post->ID); ?>" class="featured-image" />
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<?php } ?>

1 Answer
1

You can modify the […] with simple function you place in functions.php

function wpdocs_excerpt_more( $more ) {
    return '<a href="'.get_permalink( get_the_ID() ).'">[...]</a>';
}
add_filter( 'excerpt_more', 'wpdocs_excerpt_more' );

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *