WordPress.org

Ready to get started?Download WordPress

Forums

limiting the_content, more link (6 posts)

  1. leisegang
    Member
    Posted 5 years ago #

    How do i add a "read more" link where the ... are ?

    add_filter('the_content', 'content_intercept');
    
    function content_intercept($content) {
    //how many characters to show from each post
    $maxchars = "200";
    $newcontent = ''.substr($content, 0, $maxchars).'...';
    return $newcontent;
    }
  2. tomontoast
    Member
    Posted 5 years ago #

    I'm not quite sure what you are trying to acheive. Could you explain in more detail what you want this filter to do.

    A read more link can be added using the following code

    global $id;
    $more_link_text='read more>>';
    $newcontent .= ' <a href="'. get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>";
  3. leisegang
    Member
    Posted 5 years ago #

    • i want something to filter the_content so that i only display 100 words.
    • images and links dont break, and is viewed. so excerpt dont work for me...i use vipers videotags and want videoes to be displayed
    • i need a "read more link"
    • now some image links breaks off in the middle of the link and that breaks the design.

    can anyone help me with this. i couldnt find any plugin that did this. i searched a lot.

  4. leisegang
    Member
    Posted 5 years ago #

    bump

  5. tomontoast
    Member
    Posted 5 years ago #

    How about using the custom excerpt plugin http://wordpress.org/extend/plugins/custom-excerpts/

  6. tonymcclellan
    Member
    Posted 5 years ago #

    In what php file do you add the global more? post-template?

Topic Closed

This topic has been closed to new replies.

About this Topic