• I want to excerpt all my posts in the homepage and /page to a number of words.

    I would also like to add a “Click here” to continue text below it. Something like this:

    Lorem ipsum dolor sit amet I don’t knwo whats next…

    Click Here to Continue >

    How do I code that in php? I saw the hemingway theme did it, but I can’t understand because all the code is in the funtions.php

    I would really appreciate your help guys.
    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • One method:

    <?php the_excerpt(); ?><a href="<?php the_permalink(); ?>">Click here to continue</a>

    Thread Starter carlocab123

    (@carlocab123)

    Hi Shadow,

    Thank you for that but it’s not the one I’m looking for.

    I need a code that will automatically excerpt all my posts in the homepage and /page like what the theme hemingway did.

    Thanks.

    Well, if you put that code in the index.php and page.php files in your theme to replace <?php the_content(); ?>, it will be automatic.

    Or do you mean you want it to automatically happen without changing anything?

    Thread Starter carlocab123

    (@carlocab123)

    I used the code you gave me above:

    <?php the_excerpt(); ?><a href="<?php the_permalink(); ?>">Click here to continue</a>

    Although it excerpted the posts automatically, is there a way to choose how many words will it show before the cut?

    I also want to remove the ‘[…]’ and turn it into ‘…’

    Thanks

    You may want to try Kafkaesqui’s excellent plugin as an alternative.

    https://guff.szub.net/2005/02/26/the_excerpt-reloaded/

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to Exerpt Blog Posts in PHP?’ is closed to new replies.