Answer the question
In order to leave comments, you need to log in
How to integrate an additional piece into a piece of code correctly?
There is this piece of code
if( ! function_exists( 'woodmart_after_add_to_cart_area' ) ) {
function woodmart_after_add_to_cart_area(){
$content = woodmart_get_opt( 'content_after_add_to_cart' );
if ( empty( $content ) ) return;
echo '<div class="woodmart-after-add-to-cart">' . do_shortcode( $content ) . '</div>' ;
}
add_action( 'woocommerce_single_product_summary', 'woodmart_after_add_to_cart_area', 31 );
}
$my_lang = pll_current_language();
if ( $my_lang == 'en' ) {
echo do_shortcode ('[html_block id="3455"]');
} elseif ( $my_lang == 'uk' ) {
echo do_shortcode ('[html_block id="4730"]');
} else {
echo do_shortcode('[html_block id="4725"]');
}
Answer the question
In order to leave comments, you need to log in
In WordPress, there is no such thing as "correct", since everything that moves more or less is recognized as the right decision. Therefore, bothering with codestyle, correctness, maintainability, and at least an elementary division into code, data, and presentation in the wordpress environment is considered bad manners. The only thing to take care of is that the length of the name of each next written function must be greater than the previous one. This is due to the fact that in theory each next function describes a more complex functional than the previous one, and possibly contains all the previous ones. In this case, as a name, you can simply combine all the names of the functions used through underscores. Otherwise, you are free to freestyle.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question