Hello! @rayblackwell
If you have a child theme for your theme (which I strongly recommend since you’re doing custom work) you can copy the content-single-product.php WooCommerce template to your child theme /woocommerce/single-product/ folder (make the folder if it doesn’t exist).
Then you can make edits to your child-theme/woocommerce/single-product/content-single-product.php file that will never get over-written with updates. These changes will show on the front end because Woo has a templating system.
Doing something like:
/**
* Hook: woocommerce_before_single_product.
*
* @hooked wc_print_notices – 10
*/
do_action( ‘woocommerce_before_single_product’ );
if ( post_password_required() ) {
echo get_the_password_form(); // WPCS: XSS ok.
return;
}
// insert a <br> or some other HTML to format a space below here: ?>
<br />
<?php
/**
*PosicionFPD
*/
do_action( ‘fpd_product_designer’ );
?>
Would probably help, but you could use other HTML tags with CSS to achieve your intended result, maybe just wrap the fpd_product_designer in a <div>.
Hopefully you understand and this helps you. 🙂
Thank you very much!
Finally I did this:
<div id="fancyportacentros">
<?php
/**
*PosicionFPD
*/
do_action( 'fpd_product_designer' );
?>
</div>
It was that simple! 🙂
I asume reading your answer that is not possible to set up this hook with the snippets plugin. Am I right?
-
This reply was modified 6 years, 3 months ago by
rayblackwell.
-
This reply was modified 6 years, 3 months ago by
rayblackwell.
@rayblackwell
Are you saying you’d like to later on do something like:
add_action( 'fpd_product_designer', 'fpd_product_designer_fx' )
function fpd_product_designer_fx() {
// output etc. etc. etc.
}
and need a place to insert that script on your site? Personally I’d do it in a child theme functions.php file… but maybe you can do it as a snippet. You can try!
Yes!
I’ll try to do it as a snippet, but I already have lots of work to do and no time! :S For now, it’s working, so I’ll copy the content-single-product to my theme to avoid problems with updates..
Thank you again for your help.
Have a great day!
Ricardo.
@rayblackwell Hopefully you meant “child theme” when you said “copy the content-single-product to my theme to avoid problems with updates,” because if you just copy it to your parent theme, and update that, it will be over-written. Sorry if this is too obvious. Good luck!