Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #950130

    Hi there,

    i created two categories on my website for blogposts. Category 1: “Post with image”, Category 2: “Post without image”.
    I would like to change the excerpt length of this blogpost depending on the category. How would i do that?

    I found this code:
    “add_filter(‘avf_postgrid_excerpt_length’,’avf_postgrid_excerpt_length_mod’, 10, 1);
    function avf_postgrid_excerpt_length_mod($length) {
    if ( in_category( ‘3’ ) ) {
    return 160;
    } else {
    return 10;
    }
    }”

    but it doesnt work. Any ideas?

    #951253

    Hey Pixel_Production,

    Thank you for using Enfold.

    Replace in_category with the is_category function instead. More info here.

    // https://developer.wordpress.org/reference/functions/is_category/

    Best regards,
    Ismael

    #951457

    hi ismael,

    thanks. found another solution by editing the postslider.php itself.
    “$excerpt_length = !empty($thumbnail) ? 160 : 600;” if anyone else is interested. ;)

    #952037

    Hi,

    Great, glad you found a solution and thanks for sharing. Much appreciated :-)

    Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #952641

    top support as always! topic can be closed. ;)

    #953043

    Hi,

    Thanks for the kind words :-)

    Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Blogpost excerpt length depending on category’ is closed to new replies.