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,
You can go here: https://www.google.com/fonts and chose your font: http://screencast.com/t/GuRk2NUf
Thanks
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.
🙂
thank you it is working now.
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.
Thank you for your interest. I copied the code in child theme functions.php. It didnt worked. There is a white screen now.
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')
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
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.
I changed functions.php file for turkish letters (ş,ğ) problem with adding this
image
It is ok now.
I know that I have to copy funtions.php file to the child theme but there is already one in child theme folder. What will I do? replace it or copy code
Looks like it will (and tested on my site). You can remove the line with “email” because that will remove the email field as well.
Note that the functions.php you’d want to add this to would be in a child theme so the fix can survive theme updates.
@JBH
Hi, looks like setting proper folder permissions on your site really helped to start 🙂
But, looking at your example post page you have a LOT of work to do.
most of your errors have nothing to do with the theme; so you’re going to want to address all that stuff first. Possibly find better solutions for what you’re doing with some of those external systems. Basically you’re loading too many things from external sites, which will lower your scores; more than 5 external things is bad for speed.
For example – this is crazy:
This page has 29 external Javascript scripts. Try combining them into one. This page has 13 external stylesheets. Try combining them into one. This page has 7 external background images. Try combining them with CSS sprites.
Note you can’t do much about the stuff you’re loading from other sites/servers, but you should
1) remove “versioning” — implement the .htaccess (if running Apache) and functions.php suggestions which I’ve posted, especially for the remove of the version tags. If running child theme you may need to put in child version; not sure on that.
2) optimize javascript delivery; use the td speed booster plugin to help with theme resources; but it won’t help with external stuff you’re loading
3) you cant do anything about the image dimensions of the things being loaded off external websites
4) prefer async – you’d have to hack whatever plugin you’re using for Facebook to load that as async
5) optimize images – be sure what you upload is already as small as possible; also use something like smushit or similar; possibly use my functions.php code for setting smaller default compression size for WordPress built in function (e.g., change from default 90 to 6); then do regenerate thumbnails — boom everything 20% smaller!
7) consistent URL errors coming from your “leadpages” stuff
8) vary encoding errors – coming mostly from leadpages
9) redirect issues – whatever you’re doing with Facebook and Google generating errors
10) bad request with favicon
(etc.)
Hi,
this is what we do on our sites, in the functions.php file .. this overrides the default quality setting and is a WordPress function, not a hack. We have our set to “50” — for a portfolio site or photography site, you might choose “60” (it’s not a “percentage” of compression but a quality factor).
—-from my old post in the pagespeed thread–
For example, you could set the compression of images to something like 60% or even 50% in your child theme functions.php … will only change level on new images uploaded unless you use the regenerate thumbnails plugin or similar.
add_filter( 'jpeg_quality', create_function( '', 'return 50;' ) );
NOTE: Download your existing image files via FTP for safety backup, before you apply this with “regenerate thumbnails” as it will overwrite old files with the lower quality optimized images.
livingsmarttv,
Yes it is possible to not crop and only scale images. It gets a bit tricky with this theme though because it is set to crop every image(except the featured.)
In the functions.php file, you will find somewhere around line 320:
//featured image
$td_crop_features_image = td_util::get_option('tds_' . 'crop_features_image');
if ($td_crop_features_image == '') {
add_image_size('featured-image', 700, 0, true);
} else {
add_image_size('featured-image', 700, 357, true);
}
//the small thumbnails
set_post_thumbnail_size( 100, 65, true );
add_image_size('art-thumb', 100, 65, true);
//small height, 1 col wide
add_image_size('art-wide', 326, 159, true);
//medium height 1 col wide
add_image_size('art-big-1col', 326, 235, true);
//the slides
add_image_size('art-slide-small', 326, 406, true);
add_image_size('art-slide-med', 700, 357, true);
add_image_size('art-slide-big', 1074, 483, true);
//big slider - big image
add_image_size('art-slidebig-main', 745, 483, true);
//the gallery
add_image_size('art-gal', 210, 210, true);
Notice that TagDiv has built in the ability to turn cropping on or off on the featured image based on a setting in the theme panel, but you are asking for all of them.
add_image_size('featured-image', 700, 0, true);
In the line above, it is the ‘0’ argument that tells wordpress to adjust the height based on the aspect ratio of the image after it is scaled. To analyze the code a little more, what is happening with the ‘featured-image’ image size is that if them theme is not set to crop option then the ‘featured-image’ will be scaled to 700px wide and left to be however tall the image is. If you select the crop option, it will be scaled to 700px wide and then cropped to 357px tall.
You would need to look at which block(s) you are using and then determine which module the block is using to tell what image size it is. For example, let’s say your block uses td_module_2.php.
In that file, line 13 reads: <?php echo $this->get_image('art-big-1col'); ?>
If we look above at the functions.php entry, we see: add_image_size('art-big-1col', 326, 235, true); This means that if you upload a 1280×720 image, this will resize it’s width and crop it’s height to 235 pixels. If the scaled down image height is less than 235px tall, then it will scale the height to 235px and crop the width to 326px. This is not what you want. Rather, perhaps something like this: add_image_size('art-big-1col', 326, 0, false); This will take the image and scale to 326px wide and let the height be what it will be.
If you want make these changes so that updates to the theme will not break it, then you need to copy the image size declarations out of the theme’s functions.php file and put them in your child theme’s functions.php file and change the options. You might try something like this:
//featured image
$td_crop_features_image = td_util::get_option('tds_' . 'crop_features_image');
if ($td_crop_features_image == '') {
add_image_size('featured-image', 700, 0, false);
} else {
add_image_size('featured-image', 700, 357, false
}
//the small thumbnails
set_post_thumbnail_size( 100, 0, false );
add_image_size('art-thumb', 100, 0, false);
//small height, 1 col wide
add_image_size('art-wide', 326, 0, false);
//medium height 1 col wide
add_image_size('art-big-1col', 326, 0, false);
//the slides
add_image_size('art-slide-small', 326, 0, false);
add_image_size('art-slide-med', 700, 0, false);
add_image_size('art-slide-big', 1074, 0, false);
//big slider - big image
add_image_size('art-slidebig-main', 745, 0, false);
//the gallery
add_image_size('art-gal', 210, 0, false);
By setting all the height arguments to 0, we tell WordPress to always use the full height of an image relative to the horizontal scaling and by changing ‘true’ to ‘false’ we enable ‘soft crop mode’ vs ‘hard crop mode.’ Soft crop mode ensures your images will maintain their aspect and not have any cropping. Note, the 0 setting will make it so that any image uploaded that is not 16×9 aspect will be scaled and output at it’s own aspect ratio. This can break styling, but if you only upload 16×9 images it will be fine.
You would need to either re-build your current thumbnails or upload some new images to see if this fixes your problem(or creates others)
There are lots of gotchas here, and I certainly didn’t give you a definitive answer, but perhaps what I did say will help you figure out what combination of options will solve your problem.
Good luck!
Hi Marius,
Another weird thing going on. I just got this message after I tried to delete a theme:
Warning: include(/home/atelier/public_html/demo/wp-content/themes/Newspaper/includes/td_wordpres_booster.php): failed to open stream: No such file or directory in /home/atelier/public_html/demo/wp-content/themes/DEMO Finland/functions.php on line 9
Warning: include(): Failed opening ‘/home/atelier/public_html/demo/wp-content/themes/Newspaper/includes/td_wordpres_booster.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/atelier/public_html/demo/wp-content/themes/DEMO Finland/functions.php on line 9
The child theme apparently broke and default theme activated? I have now commented out line 9 so hoping this won’t cause issues?
Look forward to hearing from you,
Hash
I don’t want other thumbnail. i want to stop extra image sizes that are saved in our wp-contact folder. i only want when we upload image then only single size 326×159 generate not more extra.
When we update main theme functions.php file then works fine but not in child theme functions.
-
This reply was modified 12 years by
Abhay Pratap.
Copy all thumb generation sizes from the functions.php file into the child-themes functions.php file and set each one to the size you want. If you want only 326×159 images then set all to that size and regenerate all thumbs. But only copy the code you are changing to the child-theme, not the whole file.
Hello Sir,
I want only 326×159 image size, i have deleted all the thumb generation sizes in functions.php but how we can use in child functions.
Can you please give me child theme functions update file to stop other image sizes.
Hello Sir,
I am using child theme because we edited many files. I want to prevent some automatic generated thumbnail, so edited functions.php file and when pasted edited code into child theme functions then site is not working.
So how we can use child functions.php file.
My question is, do I make changes in the functions.php in the child theme or in the main theme? when I add
//featured image
$td_crop_features_image = td_util::get_option('tds_' . 'crop_features_image');
if ($td_crop_features_image == '') {
add_image_size('featured-image', 320, 0, true);
} else {
add_image_size('featured-image', 320, 180, true);
}
in the child theme nothing happend
Thank you for helping
Hi,
I had given up for a while, now with V3 it looks great, im exited.
What should I do now to get the result we achieved above?
In the functions.php of the theme I found:
<?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';
}
I am confused, thank you for your help.
Adding this code in functions.php:
add_filter( ‘author_link’, ‘my_multi_author_link’, 10, 2 );
function my_multi_author_link( $url, $user_id ) {
if ( 1 == $user_id ) {
return home_url( ‘flaten’ );
}
return $url;
}
…messes everything up and gives med the following warning/fatal error:
( ! ) Warning: require_once(includes/td_wordpres_booster.php): failed to open stream: No such file or directory in /Users/areflaten/Documents/Websites/www.amerikanskpolitikk.dev/wp-content/themes/Newspaper-child/functions.php on line 16
( ! ) Fatal error: require_once(): Failed opening required ‘includes/td_wordpres_booster.php’ (include_path=’.:/Applications/XAMPP/xamppfiles/lib/php’) in /Users/areflaten/Documents/Websites/www.amerikanskpolitikk.dev/wp-content/themes/Newspaper-child/functions.php on line 16
zokolus
look at the standard sizes found in the theme docs, here:
https://forum.tagdiv.com/modules-and-blocks/
I think we did
sm = 100×65
md = 326×159
lg = 700×357
NOTE: I highly recommend adding a custom compression amount to photos for WP as I’ve found that some of the pix created by theme with default WP compression level are waaaay to big.
For example on our site which is not yet optimized,
original article image 700×406 I uploaded is 31.14kb
http://publishersnewswire.com/META/PNW-Feb14-loudest.jpg
the theme/and WP created a 700×357 version, 63kb (!).
The hack to add the compression amount down to something like “50” is someplace in my prior posts. Recommended!!!
—updated——–
the code:
add the following code to your functions.php file in the theme root at the end –or– in your child theme (TIP: stop using a child theme)
add_filter( ‘jpeg_quality’, create_function( ”, ‘return 50;’ ) );
– then run the regenerate thumbnails plugin under wp admin > tools
EDIT (( AND REMEMBER TO BACKUP YOUR ORIGINAL PIX FIRST – !! ))
And one more FYI:
ga-ga is our test/optimization site
PNW is our “stock” site being used for comparison
(I have been called to other projects the past month and not working on either … hence why I was not around here for couple of weeks … and I will disappear again next week… sigh….deadlines!)