• I’m trying to learn the new WordPress 6 from scratch. In the custom theme index.php I can get the post title and the excerpt.

    while ( have_posts() ) : the_post(); ?>
        <h2><?php the_title() ?></h2>
        <?php the_excerpt(); ?>
    <?php endwhile;

    In the functions.php I followed online tutorial and created a new_excerpt_more() function, which will get the permalink of the post.

    function new_excerpt_more() {
         return '<a href="'. get_permalink() . '"> Read More...</a>';
        }
    add_filter('excerpt_more', 'new_excerpt_more');

    My issue is when I click the Read More… hyperlink, it doesn’t show the full post content as I wanted. What is the simplest way to make the_excerpt() clikable and to show the full post content? Reference url: [ redundant link removed ]

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @papino

    You have added read more link in post excerpt which redirect you to single post page.
    You have to check the single.php file define in your theme.

    You need to add below code in your single.php which show full content for that post.

    <?php 
    while ( have_posts() ) : the_post(); ?>
        <h2><?php the_title() ?></h2>
        <?php the_content(); ?>
    <?php endwhile; ?>
    Thread Starter papino

    (@papino)

    @weboccults Thanks, it worked after I created the single.php.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Click excerpt to show full post’ is closed to new replies.