I could input within the database of Wordpress, in table wordpress_commentmeta, via a custom area within the comment form, these datas:
meta_id | comment_id | meta_key | meta_value -------------------------------------------------- 9 | 6 | commentoptions | option1 10 | 7 | commentoptions | option2
Now I am looking for a method to filter your comments ought to for exhibiting them by 50 percent posts on one page, one column left and something column right, in line with the meta_value value. I am talking about: the very first comment needs to use column on te left, and subsequently comment needs to visit the column around the right.
In the beginning, I figured "I am lucky, just only have to create two div, positioning all of them with CSS, and filter your comments ought to with wordpress_list_comments function" but... wordpress_list_comments function can't do this.
Could someone suggest me how do i proceed? Thanks ahead of time!
EDIT: It is a bit late... and that i just recognized my original response is specific to publish meta data. I'll leave my original answer below since it may be helpful for getting meta fields for any publish. At the very top there is a technique to get comment meta fields.
Presuming these meta values are earning their distance to the database via wordpress API, the below code can help you pull meta values for any specific comment
<?php $comment_id = 123; $key = "commentoptions"; // change to whatever key you are using $single = true; // whether or not you want just one or multiple values returned associated with the same key, see comments below about use $meta_values = get_comment_meta($comment_id, $key, $single); ?>
Original Answer (is applicable to get publish meta fields)
<?php $post_id = 123; $key = "commentoptions"; // change to whatever key you are using $single = true; // whether or not you want just one or multiple values returned associated with the same key, see comments below about use $meta_values = get_post_meta($post_id, $key, $single); ?>
You are able to alternatively use get_publish_custom_values() as proven below, the industry better method of doing it for those who have multiple values expected for every key. The above mentioned code is going to do exactly the same if you work with $single = false, but it's not preferred due to the way the get_publish_meta() function works - if perhaps one value is came back, it offers a superior the particular string value, otherwise it returns a range of values. The below method will return an assortment for those who have one or multiple values for any key, therefore it results in cleaner, more intuitive code.
<?php $post_id = 123; $key = "commentoptions"; $meta_values = get_post_custom_values($key, $post_id); ?>