[resolved] Link to comment pop up from single.php (5 posts)

  1. pixelfight
    Posted 9 years ago #

    Sorry if this is a very simple question, and has been covered somewhere...

    Can a link from the single.php be made to the comments-popup.php? or do I use a javascript code?

  2. ColourDreamer
    Posted 9 years ago #

    I need to know.

  3. wbarnes
    Posted 9 years ago #

    I have a similar question: How do I get a pop-up window for comments when is_page() returns true?

    According to the docs for comments_popup_link() this function does nothing if is_page() (or is_single()) returns true. Is there a way around this? Do I need to set a global variable? Maybe hack the query object?

    Any suggestions would be greatly appreciated.

  4. Chelsea Otakan
    Posted 8 years ago #

    i was having trouble with this too, but I found the answer here: http://codex.wordpress.org/User:alphaoide/wp_powered_photoblog#Adding_Comments_and_Metas

    in short, just add
    <?php $wp_query->is_single = false; ?>

    before your comments pop up link on your single.php template

  5. vdrover
    Posted 8 years ago #

    This solution works well, but a side-effect is that the page (single.php) does not display any comments on it any more.

    After applying the fix above, the solution is to find the following code in single.php:

    <?php comments_template(); ?>

    and replace it with this:

    <?php $wp_query->is_single = true; ?><?php comments_template(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic