Register with your Envato account

Support forums

Homepage Support Polaris WooCommerce In Feed ads in Product Thumbnails

In Feed ads in Product Thumbnails

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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10031

    RajGundi
    Participant

    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.
    #10038

    Hey,

    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.

Viewing 2 posts - 1 through 2 (of 2 total)
You must have active support license to create new replies.

Learn more about Renewing Item Support and Themeforest Item Support Policy.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close