Jump to content
Sign in to follow this  
ruthtoledoaltschuler

Using Google API fonts

Recommended Posts

ruthtoledoaltschuler

Hello, and thank you for all the useful input, I am trying to use a Google API font for all titles on this site, one that is not in the Typography Menu. I have followed the instructions by clicking the advanced button and adding this code, provided by Google, into the Additional Selectors box: http://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'> This changes my titles to a regular serif font that I have not even selected. What is it I need to do to get it right? Thank you for all your help, always! Ruth

Share this post


Link to post
Share on other sites
Simon

Ruth, do you have platformbase installed? Reason I ask is there is an example in functions.php to add more fonts so they are available to you in typography.

Share this post


Link to post
Share on other sites
ruthtoledoaltschuler

Yes, I do have Platform Base installed and I will check the link you sent. Will get back to you on that in a moment. Thank you!

Share this post


Link to post
Share on other sites
ruthtoledoaltschuler

It will be awesome to have it in the Typography choices menu. So here is the code I found in the functions PHP file, and I understand I need to change the font name for the one I want. Now I will need precise instructions on which file I should paste this, so I do not mess up with anything important: add_filter ( 'pagelines_foundry', 'my_google_font' ); function my_google_font( $thefoundry ) { $myfont = array( 'Architects Daughter' => array( 'name' => 'Architects Daughter', 'family' => '"Architects Daughter", arial, serif', 'web_safe' => true, 'google' => true, 'monospace' => false ) ); return array_merge( $thefoundry, $myfont ); } Thank you for the support!

Share this post


Link to post
Share on other sites
Simon

Almost,

	add_filter ( 'pagelines_foundry', 'my_google_font' );
	function my_google_font( $thefoundry ) {
		$myfont = array( 'A_D' => array(
				'name' => 'Architects Daughter',
				'family' => '"Architects Daughter", arial, serif',
				'web_safe' => true,
				'google' => true,
				'monospace' => false
				)
			);
		return array_merge( $thefoundry, $myfont );
	}
	

Share this post


Link to post
Share on other sites
ruthtoledoaltschuler

And I should copy it into the functions.php file? Thank you again!! This is a great support forum and I am a super fan and very, very satisfied with Pagelines, having recommended it to many friends and colleagues.

Share this post


Link to post
Share on other sites
kastelic

Yes, copy it into platformbase/functions.php

Share this post


Link to post
Share on other sites
ruthtoledoaltschuler

Hi Kastelic, I must have done something wrong, as PHP is really unfamiliar ground for me. I pasted the above code on the Platformbase functions.php file. There was a Fatal Error message saying it could not redeclare the same thing and the site crashed once I saved that file. I had to enter via FTP to restore to the functions.php to the previous version of the file and everything was fine again, without that piece of code. Maybe I should not try to do any PHP and be happy to just do CSS alterations, but it sure would be great to have these fonts added to my Typography menu options! Thank you again for all the help offered.

Share this post


Link to post
Share on other sites
ruthtoledoaltschuler

Hi, I just found a very straight forward solution, using only the Custom Code Style sheet. Add this to make the H3 of boxes to have the google font chosen:

@import url(http://fonts.googleapis.com/css?family=Architects+Daughter);
	.fboxtitle h3{font-family: 'Architects Daughter', cursive;}

No need for php. Thanks a lot!

Share this post


Link to post
Share on other sites
evert100

Hi Ruth, I am struggling with the same thing. How to add more than 1 google font to the wp typography dashboard. Adding one i succeeded. Maybe in your case things went wrong because you did'nt replace the other code with the one above? Could you tell me where you put your css code? In which css file? Thanks

Share this post


Link to post
Share on other sites
ruthtoledoaltschuler

Hello, This was sent too long ago, and since then there is an excellent Google fonts plugin. I still need to know more CSS to be able to use it, but it works amazingly well for the most simple choices. It is called WP Google Fonts and it is brilliant! http://wordpress.org/extend/plugins/wp-google-fonts/screenshots/ Good luck!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×