Woocommerce Mystile Child Theme Not Displaying Correctly - wordpress

I've created child themes before without issue however when I create one using Woocommerce Mystile theme it does not display properly with menu items missing and images resizing to be too large.
I made the child theme by creating a new folder in the wp-content>themes folder called mystile-child and creating style.css with the contents
/*
Theme Name: Mystile Child
Description: Mystile Child Theme
Template: mystile
*/
I then created a functions.php file with the contents
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>
this is what the parent theme looks like:
This what the child theme looks like

Just out of curiousity - were the logo and other missing elements set up intially using the theme customizer (reached via the wordpress admin menu Appearance > Customize)?
If that's the case, then those settings are created outside of your theme and need to be reset or imported for your child theme. There are a few ways to accomplish this, the easiest way being with a plugin which imports/exports those Customizer settings.
Hope that helps,
Laura

Okay I fixed the problem following the advice found on Wordpress.org support forum here https://wordpress.org/support/topic/mystile-theme-child-header-problem
Seems more of temporary fix though and something that the people at Woocommerce should investigate.

Related

Adding editor styles to the Astra theme

I'm using the Astra theme (with the Astra Pro plugin). I'm trying to enqueue some custom editor styles for some block patterns I have created. I tried this first: add_theme_support('editor-styles'); but the moment I did--before even getting to add_editor_style--some unfortunate things happened, e.g. the text in a default paragraph block displayed much smaller. I was able to use the add_editor_style() function, and could then correct the problem with the small font size, but that means a lot of extra work to do to correct any other styles that inadvertently affected by the add_theme_support('editor-styles) function . Any ideas what I'm doing wrong? Please note: I am running WP v6.0.1, Astra theme 3.9.0 (with a child theme), and Astra Pro v3.9.0. I'd be grateful for any suggestions or assistance!
Here's the answer:
wp_enqueue_style( 'tg-pattern-styles', get_theme_file_uri( '/tg-pattern-styles.css' ) );
}
add_action( 'enqueue_block_assets', 'tg_block_styles' );```
It works for front and back end.

Is there a way to 'dequeue' a `require_once` entry?

I am currently working on a WordPress website, which has a Parent and Child Theme.
The Parent Theme is outputting the following statement, at the top of the WordPress Dashboard:
This theme requires the following plugins: Plugin A, Plugin B, Plugin C etc
Triggering this output, is the following code, within the Parent Theme's functions.php file:
require_once get_template_directory() . '/inc/plugins/class-tgm-plugin-activation.php';
Is there a way I could disable this, via the Child Theme's functions.php? Sure, I could comment it out within the Parent Theme, but this could get overridden during a future update. I did try to copy the entry, into the Child Theme's functions.php, then comment it out there, but that did not work.
Latest Effort
I went into the WordPress Dashboard, where I copied the notification message prefix:
This theme requires the following plugins:
I then went into the file located within get_template_directory() . '/inc/plugins/class-tgm-plugin-activation.php', where I found the above notification prefix, located within the do_action( 'tgmpa_register' ); function.
I then located the add_action for the do_action( 'tgmpa_register' ); within the /inc/functions/tgm-functions.php directory.
I then headed into the Child Theme, and duplicated the above folder hierarchy.
I then commented out both add_action and do_action, within their respective files as well as entering remove_action( 'tgmpa_register', 'register_required_plugins', 999 ); into the Child's functions.php file.
Unfortunately, neither of the above work. I take it, that this is because the Parent Directory parent_theme/inc has priority over the Child Directory child_theme/inc? If so, is there a way to change this?

Customize Enfold theme on my WP site

I've to customize the header in Enfold theme of my WP site. I placed the company logo to the left and under this I placed the primary menu. I need to add another image near to the company logo. I 'created' a theme child and I would like to add a widget to place image on the right of the company logo but the theme expected in the header the company logo and the primary menu only. Can I customize my header to do this? Can you help me please? Thank's!
If you have purchased the enfold theme, you will get the child theme along with that. Your header part (menu and logo) is running from helper-main-menu.php file which is located at enfold/includes/helper-main-menu.php
Now to get this in child theme add the header.php to your child theme and then add a folder named includes and keep a copy of helper-main-menu.php. This should be as same as in parent theme.
Now you can edit your child theme files and add as many widgets you need.
I have tested and it worked for me.Happy Coding :)
I have noticed that your theme is from themeforest so you should create a child theme, then copy your header.php in child theme folder. Then make changes on that file.
For creating a child theme, make a folder inside your 'themes' folder with you child theme name. Now the child theme should have a style sheet in it which is a must. So add a style sheet and the beginning of the child theme style sheet should be as follows:
/*
Theme Name: (theme name) Child
Theme URI: (give URL)
Description: (give description)
Version: (give your version)
Author: (author name)
Author URI: (give URL)
Template: (name of parent theme)
*/
Of these the very important thing is the 'Template' which is the parent theme name. To avoid confusion take the name of parent theme from the parent theme style sheet.
Now the second thing is the functions of your child theme. Just add a php file with the name functions.php and place the below code.
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>
This code is for enqueuing the parent theme styles. Here you go! your child theme will work now.

Hiding Wordpress parent theme

I am using the child theme and have renamed it to the new theme name. However, the parent theme is still viewable in the admin area with the original theme name. How do I hide the parent theme? Thanks.
As far as I know this cannot be done. The idea behind child themes is to be Update Safe.
This means, you can update the parent theme and all the child theme functionality goes unaffected. If you want to hide the parent theme, you are better off forking it.
As i seen on wp-admin/themes.php file that wordpress use function called wp_prepare_attachment_for_js to collect the available theme information and then display it on themes page.
The function wp_prepare_attachment_for_js located on wp-admin/theme.php may be line 409 and seems the function have filter wp_prepare_attachment_for_js, so i think this will be done with this filter by unset the selected theme (parent theme to hide) before displayed to the available themes.
try add filter like this to your functions.php
add_filter( 'wp_prepare_themes_for_js', 'test_hide_themes', 11, 1 );
function test_hide_themes($prepared_themes){
// hide parent-theme theme
unset($prepared_themes['your-parent-theme-slug']);
return $prepared_themes;
}

MailPress Child Themes

I found the solution, so I'll post this in case anyone else is looking for this info.
I was looking into using a child theme with MailPress (the Wordpress newsletter plugin).
I created the following folder:
public/mysite/wp-content/plugins/mailpress/mp-content/themes/twentyten-child
But when I went to the Admin->Mails->Themes page to activate this child theme, it showed the error:
The parent theme is missing. Please install the "twentyten-child"
parent theme.
The answer was to insert the following comments at the top of the child theme's style.css file:
/*
Theme Name: twentyten Child Theme
Template: twentyten
Version: 0.1
*/

Resources