How to get the question ID of the answer?

5.10K viewsGeneral
1

Hi!

I’m including thumbnails from the questions in the users page, like this:

But in some pages I can’t take the ID from the question to put the image, like in Reputation page. I tried some functions, but I can only get the answer ID.

For example, in theme/default/user/reputation-content.php

<?php
/**
 * Reputation loop item template
 * 
 */
?>

<?php //Do not change id attribute ?>
<div id="ap-reputation-<?php ap_reputation_get_the_id(); ?>" class="ap-reputation-item <?php ap_reputation_get_the_class(); ?>">
	<?php 
		$questionID = FUNCTION_TO_GET_THE_QUESTION_ID;
		echo '<div class="float: left; containerIMG" style="border: solid 1px white;outline: solid 1px;margin-right: 10px;width: 54px;float: left;height: 54px;">'. imgBackground( 52, $questionID ).' </div>';
	?>
	<span class="point"><?php ap_reputation_get_the_reputation() ?></span>	
	<div class="no-overflow">
		<span class="time"><?php ap_reputation_get_the_date(); ?></span>
		<span class="info"><?php ap_reputation_get_the_info(); ?></span>			
					
	</div>
</div>

 

What I should use in $questionID ?

Thanks.

Attachments

ff.png

I did it.

If some needs to do the same, heres how:

$term = get_post( ap_reputation_get_action_id() );
$parentQuestionID = $term->post_parent;