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 everyone,I'm stuck and have some php experience, but this aspect is not working out:

I am using the custom Smooth Pro theme and the Polylang plugin. Included with the theme is a search widget. The bottom 4 search categories produce post results in English and Dutch. I would like only the language specific post results to be echoed.

You can see the problem at: http://www.hvhrentals.nl

The relevant code is:

<?php

$query = new WP_Query( 'category_name=staff' );

	$args = array(
	'order'          => 'ASC',
	'orderby'        => 'menu_order',
	'post_type'      => 'attachment',
	'post_parent'    => $post->ID,
	'post_mime_type' => 'image',
	'post_status'    => null,
	'numberposts'    => 1,
	'lang'           => 'en',
	);

	$attachments = get_posts($args);
	if ($attachments) {
	    foreach ($attachments as $attachment) {

	    echo '<a href='.$surl.'/'.$post->post_name.'>'.wp_get_attachment_image($attachment->ID, 'thumbnail_results').'<span class="'.$fields['statustag'].'"></span></a>';
	}
} ?>
</div>
<div class="common_right hideOnSearch">
<span class="results-price"><?php   	include(TEMPLATEPATH."/functions/var/default-box-one.php");
  	include(TEMPLATEPATH."/functions/var/default-box-two.php");
  	include(TEMPLATEPATH."/functions/var/default-box-three.php"); echo $symbols['currency']; echo $fields['price']; ?></span> | <span class="results-meta"><?php echo $fields2['bedrooms']; echo ' '.$options['bedroomstext']; ?></span> - <span class="results-meta"><?php echo $fields2['bathrooms']; echo ' '.$options['bathroomstext']; ?></span> | <span class="results-meta"><?php echo $fields['propertytype']; ?></span><br/>

<div class="excerpt_listing">

 <?php
		$values = get_post_meta($post->ID, 'door', true);
		 foreach($values as $value) {
add_filter( 'custom_filter', 'wpautop' );
echo apply_filters( 'custom_filter', rtrim(substr($value.'…',0,160)).'...<a class="more" href='.$post->post_name.'>more</a>' );
} ?>
</div>
<?php
 echo nmbrpics($post->ID);
?>
</div>
  <div style="clear:both"></div>
</li>
<div class="listing_divider hideOnSearch"></div>
			<?php endforeach; else: ?>
				<p style="padding:30px;"><?php _e('Sorry, helaas geen resultaten.','belair');?></p>
			<?php endif; ?>

			<div class="pagination">
			<?php cps_show_pagination() ?><br/>
		</div>
		</div>
		</ul>
	</div>
	<?php

Viewing all articles
Browse latest Browse all 11471

Trending Articles



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