What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-02-17 15:50:02
wordpress use jquery in functions.php
I know what you mean about the tutorials. Here's how I do it: First you need to write your script. In your theme folder create a folder called something like 'js'. Create a file in that folder for your javascript. E.g. your-script.js. Add your jQuery scr... Add solution -
PHP 2022-02-03 07:40:43
remove gutenberg styles
// Don't load Gutenberg-related stylesheets. add_action( 'wp_enqueue_scripts', 'remove_block_css', 100 ); function remove_block_css() { wp_dequeue_style( 'wp-block-library' ); // WordPress core wp_dequeue_style( 'wp-block-library-theme' ); // WordPress co... Add solution -
Other 2022-02-01 00:51:25
disable oceanwp lightbox
/** * Disable the Lightbox scripts */ function my_enqueue_scripts() { // Unregister JS files wp_deregister_script( 'magnific-popup' ); wp_deregister_script( 'oceanwp-lightbox' ); // Unregister CSS file wp_deregister_style( 'magnific-popup' ); } ... Add solution -
Other 2021-11-14 05:38:23
wp_enqueue_style( 'main-style', get_stylesheet_directory_uri() . '/assets/css/bootstrap.min.css', [], time(), 'all' );
/** * Proper way to enqueue scripts and styles */ function wpdocs_theme_name_scripts() { wp_enqueue_style( 'style-name', get_stylesheet_uri() ); wp_enqueue_script( 'script-name', get_template_dir... Add solution -
Other 2021-11-11 22:57:13
wordpress required post admin title field
/** ADD Validation for title */ function force_post_title_init() { wp_enqueue_script('jquery'); } function force_post_title() { echo "<script type='text/javascript'>\n"; echo " jQuery('#publish').click(function()... Add solution -
PHP 2021-11-11 16:19:23
wp_localize_script
<?php function pw_load_scripts() { wp_enqueue_script('pw-script', plugin_dir_url( __FILE__ ) . 'js/pw-script.js'); wp_localize_script('pw-script', 'pw_script_vars', array( 'alert' => __('Hey! You have clicked the button!', 'pippin') ) ... Add solution -
PHP 2021-11-11 05:17:31
dequeue dashicons
// INSIDE YOUR THEME FUNCIONS.PHP FILE -> function wpdocs_dequeue_dashicon() { wp_deregister_style('dashicons'); } add_action( 'wp_enqueue_scripts', 'wpdocs_dequeue_dashicon' ); // OR remove dashicons in frontend to non-admin function wpdocs_dequeu... Add solution -
PHP 2021-11-08 07:23:10
how to add script in WordPress admin page
/** * Enqueue a script in the WordPress admin on edit.php. * * @param int $hook Hook suffix for the current admin page. */ function wpdocs_selectively_enqueue_admin_script( $hook ) { if ( 'edit.php' != $hook... Add solution