Skip to content

Instantly share code, notes, and snippets.

@humayunahmed8
Created December 24, 2022 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save humayunahmed8/92c08f12bc36d73d1957adf41575b149 to your computer and use it in GitHub Desktop.
Save humayunahmed8/92c08f12bc36d73d1957adf41575b149 to your computer and use it in GitHub Desktop.
WP enqueue scipts
function mydeals_styles() {
if( is_page(['all-deals'])) {
wp_enqueue_style( 'bootstrap-test', get_template_directory_uri() . '/assets/css/bootstrap.min.css', array(), '5.3.11', false );
}
}
add_action('wp_enqueue_scripts', 'mydeals_styles');
// function mydeals_script() {
// wp_enqueue_script( 'bootstrap-js-test', get_template_directory_uri() . '/assets/css/bootstrap.min.js', array(), '1.0', true );
// }
// add_action('wp_enqueue_scripts', 'mydeals_script');
// function mydeals_script() {
// $theme = wp_get_theme();
// wp_register_style( 'bootstrap-js-test', get_theme_file_uri('assets/css/bootstrap.min.js'), array(), $theme->get( 'Version' ) );
// }
// add_action('wp_enqueue_scripts', 'mydeals_script');
function wpdocs_enqueue_custom_style() {
$theme = wp_get_theme();
wp_register_style(
'wpdocs-style',
get_theme_file_uri( 'css/style.css' ),
array(),
$theme->get( 'Version' )
);
wp_enqueue_style( 'wpdocs-style' );
$custom_css = ".navbar-nav ul li { list-style: none; }";
wp_add_inline_style( 'wpdocs-style', $custom_css );
}
add_action( 'wp_enqueue_scripts', 'wpdocs_enqueue_custom_style' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment