• Resolved devstorm

    (@devstorm)


    Hi, is there some code/plugin which creates excerpts or more <more-tag>s (and auto-summaries) from Posts?
    I have thousands of Posts to import from old CMS, so doing this manually is not possible. I think this is a fairly common task, so I hope there’s already some plugin/hack available.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can do this by calling the_except() function. It must be called inside the wordpress loop.

    If you want to automatically append a string such as “Read more…” for each excerpt you have called, it can be achieved by using add_filter function in wordpress.

    Ex.

    <?php
        function addReadMoreToExcept(){
            global $post;
            $post_excerpt = get_the_excerpt( $post->ID );
            $readMore_permalink = get_the_permalink( $post->ID );
            $readMore_format = "[Read More...]";
            $readMore = sprintf( "%s %s", $post_excerpt,$readMore_permalink, $readMore_format  )
            return $readMore;
        }
        add_action('the_except', 'addReadMoreToExcerpt');
    
       /** Code not tested **/
    ?>
    

    Something like that.

    Thanks

    Thread Starter devstorm

    (@devstorm)

    Hi Joseph,

    thank you for your answer. I implemented it this way now.

    Best Wishes
    Stefan

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Code to automatically create more-tag or excerpt.’ is closed to new replies.