-
AuthorPosts
-
June 18, 2021 at 1:17 pm #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, 6 months ago by manurimini.
June 20, 2021 at 5:55 pm #1306571Hey 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:
this is true with the default settings
if you wish you can set a custom link
So if I have misunderstood your situation please link to your test page so we can see.Best regards,
MikeJune 21, 2021 at 12:32 pm #1306715Hello 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, 6 months ago by manurimini.
June 22, 2021 at 11:45 am #1306913Hi,
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:
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,
MikeJune 28, 2021 at 8:54 am #1307683Hello 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
ManuJune 28, 2021 at 12:44 pm #1307726Hi,
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,
MikeJune 28, 2021 at 1:52 pm #1307741Hello 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, 5 months ago by manurimini.
June 29, 2021 at 12:00 pm #1307917Hi,
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,
MikeJune 29, 2021 at 2:38 pm #1307945Thank 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, 5 months ago by manurimini.
June 30, 2021 at 12:18 pm #1308101Hi,
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 -
AuthorPosts
- The topic ‘Excerpt clickable in the portfolio grid’ is closed to new replies.