php - Auto text woocommerce_short_description hook -
i trying create automatic text in description of woocommerce articles , put "article available in store."
i thought putting inside function this:
add_filter ('woocommerce_short_description', 'in_single_product', 10, 2); function in_single_product () { echo '<p> my-text-here </ p>'; }
but text not appear in front-end. appears if put text on back-end.
does know why happens?
the correct syntax writing add_filter
// define my_editor_content function my_editor_content( $post_excerpt ) { // make filter magic happen here... return $post_excerpt; }; // add filter add_filter( 'woocommerce_short_description','my_editor_content',10, 1 );
well, use code in functions.php of child theme.
function my_editor_content( $post_excerpt ) { $content = 'the default text, imposed me, needs here in every product.'; return $content.'<br>'.$post_excerpt; } add_filter('woocommerce_short_description', 'my_editor_content', 10, 1);
i hope you.
Comments
Post a Comment