Hello. It is necessary on the "add review" page to place the form through which the comment will be posted on the "reviews" page, I just can’t figure out how to implement it, that is, comments are added to one page without any problems, but redirecting them to another doesn’t work . In short - on one page there should be only a form of commenting, on the other - the output of comments. Who faced similar tasks - please write how you solved them?
1 answer
Use the get_comments() function on the landing page to display comments by specifying the id of the page to which they are attached (the one on which you output the commenting form). For example, if id is 15:
$comments = get_comments('post_id=15'); foreach($comments as $comment){ echo('Автор: ' . $comment->comment_author); //автор echo('Текст комментария: ' . $comment->comment_content); //текст комментария } Here are the detailed documentation on the function.
|