• 08-07-2015, 01:15:20
    #1
    Arkadaşlar merhaba,

    Bana rastgele bir kategoriden rastgele bir içeriğin başlığı ve permalinkini verecek kod lazım.

    Örnekle anlatmak gerekirse:

    <a href="rastgele-yazi-linki">Rastgele Yazı Başlığı</a>
    Yardımcı olabilecek var mı?
  • 08-07-2015, 01:39:29
    #2
    ⭐ EN UCUZ CHATGPT 5.5⚡
    <?php $orig_post = $post;global $post;$categories = get_the_category($post->ID);if ($categories) {$category_ids = array();foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;$args=array( 'category__in' => $category_ids, 'post__not_in' => array($post->ID), 'posts_per_page'=> 1, 'orderby'=>'rand' );$my_query = new wp_query( $args );if( $my_query->have_posts()){echo '';while( $my_query->have_posts()){$my_query->the_post();?> <div id="hagiwhat"><a href="<? the_permalink()?>" title="<?php the_title();?>"><strong><?php the_title();?></strong></a></div><? }}}$post = $orig_post;wp_reset_query();?>
    buyur kardeşim, 'posts_per_page'=> 1, yazan yeri arttırabilirsin.
  • 08-07-2015, 02:16:35
    #3
    Hagiwhat adlı üyeden alıntı: mesajı görüntüle
    <?php $orig_post = $post;global $post;$categories = get_the_category($post->ID);if ($categories) {$category_ids = array();foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;$args=array( 'category__in' => $category_ids, 'post__not_in' => array($post->ID), 'posts_per_page'=> 1, 'orderby'=>'rand' );$my_query = new wp_query( $args );if( $my_query->have_posts()){echo '';while( $my_query->have_posts()){$my_query->the_post();?> <div id="hagiwhat"><a href="<? the_permalink()?>" title="<?php the_title();?>"><strong><?php the_title();?></strong></a></div><? }}}$post = $orig_post;wp_reset_query();?>
    buyur kardeşim, 'posts_per_page'=> 1, yazan yeri arttırabilirsin.
    Elinize sağlık hocam çok çok teşekkür ediyorum.
  • 08-07-2015, 02:22:35
    #4
    Oyun yüklersinde, Next next dersin ya o derece hızlı bir yanıt olmuş elinize sağlık