The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

limiting the_content, more link (6 posts)

  1. leisegang
    Posted 7 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
    Posted 7 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
    Posted 7 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
    Posted 7 years ago #


  5. tomontoast
    Posted 7 years ago #

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

  6. tonymcclellan
    Posted 7 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