• Hi I am trying to figure out how to echo the newly created fields in my theme template.

    I tried using the following code in a few variations and couldnt come up with anything that works.

    <?php
    $args = array(
    'orderby' => 'comment_date',
    	'order' => 'DESC',
    'post_type' => 'property',
    );
    // return a single meta value with the key 'vote' from a defined comment object
    $ag_condition = get_comment_meta( $comment->comment_ID, 'agents_condition', true );
    $comments = get_comments($args);
    foreach($comments as $comment) :
    	echo('<p>' . $comment->comment_author . '</p><p>' . $comment->comment_content . '</p>');
    echo ($ag_condition);
    endforeach;
    ?>

    https://ww.wp.xz.cn/plugins/wp-comment-fields/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter MYGM

    (@mygm)

    ANYONE?

    Thread Starter MYGM

    (@mygm)

    Help…

    Plugin Author N-Media

    (@nmedia)

    Hi MYGM,

    here you can echo extra comment fields

    echo $comment_meta_key = $meta['data_name'];
    	        	$comment_meta_val = get_comment_meta($comment -> comment_ID, $comment_meta_key, true);

    Where $meta['data_name'] is the extra field name you set in our pluin. I hope it will help you.

    Thread Starter MYGM

    (@mygm)

    thanks for the reply however, how would i fit that into my previous code and echo it out ?

    Almost a year and no reply these guys are not the greatest at this support stuff.

    here was my solution to trying to get the values to display where i wanted them to

    Save your value to a variable

    <?php $role = get_comment_meta($comment -> comment_ID, 'role', true);?>

    in my case i name the extra field role in there plugin so all you have to do is use the get_comment_meta hook for wordpress and the change role to what ever you named yours

    then simply echo it out

    <?php echo $role ?>

    if you didnt already figure it out hope this helps

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘How to echo fields in theme templates’ is closed to new replies.