{"id":973,"date":"2023-01-06T05:38:07","date_gmt":"2023-01-06T05:38:07","guid":{"rendered":"https:\/\/risecommerce.com\/blog\/?p=973"},"modified":"2023-12-19T12:00:41","modified_gmt":"2023-12-19T12:00:41","slug":"magento-2-how-to-make-a-custom-theme-computable-with-magento-2-4-x","status":"publish","type":"post","link":"https:\/\/risecommerce.com\/blog\/magento-2-how-to-make-a-custom-theme-computable-with-magento-2-4-x\/","title":{"rendered":"Magento 2: How to make a custom theme computable with Magento 2.4.x"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"973\" class=\"elementor elementor-973\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4a5c4fa elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4a5c4fa\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-8f454f5\" data-id=\"8f454f5\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-12fb500 elementor-widget elementor-widget-text-editor\" data-id=\"12fb500\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Here is an example of how you can create a custom theme in Magento 2:<\/p>\n<ol style=\"font-size: 16px; background-color: #ffffff;\">\n<li style=\"font-size: 16px;\">Create a directory for your theme under&nbsp;<code>app\/design\/frontend\/[Vendor]\/[Theme]<\/code><\/li>\n<li style=\"font-size: 16px;\">Create a&nbsp;<code>theme.xml<\/code>&nbsp;file in your theme directory with the following content:<\/li>\n<\/ol>\n<div>&nbsp;<br><br><\/div>\n<div class=\"bg-black mb-4 rounded-md\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans\">[code]<\/div>\n<div>&lt;theme xmlns:xsi=”http:\/\/www.w3.org\/2001\/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:Config\/etc\/theme.xsd”&gt;<br>&lt;title&gt;My Custom Theme&lt;\/title&gt;<br>&lt;parent&gt;Magento\/blank&lt;\/parent&gt;<br>&lt;\/theme&gt;<\/div>\n<\/div>\n<div>[\/code]<br><\/div><p><br><\/p>\n<div>\n<ol style=\"font-size: 16px;\" start=\"3\">\n<li style=\"font-size: 16px;\">Create a&nbsp;<code>composer.json<\/code>&nbsp;file in your theme directory with the following content:<\/li>\n<\/ol><div><br><\/div>\n<div class=\"bg-black mb-4 rounded-md\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans\">[code]<\/div>\n<div>{<br>“name”: “vendor\/theme”,<br>“description”: “My Custom Theme”,<br>“require”: {<br>“php”: “~7.1.3||~7.2.0||~7.3.0”,<br>“magento\/theme-frontend-blank”: “100.2.*”,<br>“magento\/framework”: “100.2.*”<br>},<br>“type”: “magento2-theme”,<br>“version”: “1.0.0”,<br>“license”: [<br>“OSL-3.0”,<br>“AFL-3.0”<br>],<br>“autoload”: {<br>“files”: [<br>“registration.php”<br>]<br>}<br>}<\/div>\n<\/div>\n<div>[\/code]<\/div>\n<\/div>\n<div>&nbsp;<br><\/div><p><br><\/p>\n<div>\n<ol style=\"font-size: 16px;\" start=\"4\">\n<li style=\"font-size: 16px;\">Create a&nbsp;<code>registration.php<\/code>&nbsp;file in your theme directory with the following content:<\/li>\n<\/ol>\n<div class=\"bg-black mb-4 rounded-md\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans\">[code]<\/div>\n<div>&lt;?php<br>\\Magento\\Framework\\Component\\ComponentRegistrar::register(<br>\\Magento\\Framework\\Component\\ComponentRegistrar::THEME,<br>‘frontend\/Vendor\/theme’,<br>__DIR__<br>);<\/div>\n<\/div>\n<div>[\/code]<\/div><div><br><\/div><div><br><\/div>\n<\/div>\n<div>\n<ol style=\"font-size: 16px;\" start=\"5\">\n<li style=\"font-size: 16px;\">Run the following command from the Magento root directory to register your theme:<\/li>\n<\/ol><div><br><\/div>\n<div class=\"bg-black mb-4 rounded-md\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans\">[code]<\/div>\n<\/div>\n<\/div>\n<div>php bin\/magento setup:upgrade<\/div>\n<div>php bin\/magento setup:deploy -f<\/div>\n<div>[\/code]<\/div>\n<div>&nbsp;<\/div>\n<div>\n<ol style=\"font-size: 16px;\" start=\"6\">\n<li style=\"font-size: 16px;\">Log in to the Magento Admin and navigate to&nbsp;<code>Content &gt; Design &gt; Configuration<\/code><\/li>\n<li style=\"font-size: 16px;\">Click the&nbsp;<code>Edit<\/code>&nbsp;button for the store view you want to apply your custom theme to<\/li>\n<li style=\"font-size: 16px;\">In the&nbsp;<code>Design Configuration<\/code>&nbsp;page, select your custom theme in the&nbsp;<code>Applied Theme<\/code>&nbsp;dropdown<\/li>\n<li style=\"font-size: 16px;\">Click the&nbsp;<code>Save Configuration<\/code>&nbsp;button<\/li>\n<\/ol><div><br><\/div>\n<p>Your custom theme should now be active for the specified store view.<\/p>\n<p>You can now start creating custom templates, layouts, and styles for your theme. For more information, you can refer to the Magento 2 documentation on creating a custom theme:&nbsp;<a href=\"https:\/\/devdocs.magento.com\/guides\/v2.4\/frontend-dev-guide\/themes\/theme-create.html\" target=\"_new\" rel=\"noopener nofollow\">https:\/\/devdocs.magento.com\/guides\/v2.4\/frontend-dev-guide\/themes\/theme-create.html<\/a><\/p>\n<\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Here is an example of how you can create a custom theme in Magento 2: Create a directory for your theme under\u00a0app\/design\/frontend\/[Vendor]\/[Theme] Create a\u00a0theme.xml\u00a0file in your theme directory with the following content: [code] &lt;theme xmlns:xsi=”http:\/\/www.w3.org\/2001\/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:Config\/etc\/theme.xsd”&gt; &lt;title&gt;My Custom Theme&lt;\/title&gt; &lt;parent&gt;Magento\/blank&lt;\/parent&gt; &lt;\/theme&gt; [\/code] &nbsp; Create a\u00a0composer.json\u00a0file in your theme directory with the following content: [code] { [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1134,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[8,24],"tags":[],"class_list":["post-973","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-magento","category-tutorial"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/risecommerce.com\/blog\/wp-json\/wp\/v2\/posts\/973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/risecommerce.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/risecommerce.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/risecommerce.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/risecommerce.com\/blog\/wp-json\/wp\/v2\/comments?post=973"}],"version-history":[{"count":0,"href":"https:\/\/risecommerce.com\/blog\/wp-json\/wp\/v2\/posts\/973\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/risecommerce.com\/blog\/wp-json\/wp\/v2\/media\/1134"}],"wp:attachment":[{"href":"https:\/\/risecommerce.com\/blog\/wp-json\/wp\/v2\/media?parent=973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/risecommerce.com\/blog\/wp-json\/wp\/v2\/categories?post=973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/risecommerce.com\/blog\/wp-json\/wp\/v2\/tags?post=973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}