function wp_rp_fetch_posts_and_title()
{
    $options = wp_rp_get_options();
    $limit = $options['max_related_posts'];
    $title = $options["related_posts_title"];
    $related_posts = array();
    wp_rp_append_posts($related_posts, 'wp_rp_fetch_related_posts_v2', $limit);
    wp_rp_append_posts($related_posts, 'wp_rp_fetch_related_posts', $limit);
    wp_rp_append_posts($related_posts, 'wp_rp_fetch_random_posts', $limit);
    if (function_exists('qtrans_postsFilter')) {
        $related_posts = qtrans_postsFilter($related_posts);
    }
    return array("posts" => $related_posts, "title" => $title);
}
Beispiel #2
0
function wp_rp_fetch_posts_and_title()
{
    $options = wp_rp_get_options();
    $limit = $options['max_related_posts'];
    // quirky stuff due to WPML compatibility
    $title_option = get_option('wp_rp_options', false);
    $title = __($title_option['related_posts_title'], 'wp_related_posts');
    $related_posts = array();
    wp_rp_append_posts($related_posts, 'wp_rp_fetch_related_posts_v2', $limit);
    wp_rp_append_posts($related_posts, 'wp_rp_fetch_related_posts', $limit);
    wp_rp_append_posts($related_posts, 'wp_rp_fetch_random_posts', $limit);
    if (function_exists('qtrans_postsFilter')) {
        $related_posts = qtrans_postsFilter($related_posts);
    }
    return array("posts" => $related_posts, "title" => $title);
}
Beispiel #3
0
/**
 * Get posts according to options set for a certain slider
 * @param int $slider_id
 * @param array $options
 */
function FA_get_posts($slider_id, $options = array())
{
    if (!$options) {
        $options = FA_slider_options($slider_id, '_fa_lite_content');
    }
    if (!is_array($options['display_from_category'])) {
        $options['display_from_category'] = array();
    } else {
        if (empty($options['display_from_category'][0])) {
            array_shift($options['display_from_category']);
        }
    }
    $args = array('numberposts' => $options['num_articles'], 'category' => implode(',', $options['display_from_category']), 'order' => 'DESC');
    // Filter by author
    if (isset($options['author']) && 0 != $options['author']) {
        $args['author'] = $options['author'];
    }
    switch ($options['display_order']) {
        case 1:
        default:
            $args['orderby'] = 'post_date';
            break;
        case 2:
            $args['orderby'] = 'comment_count post_date';
            break;
        case 3:
            $args['orderby'] = 'rand';
            break;
    }
    // Remove WP Touch PRO filter that removes categories from filter
    if (function_exists('classic_exclude_categories')) {
        remove_filter('pre_get_posts', 'classic_exclude_categories');
    }
    $posts = get_posts($args);
    // Put back WP Touch PRO filter that removes categories from filter
    if (function_exists('classic_exclude_categories')) {
        add_filter('pre_get_posts', 'classic_exclude_categories');
    }
    // qtranslate run filter function on posts content
    if (function_exists('qtrans_postsFilter')) {
        $posts = qtrans_postsFilter($posts);
    }
    return $posts;
}