Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1306345

    Hello
    I’m trying to make the excerpt of the portfolio grid (or better the entire Portfolio text field) clickable. I’ve found an old thread (2015) suggesting the following code:

    function add_custom_div(){
    ?>
    <script>
    jQuery(".grid-content").click(function(){
            window.location = jQuery(this).find("a:first").attr("href");
            return false;
        });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_div');

    But the link opens an undefined portfolio page (mysite.com/portfolio/undefined)

    May be this function is too old and there’s something wrong in the jQuery.
    Here the old thread: Portfolio text field – Link possible?

    Best Regards
    Manu

    • This topic was modified 3 years, 5 months ago by manurimini.
    #1306571

    Hey manurimini,
    Thank you for your patience as I’m understanding your situation this code snippet from 2015 is no longer necessary, in my test the portfolio title and excerpt already share the same link as the image:
    2021-06-20_005.jpg
    this is true with the default settings
    2021-06-20_006.jpg
    if you wish you can set a custom link
    2021-06-20_007.jpg
    So if I have misunderstood your situation please link to your test page so we can see.

    Best regards,
    Mike

    #1306715

    Hello Mike

    In your exemple you have set the Portfolio Grid on “Title and Excerpt”. In this case it works as desired. But if you set “Only Excerpt” it doesn’t work, also if you use Define Custom Link.
    The only way I could find to make it work is to set an href in the Excerpt (eg <a href="https://mywebsite/portfolio/title/">Excerpt</a>) and the code I’ve mentioned above in functions.php. In this case it works but is pretty annoying to write the href in every Excerpt.

    Best Regards
    Manu

    • This reply was modified 3 years, 5 months ago by manurimini.
    #1306913

    Hi,
    Thank you for the feedback, but please ensure that your theme is up to date (v4.8.3) and you are not using the function above.
    I have changed my example to Only Excerpt & Defined Custom Link and this continues to work:
    2021-06-22_001.jpg
    2021-06-22_002.jpg
    Please try this and if you continue to have trouble please include an admin login in the Private Content area with a link to your page so we can examine.

    Best regards,
    Mike

    #1307683

    Hello Mike
    I have tried your solution on different installations by using “Overwrite Portfolio Link setting” but it doen’t work if the Portfolio Grid is set on “Only Excerpt”.
    In Private Content the credentials to access to a test installation.
    In any case it would be usefull a function to automatize the process without adding in every portfolio page the custom link.
    Best Regards
    Manu

    #1307726

    Hi,
    Thank you for the login, I’m sorry I made a mistake, on my demo I had gone to one of the portfolio demos to test, but now I recognize that it was using the masonry element to show portfolio items, instead of the portfolio grid to show portfolio items, the two elements look very similar and almost behave the same, except the masonry element to show portfolio items allows the excerpt linking that you wish. I added this element to the top of your page to demonstrate, please check and consider using this element instead.

    Best regards,
    Mike

    #1307741

    Hello Mike
    Unfortunately the Masonry Element doesn’t have the feature for the Grid Settings “No Scaling (Original Width X Original Height)”. So, for the project I’m developing, I’m forced to use the Portfolio Grid.
    In the Masonry Element the “av-masonry-entry-content” is inside the “av-inner-masonry-content-pos-content” that contains the image, which is actually the clickable element. In the Portfolio the Excerpt is in the “grid-content” which is posed under the image container “grid-image avia-hover-fx”. I think that’s why in the Portfolio Grid you can manage image sizes much better.
    But since if you insert “Show Only Title” in the Portfolio Grid the “grid-content” is clickable, there should be a way to make it clickable also when you choose “Only Excerpt”. As I mentioned before Yigit tried many years ago to solve the problem but the function is not working fine anymore LINK. Maybe we can ask him if he has a solution.
    Best Regards
    Manu

    • This reply was modified 3 years, 4 months ago by manurimini.
    #1307917

    Hi,
    Thank you for the feedback, I added this script to your child theme functions.php and it seems to work for both of your portfolio grid item, with the default linking or the custom linking, please check.

    function portfolio_grid_content_linked() { ?>
        <script>
    (function($) {
      $(".grid-content").click(function(){
          window.location = $(this).closest('.inner-entry').find("a:first").attr("href");
          return false;
      });
    }(jQuery));
    </script>
        <?php
    }
    add_action('wp_footer', 'portfolio_grid_content_linked');

    Best regards,
    Mike

    #1307945

    Thank you Mike, it works perfectly! Do you think this code will be added in the next release?
    For anyone who will use this code:
    don’t forget to add

    .grid-content {
    cursor: pointer;
    }

    in your custom CSS

    Great job Mike
    Best Regards
    Manu

    • This reply was modified 3 years, 4 months ago by manurimini.
    #1308101

    Hi,
    Glad we were able to help, this will not be added to the theme, this is a customized script like Yigit had created. If you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Excerpt clickable in the portfolio grid’ is closed to new replies.