Tagged: excerpts
-
AuthorPosts
-
October 1, 2017 at 6:07 pm #858944
Hey guys,
we’ve been using Enfold for years with many clients and projects and it’s simply one of the best themes on the market.
Well we have an issue here though, where we might need your help (searched a lot but weren’t able to find a good solution):
All the excerpts are empty when the Avia Layout builder is used. When the WP Standard editor is used it’s working.
We found out that the WP function “strip_shortcodes()” is responsible for the empty excerpts when the Avia Builder is used. As far as we know the function uses the global $shortcode_tags array where all the avia shortcodes (and any other) should be registered properly.If we for instance look at the includes/loop-search.php line 88-99:
$excerpt = trim(get_the_excerpt()); if(!empty($excerpt)) { the_excerpt(); } else { $excerpt = strip_shortcodes( get_the_content() ); $excerpt = apply_filters('the_excerpt', $excerpt); $excerpt = str_replace(']]>', ']]>', $excerpt); echo $excerpt; }
We see that if the excerpt is empty you’re attempting to generate a new one from the existing content. We checked at which point the content is being empty and it’s like mentioned before the WP function strip_shortcodes() itself. So we guess it must have something to do of how the shortcodes are being registered or something in this process chain.
We assume that it’s the same reason why we also have empty excerpts with the post grid (postslider.php), where the function avia_backend_truncate (located in function-set-avia-backend.php) is also using the strip_shortcodes function.
Any suggestions of what we could do? If this is something we can’t fix within Enfold, maybe you could point us to the right direction?
Thanks a lot in advance!!!
October 3, 2017 at 8:01 am #859488Hey Chris,
Thank you for using Enfold.
Have you tried adding the excerpt manually for posts that was built with the advance layout builder? Edit the post then enable the Screen Options > Excerpt box.
Best regards,
IsmaelOctober 3, 2017 at 11:45 am #859589Hi Ismael,
sure we did and that also works fine, but we need the auto-generated excerpts to be working.
Imagine migrating a huge blog with hundreds of articles and no excerpts were manually set.
Any suggestions?
Thanks in advance!
October 4, 2017 at 8:09 am #859966Hi,
auto-generated excerpts
I’m sorry but there is no excerpt because the advance layout builder generates no content. It does generate the shortcodes which is technically the content.
Imagine migrating a huge blog with hundreds of articles and no excerpts were manually set.
And you’re going to use the advance layout builder for those posts? Unfortunately, I think you’re going to have to spend a little more time adding the excerpt manually aside from the building the content from scratch.
There’s a workaround but there’s a reason why shortcodes are stripped out from the excerpt or content. In the loop-search.php file, you can replace the code with.
$content = trim(get_the_content()); if(!empty($content)) { echo wp_trim_words( get_the_content(), 40, '...' ); }
You’ll see what I mean.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.