Tag Info

Hot answers tagged

11

You don't have to use @import. It's best not to, actually. Using an enqueued approach is probably better all around. Here's the relevant part of twentythirteen's code: function twentythirteen_scripts_styles() { ... // Loads our main stylesheet. wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18' ); ... } ...


2

warning This solution doesn't respect the parent theme's dependencies! Changing the parent theme's handle name affects the chain of dependencies set in the parent theme. See my much simpler other answer. orignal answer Although Otto's answer is pretty good, I ended up with this in my child theme's functions.php function my_theme_styles() { global ...


2

My previous answer is overly complicated and potentially doesn't respect the parent theme's dependency chain (see note in other answer). Here's another much simpler take that should work much better: function use_parent_theme_stylesheet() { // Use the parent theme's stylesheet return get_template_directory_uri() . '/style.css'; } function ...


1

I would definitely avoid using 2 different wordpress themes and instead code for a more responsive website with CSS mediaqueries. It has worked out very well for me on the Wordpress websites I created. If you're not familiar with media queries, here's a very basic rundown. HTML -- <div class="box">hello world</div> CSS -- .box { ...


1

I try this code and it solve my problem if ( is_child_theme() === false ) { // files moved } else { // do nothing } Thankx to @birgire


1

You can get this value about the child theme. At first get your child theme date. The simplest way is the function wp_get_theme(), see codex for the parameters and more information. You get a object with all relevant information about the current theme. In step two check, if is a child theme and then get his parent information, like the follow source. // ...


1

Thanks for all the help which pointed me in the right direction. In the end I used the following: $style_parent_theme = wp_get_theme(get_template()); $style_parent_theme_author = $style_parent_theme->get( 'Author' ); I use get_template() to recover the folder name of the parent theme. wp_get_theme then get's the theme object. Once we have that we can ...


1

You have two options here In a child theme, dequeue and deregister the scripts and style you are not going to need. Just remember to hook your function to wp_enqueue_scripts with a lower priority (higher number) Use the twentyfifteen as a base to a new theme. I have successfully used bundled themes in the past to create new, selfstanding themes. That is ...


1

The WP_DEFAULT_THEME constant actually just overrides what WordPress sets as default theme (which per default is the latest of the bundled themes). It does not really help you to define your parent theme. In fact you just have to "Network enable" your parent and child themes and then set the parent theme in the child themes header. No need to do more than ...


1

QUESTION 1 Is it safe to include the assumption that parent themes properly enqueue the child theme styles, from the standpoint of child theme standards? General rule of thumb, yes. But, you should never assume. Most disasters and failures in live are due to assumptions or facts based on an assumption FACTS WITHOUT ASSUMPTIONS A child theme's ...


1

Actually @Pieter Goosen took care of the issue when he corrected the Codex and removed the call to the extra style sheet. So in fact this works the way it should add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); } Thanks Pieter. ...


1

You simply need to run your code on a higher priority than what the parent theme is, the default on add_action function is 10 so you can use: function s157343_unregister_widgets() { unregister_widget( 'Chocolat_Widget_New_Entrys' ); } add_action( 'widgets_init', 's157343_unregister_widgets', 20 ); This will unregister that widget. Of course, you can ...



Only top voted, non community-wiki answers of a minimum length are eligible