again php help

Status
Not open for further replies.

puharta

Member
24
2011
0
0
do you guys can tell me what is wrong with this code:
Code:
<div id="content">
      <?php 	
      if (have_posts()) : 
        while (have_posts()) : 
          the_post();
          if (is_single() || $wp_query->is_single || $wp_query->is_singular) {
            previous_post_link('&laquo; Previous Post: %link <br />',
                             '%title',FALSE,'');
            next_post_link('Next Post: %link &raquo;<br />',
                         '%title',FALSE,'');
          } //end if single 
          ?> 
          <div class="box_head clearfix" id="post-<?php the_ID(); ?>">
         <?php 
  global $post, $fungames_box_design;
        
  // Generate the exclude query
  $fungames_exclude_front_cat = get_option('fungames_exclude_front_cat');  
  if ( empty($fungames_exclude_front_cat) ) { 
    $exclude = '';     
  } else { 
    $exclude = 'exclude='.$fungames_exclude_front_cat; 
  } 
  
  // Get categories, hide empty, exclude defined  
  $categories = get_categories($exclude);    
  
  // Get box count. If emty then set to 6 (default)
  $fungames_box_count = get_option('fungames_box_count');
  if ( empty($fungames_box_count) ) { $fungames_box_count = 6; }
  
  // Calculate the height of a game box
  $height = fungames_calculate_height($fungames_box_count);  
  
  // Pre-define the get games query.
  $get_post_query = 'numberposts='.intval($fungames_box_count).'&orderby=rand&category=';

  // Generate Game Boxes... Loop through all categories
  foreach ($categories as $category) {
    // Get the current category ID
    $cat_id = $category->cat_ID;
    // Get games from this category
    $games = get_posts($get_post_query.$cat_id);
    
    // Check if we have some games in this category
    if ($games) { 
      // There are some games.. Create the game box
      ?>    
      <div class="gamebox" <?php echo $height;?>>
        <h1><a href="<?php echo get_category_link($cat_id); ?>"><?php echo $category->name; ?></a></h1>
        <?php // print out all games from this category ?>
        <?php foreach ($games as $post) : ?>
          <div class="game_title">
            <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php echo $post->post_title; ?>" >
            <?php myabp_get_title(10); ?>
            </a>
            <br />
            <a href="<?php the_permalink() ?>" class="thumb_link" rel="bookmark" title="<?php echo $post->post_title; ?>" >
              <?php myabp_print_thumbnail(85, 85); ?>
            </a>
          </div>
        <?php endforeach; ?>

        <div class="cat_link"><a href="<?php echo get_category_link($cat_id); ?>"><?php _e("More Games", "fungames"); ?></a></div>
        <?php if ($fungames_box_design == 'Horizontal') echo '<div class="clear"></div>'; ?>
      </div>
thanks in advance
 
2 comments
is this full code? i seen few if,foreach and while tags with few non end. anyway try this one. but not sure

PHP:
<div id="content">
<?php 	
if(have_posts()):
	while (have_posts()): 
    	the_post();
		
		if (is_single() || $wp_query->is_single || $wp_query->is_singular)
		{
			previous_post_link('&laquo; Previous Post: %link <br />','%title',FALSE,'');
			next_post_link('Next Post: %link &raquo;<br />','%title',FALSE,'');
		} 
		//end if single ?> 
        
        <div class="box_head clearfix" id="post-<?php the_ID(); ?>">
        <?php 
  			global $post, $fungames_box_design;
        
			// Generate the exclude query
			$fungames_exclude_front_cat = get_option('fungames_exclude_front_cat');  
			
			if ( empty($fungames_exclude_front_cat) )
			{ 
				$exclude = '';     
			} 
			else
			{ 
				$exclude = 'exclude='.$fungames_exclude_front_cat; 
			} 
			  
			// Get categories, hide empty, exclude defined  
			$categories = get_categories($exclude);    
			  
			// Get box count. If emty then set to 6 (default)
			$fungames_box_count = get_option('fungames_box_count');
			
			if ( empty($fungames_box_count) ) 
			{
				$fungames_box_count = 6;
			}
			  
			// Calculate the height of a game box
			$height = fungames_calculate_height($fungames_box_count);  
			  
			// Pre-define the get games query.
			$get_post_query = 'numberposts='.intval($fungames_box_count).'&orderby=rand&category=';
			
			  // Generate Game Boxes... Loop through all categories
			foreach ($categories as $category) {
				// Get the current category ID
				$cat_id = $category->cat_ID;
				// Get games from this category
				$games = get_posts($get_post_query.$cat_id);
				
				// Check if we have some games in this category
				if ($games) { // There are some games.. Create the game box
      			?>    
                    <div class="gamebox" <?php echo $height;?>>
                    <h1><a href="<?php echo get_category_link($cat_id); ?>"><?php echo $category->name; ?></a></h1>
                    <?php // print out all games from this category ?>
                    
                    <?php foreach ($games as $post) : ?>
                        <div class="game_title">
                            <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php echo $post->post_title; ?>" ><?php myabp_get_title(10); ?></a>
                            <br />
                            <a href="<?php the_permalink() ?>" class="thumb_link" rel="bookmark" title="<?php echo $post->post_title; ?>" ><?php myabp_print_thumbnail(85, 85); ?></a>
                        </div>
                    <?php endforeach; ?>
    
                    <div class="cat_link"><a href="<?php echo get_category_link($cat_id); ?>"><?php _e("More Games", "fungames"); ?></a></div>
                    <?php if ($fungames_box_design == 'Horizontal') echo '<div class="clear"></div>'; 
				}
			}
		?>
		</div>
    <?php
	endwhile;
endif;
 
Status
Not open for further replies.
Back
Top