Tweek 1 page of PHP for me please - $$

Discussion in 'PHP' started by sweetlouise, May 19, 2009.

  1. #1
    hi, i have a great wordpress blog but there are a couple of errors i just cant fix. can someone help me please, i need to add a table for my adsense code and figure out why only 2 of the 4 categories are showing.


    if you look down at the bottom you will see 2 categories with the titles of new posts under that category. above those are some arrows. next to those arrows are supposed to be the other categories = entertainment and financial, but they dont display.

    i will give 10 bucks to somebody who can fix this issue

    
    <?php get_header(); ?>	
    	
    	<div id="content">
    		<div id="dynamic_box_center">
    			<div id="box_center_holder_home">
    				<div id="content_features" class="features_equal_default">
    					<div id="content_features_left">
                            <div id="headline">
    	
    	
    								<div class="box_headline">
    								<div class="headline_article_holder">
     <?php
     $postslist = get_posts('numberposts=1&offset=0&category='.$featcat.'');
     foreach ($postslist as $post) : 
     setup_postdata($post);
     
     $caption = get_post_meta($post->ID, 'caption', $single = true);  // check for caption
     $thumb = get_post_meta($post->ID, 'thumb', $single = true);
     if($thumb !== '') {	
     ?>
    
         <div class="headline_image">
    	 <a href="<?php the_permalink() ?>"><img src="<?php bloginfo('template_url'); ?>/phpthumb/phpThumb.php?src=<?php echo $thumb; ?>&w=318&h=238&q=100&zc=1" /></a>
        <?php if($caption !== '') { ?>
    	<div class="image_caption"><?php echo $caption; ?>
    	
    	</div>
    	<?php } else { echo ''; } ?>
    	</div>
    	<?php } else { echo ''; } ?>
                                
        <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1> <p><?php the_tags(); ?></p>
         
    	 <div class="headline_body"> <?php the_excerpt(); ?></div>
          
    	  <?php endforeach; ?>
    	  </div>
          </div>
          
    		<div class="other_headlines">
    	
     <?php
     $postslist = get_posts('numberposts=4&offset=10');
     foreach ($postslist as $post) : 
     setup_postdata($post);
     ?>
    	  
    	<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?>
    	
    	</a></h2>
    		<div class="headline_article_holder">
        <span class="summary"><?php the_content_limit(180, "<font color='#C90404'>Read More</font>"); ?></span>
        	</div>    
        <?php endforeach; ?>
    	 </div>
    			</div>
    		
    
    							</div>
    							<div id="content_features_right">
                                	
            <div class="box_body latest_news">
                <div class="box_title_holder"><div class="box_title"><a href="<?php bloginfo('rss2_url'); ?>"><img src="<?php bloginfo('template_url'); ?>/img/rss_subscribe.gif" alt="RSS" title="Subscribe via RSS" /></a>Latest News</div></div>
    
    			<ul>
    			<?php
     			global $post;
     			$myposts = get_posts('numberposts=10&offset=0');
     			foreach($myposts as $post) :
    			?>
           
    				<li>
                    	<span class="article_title"><a href="<?php the_permalink() ?>"><?php the_title(); ?> 
    					<?php $video = get_post_meta($post->ID, 'video', $single = true);
    	if($video !== '') { ?>
    	<img src="<?php bloginfo('template_url'); ?>/img/video_icon.gif" alt="Video" /> <?php } ?>
    					</a></span>
         <div class="article_link"><a href="<?php the_permalink() ?>"> &raquo;</a></div>
                    </li>
    				 <?php endforeach; ?>
                </ul>
    
    		
            </div>
    	
            
            	
    			</div>			
    		</div>
                                   
            <!-- Main news section -->
    <div id="category_news_box">
    	<div class="main_news_box_holder">
    		<div class="main_news_box_row">
    			<div id="box_more_category_list_3" class="main_news_category">
    		
    	<div class="box_title"><h4><a href="<?php echo get_category_link($cat1);?>"><?php echo get_cat_name($cat1); ?> &raquo;</a></h4></div>
    	<div class="box_body">
    		<ul>
    		<?php
     		$postslist = get_posts('numberposts=5&offset=0&category=' . $cat1 . '');
     		foreach ($postslist as $post) : 
     		setup_postdata($post);
     		?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endforeach; ?>
    		</ul>														
    			</div>
    		</div>
    												
    	<div id="box_more_category_list_4" class="main_news_category">
    		<?php
    		$catname = get_cat_name($cat2); 
    		?>
    	<div class="box_title"><h4><a href="<?php echo get_category_link($cat2);?>"><?php echo get_cat_name($cat2); ?> &raquo;</a></h4></div>
    	<div class="box_body">
    		<ul>
    		<?php
     		$postslist = get_posts('numberposts=5&offset=0&category=' . $cat2 . '');
     		foreach ($postslist as $post) : 
     		setup_postdata($post);
     		?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endforeach; ?>
    		</ul>
    																
    			</div>
    		</div>
    	</div>
    										
    	<div class="main_news_box_row">
    
    	<div id="box_more_category_list_5" class="main_news_category">
    		<?php
    		$catname = get_cat_name($cat3);
    		?>
    	<div class="box_title"><h4><a href="<?php echo get_category_link($cat3);?>"><?php echo get_cat_name($cat3); ?> &raquo;</a></h4></div>
    	<div class="box_body">
    		<ul>
    		<?php
     		$postslist = get_posts('numberposts=5&offset=0&category=' . $cat3 . '');
     		foreach ($postslist as $post) : 
     		setup_postdata($post);
     		?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endforeach; ?>
    		</ul>
    	</div>
    	</div>
    	
    	<div id="box_more_category_list_6" class="main_news_category">
    		<?php
    		$catname = get_cat_name($cat4); 
    		?>
    	<div class="box_title"><h4><a href="<?php echo get_category_link($cat4);?>"><?php echo get_cat_name($cat4); ?> &raquo;</a></h4></div>
    	<div class="box_body">
    		<ul>
    		<?php
     		$postslist = get_posts('numberposts=5&offset=0&category=' . $cat4 . '');
     		foreach ($postslist as $post) : 
     		setup_postdata($post);
     		?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endforeach; ?>
    		
    		</ul>
    	</div>
    	</div>
    												
    		</div>
    	</div>
    	</div>				
    		
    		</div>
    				</div><?php get_sidebar(); ?>
    
    				</div>
    			
    <?php get_footer(); ?> 
    
    Code (markup):

     
    sweetlouise, May 19, 2009 IP
  2. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #2
    Is $cat1 and $cat2 holding the right ID of the categories?
     
    Sky AK47, May 19, 2009 IP
  3. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #3
    What are id's of the two categories you want to display at bottom

    Try this

    Replace 1 and 2 by proper id's of two categories.

    <?php get_header(); 
    $cat1=1;
    $cat2=2;
    
    ?>	
    	
    	<div id="content">
    		<div id="dynamic_box_center">
    			<div id="box_center_holder_home">
    				<div id="content_features" class="features_equal_default">
    					<div id="content_features_left">
                            <div id="headline">
    	
    	
    								<div class="box_headline">
    								<div class="headline_article_holder">
     <?php
     $postslist = get_posts('numberposts=1&offset=0&category='.$featcat.'');
     foreach ($postslist as $post) : 
     setup_postdata($post);
     
     $caption = get_post_meta($post->ID, 'caption', $single = true);  // check for caption
     $thumb = get_post_meta($post->ID, 'thumb', $single = true);
     if($thumb !== '') {	
     ?>
    
         <div class="headline_image">
    	 <a href="<?php the_permalink() ?>"><img src="<?php bloginfo('template_url'); ?>/phpthumb/phpThumb.php?src=<?php echo $thumb; ?>&w=318&h=238&q=100&zc=1" /></a>
        <?php if($caption !== '') { ?>
    	<div class="image_caption"><?php echo $caption; ?>
    	
    	</div>
    	<?php } else { echo ''; } ?>
    	</div>
    	<?php } else { echo ''; } ?>
                                
        <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1> <p><?php the_tags(); ?></p>
         
    	 <div class="headline_body"> <?php the_excerpt(); ?></div>
          
    	  <?php endforeach; ?>
    	  </div>
          </div>
          
    		<div class="other_headlines">
    	
     <?php
     $postslist = get_posts('numberposts=4&offset=10');
     foreach ($postslist as $post) : 
     setup_postdata($post);
     ?>
    	  
    	<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?>
    	
    	</a></h2>
    		<div class="headline_article_holder">
        <span class="summary"><?php the_content_limit(180, "<font color='#C90404'>Read More</font>"); ?></span>
        	</div>    
        <?php endforeach; ?>
    	 </div>
    			</div>
    		
    
    							</div>
    							<div id="content_features_right">
                                	
            <div class="box_body latest_news">
                <div class="box_title_holder"><div class="box_title"><a href="<?php bloginfo('rss2_url'); ?>"><img src="<?php bloginfo('template_url'); ?>/img/rss_subscribe.gif" alt="RSS" title="Subscribe via RSS" /></a>Latest News</div></div>
    
    			<ul>
    			<?php
     			global $post;
     			$myposts = get_posts('numberposts=10&offset=0');
     			foreach($myposts as $post) :
    			?>
           
    				<li>
                    	<span class="article_title"><a href="<?php the_permalink() ?>"><?php the_title(); ?> 
    					<?php $video = get_post_meta($post->ID, 'video', $single = true);
    	if($video !== '') { ?>
    	<img src="<?php bloginfo('template_url'); ?>/img/video_icon.gif" alt="Video" /> <?php } ?>
    					</a></span>
         <div class="article_link"><a href="<?php the_permalink() ?>"> &raquo;</a></div>
                    </li>
    				 <?php endforeach; ?>
                </ul>
    
    		
            </div>
    	
            
            	
    			</div>			
    		</div>
                                   
            <!-- Main news section -->
    <div id="category_news_box">
    	<div class="main_news_box_holder">
    		<div class="main_news_box_row">
    			<div id="box_more_category_list_3" class="main_news_category">
    		
    	<div class="box_title"><h4><a href="<?php echo get_category_link($cat1);?>"><?php echo get_cat_name($cat1); ?> &raquo;</a></h4></div>
    	<div class="box_body">
    		<ul>
    		<?php
     		$postslist = get_posts('numberposts=5&offset=0&category=' . $cat1 . '');
     		foreach ($postslist as $post) : 
     		setup_postdata($post);
     		?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endforeach; ?>
    		</ul>														
    			</div>
    		</div>
    												
    	<div id="box_more_category_list_4" class="main_news_category">
    		<?php
    		$catname = get_cat_name($cat2); 
    		?>
    	<div class="box_title"><h4><a href="<?php echo get_category_link($cat2);?>"><?php echo get_cat_name($cat2); ?> &raquo;</a></h4></div>
    	<div class="box_body">
    		<ul>
    		<?php
     		$postslist = get_posts('numberposts=5&offset=0&category=' . $cat2 . '');
     		foreach ($postslist as $post) : 
     		setup_postdata($post);
     		?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endforeach; ?>
    		</ul>
    																
    			</div>
    		</div>
    	</div>
    										
    	<div class="main_news_box_row">
    
    	<div id="box_more_category_list_5" class="main_news_category">
    		<?php
    		$catname = get_cat_name($cat3);
    		?>
    	<div class="box_title"><h4><a href="<?php echo get_category_link($cat3);?>"><?php echo get_cat_name($cat3); ?> &raquo;</a></h4></div>
    	<div class="box_body">
    		<ul>
    		<?php
     		$postslist = get_posts('numberposts=5&offset=0&category=' . $cat3 . '');
     		foreach ($postslist as $post) : 
     		setup_postdata($post);
     		?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endforeach; ?>
    		</ul>
    	</div>
    	</div>
    	
    	<div id="box_more_category_list_6" class="main_news_category">
    		<?php
    		$catname = get_cat_name($cat4); 
    		?>
    	<div class="box_title"><h4><a href="<?php echo get_category_link($cat4);?>"><?php echo get_cat_name($cat4); ?> &raquo;</a></h4></div>
    	<div class="box_body">
    		<ul>
    		<?php
     		$postslist = get_posts('numberposts=5&offset=0&category=' . $cat4 . '');
     		foreach ($postslist as $post) : 
     		setup_postdata($post);
     		?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php endforeach; ?>
    		
    		</ul>
    	</div>
    	</div>
    												
    		</div>
    	</div>
    	</div>				
    		
    		</div>
    				</div><?php get_sidebar(); ?>
    
    				</div>
    			
    <?php get_footer(); ?>
    PHP:
     
    kmap, May 19, 2009 IP
  4. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #4
    Urgh...wait for the dude to reply for my post, and put that in bbcode =/ Also would be easier if you only gave the 2 variables, not copy and paste.
     
    Sky AK47, May 19, 2009 IP