I want to override magento's core order/info.phtml.
I have copied the file from
vendor/magento/module-sales/view/frontend/templates/order/info.phtml
and place it here
app/design/frontend/Magento/luma/Magento_Sales/templates/order/info.phtml
But it is still using the old phtml file instead of new overrided file, please tell me where I did wrong?
I am using magento's default theme Magento/luma
You can't override files from the Luma theme like this. And you shouldn't, because you are attempting to hack the Luma theme, while its files are located elsewhere. Plus, it is a demo theme, not meant to create new production shops with.
Instead, try to create a new theme under app/design/frontend, add a proper theme.xml and registration.php. Next, configure that theme from within your backend. And then try to override files there.
You can override luma theme but you should have your own theme name and you have to set parent theme as luma so their properties can be overridden from your custom theme.
Hope you know how to create custom theme , if not see the below steps try the same.
Create a folder inside app/design/frontend/Vendorname/themename
Example : Create vendor name as Test
Theme name as : mytheme
Now you need to create 3 files
composer.json
registration.php
theme.xml
Inside theme.xml you can set the parent as luma like this
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Test mytheme</title>
<parent>Magento/luma</parent>
<media>
<preview_image>media/preview.png</preview_image>
</media>
</theme>
Once this is done you need to activate your theme from admin end and here you can override anything inside it.
Once you activate your custom theme copy the sales folder this way
app/design/frontend/Test/mytheme/Magento_Sales/order/info.phtml
and do your changes inside it , you can see your changes in frontend.
Related
I don't know how to manually add a text-domain to my child theme.
I installed LocoTranslate to find out what the text-domain was, and it shows the same as the main theme.
This is a problem, but I need to add a file that has been made custom and it must call this child theme in various parts of the code, now it calls the main theme and this is the problem.
Searching I found [WordPress documentation on child themes,][1] but I must say that I don't know how to interpret it, my experience is not enough to know how to read this documentation.
I don't even keep looking and I can't find a site that describes how to do this by someone inexperienced.
Is there a document outlining the steps to create a child theme text-domain for beginners?
Go into the style.css file in your child theme. In the comment header, add a text domain field under the theme name field.
/*
Theme Name: My Child Theme
Text Domain: mychildtheme
*/
Then, go to your functions.php file in your child theme and add the following code.
function mychildtheme_load_textdomain() {
load_child_theme_textdomain( 'mychildtheme', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'mychildtheme_load_textdomain' );
Change 'mychildtheme' to the text domain you gave in your style.css file.
I am new in Opencart, I have installed Opencart 2.3.0.2 in my xampp server.
I have a custom html template. How I implement it in Opencart ?
can I use the template in same store(opencart default) or another ?
Thanks alot.
Make copies…
To start with copy the default folder found in
upload/catalog/view/theme/default
to a new folder in the same directory. Name it “mytheme“.
Then copy the theme_default.php file in
upload/admin/controller/extension/theme
and place it in same directory. Name it “mytheme.php“.
Rename the class to (line 2):
ControllerExtensionThemeMyTheme
+ Replace all “theme_default” text to “mytheme“. Yes there are a lot (197).
Copy the theme_default.tpl in
upload/admin/view/template/extension/theme
and place it in the same directory. Name it “mytheme.tpl“.
Replace all “theme_default” text to “mytheme“. (48)
Copy theme_default.php in
upload/admin/language/en-gb/extension/theme
and place it in the same directory. Name it “mytheme.php“.
Set the new theme’s title in heading_title (line 3) to “My Theme”.
Finally for the thumnail image to show correctly in store settings rename default.png to mytheme.png in
upload/catalog/view/theme/mytheme/image
Now go into your Administration > Extensions > Extensions and select Themes in “Choose the extension type”. You should be seeing your new theme. Install it with the green (+) button and edit it to enable it. Also ensure you set the correct theme directory whilst editing the theme!
Then in System > Settings edit your store to use your new theme.
That should do it. You can now go ahead and start chopping and changing the default theme.
I need help overriding Visual Composer plugin of Wordpress.
My intention is to change the default value of the Single Image element.
I'm working in the child theme and I created a "duplicated" .php file (the one I want to modify), but the theme doesn't read it. I even tried adding a function in the plugin original file (shortcode_vc_single_page), and nothing changed.
The function that I tried is:
if( !function_exists('vc_single_image_func')){
/ * _(((the rest of the .php)))_ */
}
Anyone has an idea?
I made a child theme. The CSS I integrated into my child theme and it works perfectly. But now I want to make some amendments in my themes functionality. I copy from my parent theme, for example, product-tab.php to an exact direction in my child theme, modify the file, save, but after refresh no changes in my page. If I do it in the parent theme it works. I think that I should integrate that product-tab.php into my functions.php file (I mean that information first get from my child theme directory not from parent theme by default), but I don't know how because I'm a newbie in PHP coding.
Can anybody give one example how to integrate any PHP file from parent theme to a child theme. Can anybody write an example of a code using the information below?
parent theme direction:
/public_html/wp-content/themes/aloshop/7upframe/element
file name: product-tab.php
child theme direction:
/public_html/wp-content/themes/aloshop-child/7upframe/element
Thank you in advance
If your child theme style sheet is working then you have created the child theme properly. Still reminding you to check the name of parent name included in child theme style.css as 'Template : '
For overwriting the functions you have to copy the php file/functions from parent theme in the same hierarchy or by keeping the same folder file structure.
If your function is still working from parent theme just check from where your function is getting called. It may be from any other file from parent theme which is not included in child theme. In such case, include that file too to he child theme.
Hope this is clear.
If you are using child theme to modify your parent theme {aloshop} then use get_stylesheet_directory() function to get the child theme directory. and then call your other files via functions.php file . To include product-tab.php file via functions.php then put below codes into your child theme's functions.php file,
<?php include_once( get_stylesheet_directory() . '/product-tab.php'); ?>
Hi I have a WooCommerce plugin activated and a Mystile theme. I want to add a custom js file located at mystile/includes/js/custom-script.js. Ive read on how to add files through using wp_enque_script but it is not loading the js files when I view page source.
I have this code block on functions.php of my current theme which is Mystile, which should have added my custom js file
function add_custom_assets(){
//Load masonry CSS and JS files
wp_enqueue_script('masonry', get_stylesheet_directory_uri().'includes/js/custom-script.js',array('jquery'), '1', true);
}
add_action('wp_enqueue_scripts','add_custom_assets');
the above code does not work and I cannot see my JS file in source. I really dont know what I am doing wrong. I even tried wp_register_scripts but its the same thing.
The only change I did to the current theme was that I copied the templates folder from the woocommerce plugin directory to my current theme and renamed it woocommerce to override certain stuffs. Any suggestions
you should specify unique handles (so stuff don't get overridden)
function add_custom_assets(){
wp_enqueue_script('my-custom-script-handle', get_stylesheet_directory_uri().'includes/js/custom-script.js',array('jquery'), '1', true);
}
add_action('wp_enqueue_scripts','add_custom_assets');
This is not a ideal solution but a hack and it does work. Enqueue the script as wp_enqueue_style rather than wp_enqueue_script. It does load the script but is a very dirty solution. Still the question is open though