zapeo s developerom koji je dobio preko 100k$ preko theme forest a nezna napravit child temu, a neznam ni ja. Čitam codex, pa samo da mi netko potvrdi. napravit novi folder s imenom blabla i unutra staviti functions.php i style.css koji moram editirati tj staviti ime te child teme?
idem ja naci jubito tut, ako uopče postoji ovo je za izludit
Prije svega moras kreirati novi direktoriji koji treba da ima sljedecu strukturu:
themeslug-child
themeslug - je slug teme, koji se provlaci kroz razne funckije unutar odredjenih fajlova.Konkretno pronadjes naziv direktorija od original teme i to ti je taj slug.
Nakon toga, potrebno je da imas 2 fajla, a to su style.css
i functions.php
koje ces smjestiti unutar child direktorija
Unutar style.css
fajla moras imat odredjene parametre na pocetku css fajla:
Sa Codex-a (Popuni sa svojim podacima):
/*
Theme Name: Twenty Fifteen Child
Theme URI: http://example.com/twenty-fifteen-child/
Description: Twenty Fifteen Child Theme
Author: John Doe
Author URI: http://example.com
Template: twentyfifteen
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-fifteen-child
*/
Zatim otvoris functions.php
fajl unutar child direktorija i zalijepis ovo:
function theme_enqueue_styles() {
$parent_style = 'parent-style';
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 )
);
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
Napomena: Provjeri da li su putanje uredu do parent fajlova.
I sada tema ima osnovu za editvanje.Ono sto je bitno jeste da raspored direktorija unutar child teme mora biti identican onome iz parent teme.Konkretno:
Reci cemo da imas fajl twitter-widget.php
koji se nalazi unutar sljedecih direktorija /inc/widgets/twitter-widget.php.
Da bi vrsio izmjene unutar tog widget fajla u child temi moras kreirati iste te direktorije i fajl unutar child teme.Znaci kreiras inc folder, zatim unutar njega widgets folder i na kraju kopiras twitter-widget.php tu i vrsis izmjene na njemu.
Nadam se da je jasno.