Hi, I’m just trying to output the font-weight selected, and I’m getting (‘array’). I’m doing echo $bodyfonttype[‘variants’]; Users have been instructed to only pick one weight for each headline, so I just want to output that.
]]>Note – I am using the ACF field in theme options – if not being used in options then you can use the normal get_field( ‘your_field_name’) without the –>> , ‘ option’
To see the Array printed in a Human friendly view:
<?php
echo '<pre>'.print_r(get_field( 'your_field_name', 'option'), true).'</pre>';
?>
To see the entire array:
<?php
$google_1 = get_field( 'your_field_name', 'option' );
var_dump($google_1);
?>
IN USE:
place at the top of your page or call from somewhere
<?php
$google_1 = get_field( 'your_field_name', 'option');
//Inner Arrays
$vars = $google_1['variants'];
//Not necessary in the US because latin is the Google default
$subs = $google_1['subsets'];
// Get all array items - comma separated
$vars_string = rtrim(implode(',', $vars), ',');
$subs_string = rtrim(implode(',', $subs), ',');
?>
CALL OUT:
<style>
@import url('https://fonts.googleapis.com/css?family=<?php echo $google_1['font'] ?>:<?php echo $vars_string ?>&display=swap&subset=<?php echo $subs_string ?>');
</style>
OR
<link href="https://fonts.googleapis.com/css?family=<?php echo $google_1['font'] ?>:<?php echo $vars_string ?>&display=swap&subset=<?php echo $subs_string ?>" rel="stylesheet">
I hope that helps someone
Cheers
I would assume this is for those using https.
the developer console shows that the Google font css is not loading because they are not being served from a secure server.
To fix the preview not displaying issue.
Find all the https:// in the plugin and make them https://
3 files
acf-google-font-selector-field\acf-google_font_selector-v4.php – 1 instance
acf-google-font-selector-field\acf-google_font_selector-v5.pph – 1 instance
acf-google-font-selector-field\js\input.js – 2 instances
Is anyone available to help me with getting the live preview for ACF: Google Font Selector to work? I already created the API key and defined it & I tried it on three different sites and for all of them it just loads forever unit I save the changes.
Thanks,
Chris
]]>When trying to load Lato font, with only the 100 font weight variant, I discovered that the built-in script enqueue wouldn’t load the 100 variant. Upon further digging, it looks like this line of code needs to be changed:
functions.php file, line 89, from:
$fvariants = ”;
to:
$f_variants = implode( ‘,’, $font[‘variants’]);
With this, I’m able to load any/all variants selected, regardless of whether or not “regular” (400) is selected.
Hope this helps and thanks for a helpful plugin!
]]>Hey all,
I’ve discovered that this plugin, while seemingly working fine otherwise, apparently creates a redundant inclusion of functions.php.
So far, I’ve noticed this has at least 2 negative results:
`require_once($_SERVER[‘DOCUMENT_ROOT’]. ‘/wp-load.php’);
I would love to be able to use this plugin, but it currently creates more problems than it solves. PLEASE, PLEASE, remedy this soon so I can go back to using it.
Thanks!
]]>I’m using ACF Google font Selector version 3.0.1 with WordPress 1.6.1.
I’m aware there’s a similar topic (@cauzeneffeckt), but that problem seemed to resolve itself.
After adding a Google API key (settings), the following error appears:
`
“We tried to verify your API key but it seems it is incorrect. Make sure to copy-paste it from Google exactly.”
`
– I’ve tried multiple API keys (via console.developers.google.com > create credentials > API key), but none of them works.
– There are no restrictions on the API key
– Also I’ve tried to wait multiple days, without any effect.
Am I forgetting something, is there an error I’m not aware of?
Thanks!
Hello, I continue to get this error when trying to activate the Google Fonts API key in the plugin. In the Google API dashboard, the API is enabled. For testing purposes, I have even lifted all access restrictions to make sure that this was not the issue but I continue to receive the error. Any help would be greatly appreciated.
]]>Currently I am using ACF to add options to a category admin page, then display those options on a custom archive category page. With this, I can get the options of the Google Font by using get_field, but the font isn’t being enqueued automatically.
Does this plugin only enqueue for post pages? What do I need to do?
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>I’ve found a bug in Chrome where the fonts are no longer pre-loading the dropdown. The web-safe fonts load, but no google fonts. This is only in the backend and only affects Chrome. I thought it was a webkit situation, but Safari works as well as Firefox.
This started happening recently. There is an error being thrown:
Invalid argument supplied for foreach() acf-google-font-selector-field/functions.php on line 167
Also Argument #1 is not an array on the same line.
If I discover a solution I’ll post it, but any insight is appreciated.
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>The live preview is not working for the fonts.
The following fixes the bug
Line 57
preview_text = jQuery('#acfgfs-preview div').html();
should read
preview_text = jQuery('.acfgfs-preview div').text();
Line 60
jQuery('#acfgfs-preview div').html(preview_text)
should read
jQuery('.acfgfs-preview div').text(preview_text)
Cheers,
Dan
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>I’m getting this error repeatedly:
Warning: Invalid argument supplied for foreach() in /path/wp-content/plugins/acf-google-font-selector-field/functions.php on line 167 and only a few fonts are even loading. I also cannot select a default font due to the same error message. Does this just simply not work with the latest updates to ACF and WP?
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Would it be possible to add in a custom hook for the display_variant_list function? I’d like to modify this list to accept radio buttons instead of checkboxes but can’t find a hook in the source code.
Or, if possible, would you be able to add in the option to choose between checkboxes or radio buttons in a future update? Cheers.
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Hello,
I’ve installed ACF Google Font Selector on a site I’m working on and I get an error “SSLRead() return error -9806” when trying to submit my API Key.
The error stack is :
Fatal error: Cannot use object of type WP_Error as array in /Users/user/projects/web/wp-content/plugins/acf-google-font-selector-field/acf-google_font_selector.php on line 147
Call Stack
# Time Memory Function Location
1 0.0010 376760 {main}( ) …/options-general.php:0
2 0.0013 448912 require_once( ‘/Users/user/projects/web/wp-admin/admin.php’ ) …/options-general.php:10
3 0.9591 72203608 do_action( ) …/admin.php:236
4 0.9591 72205200 call_user_func_array:{/Users/user/projects/web/wp-includes/plugin.php:525} ( ) …/plugin.php:525
5 0.9591 72205352 acfgfs_settings_page_content( ) …/plugin.php:525
Any idea on what’s wrong and how to make the plugin work ?
Thanks in advance
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Hello,
I saw this previous support thread:
However this did not solve my issue. I’m loading the font selection like so in the <head> of my theme:
<style>
body { font-family: <?php the_field('body_font', 'option'); ?>; }
</style>
When I look in Chrome Dev Tools, it is returning this:
body { font-family: Open Sans, Array, Array; }
A vardump like so:
<?php
$bodyfont = the_field('body_font', 'option');
var_dump( $bodyfont );
?>
returns:
Open Sans, Array, ArrayNULL
How can I just grab the font name (or value) to use with css?
Thanks!
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Hi,
I was looking for a plugin like this for a long time and now I finally found it.
But…
I set it up properly and I can select different fonts. However, the preview of the default font is working, but when I select a different one, the preview is empty.
Any help is much appreciated.
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>I am using a valid api key and copying it correctly, when I enter it I am getting this error.
“We tried to verify your API key but it seems it is incorrect. Make sure to copy-paste it from Google exactly.”
Please advise
Thanks
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Hi there,
Do you know if this plugin is multisite compatible? I’ve got it working on one site in my network , but the second site is giving me an error. They’re using the same theme files.
(changed the server address with domain to protect privacy)
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in domain/html/wp-content/plugins/acf-google-font-selector-field/functions.php on line 64
Warning: array_search() expects parameter 2 to be array, null given in domain/html/wp-content/plugins/acf-google-font-selector-field/functions.php on line 70
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in domain/html/wp-content/plugins/acf-google-font-selector-field/functions.php on line 64
Warning: array_search() expects parameter 2 to be array, null given in domain/html/wp-content/plugins/acf-google-font-selector-field/functions.php on line 70
I’m using the Google Fonts field as part of ACF Pro , and within an Options page.
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>I use your ACF: Google Font Selector plugin for my project. Firs of all I would like to thank you about this beautiful plugin that you share with all community.
I have little problem with this plugin and I think that you can help me about this issue.
I would like to include this plugin in my theme. So I would like to use acf/include_fields hook to do this. But this is not working for me. If I install as a plugin everything it’s ok.
I also contacted with acf team and he told me to contact with you.
This is my code:
function athena_register_fields(){
include_once(‘includes/add-ons/acf-google-font-selector-field/acf-google_font_selector-v5.php’);
}
add_action(‘acf/include_fields’, ‘athena_register_fields’);
So
When I include with code I got this: https://prntscr.com/7slgwg
When I install as plugin I got this: https://prntscr.com/7sli3q
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>I am currently allowing each user to pick a font per tag i.e. H1, H2, H3, etc.. in the theme admin area using the plugin. The problem is that multiple fonts of the same type, result in the font being loaded multiple times by the client. Can duplicates be filtered before being output in the wordpress header?
Blocked loading mixed active content “https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,600,700,300”
Blocked loading mixed active content “https://fonts.googleapis.com/css?family=Nunito:400,300,700”
Blocked loading mixed active content “https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,600,700,300”
Blocked loading mixed active content “https://fonts.googleapis.com/css?family=Nunito:400,300,700”
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>When using the plugin with HTTPs URLs I receive:
Blocked loading mixed active content “https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,600,700,300”
Blocked loading mixed active content “https://fonts.googleapis.com/css?family=Nunito:400,300,700”
Blocked loading mixed active content “https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,600,700,300”
Blocked loading mixed active content “https://fonts.googleapis.com/css?family=Nunito:400,300,700”
Would be great to remove the https:// and just have //URL…., so it will use either HTTP or HTTPs.
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Is there a way to allow only certain font variant and subsets from functions.php
I have the font list being filtered, but would like to limit choices further.
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Hi, thank you for great plugin!
Works perfectly but when I select web safe font (like Trebuchet), it tries to load it as google font ( https://fonts.googleapis.com/css?family=Trebuchet+MS%3A400&subset=latin&ver=4.2.2 ). This gives me errors in console.
Please, advise.
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Hi,
I have the plugin installed and set up. I have a form on the options page that has three fields using the google font selector. When I load the page the first font field shows the right default text but doesn’t show the preview. On page load is does show the “This is a preview of the selected font” but if I choose another font the text disappears. Varients and subsets show up fine.
The other two fields give the following warning:
Warning: Illegal string offset ‘font’ in /home/videomarketing/public_html/wp-content/plugins/acf-google-font-selector-field/acf-google_font_selector-v5.php on line 118
They also show the first font in the list, ABeeZee, instead of the default font I chose when setting up the field. I’m also getting two errors under Variables and Subsets on page load. They disappear when I choose a different font.
Variables- Warning: Illegal string offset ‘variants’ in /home/videomarketing/public_html/wp-content/plugins/acf-google-font-selector-field/functions.php on line 298
Subsets- Warning: Illegal string offset ‘subsets’ in /home/videomarketing/public_html/wp-content/plugins/acf-google-font-selector-field/functions.php on line 343
Can you please help me with this? Does it not work when having multiple font fields per form? Thanks in advance!
Monique
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Hello, i’m using your great plugin and it’s working well.
Only, there is a bit of confusion when I set 2 different font fields in the same form. It seems it can manage only one font, right? (I wanted to set an option page where you can set a title font and a text font).
Another question: is it possibile to set only a selection of fonts and not all the fonts from Google? They are a lot and often we don’t need them all!
Thanks!
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Hi there,
Thanks for this plugin. Currently developing on my local machine, and wondering how to get the Google API key to work. When registering for a key, it requires that you designate which domains should be able to request the data….so local dev doesn’t seem to work.
Have you run into this and know of a way around it so that I can try out your plugin on a local dev set up?
Thanks
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>i am developing a custom theme and cant seem to find what selector you are applying the google font to. it is definitely not ‘body’ and this is rendering the plugin nonfunctional. Please help! Thank you!
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Really like this plugin and it’s come in real handy.
I am having an issue however when using it within an ACF flexible content field.
The font doesn’t load when added this way. It’s just not included in the <style> tag/request at all.
Any chance of a fix / solution?
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Hi, I was wondering how to manually insert the GF script into my template when you don’t have the script enqueued? I’ve read through your documentation and I can’t seem to find anything – Could you please point me in the right direction?
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>Hi.
Firstly, thank you for a great plugin!
I want to echo out the font in a dynamic spreadsheet using the acf options plugin. No matter how I try I get : Lato, array, array.
How can I just get it to say : ‘Lato’
$bodyfont = implode(‘, ‘, get_field(‘body_font’,’option’));
echo $bodyfont
Any ideas?
Many thanks.
https://www.ads-software.com/plugins/acf-google-font-selector-field/
]]>