Correct Set-up for Childtheme

Multipurpose WordPress Theme Forum Support
GK User
Sat Aug 15, 2015 4:32 pm
Hello!

I have been trying to set up a child-theme in the correct way, as I have custom fonts I need to install (myfonts webkit).

However, it seems to break my theme and there is no documentation available on the site.

So far I have been doing this:
Quark-Child Folder
– functions.php
– style.php
– header.php (this is the place where I have to add in the custom code for fonts)


Functions.php looks like this:
Code: Select all
<?php

/* Hier kommen die functions für mein Child-Theme */

function Quark_child_styles() {
wp_deregister_style( 'quark-style');
wp_register_style('quark-style', get_template_directory_uri(). '/style.css');
wp_enqueue_style('quark-style', get_template_directory_uri(). '/style.css');
wp_enqueue_style( 'quark-child-style', get_stylesheet_directory_uri().'/style.css', array('quark-style') );
}
add_action( 'wp_enqueue_scripts', 'quark_child_styles' );


And here is the css
Code: Select all
/*
Theme Name: Quark-Child
Description: Quark-Child
Author: Dirgis
Template: Quark
*/


I assume I have to copy more files from the parent for it to work. Which ones would this concern?
User avatar
Senior Boarder

GK User
Sun Aug 16, 2015 10:42 pm
Hello,

Are you using the quickstart package with default Quark style? or another like restaurant?
It's enought to import parent style.css file in your child theme css:
Code: Select all
/* Load the CSS code from a base Quark theme */
@import url('../Quark/style.css');


and it should works (without the code from your child's functions.php. Could you send me a PM with backend and FTP access? Then I'll be able to check the issue.
User avatar
Moderator

GK User
Fri Aug 21, 2015 10:56 am
I aslo want to add some custom styles + maybe some other changes, so wanted to add my own child theme:

Tried the same with the WordPress standaard way: but i get a blank homepage (=static frontpage).
And its NOT ENOUGH "to import parent style.css file in your child theme css"

Did some testing, and had a look at the restaurant child theme + also /Quark/css/override.css
1) override.css works for me for custom overrides, but the file will be deleted if you do a theme update?
+ its not the right way in WordPress to do customazation
2) To get my Child theme (Quark-Child) homepage working, i had to add the /Quark-Child/js/functions.js file from the Child theme 'Quark-Restaurant-Child' to get it working
= also not right, because it should make use of the functions.js from the 'base' theme /Quark/js/functions.js

So can you gave me a fix so that, so adding a Child theme is working easy + alright + the WordPress Way??!!
And make this public in your documentation?

This most be a basic feature of every WordPress theme builder... So i've this is not working smoothly I start to question the Gavick themes!

gr,
Ronald
User avatar
Fresh Boarder

GK User
Sun Aug 23, 2015 12:46 pm
Hi Ronald,

I tried your suggestions and basically that broke my whole back-end. I had to delete the child-theme on my FTP to get the default theme back.

We would be both grateful, for an accurate documentation of how to set this up correctly.

Previous gavick themes worked perfectly fine with child-themes, so maybe this has to do with their own wordpress theme customizer, etc.?

Thanks Piotri for trying to look into this! I have sent you the details via PM and I hope to hear from you soon, as I should be making progress on this project.

Once solved, this should be shared with the forum.
User avatar
Senior Boarder

GK User
Mon Aug 24, 2015 8:59 am
Hello,

Thank you for your feedback.

I've checked the issue and found the reason, please replace this fragment from Quark/functions.php file
Code: Select all
// Loads JavaScript file with functionality specific to Quark.
   wp_enqueue_script( 'quark-script', get_stylesheet_directory_uri() . '/js/functions.js', array( 'jquery' ), '', true );

into:
Code: Select all
   if(file_exists(get_stylesheet_directory_uri() . '/js/functions.js') ) {
      wp_enqueue_script( 'quark-script', get_stylesheet_directory_uri() . '/js/functions.js', array( 'jquery' ), '', true );
   } else {
      wp_enqueue_script( 'quark-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '', true );
   }

It's from quark_scripts function.

After this modification, it's enough to import parent style.css file, but there's one important issue - everything works properly if you are using Quark default style, if you are using restaurant or ecommerce style (you have to use theme files from the quickstart package), becuase restaurant and ecoommerce are already child themes for the default Quark style, so it's enough to use basic theme from the quicsktart and then create a child theme.

Regarding the override.css file - if you want to edit only css, there is better solution for that:
https://www.gavick.com/blog/adding-cust ... ress-theme
User avatar
Moderator

GK User
Tue Aug 25, 2015 5:44 pm
Hola,

Sorry Dirgis that my solution is not working for you, although it was just a 'work around' for the time being for me...

Tried Piotr solution and that works for me! So my Child theme looks like this:

1) Folder /Quark-Child/ with:
style.css which looks like this:

/*
Theme Name: Quark Child theme
Theme URI: http://www.gavick.com
Description: Custom style for the Quark theme
Author: GavickPro
Author URI: http://www.gavick.com
Template: Quark
Version: 1.0
*/

/* Load the CSS code from a base Quark theme */
@import url('../Quark/style.css');

2) + I edit functions.php in Folder /Quark/ (line 148)

// Loads JavaScript file with functionality specific to Quark.
wp_enqueue_script( 'quark-script', get_stylesheet_directory_uri() . '/js/functions.js', array( 'jquery' ), '', true );

into:

if(file_exists(get_stylesheet_directory_uri() . '/js/functions.js') ) {
wp_enqueue_script( 'quark-script', get_stylesheet_directory_uri() . '/js/functions.js', array( 'jquery' ), '', true );
} else {
wp_enqueue_script( 'quark-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '', true );
}

Questions/remarks:

a) Piotr: is yr functions.php solution in the next update of the Quark theme?
b) About the override.css file: Had a look at: https://www.gavick.com/blog/adding-cust ... ress-theme
This article only tells you how to change the override.css and doesn't answer my previous question:
- If there is an update of the theme Quark, will the override.css be overwitten/deleted?
c) Remark: see also my previous post: you stated in case of the override.css "if you want to edit only css, there is better solution for that".
But I think, the best and the default WordPress solution = to make a style.css in your Child Theme, even if you want to edit only the css!! To make a override.css = more the Joomla method!
d) the Gavick documentation is sometimes 'vague' and not complete. For example making a child theme took me me, if using other themes, no more then 5 minutes to find out/get it working...
User avatar
Fresh Boarder

GK User
Tue Aug 25, 2015 10:18 pm
Hi @joommix,

Thank you for confirmation.
Regarding your questions:
a) Yes, it will be added to the next update of the Quark theme
b,c) There's no automatic updates, so you decide which files you want to update, but if you'll update the entire theme directory, of course also override.css file will be overwritten, so you have to backup the file and restore it after update. Of course you can also use 3rd party custom css plugin, to keep your css separated or use a Child theme style.css. We are using override.css file, because many users of our products are accustomed to this solution.
d) We are still improving our documenation, if you'll find any specific issue, please let us know and we'll try to fix it.
User avatar
Moderator

GK User
Thu Aug 27, 2015 12:21 pm
Thanks Pjotr for your reply.
- About your remark ''There's no automatic updates'' :
Do you mean that you cant update the theme in the WordPress wp-admin?
User avatar
Fresh Boarder

GK User
Thu Aug 27, 2015 11:10 pm
Yes - it's not possible through the dashboard, please check this article:
https://www.gavick.com/documentation/wo ... me-upgrade
User avatar
Moderator

GK User
Wed Oct 07, 2015 12:32 pm
Piotr Kunicki wrote:
Code: Select all
   if(file_exists(get_stylesheet_directory_uri() . '/js/functions.js') ) {
      wp_enqueue_script( 'quark-script', get_stylesheet_directory_uri() . '/js/functions.js', array( 'jquery' ), '', true );
   } else {
      wp_enqueue_script( 'quark-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '', true );
   }

Works for me, thanks!
User avatar
Junior Boarder

GK User
Thu Oct 22, 2015 7:41 pm
Got another problem with Childtheme:
1) wanted to adjust the footer
- So add the footer.php in my child theme: works fine

2) But for the homepage i noticed your using footer-frontpage.php
a) so added footer-frontpage.php to my child theme
- doesn't work
- noticed that the footer-frontpage.php in the 'parent theme' Quark still works

Do you have an solution for this?

Thanks,
Ronald
User avatar
Fresh Boarder

GK User
Fri Oct 23, 2015 8:39 am
Hi,

If your footer.php file is taken from the child directory, footer-frontpage.php should be also fine.
Could you send me a private message with your website backend and FTP access? Then I'll be able to check the issue.
User avatar
Moderator

GK User
Mon Oct 26, 2015 8:09 pm
Hola Piotr,
I just tested my website again, and now its working!
I dont know; maybe its a cache problem or something..

thanks anayway

gr,
Ronald
User avatar
Fresh Boarder

GK User
Tue Oct 27, 2015 4:00 pm
I could not do the installation of the theme, Help me please.

Installing Theme from uploaded file: gk_quark (1).zip
Unpacking the package…
Installing the theme…
The package could not be installed. The theme is missing the style.css stylesheet.
Theme install failed.

[img]Screen Shot 2015-10-27 at 7.46.46 AM/img]
User avatar
Fresh Boarder

GK User
Tue Oct 27, 2015 7:51 pm
Hi,

Please unzip the package first, because it contains also child themes (restaurant and ecommerce styles).
Then you can zip the Quark directory again and install in your WordPress backend.

Next time, please create new thread if the question is not connected with the subject.
User avatar
Moderator


cron