• Hello,

    Thank you for a great plug-in, very versatile . However, I have a couple of custom fields in my comment form, for example, ‘country’. How can I get what was entered into this field to display along with my comment?

    The meta for this field is being saved using the following code in my functions.php:

    if ( ( isset( $_POST['country'] ) ) && ( $_POST['country'] != '') )
        $country = wp_filter_nohtml_kses($_POST['country']);
        add_comment_meta( $comment_id, 'country', $country );

    And i am able to retrieve the fields when I use the standard wp list comments with a callback:
    <?php wp_list_comments( 'type=comment&callback=tafcomments' ); ?>
    which calls back to this function in my functions.php:

    function tafcomments($comment, $args, $depth) {
            $country = get_comment_meta( $comment->comment_ID, 'country', true );
            $GLOBALS['comment'] = $comment;
            extract($args, EXTR_SKIP);
            ?>
            <div class="commentBox">
                <?php comment_text(); ?>
                <h6><?php echo $country; ?></h6>
            </div>
            <?php
        };

    But how do i achieve the same result using this plug-in??

    https://www.ads-software.com/plugins/bwp-recent-comments/

  • The topic ‘Retrieving custom fields’ is closed to new replies.