April 14, 2014 at 1:02 pm #251015
Hi, my name is Egon, i love your theme ENFOLD, it is really very easy to use and works very fine.
I only have one question: I would like to show an shortcode in the excerpt of the theme. But if i put the shordcode “[wpc_countdown targetdate=” (Purchase code hidden if logged out) -59″]” into it i will not work. It only shows up the text.
I’ve tried to place the “add_filter(‘get_the_excerpt’,’do_shortcode’);” filter to the functions.php, but als soon as i saved it the page does not longer show, the browser stais white.
How can i manage to get it run?
Thank you in advanced for your reply, yours Egon.April 14, 2014 at 2:53 pm #251089April 14, 2014 at 3:04 pm #251096
Thank you for using the theme!
Please edit the post then look for Screen Options. Enable the excerpt metabox. Use it to specify the excerpt of the post along with the shortcode. I hope that it works.
IsmaelApril 14, 2014 at 3:14 pm #251103April 14, 2014 at 3:14 pm #251104
My bad! I didn’t notice that you’re using the blog grid style. Please edit config-templatebuilder > avia-shortcodes > postslider.php. Find this code on line 311:
$prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters( 'avf_postgrid_excerpt_length' , 60) , apply_filters( 'avf_postgrid_excerpt_delimiter' , " "), "…", true, '');
Replace it with this:
$prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : do_shortcode($entry->post_content, apply_filters( 'avf_postgrid_excerpt_length' , 60) , apply_filters( 'avf_postgrid_excerpt_delimiter' , " "));
That should enable the shortcodes on blog grid excerpts.
IsmaelApril 14, 2014 at 3:17 pm #251106April 14, 2014 at 3:23 pm #251110April 14, 2014 at 4:11 pm #251167
I’m sorry but it is working on my end. Maybe, you didn’t paste the code correctly. Can you please post the code on line 311 here?
IsmaelApril 14, 2014 at 4:17 pm #251171April 14, 2014 at 4:19 pm #251174April 14, 2014 at 4:21 pm #251176April 14, 2014 at 4:26 pm #251179April 14, 2014 at 4:29 pm #251181April 15, 2014 at 7:33 am #251463
Thank you for the update.
Please ignore the suggestion about the Screen Options > Excerpt metabox then do the changes above on line 311. Place the shortcode on the text editor. This is what I have on my end when I use the icon shortcode:
Since you’re using a third party plugin’s shortcode, please contact the plugin author. Thanks!
IsmaelApril 16, 2014 at 9:38 am #251996April 17, 2014 at 3:25 am #252400
1. Have you tried setting a manual excerpt?
2. You can set that in the Header options at the right when editing the Page:
(Purchase code hidden if logged out) /00000111.png” alt=”” />
JosueApril 17, 2014 at 9:30 am #252527April 17, 2014 at 12:32 pm #252630April 21, 2014 at 5:40 pm #253943
Excerpts in WordPress do not support shortcodes so you need to enable it on that specific selection as Ismael indicated above and as you mentioned you had working. You’ll need to go back and re-enable them on that file each time you update the theme.
DevinApril 22, 2014 at 10:27 am #254258April 22, 2014 at 4:02 pm #254421
Sorry for the confusion.
Please edit the same line on postslider.php that we suggested above. Replace the code with this:
$prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : do_shortcode(avia_backend_truncate($entry->post_content, apply_filters( 'avf_postgrid_excerpt_length' , 150) , apply_filters( 'avf_postgrid_excerpt_delimiter' , " ") , "…", false, ''));
This should allow the shortcode but since it is also calculating the shortcode as excerpt, you might want to increase the avia_backend_truncate string limit from the default 60 to 150 or more.
IsmaelApril 23, 2014 at 4:49 pm #255059
The topic ‘Shortcode does not work in excerpt’ is closed to new replies.