• 13-12-2018, 18:00:29
    #1
    Merhabalar wordpress ana sayfamda 'tema panelinden' seçtiğim kategoriyi göstermek istiyorum. Tema panelimde şöyle bir kod oluşturdum.

    array(
              'id'             => 'cat-list',
              'type'           => 'select',
              'title'          => 'Kategori Seç',
              'options'        => 'categories',
              'query_args'     => array(
    		  'orderby'      => 'name',
              'order'        => 'ASC',
    		),
              'default_option' => 'bir kategori seç'
            ),

    Kategori yazılarını yansıtmak istediğim kısıma eklediğim basit kod ise

    <div class="haberler col-lg-4 col-md-4 col-sm-5 col-xs-12"> 
    	<div class="ha-title"><i class="far fa-newspaper"></i> Haberler & Duyurular</div>
    	<?php $recent = new WP_Query("cat=1&showposts=3"); while($recent->have_posts()) : $recent->the_post();?>
    	<div class="col-xs-12">
    	<div class="haberler-content"> 
    	<div class="haber-img"> 
    	<?php $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); if ( has_post_thumbnail() ) { ?> 
    	<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><img class="left" src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url[0]; ?>&w=100&h=90&zc=1" alt="<?php the_title(); ?>" width="100" height="90" /></a> 
    	<?php } else { ?> 
    	<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><img class="left" src="<?php bloginfo('template_url'); ?>/timthumb.php?src=noimage.jpg&w=100&h=90&zc=1" alt="<?php the_title(); ?>" width="100" height="90" /></a> 
    	<?php } ?>
    	</div>
    	<div class="haber-yaz">
    	<div class="haber-bas"> <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> </div>
    	<div class="haber-ic"> <?php the_excerpt(); ?> </div>
    	</div>
    	</div>
    	</div>
    	<?php endwhile; ?>
    	
    </div>
    Nasıl bir yol izlemeliyim. Kodu nasıl güncellemeliyim. Bu konuda bilgi verebilecek arkadaşlar yardımlarınızı bekliyorum.
  • 13-12-2018, 18:12:28
    #2
    Merhabalar,

    Kod yapısından anladığım kadarıyla panel olarak codestar kullanıyorsunuz, kodlarınızı aşağıdaki gibi güncelleyebilirsiniz.,

    <div class="haberler col-lg-4 col-md-4 col-sm-5 col-xs-12"> 
    ***<div class="ha-title"><i class="far fa-newspaper"></i> Haberler & Duyurular</div>
    ***<?php $recent = new WP_Query(array('showposts' => 3, 'cat' => cs_get_option('cat-list'))); while($recent->have_posts()) : $recent->the_post();?>
    ***<div class="col-xs-12">
    ***<div class="haberler-content"> 
    ***<div class="haber-img"> 
    ***<?php $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); if ( has_post_thumbnail() ) { ?> 
    ***<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><img class="left" src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url[0]; ?>&w=100&h=90&zc=1" alt="<?php the_title(); ?>" width="100" height="90" /></a> 
    ***<?php } else { ?> 
    ***<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><img class="left" src="<?php bloginfo('template_url'); ?>/timthumb.php?src=noimage.jpg&w=100&h=90&zc=1" alt="<?php the_title(); ?>" width="100" height="90" /></a> 
    ***<?php } ?>
    ***</div>
    ***<div class="haber-yaz">
    ***<div class="haber-bas"> <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> </div>
    ***<div class="haber-ic"> <?php the_excerpt(); ?> </div>
    ***</div>
    ***</div>
    ***</div>
    ***<?php endwhile; ?>
    ****
    </div>
  • 13-12-2018, 18:32:38
    #3
    truser adlı üyeden alıntı: mesajı görüntüle
    Merhabalar,

    Kod yapısından anladığım kadarıyla panel olarak codestar kullanıyorsunuz, kodlarınızı aşağıdaki gibi güncelleyebilirsiniz.,

    <div class="haberler col-lg-4 col-md-4 col-sm-5 col-xs-12"> 
    ***<div class="ha-title"><i class="far fa-newspaper"></i> Haberler & Duyurular</div>
    ***<?php $recent = new WP_Query(array('showposts' => 3, 'cat' => cs_get_option('cat-list'))); while($recent->have_posts()) : $recent->the_post();?>
    ***<div class="col-xs-12">
    ***<div class="haberler-content"> 
    ***<div class="haber-img"> 
    ***<?php $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); if ( has_post_thumbnail() ) { ?> 
    ***<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><img class="left" src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url[0]; ?>&w=100&h=90&zc=1" alt="<?php the_title(); ?>" width="100" height="90" /></a> 
    ***<?php } else { ?> 
    ***<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><img class="left" src="<?php bloginfo('template_url'); ?>/timthumb.php?src=noimage.jpg&w=100&h=90&zc=1" alt="<?php the_title(); ?>" width="100" height="90" /></a> 
    ***<?php } ?>
    ***</div>
    ***<div class="haber-yaz">
    ***<div class="haber-bas"> <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> </div>
    ***<div class="haber-ic"> <?php the_excerpt(); ?> </div>
    ***</div>
    ***</div>
    ***</div>
    ***<?php endwhile; ?>
    ****
    </div>

    Yardımınız için çok teşekkür ederim. Umarım başka arkadaşlarda faydalanabilir bu konudan. +