I want to add a link to related product on the a with 'Obtenir en Grade Pro'. All my product have only 1 related element.
I am not able to have ONLY the link to the related product.
I am able to have the image, title and couple of thing of the related product but I can't have ONLY the link. How can I do that?
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://ift.tt/vTku09
*
* @package storefront
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if( is_home() ) : ?>
<section id="recent">
<h2>Les différents bâtons</h2>
<?php
$args = array( 'post_type' => 'product', 'meta_key' => '_featured','posts_per_page' => 15,'columns' => '3', 'meta_value' => 'yes' );
$loop = new WP_Query( $args );?>
<ul class="products">
<?php while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
<li class="product">
<?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" width="300px" height="300px" />'; ?>
<h3><?php the_title(); ?></h3>
<span class="price"><?php echo $product->get_price_html(); ?></span>
<a>" title="<?php the_title(); ?>">
<div class="hover-fiche"><p>Fiche complète du produit</p></div>
</a>
//ADD THE LINK TO RELATED PRODUCT IN THE A
<a href="LINK TO RELATED PRODUCT HERE">
<div class="gradeprobutton">Obtenir en Grade Pro</div>
<img src="wp-content/themes/storefront-child/images/info.png" alt="informations supplémentaires">
<span class="gradepro">
Bois de gamme *grade pro* sélectionné et confectionné dans un de nos 4 modèles. Il est seulement disponible dans notre édition spéciale pour la couleur.(99.99$)
</span>
</a>
<!--Second tooltip-->
<!--<div class="gradeprodiv">
<a>post->ID ); ?>"><span class="gradeprobutton">Obtenir en grade Pro</span> <span class="info-icon"><div class="info"><p>Bois de gamme *grade pro* sélectionné et confectionné dans un de nos 4 modèles. Il est seulement disponible dans notre édition spécial pour la couleur </p></div></span></a>
</div> -->
<?php
/**
* woocommerce_pagination hook
*
* @hooked woocommerce_pagination - 10
* @hooked woocommerce_catalog_ordering - 20
*/
do_action( 'woocommerce_pagination' );
?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
<?php wp_reset_query(); ?>
</section><!-- /recent -->
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_footer(); ?>
Thank you for everyone who will give a answer.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire