Hi
I had this thread open: https://kriesi.at/support/topic/show-product-category-description-even-when-there-is-no-products/#post-1358508
I have the solution of the above thread working, however, because the search results uses a page template, the H1 in the description editor gets converted to uppercase. All other product categories use the shop template and the H1 is in normal sentence case.
How to I maintain consistency by having the H1 display in sentence case on the search result page?
Here’s the code snippet I have and would it be appropriate to add CSS for the H1 within it?
function archive_description_callback() {
$term_object = get_queried_object();
$archive_description = $term_object->description;
echo '<div class="archive-description">'.$archive_description.'</div>';
return $output;
}
add_shortcode( 'archive_description_shortcode', 'archive_description_callback' );
function add_archive_description_shortcode() { ?>
<script>
(function($){
var short_code = '<?php echo do_shortcode("[archive_description_shortcode]"); ?>';
if ($('#top.archive.tax-product_cat .entry-content-wrapper').attr("id") == "search-fail") {
$(short_code).insertBefore( ".woocommerce-products-header" );
}
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'add_archive_description_shortcode');
Thank you
Lyse
Hi
Here’s a links to a product category that does not have products and where the H1 is in uppercase: https://diyjewellery.com/settings/settings-jeweler/settings-jeweler-gold/
Thanks
Lyse
Hi,
Thanks for the link to your page, please try this css:
#top.archive .template-search-none.template-page .entry-content-wrapper h1 {
text-transform: capitalize;
}
After applying the css, please clear your browser cache and check.
Best regards,
Mike
Hi Mike,
Thank you so much. That CSS does the trick.
Have a nice remaining of your weekend.
Happy Holidays
Lyse
Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.
Best regards,
Mike