Where do I go to change the position of the style.css?

Add the following code to themes functions.php file. Replace ‘http://cdn.something.com/something.css‘ to your stylesheet file uri on CDN. add_filter(‘stylesheet_uri’, ‘my_custom_stylesheet_location’); function my_custom_stylesheet_location( $stylesheet_uri ){ return ‘http://cdn.something.com/something.css’; }

Adding CSS to Blog Posts?

You can use PHP code in your child themes functions.php file to add a custom body class to any page/post etc. add_filter( ‘body_class’, ‘my_custom_body_class’ ); function my_custom_body_class( $classes ) { if ( is_single( ‘007’ )) $classes[] = ‘custom-class’; return $classes; } This sample code will add a custom body class to the post with i.d … Read more

Can’t call custom css in style.php

The easiest way to add dynamic CSS is to put it inside a callback and hook the callback into the template, e.g. via wp_head (or wp_print_styles). You’ve not posted your code in full context, so you will need to modify to suit your specific needs. That said, here’s the basic principle: Callback function wpse_129259_enqueue_dynamic_css() { … Read more

Some questions about how proper add 2 CSS file in a WordPress theme?

It seems like you’re using dependencies the opposite way of how they should be used. In the WordPress Codex, they try to explain how it’s supposed to be used. $deps (array) (optional) Array of handles of any stylesheets that this stylesheet depends on. Dependent stylesheets will be loaded before this stylesheet. Since your style2.css is … Read more

PHP in CSS file?

You can use wp_add_inline_style(). Let’s assume you enqueue your css like so add_action( ‘wp_enqueue_scripts’, ‘add_my_style’ ); function add_my_style() { wp_enqueue_script( ‘my_style’, get_template_directory_uri() . ‘/mystyle.css’ ); } Then you can change the function like so: function add_my_style() { wp_enqueue_script( ‘my_style’, get_template_directory_uri() . ‘/mystyle.css’ ); $style = “#mainnav li:after { content: url(‘{theme_url}/images/nav-divider.png’); }”; $style .= “#another-example { … Read more

post_class not working with css

First of all, <?php post_class(); ?> function prints a string that contains html ‘class’ attribute. So, whenever you are using this function inside class attribute, then you are actually printing another class attribute inside class attribute. That’s why your class is not working. Secondly, since <?php the_content(); ?> function may contains <p> tag, that’s why … Read more

CSS styling of native (inbuilt) wordpress thumbnails [closed]

The gallery_shortcode with its default styles can be found in wp-includes/media.php line 906 to 1089. There is also an article in the codex that might be useful: Gallery Shortcode. There is also a couple of filters available as you can see from the source code that you can use The gallery shortcode uses the default … Read more