Site logo

[Support request] Changes in functions.php not applied after updated to the GP 3.3.0

Home Forums Support [Support request] Changes in functions.php not applied after updated to the GP 3.3.0

Home Forums Support Changes in functions.php not applied after updated to the GP 3.3.0

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2586978
    Ivaylo

    Hi, I have some custom codes add to functions.php which were removed when updated to the new version of GP. I have now added them again, but looks like none of them is working.

    This is the code:

    add_filter( 'generate_hooks_execute_php', '__return_true' );
    
    add_filter( 'generate_schema_type', '__return_false' );
    
    //Remove jQuery Migrate
    function dequeue_jquery_migrate( $scripts ) {
        if ( ! is_admin() && ! empty( $scripts->registered['jquery'] ) ) {
            $scripts->registered['jquery']->deps = array_diff(
                $scripts->registered['jquery']->deps,
                [ 'jquery-migrate' ]
            );
        }
    }
    add_action( 'wp_default_scripts', 'dequeue_jquery_migrate' );
    
    //Remove Jquery.js
    //if ( !is_admin() ) wp_deregister_script('jquery');
    
    #2586979
    Ivaylo

    I’ve also tried to add this code:

    add_filter( ‘generate_post_date_output’,’tu_add_to_post_date’ );
    function tu_add_to_post_date( $output ) {
    return ‘<span class=”date-label”>Updated on </span>’ . $output;
    }
    
    add_filter( ‘generate_post_date_show_updated_only’, ‘__return_true’ );
    
    

    but it caused WordPress critical error and the website broke.

    #2586981
    Ivaylo

    Is there something new in GP 3.3.0 in the way it handles code in functions.php?

    #2586997
    David
    Staff
    Customer Support

    Hi there,

    Don’t add codes to the parent theme files, aside from the code being lost when updates happen you may just break something.
    If you want to do that you must use a child theme:

    https://docs.generatepress.com/article/using-child-theme/

    #2587004
    Ivaylo

    Does adding a child theme adds more CSS and JS to my website and thus slowing it down?

    #2587013
    Ivaylo

    Thanks!

    #2587034
    David
    Staff
    Customer Support

    No, adding a child theme won’t impact the sites performance. Its add no extra code except what you add to it.

    The <?php if (function_exists('rank_math_the_breadcrumbs')) rank_math_the_breadcrumbs(); ?> needs to be added using a Hook.
    Where should it be displayed on the site ? eg. all single posts above the title.

    #2587038
    Ivaylo

    All is good with Breadcrumbs, had to tick Execute PHP. Thanks!

    #2587045
    David
    Staff
    Customer Support

    Glad to hear that!

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.