Support » Plugins » Single.php not honoring the more link

  • On single.php, I would like to have a collumn that displays the recent posts to the blog, and I need to for it to honor the <!–more–> link.
    It is not honoring the <!–more–> link because WP says – if Single = true, then dont display the <!–more–> link.

    anyone know how to get around this?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Single.php is the file that displays one post in its entirety which is different to the content of index.php or the archive.php file for monthly or category archives.

    Right, I am aware of that. however, for design purposes, and trying to include a list of posts, with text in a collumn on the single/article view of the page.
    I am trying to see if that is possible.

    Do you mean links to the most recent posts?

    Well, on the single page, I have 2 collumns. One will have the full post and comments, the other will diaplay a list of posts just like the index.php.

    the prblem is that there is a function that is checking to see if the current page is single, and if so, dont use the more link.

    What I am getting, is a list of all the posts without honoring the <!–more–> link.

    I was just thinking that there might be a way to write a plugin that could handle this. maybe?

    Why don’t you just edit the function to say “false” instead of “true”? Of course, you’d have to keep track, since it would get overwritten next upgrade.

    Hmm. No, that probably wouldn’t work – or if it did it’s probably a lot more complicated than that. Wonder if you could just comment out that function?

    Or you could set up a new page template instead of using single.php….

    Do those posts that should be in the “list” have anything in common?
    If yes, you could use a plugin like “related posts” or “in-series”…

    I have looked at using related posts – the prob is that it behaves slightly differently. It shows an excerpt instead of pulling the the list of posts along with the more link. I was hoping to get it to look as if there was a blog on one side, and the article on the other side.

    A new page template might work…. I need to sit and think about how that will fit in. I might have to go the route of using something like “recent posts” the probs with that is that it will not exclude the post that you are currently on.

    I thought it would be easiest to write a query that pulled the posts from the DB and out put all the posts except the one that is currently being displayed (as a full post in opposite collumn).

    I tried this – it worked, except for the fact that it was not honoring the more link.

    I will look into the page template. Maybe the function wont be triggered if it all happened on a page template.

    “more” doesn’t work on Pages either. So using a Page template (that will be recognized by WP as a Page…) won’t really help.

    If I get the time, I might write a little plugin. I will let you know if I do.
    thanks again!

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    I see your problem. You are on a single page but have a separate loop where you want more to be active.

    Add this to your code, just before your loop:
    function set_more($value) {
    global $more;
    $more = $value;

    Setting the global $more to zero will force it to display the More link. Setting it to one will force it not to do so. So set it the way you want it to be just before your post loop and before your single post.

    Not the greatest solution, but it works.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Single.php not honoring the more link’ is closed to new replies.