Due to client's demand the situation is that I can't use the default (trimmed) body text as a teaser text in a view listing nodes. Instead I have an extra text field which contains 2-3-4 paragraphs so that the client has 100% control of what the teaser text would look like etc.

I would need to place a "read more" link at the end of that custom teaser text. I tried different methods to place such a link inline with the teaser text – but couldn't find a way to actually have a working setup.

  • I tried the read more module – which works fine with standard situation, replacing/placing the "read more" link inline – but that won't help me here.

  • I tried overriding the field in views – but that won't let me place the "read more" inside the last paragraph. Either I keep properly formated paragraphs, or I use "inline" or "inline-block" for the p but then the paragraph-structure collapses.

  • I also tried the read more control module – but that seems to solve problems that I don't have (hiding "read more" links if there is not 'more' to read)

I suppose this must be possible – and would gladly appreciate any tipps or pointers that would lead me in some direction.. thnx!

  • Have you seen the 'Long text with Summary' field type? It allows the user to specifically set the teaser.
    – Darvanen
    Commented Feb 24, 2015 at 1:54

1 Answer 1


If the goal is simply to get the read more link to appear visually inline with your last paragraph, I think you can do that with pure CSS. As you noted, formatting all your <p> tags as inline elements will break the paragraph structure. You can avoid this simply by using a :last-child selector, e.g. http://jsfiddle.net/hdys6w2j/

That said, if you are set on having the readmore link injected into your last p tag, I guess you could throw some code like this in your custom module:

function mymodule_preprocess_node(&$vars) {

  //Programmatically generate the readmore link
  $read_more_link = l('Read more', 'node' . $vars['node']->nid);

  if (!empty($vars['content']['my_field'][0]['#markup'])) {

    //Replace the last </p> tag with <a href="/path/to/my/node">Read More</a></p>
    $vars['content']['my_field'][0]['#markup'] = preg_replace(
       $read_more_link . '</p>',

  • Thank you! I just didn't come up with the selector. In my case it actually had to be the :last-of-type selector since the more-span is inside the same parent. But now it works. Great. Commented Feb 24, 2015 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.