-
AuthorPosts
-
November 9, 2018 at 12:48 pm #1031633
Hello Support.
I want to use an shortcode in the excerpt of my clients portfolio items in “Portfolio Grid” view but the code is showing as [Shordcode…..] on the front-end.
I already searched the forum and found this to a related question but it does not work for me:function avf_post_slider_entry_excerpt_custom($excerpt, $prepare_excerpt, $permalink, $entry ) { $excerpt = do_shortcode( $excerpt ); return $excerpt; } add_filter('avf_post_slider_entry_excerpt', 'avf_post_slider_entry_excerpt_custom', 10, 4);
Any suggestion what could be wrong? The shortcode works fine in normal content.
Thanks for your help!
November 12, 2018 at 2:14 pm #1032600Is it not possible to do this?
November 13, 2018 at 5:07 pm #1033071Hi gregorh,
If you want to use the shortcode, I think you can just override Post Slider.
You can read our documentation for more information: https://kriesi.at/documentation/enfold/intro-to-advanced-layout-builder/#add-elements-to-albBest regards,
NikkoNovember 13, 2018 at 6:12 pm #1033085Hello Nikko,
actually I don’t think it will work like this.
Every Portfolio Item has a different shortcode inside his excerpt so a general shortcode in the Postslider function will not work.
Or, maybe I just don’t understand what you think I could?? I can’t see how modifying the postslider function itself could help me show a shortcode for each individual item.
I just need that the in Portfolio Grid view the shortcodes I have in the items excerpt shows correctly.Thanks for your help.
November 14, 2018 at 11:32 am #1033445Hello, I can’t really believe that this is not possible…..
I found this function in the forum, which is obviously made for the avf_postslider…
function avf_post_slider_entry_excerpt_custom($excerpt, $prepare_excerpt, $permalink, $entry ) { $excerpt = do_shortcode( $excerpt ); return $excerpt; } add_filter('avf_post_slider_entry_excerpt', 'avf_post_slider_entry_excerpt_custom', 10, 4);
I need the same but for the portfolio!!! (post grid). How would it need to be changed to work in Portfolios?
Thanks a lot,
GregorNovember 14, 2018 at 1:47 pm #1033492OK, thanks for all the help ;)
I finally found a way to show the shortcode inside the excerpt!
I copied:
$excerpt = apply_filters( 'avf_post_slider_entry_excerpt', $excerpt, $prepare_excerpt, $permalink, $entry );
from postslider.php (Line 639) into portfolio.php (Line567) and added this code into my child-themes functions.php file:function avf_post_slider_entry_excerpt_custom($excerpt, $prepare_excerpt, $permalink, $entry ) { $excerpt = do_shortcode( $excerpt ); return $excerpt; } add_filter('avf_post_slider_entry_excerpt', 'avf_post_slider_entry_excerpt_custom', 10, 4);
Now the shortcode gets executed correctly.
And to make it save for future Theme updates I used Nikkos suggestion and copied the portfolio.php into a new created folder “shortcodes” inside my child theme and added this code:
add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1); function avia_include_shortcode_template($paths) { $template_url = get_stylesheet_directory(); array_unshift($paths, $template_url.'/shortcodes/'); return $paths; }
into my child-themes functions.php file to make it use the file from my shortcode folder instead of the original file.
Thanks
Gregor- This reply was modified 6 years ago by gregorh.
November 15, 2018 at 11:44 am #1033894Hi Gregor,
Glad to hear that :)
And thanks for posting the solution that worked for you.
It should help anyone that needs the same modification for portfolio.Best regards,
NikkoJune 3, 2020 at 9:11 am #1218977Hi! This isn’t working for me, any ideas to use shortcodes from other plugins (Doneren met Mollie) in Portfolio excerpt?
I added this code on line 941 in portfolio.php in stead of 567:
$excerpt = apply_filters( 'avf_post_slider_entry_excerpt', $excerpt, $prepare_excerpt, $permalink, $entry );
June 3, 2020 at 9:12 am #1218978On this site you see the shortcode I’m using, this should create a number (€).
June 8, 2020 at 9:33 am #1220403Hi jannnnnneke,
Another way to make it work is to replace this codes in portfolio.php (line 902 and 910 in Enfold 4.7.5):
$excerpt = $entry->post_excerpt;
with:
$excerpt = do_shortcode( $entry->post_excerpt );
Best regards,
NikkoJune 8, 2020 at 10:14 am #1220418Hi Nikko,
Thanks but it’s not working. See portfolio item on this page. Thanks!
June 9, 2020 at 10:05 am #1220803It’s also not working in buttons. Any ideas?
June 9, 2020 at 8:04 pm #1220951Hi jannnnnneke,
Please post us your login credentials (in the “private data” field), so we can take a look at your backend.
- Install and activate ” Temporary Login Without Password “.
- Go to ” Users > Temporary Logins ” on the left-side menu.
- Click ” Create New “.
- Add the email address for the account ( you can use (Email address hidden if logged out) ), as well as the ” Role ” making that the highest possible and the expiry about four days
( to be sure that we have enough time to debug ). - Click ” Submit “.
- You’ll now have a temporary account. Please provide us here in the private section the URL, so we can login and help you out.
When your issue is fixed, you can always remove the plugin!
If you prefer to not use the plugin, you can manually create an admin user and post the login credentials in the “private data” field.Best regards,
NikkoJune 9, 2020 at 8:16 pm #1220956Hi! See private data! Thanks!!
June 12, 2020 at 8:11 pm #1222171Hi jannnnnneke,
Thanks for giving us admin access.
I have added this code in your child theme’s functions.php:function enfold_masonry_loop_entry_content($loop_excerpt) { return do_shortcode( $loop_excerpt ); } add_filter( 'avf_masonry_loop_entry_content', 'enfold_masonry_loop_entry_content');
it works well and without the need to modify the parent theme :)
Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.