• 26-01-2020, 21:00:21
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Merhaba Arkadaşlar

    Wordpress ana sayfaya gelen ziyaretçiyi random olarak konulara yönlendirmek istiyorum. Ana sayfaya gelen ziyaretçiyi x saniye sonra websitemde bulunan konulardan herhangi bir tanesine random olarak yönlendirmek istiyorum. Her yönlendirmede farklı bir konuya gidecek ziyaretçi. Bunun için eklenti varmıdır acaba yoksa basit bir kod da olabilir.

    Yardımlarınız için şimdiden teşekkür ederim.
  • 26-01-2020, 21:03:28
    #2
    hocam ben şahsen gezdiğm sitede böyle bir olayla karşılaşmak istemem.
    haber sitelerinde bile admatic tam sayfa reklam çıkınca siteyi komple kapatıyrum
  • 26-01-2020, 21:08:28
    #3
    Hattushil adlı üyeden alıntı: mesajı görüntüle
    hocam ben şahsen gezdiğm sitede böyle bir olayla karşılaşmak istemem.
    haber sitelerinde bile admatic tam sayfa reklam çıkınca siteyi komple kapatıyrum
    Hocam etikliği ile ilgilenmiyorum, sadece böyle bir kod veya eklentiye ihtiyacım var.
  • 26-01-2020, 21:33:02
    #4
    Denesene bunu, öyle denemeden yazdım.

    <?php
    $categories = get_categories( array(
    'orderby' => 'name',
    'order' => 'ASC'
    ) );
    
    $random = rand(0, count($categories));
    
    $link = get_category_link( $categories[$random]->term_id );
    
    ?>
    setTimeout(function(){
         window.location = "<?php echo $link; ?>";
        }, 2000);
  • 26-01-2020, 21:40:14
    #5
    mustaizm adlı üyeden alıntı: mesajı görüntüle
    Denesene bunu, öyle denemeden yazdım.

    <?php
    $categories = get_categories( array(
    'orderby' => 'name',
    'order' => 'ASC'
    ) );
    
    $random = rand(0, count($categories));
    
    $link = get_category_link( $categories[$random]->term_id );
    
    ?>
    setTimeout(function(){
         window.location = "<?php echo $link; ?>";
        }, 2000);
    Hocam her iki koduda index.php ye ekliyorum dimi?
  • 26-01-2020, 21:41:26
    #6
    Estanzem adlı üyeden alıntı: mesajı görüntüle
    Hocam her iki koduda index.php ye ekliyorum dimi?
    Hocam FTP'den wp-content/themes/ ( temanızın adı ) / header.php ye ekleyebilirsin.
    yada footer.php ye fark etmez
  • 26-01-2020, 21:47:21
    #7
    mustaizm adlı üyeden alıntı: mesajı görüntüle
    Hocam FTP'den wp-content/themes/ ( temanızın adı ) / header.php ye ekleyebilirsin.
    yada footer.php ye fark etmez
    Temanın index.php'sine aşağıdaki gibi ekledim çalışmadı hocam. Temanın index.php sini basit html yönlendirme yaptığımda çalıştığı için buraya ekledim.

    <?php get_header(); ?>
    <?php
    $categories = get_categories( array(
    'orderby' => 'name',
    'order' => 'ASC'
    ) );
    
    $random = rand(0, count($categories));
    
    $link = get_category_link( $categories[$random]->term_id );
    
    ?>
    setTimeout(function(){
    window.location = "<?php echo $link; ?>";
    }, 2000);
  • 26-01-2020, 21:50:00
    #8
    Var elbette;

    /**
     * Custom post redirection 
     */
    
    add_action( 'wp_head','homepage_random_post_r10' ,2);
    
    function homepage_random_post_r10() { 
      if(is_home())
      {
        foreach ( get_posts ( array( 'posts_per_page' => 1, 'orderby' => 'rand' ) ) as $post ) {  
          echo '<meta data-fr-http-equiv="refresh" content="3;url='.get_permalink ( $post->ID ).'" />';
        }
      }
    }
    Kodun içerisindeki 3 rakamı saniye ifade eder, bunu istediğiniz gibi değiştirebilirsiniz.
    functions.php eklemeniz gerekiyor bilginize.
  • 26-01-2020, 21:50:03
    #9
    Estanzem adlı üyeden alıntı: mesajı görüntüle
    Temanın index.php'sine aşağıdaki gibi ekledim çalışmadı hocam. Temanın index.php sini basit html yönlendirme yaptığımda çalıştığı için buraya ekledim.

    <?php get_header(); ?>
    <?php
    $categories = get_categories( array(
    'orderby' => 'name',
    'order' => 'ASC'
    ) );
    
    $random = rand(0, count($categories));
    
    $link = get_category_link( $categories[$random]->term_id );
    
    ?>
    setTimeout(function(){
    window.location = "<?php echo $link; ?>";
    }, 2000);
    Hocam aşağıdaki kodu script taglarına alın

    küçüktür işaret script>
    setTimeout(function(){
    window.location = "<?php echo $link; ?>";
    }, 2000);
    küçüktür işaret / script>

    Ben script içine alıp burda cevapla deyince r10 hata veriyor ondan yazamadım