Override Woocommerce Elements - php

I am having the hardest time trying to modify the woocommerce layout for the storefont template. My directory is:
Location for woocommerce plugin: wp-content/plugins/woocommerce/templates
I copy everything in the templates folder above into: wp-content/themes/storefront_child/woocommerce/
Modify any file inside the woocommerce folder above such as writing
OMG anywhere on the page.
Nothing shows in my page.
I am a rookie in WordPress and I have no idea how to modify the files for a plugin/template. I have not activated my child template either (is that required?). When I duplicate the woocommerce files and try to install them, it says the template is missing.

open up functions.php
then copy below code on there:
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
and then check the result

I finally got it after much research. Most sites neglect to mention that what actually "activates" the child theme is the comment in the CSS. So the child theme MUST include the CSS with the information that links it to the parent child. In my case:
/*
Theme Name: storefront-child
Theme URI: http://example.com/
Description: StoreFront
Author: John Doe
Author URI: http://example.com
Template: storefront
Version: 1.3.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-fifteen-child
*/

It seems your child theme has not configured properly. You please double check below points.
You activated Child Theme (Not the parent)
Your child theme has a style.css file with below code
/*
Theme Name: My Child Theme
Description: A Twenty Thirteen child theme
Author: My author
Template: twentythirteen
Version: 1.0.0
*/
You properly Enqueued the Styles and Scripts.
add_action( 'wp_enqueue_scripts', 'my_theme_add_stylesheet' );
function my_theme_add_stylesheet() {
wp_enqueue_style( 'my-style', get_stylesheet_directory_uri() . '/style.css', false, '1.0', 'all' );
}

Related

Wordpress functions.php style version won't update

I know this has been brought up a million times on here, but I have followed various solutions to no avail. My child theme stylesheet just won't change. It actually seems like any changes I make to the child functions.php don't take effect.
This is the closest post to my issue is this one but the answer about cache busting hasn't worked for me. I am kind of thinking it has to do with how the parent theme enqueues child theme styles automatically, but I don't know how to override that.
functions.php styles enqueue:
// Load styles:
add_action( 'wp_enqueue_scripts', 'main_styles' );
function main_styles() {
//* Bootstrap CSS
wp_enqueue_style('bootstrap-style', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css');
//* Parent CSS
wp_enqueue_style( 'corporate-plus',
get_template_directory_uri() . '/style.css' );
//* Child theme CSS
$cache_buster = date("YmdHi", filemtime( get_stylesheet_directory() . '/style.css'));
wp_enqueue_style( 'yunev-corporate-plus',
get_stylesheet_directory_uri() . '/style.css',
array( 'corporate-plus '),
$cache_buster
);
}
child theme style.css theme comments:
/*
Theme Name: Yunev Custom
Description: Yunev Custom - Corporate Plus Child Theme
Template: corporate-plus
Version: 1.1.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: yunevcorporatepluschild
*/
(I removed the author and such for this post)
I customized this child theme a while ago and the custom styles are working, but any changes I make now don't propagate. I have cleared cloudflare cache, cache plugin, everything I can think of. It's driving me crazy.
The child style version that I get in the browser is always '1.0.1'. Any troubleshooting tips would be much appreciated.
Just try to rename your stylesheet or reupload your theme.

Forgot to make child theme - can it be done now?

I've added different things to my functions.php, and not in a child theme, so I can't update my theme.
Is it possible to just copy everything in my functions.php, make a child theme, and then paste in that functions.php? Or how is it done?
Yes it can be done, you can create a child theme and then in functions.php you can paste all your new functions.
Suppose your parent theme folder(tweentyseventeen), create folder with name tweentyseventeen-child into your themes folder.
Add style.css file into child folder. Copy the commentted line from parent style.css to child style.css
/*
Theme Name: Twenty Seveenten Child
Theme URI: http://example.com/twenty-seveenten-child/
Description: Twenty seveenten Child Theme
Author: John Doe
Author URI: http://example.com
Template: tweentyseventeen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-seventeen-child
*/
Add functions.php file into child folder and then add your code you want to add in.
Activate you child theme from backend.(apperances>theme)

wordpress text domain issue

so i testing my them from errs with theme check plugin
and go the text domain issue but it returns a blank value ! is this make any since !!
REQUIRED: This theme text domain does not match the theme's slug. The text domain used: This theme's correct slug and text-domain is osiris-rathemes.
/*
Theme Name: osiris rathemes
Theme URI: https://themeforest.net/user/ra-themes/portfolioa
Author: Mohamed Said
Author URI: https://themeforest.net/user/ra-themes
Description: some dec
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: osiris-rathemes
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/
theme folder name as the text domain
and the style.css have the text domain and its not an empty string
do i miss any thing !
Maybe you need to load the theme textdomain in the functions.php file. Your style.css file looks correct but I don't know what your theme plugin checker is doing..
function osiris_rathemes_setup() {
load_theme_textdomain( 'osiris-rathemes', get_template_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'osiris_rathemes_setup' );

Wordpress - child theme won't complete installation

I'm using a child theme with HTML5 Blank as the parent theme. I've used this before without any issue but for some reason I'm now getting the following error on my themes page -
Broken Themes
The following themes are installed but incomplete.
Name Description
HTML5 Blank Child Theme The parent theme is missing. Please install the "html5blank" parent theme.
This is what I have in my folder -
style.css
/*
Theme Name: HTML5 Blank Child Theme
Description: A child theme of the HTML5 Blank WordPress theme
Author: Mike Whitehead
Template: html5blank
Version: 1.0.0
*/
I've tried numerous different variations on this - also copying the official wordpress guide. The above wording worked for me on my last project so don't know why it won't work now.
This is my functions file -
functions.php
<?php
function my_theme_enqueue_styles() {
$parent_style = 'html5blank-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>
Not sure why this isn't working. Any assistance would be appreciated.
The child themes style.css 'Template' tag should match that of the parent themes folder name eg.
/*
Theme Name: HTML5 Blank Child Theme
Description: A child theme of the HTML5 Blank WordPress theme
Author: Mike Whitehead
Template: html5blank-stable
Version: 1.0.0
*/
As per the WordPress Codex page on Child Themes - https://codex.wordpress.org/Child_Themes
"The Template line corresponds to the directory name of the parent theme. The parent theme in our example is the Twenty Fifteen theme, so the Template will be twentyfifteen. You may be working with a different theme, so adjust accordingly."
Get Your Parent Theme's Textdomain and put it as child theme's Template name. Let's say your Parent theme's Style.css header like this...
/*
Theme Name: HTML5 Parent Theme
Description: A HTML5 Blank Parent WordPress theme
Author: Mike Whitehead
Text domain: html5blank
Version: 1.0.0
*/
Then you can use this Text domain name into your child theme like this..
/*
Theme Name: HTML5 Blank Child Theme
Description: A child theme of the HTML5 Blank WordPress theme
Author: Mike Whitehead
Template: html5blank
Version: 1.0.0
*/

Why isn't my child theme using the new style.css file?

I followed a very simple tutorial on how to enqueue a child theme, but when I actually went to edit my style.css nothing transferred over. Did I use the given code wrong?
style.css
/*
Theme Name: Blank Slate Child
Theme URI: http://www.efficientmind.org/blankslate-child/
*/
Enqueue code in the functions.php
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>
Your child theme stylesheet header needs to contain the Template line (the parent theme name) in order to work.
codex | child themes
Example:
/*
Theme Name: Twenty Thirteen Child
Theme URI: http://example.com/
Description: Child theme for the Twenty Thirteen theme
Author: Your name here
Author URI: http://example.com/about/
Template: twentythirteen
Version: 0.1.0
*/
add following comment to your child theme's style.css file:
Template: BlankSlate
your new Style.css should then look like this:
/*
Theme Name: Blank Slate Child
Theme URI: http://www.efficientmind.org/blankslate-child/
Template: BlankSlate
*/

Categories