Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #867403

    I need to link from the portfolio grid to articles on my client’s sites from both the image AND the title. (Out of the box, the link is on the image only, which is not intuitive.) I found the following code in the forum. It works, except that it links to the permalink on my site, not to the Custom Link I set to the source documents on my various client sites. Can you please let me know how to modify this to get the custom link (external) instead of the title link (internal) returned? Thank you!

    function my_custom_title_link( $title_link, $entry )
    {
    if( ! empty( $title_link ) )
    {
    return $title_link;
    }

    $title_link = get_permalink( $entry->ID );
    return $title_link;
    }

    add_filter( ‘avf_portfolio_title_link’, ‘my_custom_title_link’, 10, 2 );

    #867958

    Hey CatherineTurner,

    Thank you for using Enfold.

    Please replace the filter with the following code.

    function avf_portfolio_title_link_mod( $title_link, $entry )
    {
      if( ! empty( $title_link ) )
      {
        return $title_link;
      }
    
      $title_link = get_post_meta( $entry->ID  ,'_portfolio_custom_link', true) != "" ? get_post_meta( $entry->ID  ,'_portfolio_custom_link_url', true) : get_permalink( $entry->ID );
    
      return $title_link;
    }
    
    add_filter( 'avf_portfolio_title_link', 'avf_portfolio_title_link_mod', 10, 2 );

    Best regards,
    Ismael

    #867982

    Thanks for the code, Ismael! You guys are wonderful :)

    #868318

    Hi,

    Glad that Ismael helped you. Thanks for using Enfold :)

    Best regards,
    Nikko

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Portfolio External Link on Title’ is closed to new replies.