add related posts section to single post template
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		| @ -152,4 +152,20 @@ function cc_mime_types($mimes) { | ||||
| } | ||||
| add_filter('upload_mimes', 'cc_mime_types'); | ||||
|  | ||||
| // enable wordpress customizer | ||||
| // remove current post from related posts query loop | ||||
| add_filter( 'query_loop_block_query_vars', function( $query_vars, $block ) { | ||||
| 	if ( isset( $block->attributes['metadata']['name'] ) && $block->attributes['metadata']['name'] === 'Related Post' ) { | ||||
| 		$query_vars['post__not_in'] = array( get_the_ID() ); | ||||
| 	} | ||||
|  | ||||
| 	return $query_vars; | ||||
| }, 10, 2 ); | ||||
|  | ||||
| function jett_remove_current_from_queries( $query_vars, $block ) { | ||||
| 	do_action( 'qm/debug', $block->parsed_block ); | ||||
|  | ||||
| 	if ( 'related-post' === $block->parsed_block['attrs']['className'] ) | ||||
| 		$query_vars['post__not_in'] = array( get_the_ID() ); | ||||
| 	return $query_vars; | ||||
| } | ||||
| add_filter( 'query_loop_block_query_vars', 'jett_remove_current_from_queries', 10, 2 );  | ||||
		Reference in New Issue
	
	Block a user