Files
acrib.es/wp-content/themes/kadence/inc/customizer/js/generate-google-font-variants.js
Malin f3ff7b7186 feat: initial ACRIB WordPress deployment
- WordPress 6.9.4 (es_ES) with Kadence theme
- Homepage: Hero, La Asociación, Pilares, Beneficios, Eventos, Miembros, Hazte Miembro, Contacto
- Brand identity: #13294b navy, #a12932 burgundy, #c69c48 gold
- Fonts: Raleway (headings) + Source Sans 3 (body) + Lato (UI)
- Plugins: Kadence Blocks, Polylang, Contact Form 7
- Custom CSS with full brand styling and responsive layout
- HTTPS enforced via wp-config.php proxy detection
2026-05-19 19:25:59 +02:00

39 lines
1.4 KiB
JavaScript

/**
* manually run this file to generate array for google fonts inc/customizer/google-font-variants.php file)
* run the script on a page with a div with class .google-fonts class.
* you'll also need to put in a google webfonts api key.
*/
$.getJSON('https://www.googleapis.com/webfonts/v1/webfonts?key={{API_KEY}}', function(data) {
$.each( data.items, function( index, font ) {
var category = [];
category.push( font.category );
var variants = font.variants;
var weights = font.variants.slice();
var styles = ['normal'];
for( var i = 0; i < weights.length; i++){
if ( weights[i].includes('italic') ) {
weights.splice(i, 1);
}
};
if ( variants.includes('italic') ) {
styles.push('italic');
}
$('.google-fonts').append("'" + font.family + "' => array( 'v' => array(");
for(var i = 0; i < variants.length; i++) {
if( 0 === i ) {
$('.google-fonts').append("'" + variants[i] + "'");
} else {
$('.google-fonts').append(",'" + variants[i] + "'");
}
}
$('.google-fonts').append(")" + ",'c' => array(");
for(var i = 0; i < category.length; i++) {
if( 0 === i ) {
$('.google-fonts').append("'" + category[i] + "'");
} else {
$('.google-fonts').append(",'" + category[i] + "'");
}
}
$('.google-fonts').append(")" + "),");
});
});