Hi Chouby,
The IF statement is now passed. I added return class_exists('Polylang_Core'), I hope that helps. Now the website does not return any posts. I checked pieces of the code on WP forums and found that p.ID is elsewhere mentioned as ID,somehow the SQL query is not working. Hope you can help? Regards, Matijs
global $polylang;
return class_exists('Polylang_Core');
if (isset($polylang) && class_exists('Polylang_Core') && $polylang instanceof Polylang_Core && isset($polylang->curlang))
{
$join.= "INNER JOIN $wpdb->term_relationships AS pll_tr ON pll_tr.object_id = p.ID";
$where.= $wpdb->prepare(" AND pll_tr.term_taxonomy_id = %d", $polylang->curlang->term_taxonomy_id);
}
$query = "
SELECT
p.*
FROM {$wpdb->base_prefix}posts p
$join
WHERE p.post_status = 'publish'
-- Only custom posts:
AND p.post_type IN ('$in_posts')
$where
$order_by
LIMIT $from, $count
";