load a different stylesheet in a category post

You can do it like- function wpse_enqueue_post_template_styles() { if ( is_category(‘bedrijven’) ) { wp_enqueue_style( ‘post-template’, get_stylesheet_directory_uri() . ‘/layout-interieur.css’ ); } } add_action( ‘wp_enqueue_scripts’, ‘wpse_enqueue_post_template_styles’ ); Here bedrijven is your category slug. As you said the above method hasn’t worked for you, so here I’m suggesting another method- First remove the first method’s full code. Then … Read more

load jquery in footer not working

As Mark Kaplun said in the comments, something is adding defer to your one domain’s script. If you want your subdomain jQuery script to also have defer, this should do it: function my_add_defer ($tag, $handle, $src) { if ($handle == ‘jquery’) { return str_replace (‘ src=”https://wordpress.stackexchange.com/questions/251298/,” defer=”defer” src=”, $tag); } return $tag; } add_filter (“script_loader_tag”https://wordpress.stackexchange.com/questions/251298/,”my_add_defer’, … Read more

add WordPress script to page conditionally by category

is_single() doesn’t work for the page post type, use is_page() instead. You’re also missing the first argument for wp_enqueue_script, the script handle. Source should be the second argument. function my_conditional_enqueue_script1() { if ( is_page() && in_category( 19 ) ) { wp_enqueue_script( ‘my-cart-script’, ‘/members/application/cart/views/public/js/cart.js’ ); } } add_action(‘wp_enqueue_scripts’, ‘my_conditional_enqueue_script1’);

how to load css and js based on post template

It looks like your condition check is correct. As per the comments to the question, don’t forget to add it as a callback to the wp_enqueue_scripts action hook. function enqueue_styles_and_scripts() { if ( is_page_template(‘htmlcode.php’) ) { wp_enqueue_style( ‘code-mirror-css’, get_template_directory_uri() . ‘/code-mirror/plugin/codemirror/lib/codemirror.css’, array(), ‘all’); wp_enqueue_style( ‘code-mirror-monokai’, get_template_directory_uri() . ‘/code-mirror/plugin/codemirror/theme/monokai.css’, array(), ‘all’); wp_enqueue_script( ‘code-mirror-js’, get_template_directory_uri() . ‘/code-mirror/plugin/codemirror/lib/codemirror.js’, … Read more

Plugin add_action and add_menu_page

The main difference is the location where the style (link) or script tag be in the source, or whether the resource is loaded in head or the footer. With a add_menu_page()/add_submenu_page() callback like your foo_settings_page(), the style/script file would be loaded in the body (before the closing body tag), because the head has already been … Read more

how to enqueue javascript to manipulate acf input field in admin?

Maybe an easier approach would be to remove the values before the input is presented in the admin? That would circumvent having to do things in JavaScript after the field is already displayed. Take a look at acf/prepare_field hook: function my_acf_prepare_field( $field ) { unset($field[‘choices’][‘custom’]); return $field; } // Apply to all fields. // add_filter(‘acf/prepare_field’, … Read more

why wp_enqueue_scripts() not working?

Hey bro Use this code get_stylesheet_directory_uri function custom_theme_script(){ wp_register_style(‘bootstrap’, get_stylesheet_directory_uri.() .’/css/bootstrap.css’ ); wp_enqueue_style(‘bootstrap’); wp_register_style(‘style’, get_stylesheet_directory_uri() . ‘/css/style.css’); wp_enqueue_style(‘style’); wp_deregister_script( ‘jquery’ ); wp_enqueue_script(‘bootstrap.min’, get_template_directory_uri() . ‘/js/bootstrap.min.js’, array(), ‘3.5.1’, true ); } add_action(‘wp_enqueue_scripts’, ‘custom_theme_script’); `

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)