WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Link to comment pop up from single.php

[Resolved] Link to comment pop up from single.php

  • 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?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I need to know.

    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.

    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

    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(); ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Link to comment pop up from single.php’ is closed to new replies.