• 16-03-2020, 09:10:11
    #1
    Arkadaşlar slider da başlık resim ve açıklamaları çekebiliyorum ama başlığa link veremedim yardımcı olursanız sevinirim.

    <?php
    $slides = array();
    $args = array('category_name' => 'haberler', 'nopaging'=>true, 'posts_per_page'=>5 );
    $slider_query = new WP_Query( $args );
    if ( $slider_query->have_posts() ) {
    while ( $slider_query->have_posts() ) {
    $slider_query->the_post();
    if(has_post_thumbnail()){
    $temp = array();
    $thumb_id = get_post_thumbnail_id();
    $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'full', true);
    $thumb_url = $thumb_url_array[0];
    $temp['title'] = get_the_title();
    $temp['excerpt'] = get_the_excerpt();
    $temp['image'] = $thumb_url;
    $slides[] = $temp;
    }
    }
    }
    wp_reset_postdata();
    ?>
    
    <?php if(count($slides) > 0) { ?>
    
    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
    
    <ol class="carousel-indicators">
    <?php for($i=0;$i<count($slides);$i++) { ?>
    <li data-target="#carousel-example-generic" data-slide-to="<?php echo $i ?>" <?php if($i==0) { ?>class="active"<?php } ?>></li>
    <?php } ?>
    </ol>
    
    <div class="carousel-inner" role="listbox">
    <?php $i=0; foreach($slides as $slide) { extract($slide); ?>
    <div class="carousel-item<?php if($i == 0) { ?> active<?php } ?>">
    <img src="<?php echo $image ?>" alt="<?php echo esc_attr($title); ?>">
    <div class="carousel-caption"><h3><?php echo $title; ?></h3><p><?php echo $excerpt; ?></p></div>
    </div>
    <?php $i++; } ?>
    </div>
    
    <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span><span class="sr-only">Previous</span></a>
    <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span><span class="sr-only">Next</span></a>
    
    </div>
    
    <?php } ?>
    <?php the_permalink(); ?>
    kullandığım zaman aynı içeriğin linkini çekiyor
  • 16-03-2020, 09:27:59
    #2
    <a rel="nofollow" href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">


    Bir de bu şekilde deneyin.
    Kolay gelsin, iyi forumlar sevgi ve saygı ile.
    Selametle
  • 16-03-2020, 09:55:51
    #3
    kiokhan adlı üyeden alıntı: mesajı görüntüle
    <a rel="nofollow" href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">


    Bir de bu şekilde deneyin.
    Kolay gelsin, iyi forumlar sevgi ve saygı ile.
    Selametle
    Güzel temmenileriniz için teşekkürler bu şekilde
    <a href="<?php the_permalink() ?>"><img src="<?php echo $image ?>" title="<?php the_title_attribute(); ?>" alt="<?php echo esc_attr($title); ?>"></a>
    <div class="carousel-caption"><h3><?php echo $title; ?></h3><p><?php echo $excerpt; ?></p></div>
    düzenledim olmadı maalesef
  • 16-03-2020, 10:02:25
    #4
    <h3> Etiketinden önce kullanmayı denediniz mi.
  • 16-03-2020, 10:03:54
    #5
    h3 etiketinin içine a href ekleyin kaynak yoluna da the_permalink() kodunu ekleyin.
  • 16-03-2020, 15:50:25
    #6
    hallettim arkadaşlar teşekkürler
  • 16-03-2020, 21:18:38
    #7
    Nasıl yaptığınızı konuya eklerseniz diğer arkadaşlara da yardımcı olmuş olursunuz.
    Saygı ve sevgi ile iyi forumlar dilerim.
    selametle.