Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not quite working for me. #6

Open
digisavvy opened this issue Nov 27, 2014 · 3 comments
Open

Not quite working for me. #6

digisavvy opened this issue Nov 27, 2014 · 3 comments

Comments

@digisavvy
Copy link

Hey Patrick,
So I gave this a try. Installed the plugin and added the code to the functions.php file and I do not see the control/setting/section for the fonts in the customizer. I just copied and pasted what you had. What might I be missing here?

Thanks and happy T-day

@BFTrick
Copy link
Owner

BFTrick commented Dec 9, 2014

Hi @digisavvy I just don't have to time to pursue this at the moment. Writing a book and maintaining some premium plugins takes up all my time. I'm sorry but I can't figure out why it's not working for you. :(

I'll leave this issue open incase anyone else can look into it.

@erbilru
Copy link

erbilru commented Sep 18, 2016

You should add a setting so it can work.

@Ebrahim6
Copy link

Ebrahim6 commented May 6, 2018

## Hi, I have added the following in my functions.php after activating the plugin.

`function mytheme_fontsettings( $wp_customize ) {
$wp_customize->add_section('mytheme_new_section_fonts', array(
'title' => esc_html__('Fonts', 'mytheme'),
'priority' => 30,
));

$wp_customize->add_setting( 'font_family', array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
));

if (class_exists('Google_Font_Picker_Custom_Control')){
$wp_customize->add_control( new Google_Font_Picker_Custom_Control( $wp_customize,
'font_family_control', array(
'label' => __( 'Font Family', 'mytheme' ),
'section' => 'mytheme_new_section_fonts',
'settings' => 'font_family',
'choices' => $customFontFamilies->getFontFamilyNameArray(),
'fonts' => $customFontFamilies
)));
}
}
add_action( 'customize_register', 'mytheme_fontsettings' );`

## and my fonts array is:

`
$customFontFamilies;
if (class_exists('Google_Font_Collection'))
{
$fonts[] = array(
"title" => "Ubuntu Condensed",
"location" => "Ubuntu+Condensed",
"cssDeclaration" => "'Ubuntu Condensed', sans-serif",
"cssClass" => "ubuntuCondensed",
"title" => "Oswald",
"location" => "Oswald",
"cssDeclaration" => "'Oswald', sans-serif",
"cssClass" => "Oswald"
);

$customFontFamilies = new Google_Font_Collection($fonts);

}`

## and I'm getting the following error:

Fatal error: Uncaught Error: Call to a member function getFontFamilyNameArray() on null in C:\xampp\htdocs\appm\wp-content\themes\mytheme\functions.php:223

===================

any idea what I'm doing wrong here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants