最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

e commerce - Remove the link from the thumbnail and product title on woocommerce

programmeradmin6浏览0评论

Where exactly in the file structure can I find and edit the markup so that I remove that a href within the thumbnail and product title. I tried searching the template files but can't seem to find it. It's calling or echoing this template part (<?php wc_get_template_part( 'content', 'product' ); ?>) but there wasn't any markup showing the thumbnail or product title.

  <?php

    $args = array(
            'post_type' => 'product',
            'post_per_page' => 12,
    );

    $crate_products = new WP_Query ( $args );
    if ( $crate_products->have_posts() ) : while ( $crate_products->have_posts() ) :
      $crate_products->the_post();

    ?>

    <div class="three columns">
        <?php  wc_get_template_part( 'content', 'product' ); ?>


    </div>

    <?php wp_reset_postdata(); ?>

    <?php endwhile; else: ?>

    <?php endif; ?>

    <?php wp_reset_query(); ?>

Where exactly in the file structure can I find and edit the markup so that I remove that a href within the thumbnail and product title. I tried searching the template files but can't seem to find it. It's calling or echoing this template part (<?php wc_get_template_part( 'content', 'product' ); ?>) but there wasn't any markup showing the thumbnail or product title.

  <?php

    $args = array(
            'post_type' => 'product',
            'post_per_page' => 12,
    );

    $crate_products = new WP_Query ( $args );
    if ( $crate_products->have_posts() ) : while ( $crate_products->have_posts() ) :
      $crate_products->the_post();

    ?>

    <div class="three columns">
        <?php  wc_get_template_part( 'content', 'product' ); ?>


    </div>

    <?php wp_reset_postdata(); ?>

    <?php endwhile; else: ?>

    <?php endif; ?>

    <?php wp_reset_query(); ?>
Share Improve this question asked Apr 20, 2016 at 9:11 clestcruzclestcruz 2011 gold badge6 silver badges13 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

It's a bit hard to tell without knowing what shop theme you are using but I'll try anyways… 

The code <?php wc_get_template_part( 'content', 'product' ); ?> is basically calling the template file content-product.php. I would however not recommend you alter the default file.

On a standard woocommerce install you will find that default template file in the templates directory of woocommerce. If you have a theme installed that is woocommerce aware, chances are that you will also find a file content-product.php inside the theme directory. I would strongly recommend you use a child theme to override that file.

Depending on what theme you are using the code my vary – but at least inside the default woocommerce template file content-product.php you'll find the shop loop – and inside that loop the link tag beginning like this:

    <a href="<?php the_permalink(); ?>">

Depending on the theme you use you might have to digg a bit deeper since at least the default template file puts a link around every loop item (product). A.f.a.i.k. both the thumbnail and the product title are then rendered through seperate actions…

发布评论

评论列表(0)

  1. 暂无评论