Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Så här installerar du ett barntema för WordPress

Vill du installera ett barntema på din WordPress site? Barnteman är bra för att göra customizes eftersom de allow you att dra nytta av kraftfulla funktioner i ett huvudtema eller ramverk. I den här artikeln visar vi dig hur du enkelt installerar ett barntema i WordPress.

How to Install a WordPress Child Theme

Vad är ett barntema i WordPress?

WordPress barnteman är beroende av ett huvudtema eller ett temaramverk. Barnteman lånar alla funktioner och appearance från sitt huvudtema och kan ändra dem utan att röra koden för huvudtemat.

De flesta gratis och premium WordPress teman kommer med många alternativ för customomize. Ibland kan du dock fortfarande behöva lägga till kod manuellt i ditt theme.

Om du addar kod direkt till ditt temas filer, kommer dina ändringar att skrivas över när du uppdaterar ditt theme. Customizes löser detta problem genom att allow you att add your customizations i child theme. På så sätt kommer alla dina ändringar att förbli intakta när du uppdaterar huvudtemat.

Barnteman används oftare med temaramverk för WordPress. Dessa ramverk är robusta huvudteman som erbjuder en solid bas för utvecklare av teman att bygga vidare på.

Genesis är ett sådant populärt ramverk för teman. Det finns massor av barnteman tillgängliga för Genesis som du kan få från StudioPress.

Om du vill lära dig mer om WordPress barnteman rekommenderar vi att du läser vår artikel om vad är ett WordPress barntema? Pro, nackdelar och mer.

Vill du customize ditt WordPress-tema med ett eget barntema? Följ instruktionerna i vår steg-för-steg guide om hur du skapar ett WordPress barntema.

Med det sagt, låt oss ta en titt på hur du enkelt installerar ett WordPress barntema.

Step-by-Step 1. Installera WordPress barntema

Att installera WordPress barntema är inte annorlunda än att installera något annat WordPress-tema.

Inuti din WordPress admin area, head över till Appearance ” Themes page och klicka på Add New knappen.

Add new WordPress theme

Det finns två metoder för att installera ditt WordPress theme.

Metod 1: Om ditt barntema är available som ett gratis tema på WordPress.org theme directory, då kan du leta efter det genom att skriva dess namn i search-rutan.

Searching for a free WordPress child theme

Från sökresultaten tar du musen till det theme du letade efter och klickar sedan på knappen Install.

WordPress kommer nu att downloada och installera ditt barntema.

Det kommer också att leta efter det obligatoriska huvudtemat. Om huvudtemat också finns tillgängligt i WordPress.org theme directory installeras det automatiskt åt you.

Metod 2: Om ditt barntema kom som en zip-fil, måste du klicka på knappen ”Upload Theme”. Detta kommer att visa dig alternativet för uppladdning av theme.

Upload your child theme's zip file

Klicka på välj fil för att selecta temats zip-fil från din dator och klicka sedan på knappen ”Install Now”.

WordPress kommer nu att uploada zip-filen med temat från din dator och installera det. Det kommer också att kontrollera om huvudtemat är installerat. Om huvudtemat är available från WordPress.org theme directory, kommer det att försöka installera det. Annars meddelar den dig att du måste installera huvudtemat manuellt.

Installing child theme alone

Step-by-Step 2. Installera WordPress huvudtema

WordPress kommer automatiskt att försöka installera huvudtemat om det är available i WordPress.org theme directory. Om det Misslyckas med att installera huvudtemat, kommer du ej att kunna aktivera barntemat. Det kommer att visa ditt barntema som trasigt på sidan themes.

Broken child theme

Så här installerar du ditt huvudtema. Gå först till ditt huvudtemas website och download the theme zip file.

Gå nu över till sidan Appearance ” Themes och klicka på knappen Add New.

Add new WordPress theme

Klicka på knappen ”Upload Theme”. Detta kommer att visa dig alternativet för uppladdning av theme.

Click on the choose file button to select the theme zip file from your computer and then click on the ’Install Now’ button.

Upload your parent theme's zip file

När du har installerat både huvudtema och barntema kan du gå vidare och aktivera barntemat.

Note: Tänk på att du inte behöver aktivera huvudtemat för att kunna använda barntemat.

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du installerar ett barntema för WordPress. Du kanske också vill se vår guide om hur du hittar vilka filer som ska editeras i WordPress tema.

Om du gillade den här artikeln, vänligen prenumerera på vår YouTube-kanal för WordPress video tutorials. Du kan också hitta oss på Twitter och Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

29 kommentarerLämna ett svar

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Jiří Vaněk says

    I am using a child theme but I would like to ask a question. In this case, is it better to put snippets manually in the child theme, or is it better to use a plugin like WP Code to insert the code? I assume that if I change the template over time, then WP Code is preferable, because the snippets will remain active despite the change of appearance (unless there is a problem with the collision of snippets and the new template)?

    • WPBeginner Support says

      We would normally recommend placing the snippets in a plugin like WP Code to prevent the customizations from being lost with an update.

      Administratör

  3. Tamie says

    Thank you for this!

    I have a few questions:

    Can you install a child theme after you have already installed and configured a parent theme or will this undo all of your work?

    Do you really need a child theme if you are only adding css under the customizer or will that remain in place over when you update your theme?

    Also, if do need the child theme and you have placed css under the customizer on the parent, should you move it over to the child?

    • WPBeginner Support says

      You can install a child theme but you may need to set some of the settings in the original theme for your design.

      If you are only adding changes in the customizer then a child theme is not required.

      For safety, we would recommend moving CSS in the customizer on the parent to the child theme. :)

      Administratör

  4. Rohit Patel says

    Great article. What happen if I am just using parent theme and not activate the child theme after install it.

  5. Hannah Joy says

    Thank you so much!!! Every other online tutorial was so confusing and added a lot of irrelevant detail or confusing and inapplicable info. I am creating a website for the first time and not trying to do anything fancy, I just want to get it right from the start. So grateful for pages like yours that break it down into easy to chew bits for us newbies!!

  6. Belinda Ciurleo says

    Thank you for sharing this, it is very helpful.
    I have one question..
    I have already installed the parent theme and created pages, menus, etc.
    I’ve come to installing the child theme because I need to create an endpoint in WooCommerce. I’ve done most of my site, just doing the finishing touches.

    When I deactivate the parent theme, and activate the child theme, will it keep all the work I’ve done? Or will I lose it all?

    • WPBeginner Support says

      You would keep all of your pages and content. Other customizations to styling may not transfer depending on the specific theme.

      Administratör

  7. Annapurna Agrawal says

    Hey, I have this serious question. Which one should I opt for? Creating a child theme? or building a theme from scratch?

    If I create the theme from scratch, how do I manage the updates to functions in WP?

    If I create a child theme, I will basically have to update the entire style for my website.

    Help me get out of this!

    • WPBeginner Support says

      If you create a child theme it will use whatever customizations you’ve added and if you do not specify a style it will take that from the parent theme. Creating a new theme would require you to have a style rule for everything you want styled.
      You would update the functions as you would with any theme.

      Administratör

  8. Allisa says

    Hi, I have installed both Genesis and child theme Essence. While I love the framework, I don’t care for my theme. Do you have any articles or suggestions on how to install & switch child theme’s? Thanks in advance!

  9. Susana says

    If I have already activated the parent theme should I deactivate it before installing and activating the child theme?

    • WPBeginner Support says

      Hi Susana,

      You can only activate one theme at a time in WordPress. When you install and activate the child theme it automatically deactivates the parent theme. You can also manually deactivate it if you want. However, you will need to keep the parent theme installed to use the child theme.

      Administratör

      • Mayur Lokhande says

        I have installed Parent theme, I don’t know how to check weather I had installed child-theme or not. Why is there need to upload child theme. If one would not install child theme then what would happen?

  10. Juan says

    How do I create a child theme if wordpress was not installed locally on my pc. During the installation I left the ”Directory” section blank and I think that is why I do not have a local install. What are my options?

  11. Allan Seabrook says

    Hi Syed,

    Thanks for sharing this article. Recently, I have started experimenting with the ”One-Click Child Theme” plugin by tychay. It hasn’t been updated in two years by the developer. but appears to work as documented.

    Have you had any experience with this plugin or anything similar?

    Thanks!
    Allan

  12. Anton says

    Hello,

    What should I do if I already use main parent theme? How can I add child one? Do you guys have guide for that too?))

  13. Markus Martin says

    Hi Syed. I don’t know if it is only me, but my customizations in style.css for child theme don’t work anymore and am forced to use the custom css in wordpress customise dashboard. Is there a difference and is that really ok?

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.