Example #1
0
/**
 * Inject related posts into the content
 *
 * Stops injection into themes that use get_the_excerpt in their meta description
 *
 * @since 0.1
 */
function nrelate_related_inject($content)
{
    global $post;
    if (nrelate_should_inject('related')) {
        $nrelate_related_options = get_option('nrelate_related_options');
        $related_loc_top = $nrelate_related_options['related_loc_top'];
        $related_loc_bottom = $nrelate_related_options['related_loc_bottom'];
        if ($related_loc_top == "on") {
            $content_top = nrelate_related(true);
        } else {
            $content_top = '';
        }
        if ($related_loc_bottom == "on") {
            $content_bottom = nrelate_related(true);
        } else {
            $content_bottom = '';
        }
        $original = $content;
        $content = $content_top;
        $content .= $original;
        $content .= $content_bottom;
    }
    return $content;
}
Example #2
0
/**
 * Inject top and bottom post indicators to calculate flyout position
 *
 * @since 0.50.3
 */
function nrelate_flyout_wrap_post($content)
{
    global $post;
    if (nrelate_should_inject('flyout')) {
        $original = $content;
        $content = "<div id='nrelate_flyout_placeholder'>";
        $content .= $original;
        $content .= "</div> ";
    }
    return $content;
}
Example #3
0
/**
 * Inject popular posts into the content
 *
 * Stops injection into themes that use get_the_excerpt in their meta description
 *
 * @since 0.1
 */
function nrelate_popular_inject($content)
{
    global $post;
    if (nrelate_should_inject('popular')) {
        $nrelate_popular_options = get_option('nrelate_popular_options');
        $popular_loc_top = $nrelate_popular_options['popular_loc_top'];
        $popular_loc_bottom = $nrelate_popular_options['popular_loc_bottom'];
        $popular_where = $nrelate_popular_options['popular_where_to_show'];
        if ($popular_loc_top == "on") {
            $content_top = nrelate_popular(true);
        } else {
            $content_top = '';
        }
        if ($popular_loc_bottom == "on") {
            $content_bottom = nrelate_popular(true);
        } else {
            $content_bottom = '';
        }
        $original = $content;
        $content = $content_top;
        $content .= $original;
        $content .= $content_bottom;
    }
    return $content;
}