How to use custom stylesheet only for a template in child theme

Try this: add_action( ‘wp_enqueue_scripts’, ‘my_custom_styles_function’, 100 ); function my_custom_styles_function(){ if (is_page_template(‘test-template.php’)) { wp_enqueue_style( ‘my-custom-css’, get_stylesheet_directory_uri() . ‘/custom-style.css’ ); } } wp_enqueue_scripts hook is used for including new stylesheet. Here template is test-template.php. Change it with your template. Stylesheet will only be included in your page template.

WordPress Twenty Fourteen Theme Sidebar

The sidebar is created in two different places: The black strip is created from .site:before, check line 3910 of style.css #secondary actually displays the sidebar information, check line 3923 of style.css .featured-content, .site-content, .site-main .widecolumn provide left padding to the content area should you wish to dispose of that too.

How do I add Bootstrap and LESS to my migrated WordPress site?

You don’t need to create additional functions, just re-use what you already have and tweak it a bit: function theme_add_bootstrap() { wp_enqueue_style( ‘bootstrap-css’, get_template_directory_uri() . ‘/third_party/bootstrap/css/bootstrap.min.css’ ); wp_enqueue_script( ‘bootstrap-js’, get_template_directory_uri() . ‘/third_party/bootstrap/js/bootstrap.min.js’, array(), ‘3.0.0’, true ); if (WP_ENV === ‘development’) { wp_enqueue_script( ‘lesscss’, get_stylesheet_directory_uri() . ‘/third_party/less-1.5.0.min.js’ ); wp_enqueue_style( ‘style-less’, get_template_directory_uri() . ‘/css/custom.less’ ); } else … Read more

How to use my style.css file outside of wordpress subdomain?

If you’re using an absolute reference like that, you’d want to include the full file path, like http://diginomics.com/wp-content/themes/THEMENAME/css/style.css I believe any time you call the functions like get_stylesheet_directory() or get_stylesheet_directory_uri() it will return the path for the current theme. Just keep in mind that all themes need a style.css file. I would have posted this … Read more

How to disable CSS rule in Twentythirteen style.css?

The default behavior for box-sizing is content-box. This is applied when you deselect the rules in Chrome. Have you tried applying box-sizing: content-box in your own CSS file instead of inherit? .ct-black-square { background-color: #88a0a9; box-sizing: content-box; -webkit-box-sizing: content-box; -moz-box-sizing: content-box; } .ct-white-square { background-color: #fdfdfd; box-sizing: content-box; -webkit-box-sizing: content-box; -moz-box-sizing: content-box; } box-sizing

How to enqueue a random css style?

This should work! function enqueue_random_style() { wp_enqueue_style( ‘style-name’, get_stylesheet_directory_uri() . ‘/inc/rcolor/’ . mt_rand(1, 9)); } add_action( ‘wp_enqueue_scripts’, ‘enqueue_random_style’ );

Child Theme files – what is needed?

Yes you will need to enqueue parent theme styles into child theme. Adding style.css in child theme will not automatically add parent theme’s styles too. You can enqueue parent theme’s styles like this. Create a new functions.php in child theme and paste this. function enqueue_child_theme_styles() { wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/style.css’ ); wp_enqueue_style( ‘child-style’, get_stylesheet_uri(), array(‘parent-style’) ); … Read more

Override img class in gallery

You should add !important to your styles in order to override it. Better way to do this is to copy the .img-responsive styles from the Bootstrap CSS file and apply these styles to your desired HTML element instead of adding a class using PHP. img.attachment-large { display: block; max-width: 100%; height: auto; } Or target … Read more