• 25-10-2019, 00:53:18
    #1
    Arkadaşlar bunu nasıl anlaşılır dilde izah edeceğim bende bilmiyorum. Hadi hayırlısı.
    Tema ayarlarında seçebildiğim 4 kategori hakkım var. Bunları seçtiğimde ana sayfada 4 kategoriye ait 1 er adet resimli yazı yan yana şık bir şekilde görülüyor. İndex.php de bu kategorileri çalıştıran kod aşağıdaki gibidir. Bu kodu kopyalayıp yine aynı şekilde index.php ye yapıştırınca aynı ketagori ve yazılar 2 şer adet oluyor. Buraya kadar anlatabildim umarım. Sizlerden isteğim bu kodları kullanarak ben istediğim kategori idi belirleyip farklı kategorilere ait yazılarıda göstermek istiyorum ama nasıl olacak beceremedim. Saygılar sevgiler.

    <div id="cat-last-post-wrapper">
    <div class="cat-last-posts">
    <?php $cat1id = get_option('nega_cat_id1'); global $post; $args = array( 'numberposts' => 1, 'offset'=> 0, 'category' => $cat1id ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?>
    <div calss="cat-post">



    <h2 class="cat-title">
    <?php the_category (', '); ?>
    </h2>
    <p class="cat-icon">
    <img width="50" height="50" src="<?php echo get_option('nega_cat_icon1'); ?>" alt="cat image" />
    </p>
    <p class="cat-post-title">
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    </p>
    <p class="cat-post-excerpt">
    <?php echo get_excerpt(100); ?>
    </p>
    </div>
    <?php endforeach; ?>
    </div>
    <div class="cat-last-posts">
    <?php $cat2id = get_option('nega_cat_id2'); global $post; $args = array( 'numberposts' => 1, 'offset'=> 0, 'category' => $cat2id ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?>
    <div calss="cat-post">
    <h2 class="cat-title">
    <?php the_category (', '); ?>
    </h2>
    <p class="cat-icon">
    <img width="50" height="50" src="<?php echo get_option('nega_cat_icon2'); ?>" alt="cat image" />
    </p>
    <p class="cat-post-title">
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    </p>
    <p class="cat-post-excerpt">
    <?php echo get_excerpt(100); ?>
    </p>
    </div>
    <?php endforeach; ?>
    </div>
    <div class="cat-last-posts">
    <?php $cat3id = get_option('nega_cat_id3'); global $post; $args = array( 'numberposts' => 1, 'offset'=> 0, 'category' => $cat3id ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?>
    <div calss="cat-post">
    <h2 class="cat-title">
    <?php the_category (', '); ?>
    </h2>
    <p class="cat-icon">
    <img width="50" height="50" src="<?php echo get_option('nega_cat_icon3'); ?>" alt="cat image" />
    </p>
    <p class="cat-post-title">
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    </p>
    <p class="cat-post-excerpt">
    <?php echo get_excerpt(100); ?>
    </p>
    </div>
    <?php endforeach; ?>
    </div>
    <div class="cat-last-posts">
    <?php $cat4id = get_option('nega_cat_id4'); global $post; $args = array( 'numberposts' => 1, 'offset'=> 0, 'category' => $cat4id ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?>
    <div calss="cat-post">
    <h2 class="cat-title">
    <?php the_category (', '); ?>
    </h2>
    <p class="cat-icon">
    <img width="50" height="50" src="<?php echo get_option('nega_cat_icon4'); ?>" alt="cat image" />
    </p>
    <p class="cat-post-title">
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    </p>
    <p class="cat-post-excerpt">
    <?php echo get_excerpt(100); ?>
    </p>
    </div>
    <?php endforeach; ?>
    </div>
    </div>
  • 26-10-2019, 22:53:01
    #2
    Yokmu yardımcı olacak birisi arkadaşlar