Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1199093

    Hello, I’m trying to add an acf custom field inside the “taxonomy-portfolio_entries.php” loop.
    I know how to do it for masonry by using the following function :

    add_filter( 'avf_masonry_loop_prepare', 'avf_masonry_loop_prepare_mod_cat', 10, 2 );
    function avf_masonry_loop_prepare_mod_cat( $key, $entries )
    {
    	$clients = get_field('nom_du_client', $key['ID']);
        $key['text_after'] .= "<div class='client-name'>". $clients ."</div>";
        return $key;
    }

    But I’m not sure how to apply it to the avia_post_grid…
    Alternatively, would it be possible to use the masonry layout instead of the grid layout on the portfolio category pages ?
    Thanks a lot for your help!

    #1202551

    Hey maxgorelkine,

    Thank you for the inquiry.

    You can manually edit the enfold\config-templatebuilder\avia-shortcodes\portfolio\portfolio.php file and add the extra content there, or use the avf_portfolio_extra filter, which is the same as the avf_masonry_loop_prepare filter but for portfolio element.

    Best regards,
    Ismael

    #1202696

    Hello Ismael, thank you! I will give it a try and let you know…

    #1202701

    Hello, I tried to replace my code by

    add_filter( 'avf_portfolio_extra', 'avf_portfolio_extra_mod_cat', 10, 2 );
    function avf_portfolio_extra_mod_cat( $key, $entries )
    {
    	$clients = get_field('nom_du_client', $key['ID']);
        $key['text_after'] .= "<div class='zebra-client'>". $clients ."</div>";
        return $key;
    }

    But it doesn’t seem to work…
    I’m trying to show the extra field in the grid used on portfolio category pages…

    • This reply was modified 4 years, 7 months ago by maxgorelkine.
    #1203428

    Hi,

    Thank you for the update.

    The filter should return an html output. Please try this code instead.

    add_filter( 'avf_portfolio_extra', 'avf_portfolio_extra_mod_cat', 10, 2 );
    function avf_portfolio_extra_mod_cat( $output, $entry )
    {
        $clients = get_field('nom_du_client', $entry->ID);
        $output .= "<div class='zebra-client'>". $clients ."</div>";
        return $output;
    }

    Best regards,
    Ismael

    #1203504

    Thank you very much, it seems to be working! The only problem is that it displays the custom field above the thumb…
    How ca I display it under the title instead ?
    Thanks again!!

    • This reply was modified 4 years, 7 months ago by maxgorelkine.
    #1204435

    Hi,

    Replace the filter with avf_portfolio_title to render the additional content below the title.

    add_filter( 'avf_portfolio_title', 'avf_portfolio_extra_mod_cat', 10, 2 );
    function avf_portfolio_extra_mod_cat( $output, $entry )
    {
        $clients = get_field('nom_du_client', $entry->ID);
        $output .= "<div class='zebra-client'>". $clients ."</div>";
        return $output;
    }

    Best regards,
    Ismael

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