WordPress.org

Forums

How to add More Tag to every single post at once (8 posts)

  1. kylekid123
    Member
    Posted 7 months ago #

    I have a custom theme that requires the <!--more--> tag in all my posts for it to display an excerpt of my post's content.

    I've got over 500 posts already, and its going to take forever to add the tag in all my posts. I don't want to use a plugin.

    I just need a snippet i can use that will add this effect to all posts i currently have and create in the future.

    I've been searching Google and i discovered this

    function custom_excerpt_length( $length ) {
    return 20; // You can change the number here as per your need.
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

    Will this work?

  2. janet4now
    still awesome :)
    Posted 7 months ago #

    I think you misunderstood something. The tag goes on your template file, not in each post directly.

  3. kylekid123
    Member
    Posted 7 months ago #

    I know, but i just wanted to make sure that is the correct code to place in my functions.php file.

  4. kylekid123
    Member
    Posted 7 months ago #

    I want this tag ---> <!--more--> to put put on all post at once. I know i can go into every post and add it but that will take forever. I want to know if i use the above code will this work?

  5. janet4now
    still awesome :)
    Posted 7 months ago #

    that tag goes on the template file. just putting the function does not give it a place to display.

    You do not need to go into every post ever for any kind of excerpt.

  6. janet4now
    still awesome :)
    Posted 7 months ago #

  7. toinvite
    Member
    Posted 7 months ago #

    Thank you for the link. that helped me a lot!

  8. kylekid123
    Member
    Posted 7 months ago #

    Not yet i wanted to make sure its correct.

Reply

You must log in to post.

About this Topic