Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › SEO meta description length limit
Tagged: meta description, SEO
- This topic has 1 reply, 2 voices, and was last updated 4 years, 7 months ago by Sarmistha Chakraborty.
Viewing 1 reply thread
- AuthorPosts
- May 12, 2020 at 3:00 pm #129995Oksana GrishchenkoParticipant
Hello
Can you please tell me how to implement meta description word limit to ensure good and consistent SEO in the product page. Admin should be able to control the number since it keeps changing as per google norms. We are talking about store–>product>seo , vendor can fill up meta description. Without the limit, site seo is impacted negatively. - May 13, 2020 at 11:39 am #130314Sarmistha ChakrabortyMember
Hello,
Add this js in your theme’s js file -(replace wordlen with your required word limit)
if( $('.vendor-dashboard textarea#yoast_wpseo_metadesc').length > 0 ) { var wordLen = 10, len; // Maximum word length $('.vendor-dashboard textarea#yoast_wpseo_metadesc').keydown(function(event) { len = $('.vendor-dashboard textarea#yoast_wpseo_metadesc').val().split(/[\s]+/); if (len.length > wordLen) { if ( event.keyCode == 46 || event.keyCode == 8 ) {// Allow backspace and delete buttons } else if (event.keyCode < 48 || event.keyCode > 57 ) {//all other buttons event.preventDefault(); } } }); }
And add this code n your theme’s functions.php –
add_filter( 'body_class', function( $classes ) { $userid = get_current_user_id(); if(wcfm_is_vendor($userid)) { $classes = array_merge( $classes, array( 'vendor-dashboard' ) ); } return $classes; });
Thanks.
- AuthorPosts
Viewing 1 reply thread
- You must be logged in to reply to this topic.