Homepage › Support › Polaris WooCommerce › In Feed ads in Product Thumbnails
This topic contains 1 reply, has 2 voices, and was last updated by Planetshine Support 9 months, 2 weeks ago.
-
AuthorPosts
-
February 25, 2019 at 12:41 pm #10031
I want to add some ads in product thumbnails. I added the code in wc-template.php in wc-content function. But I dont see any ads. Where should I add the google ads php code? in index.php? content.php? or anywhere else?
Modified Code:
if ( ! function_exists( ‘woocommerce_content’ ) ) {/**
* Output WooCommerce content.
*
* This function is only used in the optional ‘woocommerce.php’ template.
* which people can add to their themes to add basic woocommerce support.
* without hooks or modifying core templates.
*/
function woocommerce_content() {
$i=1;
if ( is_singular( ‘product’ ) ) {while ( have_posts() ) :
the_post();if($i==5||$i==7||$i==10){?>
#my adsense code
<?php }wc_get_template_part( ‘content’, ‘single-product’ );
$i++;
endwhile;} else {
?><?php if ( apply_filters( ‘woocommerce_show_page_title’, true ) ) : ?>
<h1 class=”page-title”><?php woocommerce_page_title(); ?></h1>
<?php endif; ?>
<?php do_action( ‘woocommerce_archive_description’ ); ?>
<?php if ( woocommerce_product_loop() ) : ?>
<?php do_action( ‘woocommerce_before_shop_loop’ ); ?>
<?php woocommerce_product_loop_start(); ?>
<?php if ( wc_get_loop_prop( ‘total’ ) ) : ?>
<?php $i++; while ( have_posts() ) : ?>
<?php the_post(); ?><?php if($i==5||$i==7||$i==10){?>
#my adsense code
<?php }?><?php wc_get_template_part( ‘content’, ‘product’ ); ?>
<?php $i++;?>
<?php endwhile; ?>Have added the example image. I need ads in that fashion.
Attachments:
You must be logged in to view attached files.February 25, 2019 at 6:11 pm #10038Hey,
Unfortunately according to ThemeForest support policy here the assistance with theme customization is not a part of theme support.
I strongly recommend to you avoid doing such a modifications with theme or WooCommerce plugin itself.
The better option would be searching for some plugin which may help you to achieve this kind of functionality. -
AuthorPosts
Learn more about Renewing Item Support and Themeforest Item Support Policy.