Add permalink inline following post; another the_content <p> problem
This shouldn’t be that tough, right? I’ve got a sidebar with an unordered list of “Asides” on my front page; these don’t display with a headline, so I want to add a link to the single-post (permalink) page following each one. But, the_content wraps its output in paragraph tags, so using something like
<li><?php the_content(); echo(' <a href="'); the_permalink(); echo('" rel="bookmark" title="Permanent Link to '); the_title(); echo('">#</a>')?></li>
puts the link (“#”) on a new line.
Various solutions I’ve seen on the forum that haven’t worked:
- Modifying wpautop — I don’t want to do this because I don’t want to affect all posts; only those in the “Asides” category.
- Pass the “read more” argument to the_content — won’t work because this isn’t a “read more” situation. These posts don’t have <!–more–> links, and I just want a link to the post page at the end.
- CSS “run-in” or “:after” — I want this to work across browsers, of course, and anyway this seems like a pretty crude workaroud
- Manually adding a link to the end of each post — this would take forever, and is again not a very satisfying “fix.” In the words of the ubiquitous infomercial announcer, “There’s got to be a better way!”
- The topic ‘Add permalink inline following post; another the_content <p> problem’ is closed to new replies.