Get Just the Comment Form in Multisite for Any Blog
-
I’ve gotten the comment_form() function to work great for single install wordpresses, but I can’t figure out how to get a comment form from any blog in a multisite. Here’s what I’m doing so far:
Created a page called wp-get-comment-form.php in the root of WP install that will look for a Blog ID # and Post ID # (e.g. wp-get-comment-form.php?p=45b=9)
<?php // Need to be in WP's Loop but without theme define('WP_USE_THEMES', false); require('wp-blog-header.php'); $postid = $_GET['p']; $blogid = $_GET['b']; // Tell me where I'm at switch_to_blog($blogid); // deprecated and doesn't really switch // Check to see if the post exists if ( is_single( $postid )) { echo get_the_title($postid); // Title of the post we are commenting on comment_form( $arg , $postid ); } else echo "<br/><br/>Post doesn't exist!"; restore_current_blog(); ?>
However, the above code just returns the default or root WordPress posts. Since the actual locations of the blogs are all logically-based I can’t just put this file somewhere else to invoke the correct location. Any help would greatly be appreciated.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Get Just the Comment Form in Multisite for Any Blog’ is closed to new replies.