Home Forums WoodMart support forum Maximum n.of caracter for short description in the product grid

Maximum n.of caracter for short description in the product grid

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

    supergap
    Participant

    Hi,
    i would like to limit the number of characters of the short description in the grid view. When you go over the product you see the short description. At the moment is cut off. I don’t know the criteria (number of characters) I would like please to set a number of characters and that at the end of the trunked text can be shown two point like-> final word..
    How to get it?
    Many thanks.

    #540445

    Hello,

    Please add this code to the Theme Settings > Custom CSS > Global:

    .wd-more-desc {
    max-height:100px !important;
    }

    Best Regards.

    #540567

    supergap
    Participant

    Hi,
    thanks for replying.
    Perhaps I explain wrong. I was able to set a max-weight (I’m not a magician of CSS, but I can add it). This way just cut the last line, and more or less it seems an error define div height.
    I was please asking for a way of limit characters and at the end set by default 2 more characters (..)
    example:
    If the text is:
    “Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip”

    Limit it to a character number limit like:
    “Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqu.. (two points at the end).

    I have seen it in a lot of sites, usually in blog posts.
    Many Thanks and best regards

    #540568

    supergap
    Participant

    Hi,
    thanks for replying.
    Perhaps I explain wrong. I was able to set a max-weight (I’m not a magician of CSS, but I can add it). This way just cut the last line, and more or less it seems an error define div height.
    I was please asking for a way of limit characters and at the end set by default 2 more characters (..).
    It seems there’s already a character number limit since the the number of characters in the product grid item is less than the entire short description. The text is Character limited already.

    example:
    If the text is:
    “Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip”

    Limit it to a character number limit like:
    “Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqu.. (two points at the end).

    I have seen it in a lot of sites, usually in blog posts.
    Many Thanks and best regards

    looking around somebody suggest a solution similar to this:
    Of course I’m not expert in code to dare using it with out asking my theme support:

    add_filter(‘woocommerce_short_description’, ‘limit_woocommerce_short_description’, 10, 1);
    function limit_woocommerce_short_description($post_excerpt){
    if (!is_product()) {
    $post_excerpt = substr($post_excerpt, 0, 20);
    }
    return $post_excerpt;
    }

    • This reply was modified 1 year ago by supergap.
    • This reply was modified 1 year ago by supergap.
    #540571

    supergap
    Participant

    or this:
    add_filter(‘woocommerce_short_description’, ‘reigel_woocommerce_short_description’, 10, 1);
    function reigel_woocommerce_short_description($post_excerpt){
    if (!is_product()) {
    $post_excerpt = substr($post_excerpt, 0, 10);
    }
    return $post_excerpt;
    }

    thanks again

    #540705

    Hello,

    Please add this code to the Theme Settings > Custom CSS > Global:

    .wd-product.wd-hover-base .hover-content {
        display: -webkit-box;
        -webkit-line-clamp: 3; /* Number of lines to show */
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    Best Regards.

    #540753

    supergap
    Participant

    Hi,
    thanks for replying
    It works fine with 3 line. If I change it with 2 is also Ok. With for it stop working.

    Pasting in to the CSS field I get some parts in red. Is it ok?

    Thnaks agiando.

    Attachments:
    You must be logged in to view attached files.
    #540782

    Hello,

    Yes, it is ok.

    Best Regards.

    #540826

    supergap
    Participant

    oK, thanks.
    about setting 4 lines..
    at the momenti seems it doesn’t work if I set 4.
    many thanks

    #540904

    Hello,

    Can you please share the WP admin login details of your site so I will check and give you a possible solution?

    Best Regards.

Viewing 10 posts - 1 through 10 (of 10 total)