Bir yada daha fazla kategoride farklı single.php kullanmak istiyorum. ama yapamadım yardımcı olacakların mesajını bekliyorum..
single.php kodu:
<?php get_header();?>
<section id="maincontent">
<div class="clearfix"></div>
<div class="container container_12">
<?php while(have_posts()): the_post(); ?>
<div class="grid_12"><div class="textdev"><h3 class="fword"><?php the_title();?></h3><div></div></div></div>
<div class="clearfix"></div>
<!-- LEFT -->
<section id="maincontent">
<!-- BREADCRUMBS -->
<div class="container_12">
<div class="grid_6">
<ul class="breadcrumbs inline-list">
<li><a href="<?php bloginfo('url');?>">Anasayfa</a></li>
<li><a href="<?php the_permalink(); ?>"><?php the_category('- '); ?></a></li>
<li><?php the_title();?></li>
</ul>
</div>
<div class="clearfix"></div>
</div>
<!-- CONTENT/ARTIKEL -->
<div class="container_12">
<div class="grid_4">
<div class="widgetbox darkblue">
<h4><i class="icon-comments"></i>Son Yorumlar</h4>
<?php
$yorumlar = get_comments('number=5&status=approve'); // 5 yorum,durum : onaylı
foreach($yorumlar as $yorum) :
?>
<article class="comitem">
<div class="grid_3">
<div class="comthumb"><?php echo get_avatar( $comment, 60 ); ?></div>
</div>
<div class="grid_9">
<strong><?php the_author();?></strong> <em><?php comment_excerpt( $yorum->comment_ID ); ?> </em>
</div>
</article>
<?php endforeach; ?>
</div>
<div class="widgetbox grey">
<h4><i class="icon-bookmark"></i>Kategoriler</h4>
<ul class="categorylist">
<?php wp_list_categories('title_li=&');?>
</ul>
</div>
</div>
<div class="grid_8">
<!-- LOOP HERE... PUT THE QUERY HERE -->
<article class="singlepost">
<header>
<!-- THUMB -->
<div class="foowid">
<div class="featuredslides">
<ul class="slides">
<?php $resim = get_post_meta ($post->ID,"resim",true);
if($resim){
?>
<li>
<img src="<?php echo $resim; ?>" style="width:400px;height:500px;">
<div class="capcontain">
<div class="slidetitle">
<div class="slidedate"><?php the_time('d M Y');?></div>
<div class="clear"></div>
<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
</div>
</div>
</li>
<?php } ?>
<?php $resim1 = get_post_meta ($post->ID,"resim1",true);
if($resim1){
?>
<li>
<img src="<?php echo $resim1; ?>" style="width:400px;height:500px;">
<div class="capcontain">
<div class="slidetitle">
<div class="slidedate"><?php the_time('d M Y');?></div>
<div class="clear"></div>
<h2><?php the_title();?></h2>
</div>
</div>
</li>
<?php } ?>
<?php $resim2 = get_post_meta ($post->ID,"resim2",true);
if($resim2){
?>
<li>
<img src="<?php echo $resim2; ?>" style="width:400px;height:500px;">
<div class="capcontain">
<div class="slidetitle">
<div class="slidedate"><?php the_time('d M Y');?></div>
<div class="clear"></div>
<h2><?php the_title();?></h2>
</div>
</div>
</li>
<?php } ?>
<?php $resim3 = get_post_meta ($post->ID,"resim3",true);
if($resim3){
?>
<li>
<img src="<?php echo $resim3; ?>" style="width:400px;height:500px;">
<div class="capcontain">
<div class="slidetitle">
<div class="slidedate"><?php the_time('d M Y');?></div>
<div class="clear"></div>
<h2><?php the_title();?></h2>
</div>
</div>
</li>
<?php } ?>
<?php $resim4 = get_post_meta ($post->ID,"resim4",true);
if($resim4){
?>
<li>
<img src="<?php echo $resim4; ?>" style="width:400px;height:500px;">
<div class="capcontain">
<div class="slidetitle">
<div class="slidedate"><?php the_time('d M Y');?></div>
<div class="clear"></div>
<h2><?php the_title();?></h2>
</div>
</div>
</li>
<?php } ?>
<?php $resim5 = get_post_meta ($post->ID,"resim5",true);
if($resim5){
?>
<li>
<img src="<?php echo $resim5; ?>" style="width:400px;height:500px;">
<div class="capcontain">
<div class="slidetitle">
<div class="slidedate"><?php the_time('d M Y');?></div>
<div class="clear"></div>
<h2><?php the_title();?></h2>
</div>
</div>
</li>
<?php } ?>
<?php $resim6 = get_post_meta ($post->ID,"resim6",true);
if($resim6){
?>
<li>
<img src="<?php echo $resim6; ?>" style="width:400px;height:500px;">
<div class="capcontain">
<div class="slidetitle">
<div class="slidedate"><?php the_time('d M Y');?></div>
<div class="clear"></div>
<h2><?php the_title();?></h2>
</div>
</div>
</li>
<?php } ?>
<?php $resim7 = get_post_meta ($post->ID,"resim7",true);
if($resim7){
?>
<li>
<img src="<?php echo $resim7; ?>" style="width:400px;height:500px;">
<div class="capcontain">
<div class="slidetitle">
<div class="slidedate"><?php the_time('d M Y');?></div>
<div class="clear"></div>
<h2><?php the_title();?></h2>
</div>
</div>
</li>
<?php } ?>
<?php $resim8 = get_post_meta ($post->ID,"resim8",true);
if($resim8){
?>
<li>
<img src="<?php echo $resim8; ?>" style="width:400px;height:500px;">
<div class="capcontain">
<div class="slidetitle">
<div class="slidedate"><?php the_time('d M Y');?></div>
<div class="clear"></div>
<h2><?php the_title();?></h2>
</div>
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
<div class="clearfix"></div>
<!-- META -->
<div class="singleMeta">
<div class="grid_2 alpha omega">
<?php echo get_avatar( $comment, 70 ); ?>
</div>
<div class="grid_4 ">
<i class="icon-user"></i> by <a href="#"><?php the_author();?></a> <br/>
<i class="icon-time"></i><?php the_time('d M Y');?><br/>
<i class="icon-bookmark-empty"></i> <a href="<?php the_permalink(); ?>"><?php the_category('- '); ?></a><br/>
<i class="icon-comments"></i> <a href="#"><?php comments_number('Yorum Yok', '1 Yorum ', '% Yorum' );?></a><br>
<i class="icon-eye-open"></i> <a href="#"><?php setPostViews(get_the_ID()); ?><?php echo getPostViews(get_the_ID()); ?></a>
</div>
<br><br><br><br>
<ul class="fadeout">
<a href="http://www.facebook.com/share.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>" title="Facebookta Paylaş" target='_blank'><i class="icon-facebook"></i>Facebook</a>
<a href="http://twitter.com/home/?status=<?php the_permalink();?>&t=<?php the_title(); ?>" title="Twitterda Paylaş" target='_blank'><i class="icon-twitter"></i>Twitter</a>
<a href="https://plus.google.com/share?url=<?php the_permalink();?>&t=<?php the_title(); ?>" title="Google Plusda Paylaş" target='_blank'><i class="icon-google-plus"></i>Google+</a>
</ul>
</div>
</header>
<div class="clearfix"></div>
<div class="devide"></div>
<div class="content-entry">
<h2><?php the_title();?></h2>
<p><?php the_content();?></p>
</div>
<div class="clearfix"></div>
<div class="clearfix"></div>
<div class="devide"></div>
<footer>
<!-- TAGS -->
<div class="content-entry content-tags">
<b>Etiketler:<b> <?php the_tags( '
', ', ', '
'); ?>
</div>
<div class="clearfix"></div><div class="devide"></div>
<!-- AUTHOR BOX -->
<div class="content-entry">
<div class="authorbox">
<div class="grid_2 alpha">
<img src="<?php echo get_option('uur_adminfoto'); ?>" style=" width:75x; height:75px;"/>
</div>
<div class="grid_10 omega">
<h4><a href="#">Müşteri Temsilcisi</a> İletişim </h4>
<?php echo get_option('uur_admin'); ?>
</div>
</div>
</div><div class="clearfix"></div>
</footer>
<div class="clearfix"></div><div class="devide"></div>
<!-- RELATED -->
<div class="content-entry related">
<div class="grid_12">
<h3>Benzer Yazılar</h3>
</div>
<?php
$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),
'showposts'=>3, // Gösterilecek benzer yazı sayısı
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo '';
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<div class="grid_4">
<?php $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); if ( has_post_thumbnail() ) { ?>
<img class="left" src="<?php echo $image_url[0]; ?>" width="218" height="116" />
<?php } else { ?>
<?php $resim = get_post_meta ($post->ID,"resim",true);?>
<img src="<?php echo $resim; ?>" style=" width:218px; height:116px;"/>
<?php } ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h2>
</div>
<?php
}
echo '';
}
wp_reset_query();
}
?>
</div>
</article>
<!-- END/CLOSE THE QUERY HERE -->
<div class="clearfix"></div>
<!-- Start Comment -->
<div class="comments">
<h3 class="fword"><?php comments_number('Yorum Yok', '1 Yorum ', '% Yorum' );?></h3>
<div class="clearfix"></div><br/>
<!-- FORM -->
<?php comments_template();?>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</section>
<?php endwhile; ?>
<div class="clearfix"></div>
<?php get_footer();?>
burada amacım 400 ve 500 olan yükseklik-genişlik ayarını 700 genişlik olarak ayarlamak. yardımcı olacak arkadaşlar konuya kodun düzenlenmiş halini yazabilirse daha sonra aynı sorunla karşılaşanlara da yardımcı olacaktır.
ben tema içerisine single-genis.php adlı bir tane daha oluşturdum ve en başına şu kodu ekledim
<?php
#post;
if (in_category(8)) {
include (TEMPLATEPATH./single-genis.php);
return;
}
buradaki 8 değeri çağırmak istediğim kategori id numarasıdır
ama single-genis.php yi çağıramadım
CEVAP BELKİ BİR BAŞKASININ İŞİNİ GÖRÜR.
wp temamdaki single.php içerisindeki kodu komple bir yere kopyaladıktan sonra single.php içini komple temizleyip sadece şu kodu ekliyoruz.
<?php if (in_category(BURAYA KATEGORİ NUMARASI YAZIYORUZ)) : ?>
<?php include (TEMPLATEPATH . '/single2.php'); ?>
<?php elseif (in_category(BURAYA KATEGORİ NUMARASI YAZIYORUZ)): ?>
<?php include (TEMPLATEPATH . '/single3.php'); ?>
<?php else : ?>
<?php include (TEMPLATEPATH . '/single1.php'); ?>
<?php endif ; ?>
KODUMUZDA ŞU DEMEK OLUYOR.
EĞER bir kategoriyi single2.php içerisinde göstermek istiyorsak o kategori id numarasını BURAYA KATEGORİ NUMARASI YAZIYORUZ yazısını silip içerisine o kategorinin numarasını giriyoruz.
EĞER bir kategoriyi single3.php içerisinde göstermek istiyorsak o kategori id numarasını BURAYA KATEGORİ NUMARASI YAZIYORUZ yazısını silip içerisine o kategorinin numarasını giriyoruz.
bunların dışında kalan kategoriler ise single1.php içerisinde gösterilsin demek oluyor.
şimdi en başta bir yere kopyaladığımız single.php içeriğinde gerekli editlemeleri yapıyoruz ve single1.php single2.php single3.php gibi 3 tane hazırlayıp tema klasörümüze atıyoruz. birbirine göre hangi farkı koyacaksak o single içerisinde istediğimiz değişikliği yapabiliriz..
cevaplayan ve yardımcı olan https://www.r10.net/members/21177-tylerdurden.html arkadaşımıza çok teşekkür ediyorum