-
AuthorPosts
-
June 13, 2019 at 10:55 am #1109821
Hi,
I’m using a page with several portfolio grids (link in private section). All portfolio items in a grid have an image, a title and an excerpt. What I’m trying to achieve is that all portfolio items have the same height. This is already the case for the image and the title, but not for the excerpt.
How can I limit the amount of characters shown in the excerpt? I think that is the most workable solution.
Hope you can help!
cheers, Daniel
June 14, 2019 at 1:28 pm #1110313Hey Daniel,
Please add following code to bottom of functions.php file in Appearance > Editor and adjust value as needed
add_filter('avf_postgrid_excerpt_length','avia_change_postgrid_excerpt_length', 10, 1); function avia_change_postgrid_excerpt_length($length) { $length = 100; return $length; }
Best regards,
YigitJune 17, 2019 at 10:10 am #1110962Hi Yigit,
Thanks for your answer. I’ve added it to my functions.php but it doesn’t seem to change anything. Changing the length from 100 to 10 doesn’t change anything either.
Any ideas?
Regards,
DanielJune 17, 2019 at 10:59 am #1110969June 17, 2019 at 11:07 am #1110973Hey Yigit,
Changing $length = 100 to 50 doesn’t make a change on the page.
Regards,
DanielJune 18, 2019 at 7:22 pm #1111435Hi,
Please post us your login credentials (in the “private data” field), so we can take a look at your backend.
- Install and activate ” Temporary Login Without Password “.
- Go to ” Users > Temporary Logins ” on the left-side menu.
- Click ” Create New “.
- 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
( do be sure that we have enough time to debug ). - Click ” Submit “.
- 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,
BasilisJune 19, 2019 at 9:37 am #1111547This reply has been marked as private.June 21, 2019 at 8:36 am #1112225Hi,
Thank you for the update.
You should be able to adjust the excerpt length with the following filter.
// https://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_length
Example:
function avf_custom_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'avf_custom_excerpt_length', 999 );
Let us know if it helps.
Best regards,
IsmaelJune 21, 2019 at 10:01 am #1112257Hi Ismael,
Unfortunately, no dice. I’ve tried to delete everything in the functions.php’s file except this function but even then it’s not changing anything on the page.
June 21, 2019 at 9:12 pm #1112420Hi Daniel,
Please try this cs solution, maybe it will work for you:
@media only screen and (min-width: 1024px) { #top .grid-content { height: 235px; overflow: hidden; } } @media only screen and (min-width: 480px) and (max-width: 1023px){ #top .grid-content { height: 290px; overflow: hidden; } }
Best regards,
VictoriaJune 23, 2019 at 1:22 pm #1112703on default the filter had to work –
you can try this – maybe it works better:
for your child-theme functions.php
don’t see your site so you had to know your selector by yourself : but guess it is right:// Excerpt length function custom_grid_excerpt(){ ?> <script> (function($){ $(window).load(function(){ $('.grid-entry').each(function() { $(".entry-content").text(function(index, currentText) { return currentText.substr(0, 20); }); }); }); })(jQuery); </script> <?php } add_action('wp_head', 'custom_grid_excerpt');
for blog the part in the middle of that function will be:
$('.post-entry').each(function() { $(".entry-content > p").text(function(index, currentText) { return currentText.substr(0, 20); }); });
-
AuthorPosts
- You must be logged in to reply to this topic.