In che modo i temi forniscono supporto per i temi figlio?
-
-
Si è verificato unproblema durante la creazione di untemafiglioperiltuotema?Se sai come creare untemafiglio,dovresti saperetutto quello che c'è da sapere?Was there a problem creating a child theme for your theme? If you know how to create a child theme then you should know everything there is to know?
- 0
- 2013-08-10
- Tom J Nowell
-
L'ho creatoe funzionabene,mami chiedo se c'è qualcos'altro che devo aggiungere otestare.Se ètutto ok.Grazie!I created and it works fine, but I wonder if there is anything more that I need to add or test. If that's all than ok. Thanks!
- 0
- 2013-08-10
- Valeka
-
2 risposta
- voti
-
- 2013-08-10
Esistegià una risposta accettata,tuttavia,offrirò una risposta diversa. Ci sono cose che devifareper supportare la correttafunzionalità deltemafiglio.
Prima ditutto,lavora all'interno della gerarchia deimodelli di WordPress . Ho vistotemi fare cose stranee creare strutture dimodellinon standard. Non ènemmenonecessario utilizzarenessuno dei sistemi ditemi di WordPressper visualizzarei contenuti se davveronon vuoi. Resisti all'impulso difare qualsiasi cosa.
In secondo luogo,caricai file che dovrebberoessere sostituibili con
get_template_part ()
elocate_template ()
e non coninclude
orequire . File caricati con
get_template_part ()
elocate_template ()
puòessere sostituita datemi figlio. Ifile caricati dainclude
orequire
nonpossono.Terzo,utilizza get_template_directory () ,get_template_directory_uri () ,get_stylesheet_directory () e get_stylesheet_directory_uri () in modo appropriato.
Probabilmente vuoi anche registraree accodarei tuoi scripte fogli di stile con
wp_register_script
,wp_enqueue_script
,wp_register_style
ewp_enqueue_style
.Sefai queste cose,iltema dovrebbeessere abbastanza adatto aibambini.
In altreparole,se staifacendo le cosebene inprimo luogonon dovrestifarenulla di specialeper avere untema adatto aibambini.
There is already an accepted answer, however, I am going to offer a different answer. There are things you need to do to support proper child theme functionality.
First and foremost, work within the WordPress template hierarchy. I have seen themes do strange things and cook up non-standard templating structures. It isn't even necessary to use any of the WordPress theme system to display content if you really really don't want to. Resist the urge to do any of that.
Second, load files that should be replaceable with
get_template_part()
andlocate_template()
and not with PHP'sinclude
orrequire
. Files loaded withget_template_part()
andlocate_template()
part can be replaced by child themes. Files loaded byinclude
orrequire
can't.Third, use get_template_directory(), get_template_directory_uri(), get_stylesheet_directory(), and get_stylesheet_directory_uri() appropriately.
You probably also want to register and enqueue your scripts and stylesheets with
wp_register_script
,wp_enqueue_script
,wp_register_style
andwp_enqueue_style
.If you do those things the theme should be pretty pretty child-theme friendly.
Put another way, if you are doing things right in the first place you shouldn't have to do anything special to have a child-theme friendly theme.
-
Esattamente.Niente èpiùfrustrante che lavorare con untemain cui stili,scripte parti delmodellononpossonoesseremodificati da untemafiglio.Exactly. Nothing is more frustrating than working with a theme where styles, scripts and template parts can't be modified by a child theme.
- 5
- 2013-08-10
- Michael Dozark
-
@ s_ha_dum:ben spiegato!@ s_ha_dum: well sexplained!
- 0
- 2013-08-11
- Tara
-
@Valeka: dovresti contrassegnare questa risposta come accettata - cosìben spiegata da s_ha_dum.Complimenti a lui.@Valeka: You should mark this answer as Accepted - such nicely explained by s_ha_dum. Kudos to him.
- 2
- 2013-11-25
- Mayeenul Islam
-
In realtàpenso che `include`e` require` debbanoessere usatie `get_template_directory ()` dovrebbeessere lì al lorointerno,e i childthemepossonomodificarei file richiesti,(oinclusi).Puoimodificare unpo 'latua risposta.Actually I think `include` and `require` need to be used and `get_template_directory()` should be there inside of them, and child themes can modify files required, (or included). Can you please modify your answer a bit.
- 0
- 2016-05-02
- prosti
-
Non hai capito lamia risposta @prostiYou didn't understand my answer @prosti
- 0
- 2016-05-02
- s_ha_dum
-
- 2013-08-10
Dallamiaesperienza,quasituttii temi dovrebbero supportare un childtheme.Non homai dovutofarenulla di specificoper untemaprincipaleper renderlo compatibile con untemafiglio.Il codice WordPress ha unabuonapanoramica deitemi figlio. http://codex.wordpress.org/Child_Themes Spero che questoti aiuti a rispondere allatua domanda!
From my experience, nearly all themes should support a child theme. I've never had to do any thing specific to a parent theme to make it support a child theme. The WordPress Codex has a good overview of child themes. http://codex.wordpress.org/Child_Themes Hope this helps answer your question!
Una delle richieste suthemeforest è chei temi sianotenuti afornire supporto aitemi secondari.
So cosa sonoi temifiglio,anche senon ci ho lavoratomolto,ma vorrei sapere se c'è qualcosa cheilmiotema deve avereper supportare i temifiglio?