• 10-12-2016, 01:37:13
    #1
    Sitedeki kod bu. Bu kod ile son 3 blog yazısı ana sayfada görünüyor. Ben son 6 yazı görünsün istiyorum.
    	<?php foreach($lastposts as $post) { setup_postdata($post); 
    					$postType     = get_post_meta(get_the_ID(), 'content_type', true);
    					$hasMedia     = false;
    					$vType        = get_post_meta(get_the_ID(), 'video_server', true);
    					$vID   		  = get_post_meta(get_the_ID(), 'video_id', true);
    						
    					if($postType == '1' && function_exists('has_post_thumbnail') && has_post_thumbnail())
    						$hasMedia = true;
    					else if($postType == '2')
    						$hasMedia = true;
    					
    					$boxClass = $hasMedia ? '' : 'no-media';
    				?>
    
    					<div class="span4 box <?php echo $boxClass; ?>">
    						<a href="<?php the_permalink(); ?>">
    							<div class="meta">
    								 <?php the_time('d'); ?>
    								<span><?php the_time('M'); ?></span>
    							</div>
    							<?php if($postType == '1'){ ?>
    							<div class="image">
    								<?php if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) 
    											the_post_thumbnail('recent-posts'); 
    								?>
    							</div>
    							<?php 
    							}
    							elseif($postType == '2')
    							{
    								?>
    								<div class="post_video">
    								<?php
    								if($vType == '' || $vType == '1')
    								{
    								?>
    									<iframe width="560" height="315" src="http://www.youtube.com/embed/<?php echo $vID; ?>" frameborder="0" allowfullscreen></iframe>
    							<?php
    								}
    								else
    								{?>
    									<iframe src="http://player.vimeo.com/video/<?php echo $vID; ?>?color=f0e400" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
    								<?php
    								}
    								?>
    								</div>
    							<?php
    							}
    							?>
    						</a>
    						<h2>
    							<a class="title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    						</h2>
    						<div class="separator"></div>
    						<p>
    						<?php
    						$content = get_the_content();
    
    						if(strlen($content) <= 200)
    							echo $content;
    						else
    						{
    							$matches = array();
    							preg_match('/^.{0,200}(?:.*?)\b/iu', strip_tags($content), $matches);
    							echo $matches[0] . '...';
    						}
    						?>
    						</p>
    					</div>
    				<?php } ?>
    				</div>
    			</div>
    			
    			<?php 
    			}//If recent posts 
    		}
    		?>
    Aynı kodu peş peşe ekleyince şöyle oldu ikinci kısımda sonraki 3 yapsakta olur Çok cahilim kendimce uğraşıyorum ama işin içinden çıkamadım

  • 10-12-2016, 01:45:48
    #2
    medkir adlı üyeden alıntı: mesajı görüntüle
    Sitedeki kod bu. Bu kod ile son 3 blog yazısı ana sayfada görünüyor. Ben son 6 yazı görünsün istiyorum.
    	<?php foreach($lastposts as $post) { setup_postdata($post); 
    					$postType     = get_post_meta(get_the_ID(), 'content_type', true);
    					$hasMedia     = false;
    					$vType        = get_post_meta(get_the_ID(), 'video_server', true);
    					$vID   		  = get_post_meta(get_the_ID(), 'video_id', true);
    						
    					if($postType == '1' && function_exists('has_post_thumbnail') && has_post_thumbnail())
    						$hasMedia = true;
    					else if($postType == '2')
    						$hasMedia = true;
    					
    					$boxClass = $hasMedia ? '' : 'no-media';
    				?>
    
    					<div class="span4 box <?php echo $boxClass; ?>">
    						<a href="<?php the_permalink(); ?>">
    							<div class="meta">
    								 <?php the_time('d'); ?>
    								<span><?php the_time('M'); ?></span>
    							</div>
    							<?php if($postType == '1'){ ?>
    							<div class="image">
    								<?php if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) 
    											the_post_thumbnail('recent-posts'); 
    								?>
    							</div>
    							<?php 
    							}
    							elseif($postType == '2')
    							{
    								?>
    								<div class="post_video">
    								<?php
    								if($vType == '' || $vType == '1')
    								{
    								?>
    									<iframe width="560" height="315" src="http://www.youtube.com/embed/<?php echo $vID; ?>" frameborder="0" allowfullscreen></iframe>
    							<?php
    								}
    								else
    								{?>
    									<iframe src="http://player.vimeo.com/video/<?php echo $vID; ?>?color=f0e400" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
    								<?php
    								}
    								?>
    								</div>
    							<?php
    							}
    							?>
    						</a>
    						<h2>
    							<a class="title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    						</h2>
    						<div class="separator"></div>
    						<p>
    						<?php
    						$content = get_the_content();
    
    						if(strlen($content) <= 200)
    							echo $content;
    						else
    						{
    							$matches = array();
    							preg_match('/^.{0,200}(?:.*?)\b/iu', strip_tags($content), $matches);
    							echo $matches[0] . '...';
    						}
    						?>
    						</p>
    					</div>
    				<?php } ?>
    				</div>
    			</div>
    			
    			<?php 
    			}//If recent posts 
    		}
    		?>
    Aynı kodu peş peşe ekleyince şöyle oldu ikinci kısımda sonraki 3 yapsakta olur Çok cahilim kendimce uğraşıyorum ama işin içinden çıkamadım

    Kod bu şekilde eksik çünkü $lastposts arrayinin tanımlandığı yeri yapıştırmamışsınız. Pm atın yardımcı olayım.
  • 10-12-2016, 01:55:33
    #3
    inspectorrr adlı üyeden alıntı: mesajı görüntüle
    Kod bu şekilde eksik çünkü $lastposts arrayinin tanımlandığı yeri yapıştırmamışsınız. Pm atın yardımcı olayım.
    yardımınız için teşekkür ederim hocam