Change excerpt length for different post types. WordPress co... open

Change excerpt length for different post types. WordPress code example

/**
 * Change Excerpt length for different post types.
 */
 function vishivka_custom_excerpt_length($length)
{
    global $post;
    if ($post->post_type == 'post')
        return 25;
    else if ($post->post_type == 'product')
        return 100;
    else
        return 50;
}
add_filter('excerpt_length', 'vishivka_custom_excerpt_length');
0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation