Reputation: 33
I am trying to:
However the remove_action queries don't work and the description now displays above and below the products.
I don't want to rely on css to hide the duplicate description as I believe it is bad for SEO.
What is the correct action to remove?
Todo this I've tried:
add_action('woocommerce_after_main_content', 'add_shop_page_description');
function add_shop_page_description(){
if (is_shop() && !property_exists(get_queried_object(), 'slug')){
remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 );
$shop_id = woocommerce_get_page_id('shop');
$content = get_the_content(null, false, $shop_id);
echo apply_filters( 'the_content', $content );
}
}
Upvotes: 1
Views: 244
Reputation: 2096
Add the following in your functions.php in your child theme.
remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 );
add_action('woocommerce_after_main_content', 'add_shop_page_description');
function add_shop_page_description(){
if (is_product()){
$shop_id = wc_get_page_id('shop'); // replace woocommerce_get_page_id() with wc_get_page_id()
$content = get_the_content(null, false, $shop_id);
echo apply_filters( 'the_content', $content );
}
}
Upvotes: 2