• Resolved someguy111

    (@someguy111)


    I have a video theme that allows you to show a ‘Featured Video’ and then a list of ‘More Videos’ under it from a category you choose. The problem I’m running into is that it’s showing the ‘Featured Video’ again right under itself in the ‘More Videos’ section because I’m picking the same category for ‘Featured Video’ and ‘More Videos’. Here is the code:

    <div id="featuredvideo">
    
    			<?php $featured_vid_1 = get_option('tubular_featured_vid_1'); $featured_vid_1_num = get_option('tubular_featured_vid_1_num'); if(!$featured_vid_1) $featured_vid_1 = 1; //setting a default ?>
    				<?php $recent = new WP_Query("cat=".$featured_vid_1."&showposts=".$featured_vid_1_num); while($recent->have_posts()) : $recent->the_post();?>
    			<div class="postarea">
    
                <h3>Featured Episode</h3>	
    
           		<div class="entry">
    
                	<div class="videoborder">
                 		<?php the_content(__('Read more'));?>
                    </div>
    
                    <div class="videoleft">
                        <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
                        <p class="date">Posted on <?php the_time('m.d.y'); ?> by <?php the_author(); ?></p>
                    </div>
    
                    <div class="videoright">
                        <p><?php comments_popup_link('Leave a Comment', '1 Comment', '% Comments'); ?></p>
                    </div>
    
                	<div style="clear:both;"></div>
    
                    </div>
    
    			</div>
    
    			<?php endwhile; ?>
    
            </div>		
    
        <div id="hpbottom">
    
    			<?php $featured_vid_2 = get_option('tubular_featured_vid_2'); $featured_vid_2_num = get_option('tubular_featured_vid_2_num'); if(!$featured_vid_2) $featured_vid_2 = 1; //setting a default ?>
    				<?php $recent = new WP_Query("cat=".$featured_vid_2."&showposts=".$featured_vid_2_num); while($recent->have_posts()) : $recent->the_post();?>
    			<div class="videos">
    
                    <div class="videosleft">
    					<?php the_content(__('Read more'));?>
                    </div>

    How can I exclude the current ‘Featured Video’ from the ‘More Videos’ list?

    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • similar topic with a possible solution: https://www.ads-software.com/support/topic/347043?replies=11

    Thread Starter someguy111

    (@someguy111)

    It does sound similar to mine, but I’m still not really sure what to do. Thanks though…

    Thread Starter someguy111

    (@someguy111)

    Does anyone know how to fix this?

    Thanks

    Thread Starter someguy111

    (@someguy111)

    I will pay $3 PayPal to anyone who can come up with a working solution.

    alchymyth gets the $3! The thread he linked to has the same problem. Here is how the code goes in your file (Note: UNTESTED):

    <div id="featuredvideo">
    
       <?php $featured_vid_1 = get_option('tubular_featured_vid_1');
       $featured_vid_1_num = get_option('tubular_featured_vid_1_num');
       if(!$featured_vid_1) $featured_vid_1 = 1; //setting a default ?>
       <?php $excludes = array();  // Add this line?>
       <?php $recent = new WP_Query("cat=".$featured_vid_1."&showposts=".$featured_vid_1_num);
       while($recent->have_posts()) : $recent->the_post();?>
          <div class="postarea">
             <?php $excludes[] = $post->ID;  // Add this line ?>
             <h3>Featured Episode</h3>	
    
             <!-- Lots of other code here -->
          </div>
    
       <?php endwhile; ?>
    
    </div>		
    
    <div id="hpbottom">
    
    <?php $featured_vid_2 = get_option('tubular_featured_vid_2');
    $featured_vid_2_num = get_option('tubular_featured_vid_2_num');
    if(!$featured_vid_2) $featured_vid_2 = 1; //setting a default ?>
    <?php $args = array (  // Insert this, and change WP_Query()
                'cat' => $featured_vid_2,
                'showposts' => $featured_vid_2_num,
                'post__not_in' => $excludes,
                ); ?>
    <?php $recent = new WP_Query($args);
    while($recent->have_posts()) : $recent->the_post();?>
       <div class="videos">
    
          <div class="videosleft">
             <?php the_content(__('Read more'));?>
          </div>

    the price goes to @t31os_ and @vtxyzzy
    who are always very good with these kind of solutions ??

    Thread Starter someguy111

    (@someguy111)

    That worked, thanks to both you. Can you give me your PayPal emails? I will send you both $3 for helping. ??

    I’d have given you an example for free… ??

    I didn’t reply because i saw the other thread had been linked to..

    Feel free to donate the $$$ to an open source project (any is fine, if it’s open source) … i’ve no need for it .. though i do appreciate your kind offer… ??

    Same as t310s_. Please mark this topic ‘Resolved’.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Exclude Current ‘Featured Post’ from ‘More Posts’’ is closed to new replies.