• Resolved calabronelampa

    (@calabronelampa)


    Hi,
    i have some problem with a customize that i did on my site.

    I add this script on ” content-product.php ” to show an ads every 3 products.

    The script works good but i noticed that the contents appears also on product related content.

    There is any way to hide the ads on this section ( product related ) ?

    Here the code:

    <li <?php wc_product_class( $classes, $product ); ?>>
    <div class="product-inner">
    	<?php
    	/**
    	 * Hook: woocommerce_before_shop_loop_item.
    	 *
    	 * @hooked woocommerce_template_loop_product_link_open - 10
    	 */
    	do_action( 'woocommerce_before_shop_loop_item' );
    	?>
    
    	<div class="product-image">
    
    		<a <?php echo porto_filter_output( $more_target ); ?> href="<?php echo esc_url( $more_link ); ?>">
    			<?php
    
    				/**
    				 * Hook: woocommerce_before_shop_loop_item_title.
    				 *
    				 * @hooked woocommerce_show_product_loop_sale_flash - 10
    				 * @hooked woocommerce_template_loop_product_thumbnail - 10
    				 */
    				do_action( 'woocommerce_before_shop_loop_item_title' );
    			?>
    		</a>
    	<?php if ( ( ! isset( $porto_woocommerce_loop['widget'] ) || ! $porto_woocommerce_loop['widget'] ) && ( ! isset( $porto_woocommerce_loop['use_simple_layout'] ) || ! $porto_woocommerce_loop['use_simple_layout'] ) && isset( $woocommerce_loop['addlinks_pos'] ) && ! empty( $woocommerce_loop['addlinks_pos'] ) && ( ! in_array( $woocommerce_loop['addlinks_pos'], array( 'default', 'onhover', 'outimage' ) ) || ( class_exists( 'YITH_WCWL' ) && $porto_settings['product-wishlist'] && 'onimage' == $woocommerce_loop['addlinks_pos'] ) ) ) : ?>
    		<div class="links-on-image">
    			<?php woocommerce_template_loop_add_to_cart(); ?>
    		</div>
    	<?php endif; ?>
    	</div>
    
    	<div class="product-content">
    		<?php do_action( 'porto_woocommerce_before_shop_loop_item_title' ); ?>
    
    		<?php if ( version_compare( $porto_woo_version, '2.4', '<' ) ) : ?>
    
    			<a class="product-loop-title" <?php echo porto_filter_output( $more_target ); ?> href="<?php echo esc_url( $more_link ); ?>">
    				<h3><?php the_title(); ?></h3>
    			</a>
    
    		<?php else : ?>
    
    			<?php
    				/**
    			 * Hook: woocommerce_shop_loop_item_title.
    			 *
    			 * @hooked woocommerce_template_loop_product_title - 10
    			 */
    			do_action( 'woocommerce_shop_loop_item_title' );
    			?>
    		<?php endif; ?>
    
    		<?php
    			/**
    			 * Hook: woocommerce_after_shop_loop_item_title.
    			 *
    			 * @hooked woocommerce_template_loop_rating - 5
    			 * @hooked woocommerce_template_loop_price - 10
    			 */
    			do_action( 'woocommerce_after_shop_loop_item_title' );
    		?>
    
    		<?php
    			/**
    			* Hook: woocommerce_after_shop_loop_item.
    			*
    			* @hooked woocommerce_template_loop_product_link_close - 5 : removed
    			* @hooked woocommerce_template_loop_add_to_cart - 10
    			*/
    			do_action( 'woocommerce_after_shop_loop_item' );
    		?>
    	</div>
    </div>
    <!-- IMPOSTO UNA PUBBLICITA' OGNI 3 PRODOTTI-->
     <?php if ($wp_query->current_post !== 0 && ($wp_query->current_post+1)%3 == 0) { ?>
    <div class="col d-block d-sm-none">
    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    	<!-- responsive orizzontale -->
    	<ins class="adsbygoogle"
    		style="display:block"
    		data-ad-client="ca-pub-6200644600148421"
    		data-ad-slot="7973493671"
    		data-ad-format="auto"
    		data-full-width-responsive="true">
    	</ins>
    <script>
         (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>
            <?php }?>
    <!-- IMPOSTO UNA PUBBLICITA' OGNI 3 PRODOTTI-->
    </li>
    

    Thanks.

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

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Hide Custom Div on Related Product’ is closed to new replies.