/var/www/leolaart.com/www/wp-content/plugins/polylang/integrations/jetpack
Edit: /var/www/leolaart.com/www/wp-content/plugins/polylang/integrations/jetpack/featured-content.php (3105B)
is_active() || false !== $featured_ids ) {
return $featured_ids;
}
$settings = Featured_Content::get_setting();
if ( ! $term = get_term_by( 'name', $settings['tag-name'], 'post_tag' ) ) {
return $featured_ids;
}
// Get featured tag translations
$tags = PLL()->model->term->get_translations( $term->term_id );
$ids = array();
// Query for featured posts in all languages
// One query per language to get the correct number of posts per language
foreach ( $tags as $tag ) {
$args = array(
'lang' => 0, // Avoid language filters.
'fields' => 'ids',
'numberposts' => Featured_Content::$max_posts,
'tax_query' => array(
array(
'taxonomy' => 'post_tag',
'terms' => (int) $tag,
),
),
);
// Available in Jetpack, but not in Twenty Fourteen.
if ( isset( Featured_Content::$post_types ) ) {
$args['post_type'] = Featured_Content::$post_types;
}
$_ids = get_posts( $args );
$ids = array_merge( $ids, $_ids );
}
$ids = array_map( 'absint', $ids );
set_transient( 'featured_content_ids', $ids );
return $ids;
}
/**
* Translates the featured tag id in featured content settings
* Mainly to allow hiding it when requested in featured content options
* Acts only on frontend
*
* @since 1.4
*
* @param array $settings featured content settings
* @return array modified $settings
*/
public function option_featured_content( $settings ) {
if ( $this->is_active() && PLL() instanceof PLL_Frontend && $settings['tag-id'] && $tr = pll_get_term( $settings['tag-id'] ) ) {
$settings['tag-id'] = $tr;
}
return $settings;
}
}