[Closed] Slider is showing all slides

Home Support English Support [Closed] Slider is showing all slides

This topic contains 7 replies, has 3 voices, and was last updated by  Gaspar 2 years, 3 months ago. The support staff assigned to this topic is Harshad.

Viewing 8 posts - 1 through 8 (of 8 total)
Author Posts
Author Posts
February 27, 2012 at 8:13 pm #49067

Samir

All slides with both language English and Arabic are displayed in the Page?

How can I fix this issue, although I have checked the slider to be translated.

February 27, 2012 at 8:23 pm #49071

Harshad
Forum moderator

Hello,

WPML hooks to WP API functions such as get_posts and others.

It filters their results so that they would return only items in the current language.

For this to happen, filters must be applied. To tell WordPress that filters are applied, you need to include 'suppress_filters' => false.

This Codex pages explains get_posts:
http://codex.wordpress.org/Template_Tags/get_posts

As you can see, suppress_filters is true by default. So, in order to get language filtering, you need to specifically set it to false when you make that call.

It's impossible for us to provide the complete solution based on this code snip.

Check how the arguments for get_posts are assembled and add the 'suppress_filters' => false attribute to them.

For example:
get_posts(array('suppress_filters' => false))

Thanks,

Harshad

February 28, 2012 at 2:17 pm #49179

Samir

This is my Code so where I should add the 'suppress_filters' => false, As you see I found many get_post functions, Appreciate your help.

<div id="slider" class="nivoSlider">
<?php $posts_counter = 0; ?>
<?php
query_posts("post_type=slider&posts_per_page=-1&post_status=publish");
while ( have_posts() ) : the_post(); $posts_counter++;
?>
<?php

$custom = get_post_custom($post->ID);
$url = get_post_custom_values("slider-url");
$sl_thumb = $custom["thumb"][0];
$sl_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'slider-post-thumbnail');
$tab_title = get_post_custom_values("tab-title");
?>
<?php if(has_post_thumbnail( $the_ID) || $sl_thumb!=""){ ?>

<?php if($url!=""){ ?>
<?php if($sl_thumb!=""){
echo "<a href='" . $url[0] . "'>";
echo "<img src='" . $sl_thumb . "' alt='";
echo $tab_title[0];
echo "' title='#sliderCaption" . $posts_counter . "' />";
echo "</a>";
} else{
echo "<a href='" . $url[0] . "'>";
echo "<img src='";
echo $sl_image_url[0];
echo "' alt='";
echo $tab_title[0];
echo "' title='#sliderCaption" . $posts_counter . "' />";
echo "</a>";
} ?>
<?php }else{ ?>
<?php if($sl_thumb!=""){
echo "<img src='" . $sl_thumb . "' alt='";
echo $tab_title[0];
echo "' title='#sliderCaption" . $posts_counter . "' />";
} else{
echo "<img src='";
echo $sl_image_url[0];
echo "' alt='";
echo $tab_title[0];
echo "' title='#sliderCaption" . $posts_counter . "' />";
} ?>
<?php } ?>

<?php } ?>
<?php endwhile; ?>
<?php wp_reset_query();?>
</div>
<?php $posts_counter = 0; ?>
<?php
query_posts("post_type=slider&posts_per_page=-1&post_status=publish");
while ( have_posts() ) : the_post(); $posts_counter++;
?>
<?php
$custom = get_post_custom($post->ID);
?>
<div id="sliderCaption<?php echo $posts_counter ?>" class="nivo-html-caption">
<?php the_content(); ?>
</div>
<?php endwhile; ?>
<?php wp_reset_query();?>

February 28, 2012 at 2:21 pm #49181

Harshad
Forum moderator

Hello Samir,

Add it to

query_posts("post_type=slider&posts_per_page=-1&post_status=publish&suppress_filters=false");

Thanks,

Harshad

February 28, 2012 at 2:34 pm #49185

Samir

http://www.etechwave.com/wordpress/

Please check the website, all slides are displayed although I added the code as you mentioned above. :(

February 28, 2012 at 3:22 pm #49193

Harshad
Forum moderator

Hello Samir,

Can you please send your wp admin details and the filename where code is present to my email address?

I will further investigate on your issue(s).

Thanks,

Harshad

February 29, 2012 at 6:17 pm #49379

Samir

Thanks alot Harshad

April 16, 2012 at 12:26 pm #55797

Gaspar

It´s works.

I found this code in my site:

<?php
//get custom post type === > Slides
global $post;
$args = array(
'post_type' =>'slides',
'numberposts' => -1,
'order' => 'ASC',
);
$slides = get_posts($args);
?>

…then I add this line code ('suppress_filters' => false)

<?php
//get custom post type === > Slides
global $post;
$args = array(
'post_type' =>'slides',
'numberposts' => -1,
'order' => 'ASC',
'suppress_filters' => false
);
$slides = get_posts($args);
?>

I hope that helps a others…

THANXS HARSHAD

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘[Closed] Slider is showing all slides’ is closed to new replies.