This topic has 8 replies, 3 voices, and was last updated 7 years by Radu.

  • Author
  • #169734
     DarlingPropaganda
    Participant

    Hi – is there a way I can set the number of characters in the group description on the groups home page? Right now some have a couple words, others a couple paragraphs.

    Thanks!

    #169735
     Kieran_SQ
    Moderator

    Hi,

    To limit how much a user may enter into the description field please do the following

    – Enable KLEO Child theme
    – Copy the below file from the main KLEO theme
    /kleo/buddypress/groups/create.php
    – Move to the KLEO Child theme (if you haven’t made edits here before you’ll need to recreate / mirror the file structure)
    /kleo-child/buddypress/groups/create.php
    – Open the create.php file from the KLEO Child theme with your favorite editor or with your hosts built in file browser / editor
    – Scroll to line 80 and replace the below text
    <textarea name="group-desc" id="group-desc" aria-required="true"><?php bp_new_group_description(); ?></textarea>
    With the below
    <textarea name="group-desc" id="group-desc" maxlength="50" aria-required="true"><?php bp_new_group_description(); ?></textarea>
    – The value is currently set to 50, please adjust as needed
    – Save
    – Clear website cache, browser cache and purge any services like CloudFlare or MaxCDN

    When a user creates a group it should now be limited to 50 characters (or whichever value you set)

    If you need more assistance please let me know,

    Kieran.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Custom development requests can be sent to dev@seventhqueen.com, one of the development team will be happy to discuss your needs.

    #169736
     DarlingPropaganda
    Participant

    Hi – I don’t care how long the description is. I just care how much is displayed on the group home page. Right now some descriptions cut off after only a few words, and some descriptions cut off after a few sentences. I would like the groups home page to look a bit more uniform and have each description display the first 50 (or what ever) characters.

    Thanks!

    #169737
     DarlingPropaganda
    Participant

    I know I can use css to hide them completely, but I can’t figure out how to use css to only show a set number of characters.

    #169865
     Kieran_SQ
    Moderator

    Hi,

    I’m going to ask my colleague @Radu to look at this for you as I am not confident in the solution. They’ll be in touch with you soon.

    Thanks,

    Kieran.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Custom development requests can be sent to dev@seventhqueen.com, one of the development team will be happy to discuss your needs.

    #169995
     DarlingPropaganda
    Participant

    OK – thank you!

    #170190
     Radu
    Moderator

    Hi,

    Use this css

    COPY CODE
    
    .group-inner-list .item .item-desc p {
        max-height: 100px;
        white-space: wrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    

    You will have to change the max-height value from 100 to your desired height, in this way you limit the number of the characters.

    The css will be added to wp-admin -> theme options -> General settings -> Quick CSS

    Let me know

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #170648
     DarlingPropaganda
    Participant

    Hi – This doesn’t work. It can be used to limit the height of box, but not define the number of characters are visible.

    See screenshot. Some description have very few characters visible before they are truncated with […] others have several sentences. I would like them all to have the same number of characters. I.E. I would like to have a full description (or at least the first 200 characters) visible to readers.

    Attachments:
    You must be logged in to view attached files.
    #170889
     Radu
    Moderator

    Hi,

    I see,

    Instead of the CSS use the next code

    COPY CODE
    
    // limit group description length
    function my_excerpt_group_description( $description ) {
    
        $length = 200;
        $description = substr($description,0,$length);
        return $description;
    }
    add_filter( 'bp_get_group_description_excerpt', 'my_excerpt_group_description');
    

    The function needs to be pasted in wp-content/themes/kleo-child/functions.php

    NOTE : Child theme needs to be installed and activated.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Ticket solution
Viewing 9 posts - 1 through 9 (of 9 total)

The forum ‘Bugs & Issues’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?