How do I set up a child-theme without using @import

The code that is in codex for queuing the style of the parent theme instead of using @import, is not well commented, so i will comment it more, so you have this: <?php function my_theme_enqueue_styles() { $parent_style=”parent-style”; wp_enqueue_style($parent_style, get_template_directory_uri() . ‘/style.css’); wp_enqueue_style(‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, array($parent_style), wp_get_theme()->get(‘Version’) ); } add_action(‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’); ?> 1.- line: $parent_style=”parent-style”; … Read more

How can I load script and style in specific page in the back-end?

So simple I will explain it step by step: First, use the $hook variable that is WordPress default like this: function the_themescripts($hook) { echo $hook; } add_action( ‘admin_enqueue_scripts’, ‘dr_theme_options_style_scripts’ ); Now go to custom page in your admin WP Dashboard and at the top you will see something like toplevel_page_your_theme_page_slug if it does not visible … Read more

Google fonts enqueue only imports last font family

From the wp_enqueue_style() documentation: $ver (string|bool|null) (Optional) String specifying stylesheet version number, if it has one, which is added to the URL as a query string for cache busting purposes. If version is set to false, a version number is automatically added equal to current installed WordPress version. If set to null, no version is … Read more

Enqueue styles after a plugin

Note that cForms is hooking into wp_head, and you’re attempting to hook into wp_enqueue_scripts. The wp_enqueue_scripts hook is fired inside the wp_head hook (at priority 0, IIRC). So, your stylesheet is being enqueued at wp_head, priority 0, and the cForms stylesheet is being enqueued at wp_head, priority 10. Since it outputs later, it is taking … Read more

Enqueue stylesheet depending on template

You need to first register the style and then en-queue it! This might work! function custom_style_method() { wp_register_style( ‘paralax_style’, get_template_directory_uri().’/paralax.css’ ); } add_action(‘wp_enqueue_scripts’, ‘custom_style_method’); add_filter( ‘template_include’, ‘themename_include_page_specific_css’, 1000 ); function themename_include_page_specific_css( $template ){ if ( is_page_template(‘single-location.php’ ) ) { wp_enqueue_style( ‘paralax_style’ ); } return $template; }

Enqueued Stylesheets Effecting Admin Styles

You could do it like this: function theme_styles(){ /* * This if() statement is unnecessary, as wp_enqueue_scripts * doesn’t fire on the admin pages. * if( is_admin() ) { * return; * } */ wp_enqueue_style( ‘theme-styles’, get_template_directory_uri() . ‘/css/all.css’, array(), false, ‘all’ ); } add_action( ‘wp_enqueue_scripts’, ‘theme_styles’ ); References is_admin() Also, note that the wp_enqueue_scripts … Read more

Enqueue script o style only if a template part is loaded

You can use the get_template_part_{$slug} hook, which fires before a template part is loaded. You can find the reference here, which I find more useful than the official reference. So, I tested it in the twentytwentyone theme (yes I modified the theme directly but only for testing). I tested it with the template-parts/content/content-single.php part, and … Read more

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