How to control the order of the combination of enqueued styles and scripts – site speed issue

We know, using wp_head() and wp_footer() all the scripts and styles are enqueued using wp_enqueue_styles and wp_enqueue_scripts hook. What we do is to enqueue our stylesheets and scripts using functions.php. And similarly WordPress plugins also enqueue their stylesheets and scripts using the same method. So, in the end there are many enqueued styles and scripts … Read more

The correct way to include JavaScript and CSS in my WordPress Themes

I’m trying to build my own WordPress theme using the correct ways. But… The first trouble that I found was how to add css and js “using the correct way”. I found severals tutorials how to do it. e.x: http://code.tutsplus.com/tutorials/loading-css-into-wordpress-the-right-way–cms-20402 (this is from “30-Jun-2014”) and this one http://code.tutsplus.com/articles/how-to-include-javascript-and-css-in-your-wordpress-themes-and-plugins–wp-24321 (this is from “14-Feb-2012”) They explain the … Read more

How to switch css files according to devices and button click?

I am trying to enqueue a responsive css file if the website is opened on mobile devices. Also I want to switch / enqueue a default or non-responsive css file when a button is clicked. The non-responsive css file is the default style sheet which is loaded on desktop. So the requirements are: By default … Read more

Enqueue stylesheets if parent theme has more than one .css file

I just learnt about creating child themes from the Codex , it says to add add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ ); function theme_enqueue_styles() { wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ ); } and function 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 ) ); } add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ ); in … Read more

Creating Admin Options Page where users can make changes to a theme

I need help to finish this last bit of php code. I’m trying to create an admin options page similar to in admin>settings>discussions like how a user can select an avatar, but instead of selecting an avatar, the user selects a style option that makes a change to the theme (by enqueueing a CSS file … Read more

I want to include my style.css in function.php file?

I’m new to WordPress. I’m including my file using <link rel=”stylesheet” href=”https://wordpress.stackexchange.com/questions/236370/<?php bloginfo(“stylesheet_url”)?>”/> But if i enqueue my css file in functions.php it is not working. Why? Where is my mistake? <?php wp_enqueue_style(‘style’,get_template_directory_uri())?> What is the solution for this? 2 Answers 2 You are calling the function wrong. You have not given your filename, just … Read more

De-registering parent style sheet css recommended?

Just a general question: I am just wondering, why every tutorial for child themes still includes the parent’s stylesheet. Would it not be preferable to de-enqueue & to de-register the parent’s stylesheet and then just to copy the parent’s stylesheet rules right into the child theme’s style.css? This way, you would have one less page … Read more

Is it possible to use the featured image of a page as a css background without inlining?

So, I’m totally new to WordPress and trying to “convert” a static site to a WP theme. I have a page where I’d like to use the featured image as a background for a div. I was wondering what is the best way or whats the convention to do that? It doesn’t matter if its … Read more