Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

Where to place PHP code and hide insertions?

         

toplisek

11:21 am on Feb 13, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Where to place PHP code and hide insertions like code at the bottom. Can be improved code?

body{--wp--preset--color--black: #000000;--wp--preset--color--cyan-bluish-gray:

An example:
//Remove Gutenberg Block Library CSS from loading on the frontend
function try_remove_wp_block_library_css(){
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-block-style' ); // Remove WooCommerce block CSS
wp_dequeue_style( 'global-styles' ); // Remove theme.json
}
add_action( 'wp_enqueue_scripts', 'try_remove_wp_block_library_css', 100 );

not2easy

12:21 pm on Feb 13, 2022 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You can edit your functions.php file. This assumes you understand php coding and the structure of WordPress. You might find help in some of the WP workshops and their social learning spaces: [learn.wordpress.org...]

I would only use a test site for editing efforts.

Dimitri

1:02 pm on Feb 13, 2022 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



I never used WP or any ready to use script, ... but I was wondering , by curiosity. If you alter WP source code, won't it be overwritten when WP updates ?

toplisek

1:13 pm on Feb 13, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It seems WP added junk code all the time. It should be managed using PHP.
body{--wp--preset--color--black: #000000;--wp--preset--color--cyan-bluish-gray:

not2easy

2:39 pm on Feb 13, 2022 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



The appearance features such as text colors and fonts is controlled using css and you are free to write your own css file by simply using a child theme. Child theme files are not overwritten by updates.