-
AuthorPosts
-
April 4, 2016 at 12:46 am #607300
I’ve been using the Advanced Except plugin to make the enfold dropcaps shortcode work in search results and archive page excepts (WordPress filters-off/strips shortcodes in excerpts). So far it works great, but I’ve now run into a situation where I need dropcaps to appear in the Magazine element excerpts. Is there a functions.php way to enable the Enfold dropcaps globally (prevent shortcode stripping in other shortcode excerpts)? If not, can you advise how to fix this in magazine element excerpts? It would be greatly appreciated! :)
Many thanks in advance!
- This topic was modified 8 years, 8 months ago by cryscryb.
April 4, 2016 at 3:42 pm #607682Hey cryscryb!
can you provide us a link to your site showing the elements in question please? we need to be able to inspect the elements.
Regards,
AndyApril 5, 2016 at 2:24 am #607993Here’s the URL (in a private attachment)
April 5, 2016 at 2:25 am #607994Notes:
– All plugins are currently disabled.– I tried adding the following to my child-theme functions: add_filter( ‘the_excerpt’, ‘do_shortcode’, 11 ); No joy
– I have disabled my child-theme and gone back to the primary (non-modified) Enfold theme.
– I’m on the current version of WordPress (4.2.2)
– I’m on the most current version of Enfold (3.5.1)
– I tried removing all CSS in the admin panel CSS field – no change so I put my CSS backExamining the code in Firefox or Chrome shows the shortcode and it’s contents (dropcap/character) are completely stripped/filtered off in the rendered code when the element is inspected.
– I am not using custom excerpts of any kind, I’m allowing the magazine element to create the excerpt.
- This reply was modified 8 years, 8 months ago by cryscryb.
April 5, 2016 at 10:21 pm #608536I wasn’t able to wait for a response so I found an alternate solution. I will no longer use the Enfold dropcaps shortcode because:
– It does not degrade gracefully (both code and first letter of the paragraph are stripped when displayed in shortcode excerpts, search and archive pages).
– It’s extra work to insert this in every post.Instead I’m moving to a CSS snipet to create an automatic dropcap on every post.
– This degrades gracefully in all excerpts (only the HTML/CSS formatting is stripped, not the letter).
– Less work/automatic.The only Cons I can see are:
– If have a post or two where I need the first letter to NOT be auto-dropcapped.
– I now have to go and remove all dropcap shortcodes from my existing posts. :/I thought I’d share this for anyone else who runs into this issue. Consider not using the dropcaps shortcode if you want the first letter of your post or page to not be stripped in excerpts (which are often used on Archive and Search Results pages); or if you use Enfold shortcodes that display excerpts. You might instead consider using a CSS trick to apply dropcaps site-wide and avoid this issue (adjusting the CSS below to target elements appropriately for your desired result):
/*-- auto-dropcap the first paragraph element of entry-content in standard editor --*/ .entry-content > p:nth-of-type(1):first-letter { display: block; float: left; font-size: 38px; line-height: 32px; margin: 4px 8px 0 0; }
April 9, 2016 at 1:07 pm #610573Hi!
It’s possible to render shortcodes in a magazine excerpt but you have to modify the config-templatebuilder > avia-shortcodes > magazine.php file. Look for this code around line 566:
$excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters( 'avf_magazine_excerpt_length' , 60) , apply_filters( 'avf_magazine_excerpt_delimiter' , " "), "…", true, '');
Set the avia_backend_truncate’s $stripClean parameter to false:
$excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters( 'avf_magazine_excerpt_length' , 60) , apply_filters( 'avf_magazine_excerpt_delimiter' , " "), "…", false, '');
Shortcodes are not allowed by default because it will possibly cause a lot of errors in the layout.
Regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.