Forums

[resolved] Is it possible to display a random post in a page and include comments (5 posts)

  1. TIHY
    Member
    Posted 1 year ago #

    I know how to use the query_posts function to display a random post in a page, and I have done so with a custom page template.

    But the issue I am running into is that I want to see comments and comment reply box for the random post displayed on the page as well.

    Is this possible at all?

    I basically want a page that displays an entire random post, including everything a post page would normally include.

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    make sure 'allow comments' is ticked;

    you probably already have:

    <?php comments_template( '', true ); ?>

    in your template file;
    try to extend this:

    <?php global $withcomments;
    $withcomments = 1;
    comments_template( '', true ); ?>
  3. TIHY
    Member
    Posted 1 year ago #

    Thanks soooo much! That did the trick!

    Anyway you could explain in short what this does?

    I'm very slowly starting to understand PHP and interested in learning all I can. :)

  4. alchymyth
    The Sweeper
    Posted 1 year ago #

    there is a bit of info in here.

  5. TIHY
    Member
    Posted 1 year ago #

    Much appreciated. :)

Topic Closed

This topic has been closed to new replies.

About this Topic