Background pattern possible?

February 2013 WordPress Theme
GK User
Sat Feb 16, 2013 5:37 pm
Hi, I don't see any options to change something to the background; no color, no pattern.
Is this possible and what then is the best way to do it, custom CSS?
User avatar
Junior Boarder

GK User
Sat Feb 16, 2013 5:43 pm
Hi,

Currently the best solution is using the custom CSS code in the override.css file from advanced settings.
User avatar
Administrator

GK User
Sun Feb 17, 2013 9:42 am
Hi Tomasz, I'm back on this one too. I was testing with the CSS element below, but as I'm brought up with good Wordpress manners I use a child theme style.css. But, this does not work. When I use override.css it works. But (what's in a word) when I will update the theme these settings will be overriden :D and that's not what I prefer.

My point is: I think I should add custom CSS in the child theme AND it should work. Don't you agree?
Code: Select all
body {
   background: #bbb;
   color: #555;
   font-size: 16px;
   font-weight: 400;
   line-height: 170%;
   margin: 0 0 0 52px;
   min-height: 100%;
   padding: 0;
   word-wrap: break-word;
}

Regards, Sjef
User avatar
Junior Boarder

GK User
Sun Feb 17, 2013 12:04 pm
In fact you can add the CSS code in the child theme style.css file. I've planned to add full child themes support in version 1.7 but after your questions I've decided to put it in the version 1.6 which will be released in the next week. The changes in the template code are visible in this commit: https://github.com/GavickPro/Meet-Gaver ... 19a7484f8e

In general in your case you should only add this code in the functions.php file:

Code: Select all
if(!function_exists('gavern_file')) {
   /**
    *
    * Function used to get the file absolute path - useful when child theme is used
    *
    * @return file absolute path (in the original theme or in the child theme if file exists)
    *
    **/
   function gavern_file($path) {
      if(is_child_theme()) {
         if($path == false) {
            return get_stylesheet_directory();
         } else {
            if(is_file(get_stylesheet_directory() . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path))) {
               return get_stylesheet_directory() . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path);
            } else {
               return get_template_directory() . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path);
            }
         }
      } else {
         if($path == false) {
            return get_template_directory();
         } else {
            return get_template_directory() . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path);
         }
      }
   }
}

if(!function_exists('gavern_file_uri')) {
   /**
    *
    * Function used to get the file URI - useful when child theme is used
    *
    * @return file URI (in the original theme or in the child theme if file exists)
    *
    **/
   function gavern_file_uri($path) {
      if(is_child_theme()) {
         if($path == false) {
            return get_stylesheet_directory_uri();
         } else {
            if(is_file(get_stylesheet_directory() . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $path))) {
               return get_stylesheet_directory_uri() . '/' . $path;
            } else {
               return get_template_directory_uri() . '/' . $path;
            }
         }
      } else {
         if($path == false) {
            return get_template_directory_uri();
         } else {
            return get_template_directory_uri() . '/' . $path;
         }
      }
   }
}


and then change in the layouts/header.php file fragments like this:
Code: Select all
 <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/normalize.css" />


to:
Code: Select all
 <link rel="stylesheet" href="<?php echo gavern_file_uri('css/normalize.css'); ?>" />


then you will be able to override main theme files in the child theme.
User avatar
Administrator

GK User
Sun Feb 17, 2013 1:47 pm
Hi Tomasz, I think I followed the steps: 1) add the function to functions.php 2) replaced 12 lines in layouts/header.php. But with me it still doesn't work. On the other hand I'm not that much in a hurry (just playing with the theme) and can wait for a new release. So don't feel a need to work now in the weekend on this.
User avatar
Junior Boarder

GK User
Sun Feb 17, 2013 5:33 pm
BTW - did you tried to edit the style.css file in the child theme? it should helps :)
User avatar
Administrator

GK User
Sun Feb 17, 2013 5:59 pm
I just did, but still no succes.
User avatar
Junior Boarder

GK User
Sun Feb 17, 2013 6:05 pm
Are you using child theme from the quickstart package? Or your own one? Please check if your style.css file contains following code:

Code: Select all
/*
Theme Name:     Magazine Child
Theme URI:      http://www.gavick.com
Description:    Child theme for the Magazine theme
Author:         GavickPro
Author URI:     http://www.gavick.com
Template:       Magazine
Version:        1.0.0
*/
User avatar
Administrator

GK User
Sun Feb 17, 2013 6:21 pm
I indeed installed the quickstart package and apart from my body-element it's exactly this what's in it.
User avatar
Junior Boarder

GK User
Sun Feb 17, 2013 6:42 pm
Sorry, I've forgot about one detail - the style.css file isn't loaded directly in the theme - it is used only due the WordPress requirements. So in this case the best way will be waiting for the update in the next week where we'll implement the extended support for the Child Themes :)
User avatar
Administrator

GK User
Sun Feb 17, 2013 7:21 pm
No problem, I wait and try it again after the update.

Must say I just read your readme.txt file and saw that you explained things there. Since the child theme came with the quickstart I assumed it worked the same as with other theme's I use, but that was not the case. Probably those are these peculiar things that come with making a step from Joomla to Wordpress. I myself don't know anything from Joomla, but see in reading posts here on the forum that the typical Joomla user probably is a lot more technical than the typical Wordpress user.
User avatar
Junior Boarder


cron