Hot answers tagged

4

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 ...


3

You could use the filter term_links-post_tag to sort tags while ignoring their case: add_filter( "term_links-post_tag", 'themeslug_sort_tags_alphabetically' ); function themeslug_sort_tags_alphabetically( $tags ){ natcasesort( $tags ); return $tags; } This code is to be placed in the functions.php of the child theme.


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

You can use language files that are in your child theme folder. First you have to know which text domain the parent theme is using. Then create the .po and .mo files with only your language as the file name (e.g. de_DE.po/de_DE.mo or nl_NL.po/nl_NL.mo) and put them into a folder within your child theme directory, "languages" for example. You can then ...


1

I think I found a solution, but before a little Premise load_theme_textdomain() and load_child_theme_textdomain() are basically equal, the only difference is the default path they use: they get the current language (using get_locale()) and add the relative .mo file to the path passed as argument; then they call load_textdomain() passing as argument both ...


1

You could try the following: add_action( 'switch_theme', function( $new_name, $new_theme ) { if( is_a( $new_theme->parent(), '\WP_Theme' ) ) { // Child theme was activated } else { // Parent theme was activated } }, 10, 2 ); to see if the theme you just activated is a child theme or not.


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

I think you are confused about this. Let me explain. The @import url("../responsive/style.css"); is telling the Child theme to import the Responsive themes style.css. This is important because without this the Child theme doesn't know what its Parent theme is. So the @import url("../responsive/style.css"); points the Child theme to the default (main) file ...


1

There are a few steps you'll need to take, to switch parent themes. Create a Backup of the Original Child Theme If you have FTP access, log into [root]\wp-content\themes\ and download the child theme folder to your your computer. Copy and rename the entire child theme folder. This will be your new child theme. If you don't have FTP access, it's probably ...



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