This topic has 7 replies, 5 voices, and was last updated 8 years by Abe.

  • Author

    Tagged: ,

  • #20932
     shmall
    Participant

    Hi,

    We are using KLEO and would like to know how to limit the post excerpt in Grid view, as when the post are in japanese or chinese it will display a long excerpt.

    Thanks,

    #20978
     Catalin
    Moderator

    Hello,

    You need to add in functions.php file from the child theme folder this code:

    COPY CODE
    \[[^\]]*\]

    where

    COPY CODE
    ( $limit = 10 )

    “10” in the number of words to display.

    Thank you,
    Catalin

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

    Hi Catalin,

    Thanks for the reply.

    After I pasted the code to child theme’s functions.php

    I got the error under the post

    Warning: preg_replace() [function.preg-replace]: Unknown modifier ‘\’ on line 24

    Hope you would know how to fix it.

    best regards,

    #21080
     Catalin
    Moderator

    Hello,

    Please send me FTP access to your child theme and credentials for your WordPress admin panel. Reply as private for security reasons.

    Thank you,
    Catalin

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

    Tried the code above and it completely removed the excerpt in the archive-porfolio view. Also tried the following in the kleo-child functions.php to change the excerpt to word limit instead of characters and nothing changed:

    COPY CODE
    if ( ! function_exists( 'kleo_excerpt' ) ) {
    	function kleo_excerpt( $limit = 15 ) {
            if ( $chars ) {
                $excerpt = explode( ' ', get_the_excerpt(), $limit );
                if ( count( $excerpt ) >= $limit ) {
                    array_pop( $excerpt );
                    $excerpt = implode( " ", $excerpt ) . '...';
                } else {
                    $excerpt = implode( " ", $excerpt ) . '';
                }
                $excerpt = preg_replace( '<code>\[[^\]]*\]</code>', '', $excerpt );
                return '<p>' . $excerpt . '</p>';
            } else {
                $excerpt = get_the_excerpt();
                return '<p>'. substr( $excerpt, 0, $limit ) . ( strlen( $excerpt ) > $limit ? '...' : '' ) . '</p>';
            }
    	}
    }
    #39161
     Abe
    Keymaster

    @exenewyorker a better option is to edit wp-content/themes/kleo/page-parts/portfolio-masonry.php template and change the function parameters without adding the above code.
    You will see something like this at the end of the file
    <?php echo kleo_excerpt( 60, false ); ?>

    where 60 is the char limit

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

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #98470
     dinnap
    Participant

    Hi.

    We have the same problem, but none of the above solutions work.

    See our site for the case, or the attached picture.

    Regards,
    Thomas

    Attachments:
    You must be logged in to view attached files.
    #98510
     Abe
    Keymaster

    Hi, you are not using the KLEO Posts shortcode to which this topic is reffering to and you are using Posts Grid shortcode that does not have that option. You can edit the posts and set a custom excerpt in the Excerpt field

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

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    Attachments:
    You must be logged in to view attached files.
Viewing 8 posts - 1 through 8 (of 8 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?