hello i'm using this code in my functions.php file to display a short description in shop page (woocommerce page) but the discription goes before the title can some one help me please to display it after the title thank you
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`[[^]]*]`','',$excerpt);
return $excerpt;
}
function woocommerce_after_shop_loop_item_title_short_description() {
if ( has_excerpt() ) :
?>
<div itemprop="description">
<?php echo apply_filters( 'woocommerce_short_description', excerpt(10) ) ?>
</div>
<?php
endif;
}
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_after_shop_loop_item_title_short_description', 5 );```
hello i'm using this code in my functions.php file to display a short description in shop page (woocommerce page) but the discription goes before the title can some one help me please to display it after the title thank you
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`[[^]]*]`','',$excerpt);
return $excerpt;
}
function woocommerce_after_shop_loop_item_title_short_description() {
if ( has_excerpt() ) :
?>
<div itemprop="description">
<?php echo apply_filters( 'woocommerce_short_description', excerpt(10) ) ?>
</div>
<?php
endif;
}
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_after_shop_loop_item_title_short_description', 5 );```
An Link to your page might be useful to see exactly what is happening.
To display something After the Title and before the shop loop I would suggest Hooking in to the 'woocommerce_before_shop_loop' Hook
by doing something like:
add_action( 'woocommerce_before_shop_loop', 'woocommerce_after_shop_loop_item_title_short_description', 10 ); function woocommerce_after_shop_loop_item_title_short_description() { echo ''; echo 'something here'; echo ''; }
Screenshot of my example in action:
Checkout this Visual Hook Guide for some more information on where the different hooks are https://businessbloomer.com/woocommerce-visual-hook-guide-archiveshopcat-page/