Esempio n. 1
0
function ap_post_status_description($post_id = false)
{
    $post_id = ap_parameter_empty($post_id, @ap_question_get_the_ID());
    $post = get_post($post_id);
    $post_type = $post->post_type == 'question' ? __('Question', 'ap') : __('Answer', 'ap');
    if (ap_have_parent_post($post_id) && $post->post_type != 'answer') {
        ?>
        <div id="ap_post_status_desc_<?php 
        echo $post_id;
        ?>
" class="ap-notice blue clearfix">
            <?php 
        echo ap_icon('link', true);
        ?>
            <span><?php 
        printf(__('Question is asked for %s.', 'ap'), '<a href="' . get_permalink(ap_question_get_the_post_parent()) . '">' . get_the_title(ap_question_get_the_post_parent()) . '</a>');
        ?>
</span>
        </div>
    <?php 
    }
    if (is_private_post($post_id)) {
        ?>
        <div id="ap_post_status_desc_<?php 
        echo $post_id;
        ?>
" class="ap-notice gray clearfix">
            <i class="apicon-lock"></i><span><?php 
        printf(__('%s is marked as a private, only admin and post author can see.', 'ap'), $post_type);
        ?>
</span>
        </div>
    <?php 
    }
    if (is_post_waiting_moderation($post_id)) {
        ?>
        <div id="ap_post_status_desc_<?php 
        echo $post_id;
        ?>
" class="ap-notice yellow clearfix">
            <i class="apicon-info"></i><span><?php 
        printf(__('%s is waiting for approval by moderator.', 'ap'), $post_type);
        ?>
</span>
        </div>
    <?php 
    }
    if (is_post_closed($post_id) && $post->post_type != 'answer') {
        ?>
        <div id="ap_post_status_desc_<?php 
        echo $post_id;
        ?>
" class="ap-notice red clearfix">
            <?php 
        echo ap_icon('cross', true);
        ?>
<span><?php 
        printf(__('%s is closed, new answer are not accepted.', 'ap'), $post_type);
        ?>
</span>
        </div>
    <?php 
    }
    if ($post->post_status == 'trash') {
        ?>
        <div id="ap_post_status_desc_<?php 
        echo $post_id;
        ?>
" class="ap-notice red clearfix">
            <?php 
        echo ap_icon('cross', true);
        ?>
<span><?php 
        printf(__('%s has been trashed, you can delete it permanently from wp-admin.', 'ap'), $post_type);
        ?>
</span>
        </div>
    <?php 
    }
}
if (!ap_user_can_view_post(get_the_ID())) {
    return;
}
global $post;
$clearfix_class = array('ap-questions-item clearfix');
?>

<div id="answer-<?php 
the_ID();
?>
" <?php 
post_class($clearfix_class);
?>
>
	<?php 
if (is_private_post()) {
    ?>

		<div class="private-question-label clearfix">
			<span><?php 
    _e('Private Answer', 'ap');
    ?>
</span>
		</div>
	<?php 
}
?>

	<div class="ap-questions-inner">
		<div class="ap-avatar ap-pull-left">
			<a href="<?php 
Esempio n. 3
0
/**
 * Check if active post is private post
 * @return boolean
 * @since  2.1
 */
function ap_question_is_private()
{
    return is_private_post();
}