• 29-04-2014, 16:52:14
    #1
    Üyeliği durduruldu
    Merhaba arkadaşlar. Wordpresste tema kodlarken bir kaç sıkıntı yaşadım. Arkadaşlar, wordpressde category.php sayfam kategoriye ait haberleri çekmiyor karışık çekiyor. Aşağıda category.php sayfamı paylaştım.

    @saintx yardım edersen sevinirim.


    <?php include('inc/header.php'); ?>
    <?php include ('manset1.php');?>		
    <?php wp_reset_query();?>		
    
    
    
    <div class="kategoribaslik"><h1><?php wp_title(''); ?> Kategorisindeki Haberler Aşağıda Listelendi</h1></div>
    <div class="p10"></div>
    
    <div class="betaek_8 first">
    			<!-- Headline -->
    			<div id="headline">
    				
    				
    				<div class="news">
    				<?php query_posts("showposts=1orderby=date&cat=".the_category_id('')."");
    		         while (have_posts()) : the_post(); ?>
    					<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="selected">
    							<p><?php the_title(); ?></p>
    						 <?php if ( has_post_thumbnail() ): $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); $image_url = $image_url[0]; else: $image_url = get_post_meta($post->ID, "resim", true); endif; ?>		
    						<img width="628" height="304" alt="<?php the_title(); ?>" src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url; ?>&w=628&h=304&zc=0"  /> 
    						<strong><?php the_title(); ?></strong>
    					</a>
    					<?php endwhile; ?>
    					<?php query_posts("showposts=19&offset=1&orderby=date&cat=".the_category_id('')."");
    		         while (have_posts()) : the_post(); ?>
    					
    					<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="mainLink cuff">
    						<p><?php the_title(); ?></p>
    						 <?php if ( has_post_thumbnail() ): $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); $image_url = $image_url[0]; else: $image_url = get_post_meta($post->ID, "resim", true); endif; ?>		
    						<img width="628" height="304" alt="<?php the_title(); ?>" src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url; ?>&w=628&h=304&zc=0"  /> 
    						<strong><?php the_title(); ?></strong>
    					</a>
    					<?php endwhile; ?>
    					
    				</div>
    				
    		</div>
    		<div class="clear"></div>
    		<!-- /Headline 1-->	
    		<div class="clear"></div>
    
    	<ul class="categories_news">
    	<?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    	
    		<li>
    			<a href="<?php the_permalink() ?>">
    				 <?php if ( has_post_thumbnail() ): $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); $image_url = $image_url[0]; else: $image_url = get_post_meta($post->ID, "resim", true); endif; ?>		
    						<img width="143" height="100" alt="<?php the_title(); ?>" src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url; ?>&w=143&h=100&zc=0"  /> 
    				<strong><?php the_title(); ?></strong>
    				<p><?php the_content_rss('', TRUE, '', 10); ?></p>
    				<span><?php the_time('j F Y - l') ?></span>
    			</a>
    		</li>
    		<?php endwhile; ?> 		
      <?php endif; ?>
      
    	</ul>
    	<?php sayfalama(); ?>
    </div>
    
    <?php include ('sidebar.php');?>
    <div class="clear"></div>
    
    
    
    	</div>
    
    <?php include('footer.php');?>
  • 29-04-2014, 20:43:09
    #2
    Üyeliği durduruldu
    Aslında hatanı söylerdim ama saintx 'a sormuşsun foruma değil keşke bunu özel mesaj ile sorsaydın. mağlum bir kişiye sormak için konu açılmaz
  • 30-04-2014, 14:39:36
    #3
    Üyeliği durduruldu
    mka688 adlı üyeden alıntı: mesajı görüntüle
    Aslında hatanı söylerdim ama saintx 'a sormuşsun foruma değil keşke bunu özel mesaj ile sorsaydın. mağlum bir kişiye sormak için konu açılmaz
    abi, saintx arkadaşımıza önceden ulaşmıştım ama görmedi herhalde. Yardımcı olursan sevinirim. İşin içinden çıkamadım bir türlü.
  • 30-04-2014, 14:58:43
    #4
    Üyeliği durduruldu
    Kategorinin zaten içindeyken tekrardan ID belirtmene gerek yok. Aşağıda örnek category.php var. Bundan yararlanarak yapabilirsin.


     <?php get_header(); ?>  
    		
    <div id="siteyi-topla">
        <div id="orta-kisim">
            <div id="yazi-kismi">
                	
    			
                <div id="kategori-baslik">
                    <h1>"<?php single_cat_title()?>" kategorisindeki yazılar:</h1>
                </div>
    			
    			
    			<?php while (have_posts()) : the_post(); ?>	
    			
                                <div class="yazilar">
                        <div class="yazi-resimleri">
                            <a href="<?php the_permalink(); ?>"><img width="201" height="155" src="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID)); ?>" class="resim wp-post-image" alt="<?php the_title(); ?>" /></a>
                        </div>
                        <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
                        <div class="yazi-bilgileri">
                            <div class="yazar">
                                <?php the_author(); ?>                     </div>
                            <div class="tarih">
                                <?php the_time('j F Y') ?>                        </div>
                            <div class="yorum">
                                <span class="dsq-postid" rel="<?php the_ID(); ?> <?php the_permalink(); ?>"><?php comments_number('Yorum Yok', '1 Yorum ', '% Yorum' );?></span>                      </div>
                        </div>
                        <div class="yazi">
                            <?php excerpt('15'); ?>                    </div>
                        <div class="devamini-oku">
                            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">DEVAMINI OKU</a>
                        </div>
                    </div>
                             
                      <?php endwhile; ?>          
                          
                             
        
    
                <div id="sayfalama">
    				<div class='wp-pagenavi'>
    
    <?php sayfalama(); ?>
    
    
    </div>            </div>
                        </div>
    								
    								
    <?php get_sidebar(); ?>  
     
    <?php get_footer(); ?>
  • 30-04-2014, 15:43:46
    #5
    Üyeliği durduruldu
    Gibberring adlı üyeden alıntı: mesajı görüntüle
    Kategorinin zaten içindeyken tekrardan ID belirtmene gerek yok. Aşağıda örnek category.php var. Bundan yararlanarak yapabilirsin.


     <?php get_header(); ?>  
    		
    <div id="siteyi-topla">
        <div id="orta-kisim">
            <div id="yazi-kismi">
                	
    			
                <div id="kategori-baslik">
                    <h1>"<?php single_cat_title()?>" kategorisindeki yazılar:</h1>
                </div>
    			
    			
    			<?php while (have_posts()) : the_post(); ?>	
    			
                                <div class="yazilar">
                        <div class="yazi-resimleri">
                            <a href="<?php the_permalink(); ?>"><img width="201" height="155" src="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID)); ?>" class="resim wp-post-image" alt="<?php the_title(); ?>" /></a>
                        </div>
                        <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
                        <div class="yazi-bilgileri">
                            <div class="yazar">
                                <?php the_author(); ?>                     </div>
                            <div class="tarih">
                                <?php the_time('j F Y') ?>                        </div>
                            <div class="yorum">
                                <span class="dsq-postid" rel="<?php the_ID(); ?> <?php the_permalink(); ?>"><?php comments_number('Yorum Yok', '1 Yorum ', '% Yorum' );?></span>                      </div>
                        </div>
                        <div class="yazi">
                            <?php excerpt('15'); ?>                    </div>
                        <div class="devamini-oku">
                            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">DEVAMINI OKU</a>
                        </div>
                    </div>
                             
                      <?php endwhile; ?>          
                          
                             
        
    
                <div id="sayfalama">
    				<div class='wp-pagenavi'>
    
    <?php sayfalama(); ?>
    
    
    </div>            </div>
                        </div>
    								
    								
    <?php get_sidebar(); ?>  
     
    <?php get_footer(); ?>

    dostum teşekkürler ama category içinde manşet kullandığım için 20 tane haber çekmem gerekiyor. Bunun için id belirmem gerekiyor. Sadece o kategoriye ait haberleri çekmesi gerekiyor manşetten.
  • 30-04-2014, 18:24:23
    #6
    Üyeliği durduruldu
    yardım edecek yok mu
  • 30-04-2014, 22:12:17
    #7
    Kimlik doğrulama veya yönetimden onay bekliyor.
    @bekirbasar; şu şekilde deneyebilir misin?

    <?php
    
    	require('inc/header.php');
    	require('manset1.php');
    
    	wp_reset_query();
    
    	$categories = get_the_category('');
    
    ?>
    
    <div class="kategoribaslik">
    	<h1><?php wp_title(''); ?> Kategorisindeki Haberler Aşağıda Listelendi</h1>
    </div>
    
    <div class="p10"></div>
    
    <div class="betaek_8 first">
    	<!-- Headline -->
    	<div id="headline">
    		<div class="news">
    			<?php query_posts("showposts=1&orderby=date&cat=".$categories); while(have_posts()): the_post(); ?>
    				<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="selected">
    					<p><?php the_title(); ?></p>
    					<?php
    						
    						if(has_post_thumbnail()):
    							$image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
    							$image_url = $image_url[0];
    						else:
    							$image_url = get_post_meta($post->ID, "resim", true);
    						endif;
    						
    					?>
    					<img
    						width="628" height="304"
    						alt="<?php the_title(); ?>"
    						src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url; ?>&amp;w=628&amp;h=304&amp;zc=0"
    					/>
    					<strong><?php the_title(); ?></strong>
    				</a>
    			<?php endwhile; ?>
    			<?php query_posts("showposts=1&orderby=date&cat=".$categories); while(have_posts()): the_post(); ?>
    				<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="mainLink cuff">
    					<p><?php the_title(); ?></p>
    					<?php
    						
    						if(has_post_thumbnail()):
    							$image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
    							$image_url = $image_url[0];
    						else:
    							$image_url = get_post_meta($post->ID, "resim", true);
    						endif;
    						
    					?>
    					<img
    						width="628" height="304"
    						alt="<?php the_title(); ?>"
    						src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url; ?>&amp;w=628&amp;h=304&amp;zc=0"
    					/>
    					<strong><?php the_title(); ?></strong>
    				</a>
    			<?php endwhile; ?>
    		</div>
    	</div>
    	<div class="clear"></div>
    	<!-- /Headline -->
    	<div class="clear"></div>
    	<ul class="categories_news">
    		<?php if(have_posts()): while(have_posts()): the_post(); ?>
    		<li>
    			<a href="<?php the_permalink() ?>">
    				<?php
    					
    					if(has_post_thumbnail()):
    						$image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
    						$image_url = $image_url[0];
    					else:
    						$image_url = get_post_meta($post->ID, "resim", true);
    					endif;
    					
    				?>
    				<img
    					width="143" height="100"
    					alt="<?php the_title(); ?>"
    					src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url; ?>&amp;w=143&amp;h=100&amp;zc=0"
    				/>
    				<strong><?php the_title(); ?></strong>
    				<p><?php the_content_rss('', true, '', 10); ?></p>
    				<span><?php the_time('j F Y - l') ?></span>
    			</a>
    		</li>
    		<?php endwhile; endif; ?>
    	</ul>
    	<?php sayfalama(); ?>
    </div>
    
    <?php require('sidebar.php'); ?>
    
    <div class="clear"></div>
    
    </div>
    
    <?php require('footer.php'); ?>
  • 01-05-2014, 11:44:17
    #8
    Üyeliği durduruldu
    saintx adlı üyeden alıntı: mesajı görüntüle
    @bekirbasar; şu şekilde deneyebilir misin?

    <?php
    
    	require('inc/header.php');
    	require('manset1.php');
    
    	wp_reset_query();
    
    	$categories = get_the_category('');
    
    ?>
    
    <div class="kategoribaslik">
    	<h1><?php wp_title(''); ?> Kategorisindeki Haberler Aşağıda Listelendi</h1>
    </div>
    
    <div class="p10"></div>
    
    <div class="betaek_8 first">
    	<!-- Headline -->
    	<div id="headline">
    		<div class="news">
    			<?php query_posts("showposts=1&orderby=date&cat=".$categories); while(have_posts()): the_post(); ?>
    				<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="selected">
    					<p><?php the_title(); ?></p>
    					<?php
    						
    						if(has_post_thumbnail()):
    							$image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
    							$image_url = $image_url[0];
    						else:
    							$image_url = get_post_meta($post->ID, "resim", true);
    						endif;
    						
    					?>
    					<img
    						width="628" height="304"
    						alt="<?php the_title(); ?>"
    						src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url; ?>&amp;w=628&amp;h=304&amp;zc=0"
    					/>
    					<strong><?php the_title(); ?></strong>
    				</a>
    			<?php endwhile; ?>
    			<?php query_posts("showposts=1&orderby=date&cat=".$categories); while(have_posts()): the_post(); ?>
    				<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="mainLink cuff">
    					<p><?php the_title(); ?></p>
    					<?php
    						
    						if(has_post_thumbnail()):
    							$image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
    							$image_url = $image_url[0];
    						else:
    							$image_url = get_post_meta($post->ID, "resim", true);
    						endif;
    						
    					?>
    					<img
    						width="628" height="304"
    						alt="<?php the_title(); ?>"
    						src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url; ?>&amp;w=628&amp;h=304&amp;zc=0"
    					/>
    					<strong><?php the_title(); ?></strong>
    				</a>
    			<?php endwhile; ?>
    		</div>
    	</div>
    	<div class="clear"></div>
    	<!-- /Headline -->
    	<div class="clear"></div>
    	<ul class="categories_news">
    		<?php if(have_posts()): while(have_posts()): the_post(); ?>
    		<li>
    			<a href="<?php the_permalink() ?>">
    				<?php
    					
    					if(has_post_thumbnail()):
    						$image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
    						$image_url = $image_url[0];
    					else:
    						$image_url = get_post_meta($post->ID, "resim", true);
    					endif;
    					
    				?>
    				<img
    					width="143" height="100"
    					alt="<?php the_title(); ?>"
    					src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $image_url; ?>&amp;w=143&amp;h=100&amp;zc=0"
    				/>
    				<strong><?php the_title(); ?></strong>
    				<p><?php the_content_rss('', true, '', 10); ?></p>
    				<span><?php the_time('j F Y - l') ?></span>
    			</a>
    		</li>
    		<?php endwhile; endif; ?>
    	</ul>
    	<?php sayfalama(); ?>
    </div>
    
    <?php require('sidebar.php'); ?>
    
    <div class="clear"></div>
    
    </div>
    
    <?php require('footer.php'); ?>

    ilgin için teşekkür ederim böyle yaptığımda sadece son haber çekmektedir. O kategoriye ait yazıyıda çekmiyor.