Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
May 16, 2022 at 1:30 pm #1351954
Hi,
I have problem getting the read more/less button in category text to work.
Any solution?I also having problems with the category menue to be on the right when open a product.
It moves to under the products.May 18, 2022 at 8:11 am #1352149Hey KvarngardenMedia,
Thank you for the inquiry.
Try to add this script in the functions.php file to initially hide some of the categories and create a toggle button.
function ava_add_custom_script(){ ?> <script> (function($) { $(".product_meta").prepend("<a class='prod_category_toggle cat_hidden' href='#'>toggle</a>"); $(".prod_category_toggle").on("click", function() { var toggle = $(this); if( toggle.is(".cat_hidden") ) { show_categories(); } else { hide_categories(); } toggle.toggleClass("cat_hidden"); }); function hide_categories() { var posted_in = $(".product_meta .posted_in").html(); var posted_in_replaced = posted_in.replaceAll(", ", "<span class='sep'>, </span>"); $(".product_meta .posted_in").html(posted_in_replaced); $(".product_meta .posted_in a").each(function(i) { if (i > 10) { $(this).css("display", "none"); $(this).next(".sep").css("display", "none"); } }); } function show_categories() { $(".product_meta .posted_in a").each(function(i) { $(this).css("display", "inline"); $(this).next(".sep").css("display", "inline"); }); } hide_categories(); })(jQuery); </script> <?php } add_action('wp_footer', 'ava_add_custom_script');You can adjust the style of the toggle button with this css code.
.prod_category_toggle { position: absolute; background: #555555; padding: 10px 15px; font-size: 15px; border-radius: 2px; color: #ffffff; }Best regards,
Ismael -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
