Help w/Excerpt Length on Divi Theme Site

Post excerpts on the home page are all random lengths whereas they used to be all fairly short, about the same height as the featured icon image which is the preferred size. Can you figure out where this option is set and/or why it is not consistent?

Support Staff Access is currently activated in case you need it.

http://AudioEngineering.co/

Thanks!

  • Core Zero

    WEBSITE IS CRASHED!

    I can get to the dashboard but anything else (Appearance, Plugins etc) gives this error.

    Parse error: syntax error, unexpected T_FUNCTION in /home4/corezero/public_html/audioengineering.co/wp-content/themes/audio-engineering-co/functions.php on line 35

    I did not change anything on line 35, I just added your code snippet up above on Line 20. I did copy functions.php so here it is to look at.

    Please respond ASAP or use the Support Login.

    Thanks

    functions.php

    <?php

    /* Functions - Child theme custom functions */

    /* Featured Image Custom Size */
    function mycustom_featured_width( ) { return 150; /* Custom featured post image width */ }
    add_filter( 'et_pb_blog_image_width', 'mycustom_featured_width');

    function mycustom_featured_height( ) { return 150; /* Custom featured post image height */ }
    add_filter( 'et_pb_blog_image_height', 'mycustom_featured_height');

    function mycustom_featured_size( $image_sizes ) {
    $custom_size = mycustom_featured_width() . 'x' . mycustom_featured_height();
    $image_sizes[$custom_size] = 'et-pb-post-main-image-thumbnail';
    return $image_sizes;
    }
    add_filter( 'et_theme_image_sizes', 'mycustom_featured_size' );
    /* Featured Image Custom Size */

    /* Excerpt Length */
    function custom_excerpt_length( $length ) {
    return 30;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
    /* Excerpt Length */

    /*****************************************************************************************************************
    ************************** Caution: do not remove or edit anything within this section **************************/

    /**
    * Loads the Divi parent stylesheet.
    * Do not remove this or your child theme will not work unless you include a @import rule in your child stylesheet.
    */
    function dce_load_divi_stylesheet() {
    wp_enqueue_style( 'divi-parent-style', get_template_directory_uri() . '/style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'dce_load_divi_stylesheet' );

    /**
    * Makes the Divi Children Engine available for the child theme.
    * Do not remove this or you will lose all the customization capabilities created by Divi Children Engine.
    */
    require_once('divi-children-engine/divi_children_engine.php');

    /****************************************************************************************************************/

    /**
    * Patch to fix Divi issue: Duplicated Predefined Layouts.
    */
    if ( function_exists( 'et_pb_update_predefined_layouts' ) ) {
    remove_action( 'admin_init', 'et_pb_update_predefined_layouts' );
    function Divichild_pb_update_predefined_layouts() {
    if ( 'on' === get_theme_mod( 'et_pb_predefined_layouts_updated_2_0' ) ) {
    return;
    }
    if ( ! get_theme_mod( 'et_pb_predefined_layouts_added' ) OR ( 'on' === get_theme_mod( 'et_pb_predefined_layouts_added' ) )) {
    et_pb_delete_predefined_layouts();
    }
    et_pb_add_predefined_layouts();
    set_theme_mod( 'et_pb_predefined_layouts_updated_2_0', 'on' );
    }
    add_action( 'admin_init', 'Divichild_pb_update_predefined_layouts' );
    }

    ?>

  • Core Zero

    Thank you but I would like to follow along. I am nervous about it now. It's not too difficult to enter the code as you asked. I've done it several times. There must be another error somewhere. I even tried the plugin "My Custom Functions" and excerpt length still does not change. I have tried it in the main theme functions.php and of course in the child theme's functions.php exactly as you entered it above, which is the same code as in many articles out there. The question is why is it breaking this theme?

  • Jude

    Hey @Core Zero

    Yeah .. you are right. The code itself should work. Its part of the official WP Codex as you can see here.

    https://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_length

    I was guessing it could be a copy/paste issue. Now that you say that you are absolutely sure its not, Im guessing its something in the theme that overrides/inteferes with the excerpt_length filter.

    You could ask Divi what the exact issue with this function is and if they are doing something custom, maybe a workaround to get this functionality working.

    Cheers
    Jude

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.