Tagged: custom font, devin-docs, font, google fonts
-
AuthorPosts
-
January 17, 2014 at 12:37 am #210948
Hi,
I tried to add new Google fonts: PT Sans Narrow and PT Sans. A both with cyrilic.
I used instruction from this topic. I added both parts of the code from this topic.
After adding the first part, I did not see the new font in the font selection in Styling.
After the second part of the code instead of admin panel opens a blank white page.
I use a network of sites. Maybe is it make a problem?January 17, 2014 at 5:54 am #211016Hi Kvanto!
Please locate this code on functions.php, you can find it at the very top:
global $avia_config;
Below, add the google font filter:
add_filter( 'avf_google_heading_font', 'avia_add_heading_font'); function avia_add_heading_font($fonts) { $fonts['PT Sans Narrow'] = 'PT Sans Narrow'; $fonts['PT Sans'] = 'PT Sans'; return $fonts; } add_filter( 'avf_google_content_font', 'avia_add_content_font'); function avia_add_content_font($fonts) { $fonts['PT Sans Narrow'] = 'PT Sans Narrow'; $fonts['PT Sans'] = 'PT Sans'; return $fonts; }
Cheers!
IsmaelJanuary 17, 2014 at 11:43 am #211163Nope. Blank white page is again.
But all is work after removing any new codes.((- This reply was modified 10 years, 11 months ago by Kvanto.
January 18, 2014 at 8:23 am #211526Hey!
I just tested this one out the other day as I was writing it up for the documentation. This is exactly what I have on my live site right now and its working:
<?php global $avia_config; add_filter( 'avf_google_heading_font', 'avia_add_heading_font'); function avia_add_heading_font($fonts) { $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700'; $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic'; return $fonts; } add_filter( 'avf_google_content_font', 'avia_add_content_font'); function avia_add_content_font($fonts) { $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic'; $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700'; return $fonts; }
The new fonts will show up at the bottom of the list. If you are getting a blank screen it means the code hasn’t been added in correctly. Even a single missing } will cause WordPress to be unable to read the file so make sure that you are editing the file in a clean text editor that doesn’t add any other markup (like notepad) and that its exactly the same as above.
Best regards,
DevinJanuary 18, 2014 at 10:04 pm #211707I added the code how you tell – http://take.ms/lzhY2
Site is work. But fonts not change in preview, when I choose my custom fonts in selects – http://take.ms/tuimr
After save this changes on site loading Open Sane font – http://take.ms/VLEBsThank for your support! I hope we will solve this problem))
- This reply was modified 10 years, 11 months ago by Kvanto.
January 18, 2014 at 10:32 pm #211730Hi!
Your code is incorrect. Remove the + sign:
add_filter( 'avf_google_heading_font', 'avia_add_heading_font'); function avia_add_heading_font($fonts) { $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700'; $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic'; return $fonts; } add_filter( 'avf_google_content_font', 'avia_add_content_font'); function avia_add_content_font($fonts) { $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic'; $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700'; return $fonts; }
Best regards,
IsmaelJanuary 18, 2014 at 10:40 pm #211737http://take.ms/OwSd8
Nothing not change. Open Sans loading again.And I need a cyrillic fonts.
- This reply was modified 10 years, 11 months ago by Kvanto.
January 18, 2014 at 11:35 pm #211760Have you selected the new font in your theme options under the styling tab? If so, can we see the site live so we can inspect the font stack and see what it isn’t getting loaded in?
January 18, 2014 at 11:45 pm #211769Yes, I have.
Please http://myrentacar.me/ru/rentacars/January 19, 2014 at 12:01 am #211786Hi!
This is the font now:
h1, h2, h3, h4, h5, h6, tr.pricing-row td, #top .portfolio-title, .callout .content-area, .avia-big-box .avia-innerbox, .av-special-font { font-family: 'PT Sans Narrow', 'HelveticaNeue', 'Helvetica Neue', Helvetica, Arial, sans-serif; }
It means that the font works. Please remove browser cache then reload the page. The font is being called on the properly:
<link id=”google_webfont_1″ rel=”stylesheet” type=”text/css” href=”http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700″>
<link id=”google_webfont_2″ rel=”stylesheet” type=”text/css” href=”http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic”>Best regards,
IsmaelJanuary 19, 2014 at 12:34 am #211815Ok, thank you. Now it is ok. But it work only for latin characters.
This fonts support cyrillic characters. How can I add this correctly?January 20, 2014 at 8:46 am #212124Hey!
You can select the subset with &subset=XXX – i.e.:
add_filter( 'avf_google_heading_font', 'avia_add_heading_font'); function avia_add_heading_font($fonts) { $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700&subset=cyrillic'; $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic&subset=cyrillic'; return $fonts; } add_filter( 'avf_google_content_font', 'avia_add_content_font'); function avia_add_content_font($fonts) { $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic&subset=cyrillic'; $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700&subset=cyrillic'; return $fonts; }
Cheers!
PeterJanuary 20, 2014 at 4:32 pm #212299Thank you very much!
-
AuthorPosts
- The topic ‘Add a new custom font’ is closed to new replies.