Example #1
0
function wp_review_inject_data($content)
{
    global $post;
    $options = get_option('wp_review_options');
    $custom_location = get_post_meta($post->ID, 'wp_review_custom_location', true);
    $location = get_post_meta($post->ID, 'wp_review_location', true);
    if (!$custom_location && !empty($options['review_location'])) {
        $location = $options['review_location'];
    }
    $location = apply_filters('wp_review_location', $location, $post->ID);
    if (empty($location) || $location == 'custom') {
        return $content;
    }
    $review = wp_review_get_data();
    if ('bottom' == $location) {
        global $multipage, $numpages, $page;
        if ($multipage) {
            if ($page == $numpages) {
                return $content .= $review;
            } else {
                return $content;
            }
        } else {
            return $content .= $review;
        }
    } elseif ('top' == $location) {
        return $review .= $content;
    } else {
        return $content;
    }
}
Example #2
0
function wp_review_shortcode($atts, $content = "")
{
    if (empty($atts['id'])) {
        $atts['id'] = null;
    }
    return wp_review_get_data($atts['id']);
}