WordPress.org

Forums

Show comments Popup to Pages (not the link, the actual comments) (2 posts)

  1. rodrigovolponi
    Member
    Posted 7 years ago #

    Hello.

    Is it possible to show comments, in popup, for Pages?

    I'm trying to get my theme's comments-popup.php file to show the comments form to static pages.

    It works fine with POSTs. However, the comments-popup.php file shows only The_Loop's "Sorry, no posts matched your criteria." string for PAGEs.

    Example 1 (POST - working fine):
    http://www.cronistasreunidos.com.br/?p=998
    http://www.cronistasreunidos.com.br/?comments_popup=998

    Example 2 (PAGE - "sorry, no posts matched your criteria")
    http://www.cronistasreunidos.com.br/?page_id=150
    http://www.cronistasreunidos.com.br/?comments_popup=150

    I've used a version of Kubrick's default comments-popup.php page. The file is at http://wordpress.pastebin.ca/630858

    Any help dealing with this? Thanks!

  2. rodrigovolponi
    Member
    Posted 7 years ago #

    I've made a stupid plugin that SURPASSES que original WordPress Query to do what i needed. But it's very far from a good solution.

    The problem seems to be with WP_QUERY. It does not allow any ?comments_popup=ID to have post_type=page. It outputs only post_type=post.

    So, let's make the actual SQL instruction to have both "post_type=post" and "post_type=page". I'm afraid it will slow down the server a little bit more. Again.

    function rvl_comments_popup_page($dados) {
    	$procura_por = "post_type = 'post'";
    	$substitui_por = "(post_type = 'post' OR post_type = 'page')";
    	$s = str_replace($procura_por,$substitui_por,$dados);
    	return $s;
    }
    
    add_filter('posts_request', 'rvl_comments_popup_page');

    Any better suggestions? Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic