Home › Forums › WoodMart support forum › woodmart excerpts on blog archive showing elementor code
woodmart excerpts on blog archive showing elementor code
- This topic has 12 replies, 3 voices, and was last updated 2 years, 3 months ago by Luke Nielsen.
-
AuthorPosts
-
July 7, 2022 at 11:30 pm #389482
hollistergjParticipantBlog archive is showing excerpts but they are showing elementor shortcode in the excerpt.
When I turn use twenty-twenty theme it does not show that code.
When I go back to woodmart, it shows up again.
I have turned off all other plugins not included with woodmart and done all the latest upgrades for WP, woocommerce and all other plugins.
How do I get the code to not show up in excerpts?July 8, 2022 at 9:39 am #389527
Luke NielsenKeymasterHello,
Could you provide login access for your site’s WordPress admin panel? So we can log in and check what is wrong on your side.
I await your response.
Kind Regards
July 18, 2022 at 4:50 pm #391848
hollistergjParticipantsure
July 19, 2022 at 10:03 am #391991
Luke NielsenKeymasterHello,
Sorry, but the admin details are incorrect, please update it and let me know.
https://gyazo.com/cb4228e7c14cf5cfc91524624f46089a
Looking forward to hearing back from you!
Kind Regards
July 19, 2022 at 4:07 pm #392128
hollistergjParticipantok
July 20, 2022 at 3:51 pm #392360
Luke NielsenKeymasterHello,
Please send us your FTP access to your server files so we can check what is wrong with your website. We will do our best to help you.
Kind Regards
July 20, 2022 at 6:04 pm #392422
hollistergjParticipantthanks
July 22, 2022 at 9:55 am #392783
Luke NielsenKeymasterHello,
You can sort it out with the below code, enter it into the
functions.php
file in your child theme.if( ! function_exists( 'woodmart_excerpt_from_content' ) ) { function woodmart_excerpt_from_content($post_content, $limit, $shortcodes = '') { // Strip shortcodes and HTML tags if ( empty( $shortcodes )) { $post_content = preg_replace("/\[caption(.*)\[\/caption\]/i", '', $post_content); $post_content = preg_replace('\[[^\]]*\]','',$post_content); } $post_content = stripslashes( wp_strip_all_tags( $post_content ) ); if ( woodmart_get_opt( 'blog_words_or_letters' ) == 'letter' ) { $excerpt = mb_substr( $post_content, 0, $limit ); if ( mb_strlen( $excerpt ) >= $limit ) { $excerpt .= '...'; } }else{ $limit++; $excerpt = explode(' ', $post_content, $limit); if ( count( $excerpt) >= $limit ) { array_pop( $excerpt ); $excerpt = implode( " ", $excerpt ) . '...'; } else { $excerpt = implode( " ", $excerpt ); } } $excerpt = strip_tags( $excerpt ); if ( trim( $excerpt ) == '...' ) { return ''; } return $excerpt; } }
Please let me know if you have any further questions in the meantime.
Kind Regards
- This reply was modified 2 years, 4 months ago by Luke Nielsen.
- This reply was modified 2 years, 4 months ago by Luke Nielsen.
- This reply was modified 2 years, 4 months ago by Luke Nielsen.
July 25, 2022 at 5:51 pm #393432
hollistergjParticipantThanks so much.
Unfortunately, that didn’t seem to work, I pasted your code in and I’m getting this error message on the excerpts now:
Warning: preg_replace(): Unknown modifier '\' in /home/vieracleartech/public_html/wp-content/themes/woodmart-child/functions.php on line 15
this is line 15 in your code:
$post_content = preg_replace('<code>\[[^\]]*\]</code>','',$post_content);
This also didn’t have an effect on the HTML block shortcode being used in the category description. It’s still showing as just the shortcode, not the content of it.
July 26, 2022 at 10:19 am #393572
Luke NielsenKeymasterHello,
The issue has been fixed on your website so now it appears well.
https://gyazo.com/2e807f29bc04034051731a346cd44509
If you’d like to contact us, we are here for whatever questions you may have.
Kind Regards
August 22, 2022 at 6:45 pm #398832
FranjujuParticipantHi, I have exactly the same problem with the same error message. Can you provide the corrected version of the code to copy please?
Thank you!
August 22, 2022 at 6:52 pm #398833
FranjujuParticipantJust fixed it:
if( ! function_exists( 'woodmart_excerpt_from_content' ) ) { function woodmart_excerpt_from_content($post_content, $limit, $shortcodes = '') { // Strip shortcodes and HTML tags if ( empty( $shortcodes )) { $post_content = preg_replace("/\[caption(.*)\[\/caption\]/i", '', $post_content); $post_content = preg_replace('/\[[^\]]*\]/i','',$post_content); } $post_content = stripslashes( wp_strip_all_tags( $post_content ) ); if ( woodmart_get_opt( 'blog_words_or_letters' ) == 'letter' ) { $excerpt = mb_substr( $post_content, 0, $limit ); if ( mb_strlen( $excerpt ) >= $limit ) { $excerpt .= '...'; } }else{ $limit++; $excerpt = explode(' ', $post_content, $limit); if ( count( $excerpt) >= $limit ) { array_pop( $excerpt ); $excerpt = implode( " ", $excerpt ) . '...'; } else { $excerpt = implode( " ", $excerpt ); } } $excerpt = strip_tags( $excerpt ); if ( trim( $excerpt ) == '...' ) { return ''; } return $excerpt; } }
August 23, 2022 at 10:44 am #398956
Luke NielsenKeymasterHello,
Glad that you manage to sort this out.
Always remember that you can reach out to us with any questions you may have.
We wish you a splendid day!
Kind Regards
-
AuthorPosts
The topic ‘woodmart excerpts on blog archive showing elementor code’ is closed to new replies.
- You must be logged in to create new topics. Login / Register