-
AuthorPosts
-
May 18, 2017 at 10:23 pm #796203
Hello,
I’ve a plugin which converts currencies. I want to put the prices into the excerpt field of the masonry. The plugin works fine in the text fields. I’ve asked the author how to do and they said that I need to add do_shortcode function to the excerpt field.
I’ve checked the forum and found several solutions which none worked.
Solution by PeterHi!
Excerpts do not support shortcodes by default but you can use the do_shortcode() function to execute them even if wordpress does not support them in excerpts. In your case you need to modify /wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/portfolio.php – open up the file and replace$output .= !empty($excerpt) ? "<div class='grid-entry-excerpt entry-content' ".avia_markup_helper(array('context'=>'entry_content','echo'=>false)).">".$excerpt."</div>" : '';
with
$output .= !empty($excerpt) ? "<div class='grid-entry-excerpt entry-content' ".avia_markup_helper(array('context'=>'entry_content','echo'=>false)).">".do_shortcode($excerpt)."</div>" : '';
Cheers!
PeterHi Ben!
It’s on line 473 in /enfold/config-templatebuilder/avia-shortcodes/portfolio.php.
$output .= !empty($excerpt) ? "<div class='grid-entry-excerpt entry-content' ".avia_markup_helper(array('context'=>'entry_content','echo'=>false)).">".do_shortcode($excerpt)."</div>" : '';
I just tried it and it seems to work fine. If it’s still not working for you then send us a link to your page and we’ll take a look.Cheers!
ElliottBoth changes nothing
Solution by ElliottHi!
You could try doing the same on line 739 in the /enfold/config-templatebuilder/avia-shortcodes/masonry_entries.php file.
$this->loop[$key]['content'] = do_shortcode($entry->post_excerpt);
Though I’m not sure it’s going to work the same in the Masonry. What type of content are you trying to add?Regards,
ElliottBut there is no line 739, it ends at 418.
Hey dewasurya!
Please add the below code in functions.php to enable shortcode in excerpts.add_filter('the_excerpt', 'do_shortcode');
Best regards,
VinayChanges nothing.
I have added in the following line to the helper-masonry.php file.
Line 406: $this->loop[$key][‘content’] = do_shortcode($entry->post_excerpt);
With that shortcodes work. However, it only lets me enter in theme shortcodes, and it won’t display custom shortcodes. Is this code only meant to show avia shortcodes, or is it simply a matter of the custom shortcodes plugin not working properly in your opinion?
Also, this has no effect.
How can I let the wordpress process shortcodes in excerpt fields of the masonry portfolio?
May 21, 2017 at 9:19 pm #797303Hey pavlika,
To be honest with you, that is a very though modification
Peter has provided a guidance which is the further we can go
The best option is to consider to hire a freelancer who will be able to help you by follwing the directions provided and make it in a way to work through shortcodes from child theme.Best regards,
BasilisMay 23, 2017 at 11:05 pm #798559Thank you Basilis.
May 24, 2017 at 7:37 am #798742 -
AuthorPosts
- You must be logged in to reply to this topic.