- This topic has 8 replies, 2 voices, and was last updated 2 years, 11 months ago by
David.
-
AuthorPosts
-
March 29, 2023 at 4:46 am #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');March 29, 2023 at 4:49 am #2586979Ivaylo
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.
March 29, 2023 at 4:49 am #2586981Ivaylo
Is there something new in GP 3.3.0 in the way it handles code in functions.php?
March 29, 2023 at 5:03 am #2586997David
StaffCustomer SupportHi 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:March 29, 2023 at 5:07 am #2587004Ivaylo
Does adding a child theme adds more CSS and JS to my website and thus slowing it down?
March 29, 2023 at 5:16 am #2587013Ivaylo
Thanks!
March 29, 2023 at 5:34 am #2587034David
StaffCustomer SupportNo, 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.March 29, 2023 at 5:36 am #2587038Ivaylo
All is good with Breadcrumbs, had to tick Execute PHP. Thanks!
March 29, 2023 at 5:40 am #2587045David
StaffCustomer SupportGlad to hear that!
-
AuthorPosts
- You must be logged in to reply to this topic.