I have a custom comments loop on my author.php
page. I am trying to get the post id so that I can echo the permalink for the post that the comment belongs to. Also so I can echo some post meta custom fields.
This is what my loop looks like now -
<?php
$object = get_queried_object();
$authorID = get_queried_object()->ID;
$author_email = get_the_author_meta( 'user_email', $authorID );
$postid = get_queried_object()->post->ID;
$args = array(
'user_id' => $authorID,
'post_id' => $postid,
);
// The Query
$comments_query = new WP_Comment_Query;
$comments = $comments_query->query( $args );
// Comment Loop
if ( $comments ) {
foreach ( $comments as $comment ) { ?>
I tried place a normal post loop within this but things got weird. The part I need the post meta for is this --
<div class="full-divs">
<strong>
<a href="<?php echo get_permalink(); ?>">
View
<?php
$property_address = get_post_meta(
get_the_ID(),
'imic_property_site_address',
true
);
echo $property_address;
?>
</a>
</strong>
</div>
What am I doing wrong?