You would copy just the code you need. Doubling the whole functions.php in parent and child themes tends to generate errors and give you a white screen of death.
But sadly it’s not quite that simple. The line you added is part of another function in the parent: td_load_css. To alter it, copy the whole function you’ve edited into your child theme’s functions.php. You’ll know it’s the end because you’ll see this line:
add_action('wp_enqueue_scripts', 'td_load_css');
Don’t include that.
Now rename your new copy like this:
function my_td_load_css {
...
Then you need to unhook the original function and hook your new one in by adding these lines after the function:
remove_action('wp_enqueue_scripts', 'td_load_css');
add_action('wp_enqueue_scripts', 'my_td_load_css')
Let me know if it doesn’t work!
-
This reply was modified 11 years by
TheMediumUTM.
Thank you for your kind answer. I know html and css. I dont know how php works. Can you help me in more details. This is my child theme functions code
<?php
/* ----------------------------------------------------------------------------
WordPress booster framework - this is our theme framework - all the content and settings are there
It is not necessary to include it in the child theme only if you want to use the API
*/
if (!defined('TD_THEME_WP_BOOSTER')) {
include TEMPLATEPATH . '/includes/td_wordpres_booster.php';
}
Can you please tell me how it should be?
Regards
Here it is and here’s how I got it:
1. Copied and pasted your child theme functions code
2. Copied and pasted the function td_load_css from the parent theme’s functions code
3. Changed the name from td_load_css to my_td_load_css
4. Changed the line you mentioned to include ‘&subset=latin,latin-ext’
5. Copied the two extra lines I mentioned in my first post and pasted them at the very end
See if this works:
/* ----------------------------------------------------------------------------
WordPress booster framework - this is our theme framework - all the content and settings are there
It is not necessary to include it in the child theme only if you want to use the API
*/
if (!defined('TD_THEME_WP_BOOSTER')) {
include TEMPLATEPATH . '/includes/td_wordpres_booster.php';
}
function my_td_load_css() {
//google fonts
if ((defined('TD_DEPLOY_MODE') and (TD_DEPLOY_MODE == 'demo' /*or TD_DEPLOY_MODE == 'dev' */)) or defined('TD_SPEED_BOOSTER')) { //on demo and dev we load only the latin fonts
//modify this collection if you want to optimize the fonts loaded
//collection url -> : http://www.google.com/fonts#ReviewPlace:refine/Collection:PT+Sans:400,700,400italic|Ubuntu:400,400italic|Open+Sans:400italic,400|Oswald:400,700|Roboto+Condensed:400italic,700italic,400,700
wp_enqueue_style('google-font-rest', td_global::$http_or_https . '://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic|Ubuntu:400,400italic|Open+Sans:400italic,400|Oswald:400,700|Roboto+Condensed:400italic,700italic,400,700&subset=latin,latin-ext'); //used on menus/small text
// Above line has been modified in child theme to include '&subset=latin,latin-ext'
} else {
$td_user_fonts_list = array();
$td_user_fonts_db = td_util::get_option('td_fonts');
if(!empty($td_user_fonts_db)) {
foreach($td_user_fonts_db as $td_font_setting_key => $td_font_setting_val) {
if(!empty($td_font_setting_val) and !empty($td_font_setting_val['font_family'])) {
$td_user_fonts_list[] = $td_font_setting_val['font_family'];
}
}
}
if(!in_array('g_438', $td_user_fonts_list)) {//'g_438', //Open Sans
wp_enqueue_style('google-font-opensans', td_global::$http_or_https . '://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&subset=latin,cyrillic-ext,greek-ext,greek,vietnamese,latin-ext,cyrillic'); //used on menus/small text
}
if(!in_array('g_617', $td_user_fonts_list)) {//'g_617', //Ubuntu
wp_enqueue_style('google-font-ubuntu', td_global::$http_or_https . '://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,300italic,400italic,500italic,700italic&subset=latin,cyrillic-ext,greek-ext,greek,latin-ext,cyrillic'); //used on content
}
if(!in_array('g_453', $td_user_fonts_list)) {//'g_453', //PT Sans
wp_enqueue_style('google-font-pt-sans', td_global::$http_or_https . '://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic&subset=latin,cyrillic-ext,latin-ext,cyrillic'); //used on content
}
if(!in_array('g_445', $td_user_fonts_list)) {//'g_445', //Oswald
wp_enqueue_style('google-font-oswald', td_global::$http_or_https . '://fonts.googleapis.com/css?family=Oswald:400,300,700&subset=latin,latin-ext'); //used on content
}
if(!in_array('g_521', $td_user_fonts_list)) {//'g_521', //Roboto
wp_enqueue_style('google-roboto-cond', td_global::$http_or_https . '://fonts.googleapis.com/css?family=Roboto+Condensed:300italic,400italic,700italic,400,300,700&subset=latin,cyrillic-ext,greek-ext,greek,vietnamese,latin-ext,cyrillic'); //used on content
}
if(!in_array('g_639', $td_user_fonts_list)) {//'g_639', //Vollkorn
wp_enqueue_style('google-vollkorn', td_global::$http_or_https . '://fonts.googleapis.com/css?family=Vollkorn:400italic,700italic,400,700'); //used on quoates classic
}
}
//add the google style link for fonts used by user
$td_fonts_css_files = td_util::get_option('td_fonts_css_files');
if(!empty($td_fonts_css_files)) {
wp_enqueue_style('google-fonts-style', td_global::$http_or_https . $td_fonts_css_files);
}
//bootstrap - custom built - it was generated via compilation of /external/bootstrap-master/less/bootstrap.less
$responsive = td_util::get_option('tds_responsive');
switch ($responsive) {
case '980_responsive':
wp_enqueue_style('td-bootstrap', get_template_directory_uri() . '/includes/wp_booster/external/bootstrap/td-bootstrap-980-responsive.css', '', TD_THEME_VERSION, 'all' );
break;
case '980':
wp_enqueue_style('td-bootstrap', get_template_directory_uri() . '/includes/wp_booster/external/bootstrap/td-bootstrap-980-not-resp.css', '', TD_THEME_VERSION, 'all' );
break;
case '1170':
wp_enqueue_style('td-bootstrap', get_template_directory_uri() . '/includes/wp_booster/external/bootstrap/td-bootstrap-1170-not-resp.css', '', TD_THEME_VERSION, 'all' );
break;
default:
wp_enqueue_style('td-bootstrap', get_template_directory_uri() . '/includes/wp_booster/external/bootstrap/td-bootstrap.css', '', TD_THEME_VERSION, 'all' );
break;
}
//main theme style - set the TD_DEBUG_USE_LESS flag in /includes/app/td_config.php and the theme will load the less files and compile them for you
if (TD_DEBUG_USE_LESS) {
wp_enqueue_style('td-theme', get_template_directory_uri() . '/td_less_style.css.php', array('td-bootstrap'), TD_THEME_VERSION, 'all' );
//wp_enqueue_style('td-theme', get_template_directory_uri() . '/style.less', array('td-bootstrap'), TD_THEME_VERSION, 'all' );
} else {
wp_enqueue_style('td-theme', get_stylesheet_uri(), array('td-bootstrap'), TD_THEME_VERSION, 'all' );
}
}
remove_action('wp_enqueue_scripts', 'td_load_css');
add_action('wp_enqueue_scripts', 'my_td_load_css')
My apologies, I forgot to copy the <?php tag at the very start of the file and to add a semicolon at the end of the last line. Try it with that.
hi again,
which fonts are ok for turkish letters? “ışğçöü” I dont want them affect pagespeed. just the recommended ones.
I use default font for all contents and parts but some of them looks bad.
Hi,
You can go here: https://www.google.com/fonts and chose your font: http://screencast.com/t/GuRk2NUf
Thanks
This is google “open sans 18px”.
http://prntscr.com/4iwy4y
This is how it looks when I choose “open sans 18px” from the widgets title fonts.
http://prntscr.com/4iwykr
What do I need to do for a clean turkish website?
Thanks
Hi,
Should work, make sure you have done this right, I have checked this on your site and worked fine: http://screencast.com/t/V7N6kBvv
Thanks
Thanks Lucian,
It didnt worked. I only want to change block title font not all parts. So add only this to custom css:
.block-title span {
font-family: "Roboto Condensed" !important;
}
Would you please check? http://www.konsantrepo.com/
Apart from this, when I open the website, I first see the blue title block which is default, then it becomes grey which is my choice.
If I modify something on theme panel, do I need to write a custom css for every single change?
Regards,
Hi,
I just checked your site and seems to me it’s working fine using both fonts Roboto/Open sans: http://screencast.com/t/dylrBRszw I have enlarged the block title font here so you can see that if you use this font the turkish characters look fine also.
Use the css like this if you want to change the block titles: http://screencast.com/t/BPwIBCHr2z
.column_container .block-title span {
font-family: "Open Sans" !important;
line-height: 28px;
}
Regarding the blue default color loading first, please re-install the speedbooster plugin and also update the theme to the latest version 4.2.2. Before this please make sure you make a backup of your current theme files so you can revert if something goes wrong.
If that dose not help, try this solution: https://forum.tagdiv.com/topic/about-default-theme-colors/#post-17657
Hope this helps!
Thanks
I got confused.
1) Open sans works fine but ubuntu,roboto etc. do not. They look different.
Roboto: http://prntscr.com/4jbd9r
Ubuntu:http://prntscr.com/4jbdp8
Roboto and Ubuntu(google fonts page): http://prntscr.com/4jbfff
2) Blue default color loading first is not fixed. I re-installed the plugin and update again the theme. nothing changed. Last solution does not make any meaning because problem is not only blue color. Default template loads first. all fonts and colors change.
3) All I need is a website with latin extended fonts. I want to change widget, menu, h1, h2, title. etc.. fonts and colors using theme panel.
All these fonts and colors supposed to be changed by theme panel. But, in this situation, theme panel has no fuction.
or
(Theme Panel > Custom Typography) never works. I have to change everything manually with css. Is this right?
It has been just two weeks, that I bought the theme. I can start all over if there will be no problems like these.
What do you recommend?
Hi,
1. Looks fine to me, this is “Ubuntu” on your page: http://screencast.com/t/tyYTqVEex and look’s to me like it dose on google fonts page: http://screencast.com/t/BsD9l6Xvi the point is that the fonts do change, please use the one that looks fine, from I have noticed the one that you are using now looks fine and supports the turkish characters.
2. This usually happens because of the speed booster plugin which move the css and js at the bottom of the page structure so that the page will load faster, this is why the theme blue color appears first then changes, because of the cascading property of css, the same regarding fonts.
What you can do is to use the method I suggested before and change the color and the fonts directly into the css style-sheet which will make your colors and your fonts to load first and stay that way. You could also deactivate the plugin if you don’t need it.
3. Regarding the theme panel’s custom typography I have made some tests with it to check if it’s working well and noticed that works just fine for widgets title:
This is what I have chosen: http://screencast.com/t/M9V7tFarfe
This is the result: http://screencast.com/t/suckL0bGpf
This only changes the widgets title, not the block title, for that you will need custom css.
For the menu items also works: http://screencast.com/t/Qr3UD6bMeo
Try to change it yourself like this, I’m not sure why it dose not work for you, it may be due to some plugins or the speed booster plugin which overwrites the settings from theme panel, try this without any plugin activated and check if works.
Like I said before the best solution would be to replace the fonts and color as you like and need into the style.css file, this will solve both issues if you want to use the speed booster plugin or try to see if this works without the plugin.
Sorry for the delay, hope this helps!
Thanks
