• Resolved 54once

    (@54once)


    Hi guys !
    Is there any way to delete or erase all related posts from all my posts ? I was trying to find a plugin but they just made the site very slow. I found something in single.php, the default value is 6 and there appeared 6 related posts, I try replacing it with 3 and of course appeared just 3 related posts, but when I tried with 0 there appeared like 90 related posts !
    Any idea ?
    Thanks !

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • it seems that removing this whole section of code from your single.php (ideally done in single.php within a child theme) should work:

    
    					<div class="related-posts wow fadeInUp" data-wow-duration="2s">
    						<h3><?php esc_html_e( 'Related Posts', 'whiteboard64' ); ?></h3>
    						<?php
    			                $related = get_posts( array( 
    			                    'category__in' => wp_get_post_categories($post->ID), 
    			                    'numberposts' => 6, 
    			                    'post__not_in' => array($post->ID) 
    			                    ) );
    			                if( $related ) foreach( $related as $post ) {
    			                setup_postdata($post); ?>
    
    			                    <div class="col-xs-12 col-sm-4">
    					            	<div class="row blog-details wow fadeInUp" data-wow-duration="2s">
    					              		<figure>
    					                		<?php if (has_post_thumbnail()) : ?>
    					                			<?php the_post_thumbnail('full'); ?>
    					                		<?php else : ?>
    					                  			<div class="no-img"><i class="fa fa-camera-retro fa-5x"></i></div>
    					                		<?php endif; ?> 
    					                		<div class="detail-date wow fadeInLeft" data-wow-duration="4s">
    									        	<div class="month-day"><?php echo get_the_date('d M');?></div>
    									        	<div class="year"><?php echo get_the_date('Y');?></div>
    									    	</div>	                       
    					                  
    					                		<figcaption>
    					                  			<div>    
    								                    <?php the_excerpt(); ?>
    					                  			</div>
    					                		</figcaption>
    					              		</figure> <!--figure end--> 
    
    					              		<div class="blog-info">
    					                		<h4><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h4>
    					              		</div>
    					            	</div> <!--blog-details end--> 
    					          	</div>  <!--col-sm-4 end-->  
    
    			                <?php }
    			                wp_reset_postdata(); 
    			            ?>
    					</div>

    for details, please ask in your theme’s forum at https://ww.wp.xz.cn/support/theme/whiteboard64

    Thread Starter 54once

    (@54once)

    Wow !!! It worked !!!
    Thanks a lot Michael !!!
    You are so kind !!!

    • This reply was modified 8 years, 6 months ago by 54once.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Related Posts’ is closed to new replies.