• Hi all
    I want to combine these two codes together
    One of these codes to view the relativ post and other code display post by Scrollers.
    Now I want to display related post in the Scroller
    Can anyone help me?

    <?php global $post;
    		$orig_post = $post;
    		$tags = wp_get_post_tags($post->ID);
    		if ($tags) {
    			$tag_ids = array();
    
    			foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
    			$args=array(
    				'tag__in' => $tag_ids,
    				'post__not_in' => array($post->ID),
    				'showposts'=>5,
    				'ignore_sticky_posts'=>1
    			);
    			$my_query = new wp_query( $args );
    
    			if( $my_query->have_posts() ) { ?>		
    
    					<?php while( $my_query->have_posts() ) {
    					$my_query->the_post(); ?>
    						<?php $thumb = '';
    						$width = 90;
    						$height = 109;
    						$classtext = '';
    						$titletext = get_the_title();
    						$thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext);
    						$thumb = $thumbnail['thumb']; ?>
    
    							<?php if ($thumb <> '') { ?>
     	<a href="<?php the_permalink(); ?>">
    	<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>
    	                              </a>
             <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    							<?php } ?>
    
    					<?php } ?>
    
    			<?php }
    		}
    		wp_reset_postdata();
    		$post = $orig_post; ?>
    <a href="#" id="left-arrow"><?php _e('Previous'); ?></a>
    
    		<?php $dealsNum = get_option('estore_deals_numposts');
    		$args=array(
    			'showposts'=>$dealsNum,
    			'cat' => get_cat_ID(get_option('estore_deals_category')),
    		);
    		query_posts($args);
    		$i = 0;
    		if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<?php if ( ($i % 4 == 0) || ($i == 0) ) echo ('<div class="block">'); ?>
    
    		<?php if (($i+1) % 4 == 0) echo(' last'); ?>
    
                    <?php $custom = '';
    		$custom = get_post_custom($post->ID);
    
    						$thumb = '';
    						$width = 162;
    						$height = 112;
    						$classtext = '';
    						$titletext = get_the_title();
    
    						$thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext);
    						$thumb = $thumbnail["thumb"]; ?>
    
    	<?php echo($arr[$i]["price"]); ?>
    	<?php }; ?>
    	<?php if ($thumb <> '') { ?>
    <?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>
    						<?php }; ?>
    						<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    
    					<a href="<?php the_permalink(); ?>" class="more"><?php _e('more info','eStore'); ?></a>
    				</div> <!-- .item -->
    
    			<?php if ( ($i+1) % 4 == 0 ) echo ('</div> <!-- end .block -->'); ?>
    
    			<?php $i++; ?>
    
    		<?php endwhile; ?>
    		<?php endif; wp_reset_query(); ?>
    
    		<?php if ($dealsNum % 4 <> 0) echo('<!-- end .block-->'); ?>
    
    	<a href="#" id="right-arrow"><?php _e('Next'); ?></a>

  • The topic ‘Combining two different code’ is closed to new replies.