Reputation: 515
I am trying to get my head around where the various template files are stored for WooCommerce, Wordpress, & the theme I am using (Reykjavic).
I have successfully created a child theme to make my amendments and have found and edited some template files successfully.
I'd like to move the link to be part of the text itself and not a separate paragraph. The templates are displaying it on the page like this:
<div class="woocommerce-product-details__short-description">
<p>The B&G Zeus3 Glass Helm 19 is designed specifically for blue water sailing, multihulls and superyachts; this premium, super-fast, super large-screen, multifunction display sits at the heart of your fully integrated navigation system and comes with B&G’s unique sailing features including SailSteer and RacePanel.</p>
<p class="product-description-link-container">
<a href="#tab-description" class="product-description-link">More details…</a>
</p>
I have found this WooCommerce template file which I believe sends the short description to the page:
/**
* Single product short description
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/short-description.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
global $post;
$short_description = apply_filters( 'woocommerce_short_description', $post->post_excerpt );
if ( ! $short_description ) {
return;
}
?>
<div class="woocommerce-product-details__short-description">
<?php echo $short_description; // WPCS: XSS ok. ?>
</div>
</div>
I believe I need to find or amend the post excerpt where this is happening. apply_filters( 'woocommerce_short_description', $post->post_excerpt );
but unsure where this is being set?
Could anyone point me in the right direction?
Upvotes: 1
Views: 906
Reputation: 11861
add_action( 'woocommerce_short_description', 'modify_short_description' );
function modify_short_description( $short ) {
return $short . '<a rel="nofollow" href="https://www.google.com" class="read_more">More details</a>';
}
Try this code snippet
Upvotes: 1