0

The slider I made lists the first article 2 times.

enter image description here

enter image description here

They said I could solve this problem using "post__not_in".

Could you help me figure out how to do this?

<div id="banner">
    <div id="anaslayt" class="col-xs-12 col-sm-12">
<?php query_posts('showposts=10&cat=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
            <a class="slidesjs-slide" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
            <?php if(has_post_thumbnail()) { the_post_thumbnail(); } 
            elseif( $thumbnail = get_post_meta($post->ID, 'resim', true) ){  ?>    
            <img src ="<?php echo $thumbnail; ?>" alt="<?php the_title(); ?>"  title = "<?php the_title(); ?>" /></a>
            <?php } ?>
            <div class="yaziarka">
            <span class="yazi"><?php the_title(); ?></span>
            </div>
<?php endwhile; ?>
    </div>
    <div id="sabitbanner" class="pull-right hidden-sm hidden-xs">
    <div class="yatayhaber">


<?php query_posts('showposts=1&cat=1&posts_per_page=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
            <?php if(has_post_thumbnail()) { the_post_thumbnail(); } 
            elseif( $thumbnail = get_post_meta($post->ID, 'resim', true) ){  ?>    
            <img src ="<?php echo $thumbnail; ?>" alt="<?php the_title(); ?>"  title = "<?php the_title(); ?>" />
            <?php } ?>
            <span class="yazi pull-left col-md-12"><?php the_title(); ?></span>


    <?php query_posts('showposts=2&&cat=1&offset=1'); ?>

        <?php while (have_posts()) : the_post(); ?>
    <div class="dikeyhaber">
        <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
        <?php if(has_post_thumbnail()) { the_post_thumbnail(); } 
        elseif( $thumbnail = get_post_meta($post->ID, 'resim', true) ){  ?>    
        <img src ="<?php echo $thumbnail; ?>" alt="<?php the_title(); ?>"  title = "<?php the_title(); ?>" />
        <?php } ?>
        <span class="yazi pull-left col-md-12"><?php the_title(); ?></span></a>


  • What did you try so far? I don't see "post__not_in" in your code – BenB Mar 29 '18 at 14:19
  • Dear BenB, I could not intervene because I did not know how to use "post__not_in". I was just told to use "post__not_in" to solve this problem. But I did not make use of it. – Ibrahim Yavuz Mar 29 '18 at 14:26
  • Take a look at the docs codex.wordpress.org/Class_Reference/WP_Query search for "post__not_in – BenB Mar 29 '18 at 14:39
  • OMG, do you really need 3 queries just to get 4 latest posts? It's very, very inefficient. And even worse, since you use query_posts and not your own WP_Query... Could you update your question and explain how the HTML structure should look like? – Krzysiek Dróżdż Mar 30 '18 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.