Quantcast
Channel: polylang – WordPress.org Forums
Viewing all articles
Browse latest Browse all 11471

matijsnijland on "Search results should show only Dutch or English posts (listings)"

$
0
0

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
         ";

Viewing all articles
Browse latest Browse all 11471

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>