function rcp_hide_premium_posts($query)
{
    global $rcp_options, $user_ID;
    $suppress_filters = isset($query->query_vars['suppress_filters']);
    if (isset($rcp_options['hide_premium']) && !is_singular() && false == $suppress_filters) {
        if (!rcp_is_active($user_ID)) {
            $premium_ids = rcp_get_paid_posts();
            if ($premium_ids) {
                $query->set('post__not_in', $premium_ids);
            }
        }
    }
}
Пример #2
0
function rcp_list_paid_posts() {
	$paid_posts = rcp_get_paid_posts();
	$list = '';
	if( $paid_posts ) {
		$list .= '<ul class="rcp_paid_posts">';
		foreach( $paid_posts as $post_id ) {
			$list .= '<li><a href="' . esc_url( get_permalink( $post_id ) ) . '">' . get_the_title( $post_id ) . '</a></li>';
		}
		$list .= '</ul>';
	}
	return $list;
}