Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #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

    #1110313

    Hey 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,
    Yigit

    #1110962

    Hi 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,
    Daniel

    #1110969

    Hi,

    Could you please try 50 instead?

    Best regards,
    Yigit

    #1110973

    Hey Yigit,

    Changing $length = 100 to 50 doesn’t make a change on the page.

    Regards,
    Daniel

    #1111435

    Hi,

    Please post us your login credentials (in the “private data” field), so we can take a look at your backend.

    1. Install and activate ” Temporary Login Without Password “.
    2. Go to ” Users > Temporary Logins ” on the left-side menu.
    3. Click ” Create New “.
    4. 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 ).
    5. Click ” Submit “.
    6. 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,
    Basilis

    #1111547
    This reply has been marked as private.
    #1112225

    Hi,

    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,
    Ismael

    #1112257

    Hi 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.

    #1112420

    Hi 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,
    Victoria

    #1112703

    on 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);
            });
        });
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.