Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #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!

    #1032600

    Is it not possible to do this?

    #1033071

    Hi 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-alb

    Best regards,
    Nikko

    #1033085

    Hello 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.

    #1033445

    Hello, 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,
    Gregor

    #1033492

    OK, 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 5 years, 3 months ago by gregorh.
    #1033894

    Hi 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,
    Nikko

    #1218977

    Hi! 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 );

    #1218978

    On this site you see the shortcode I’m using, this should create a number (€).

    #1220403

    Hi 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,
    Nikko

    #1220418

    Hi Nikko,

    Thanks but it’s not working. See portfolio item on this page. Thanks!

    #1220803

    It’s also not working in buttons. Any ideas?

    #1220951

    Hi jannnnnneke,

    Please post us your login credentials (in the “private data” field), so we can take a look at your backend.

    1. Install and activate ” Temporary Login Without Password “.
    2. Go to ” Users > Temporary Logins ” on the left-side menu.
    3. Click ” Create New “.
    4. 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 ).
    5. Click ” Submit “.
    6. 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,
    Nikko

    #1220956

    Hi! See private data! Thanks!!

    #1222171

    Hi 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

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.