File size: 1,755 Bytes
2f7542e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | // WordPress Theme Customizer Integration
document.addEventListener('DOMContentLoaded', function() {
// Apply color scheme from WordPress customizer
function applyColorScheme() {
const primaryColor = getComputedStyle(document.documentElement).getPropertyValue('--primary').trim();
const secondaryColor = getComputedStyle(document.documentElement).getPropertyValue('--secondary').trim();
// You would typically get these from WordPress customizer settings
console.log('Applying color scheme:', {primaryColor, secondaryColor});
// Example of dynamic color application
document.documentElement.style.setProperty('--primary', primaryColor || '#3b82f6');
document.documentElement.style.setProperty('--secondary', secondaryColor || '#10b981');
}
// Initialize color scheme
applyColorScheme();
// Watch for changes in WordPress customizer (simulated)
if (window.wp && wp.customize) {
wp.customize('primary_color', function(value) {
value.bind(function(newval) {
document.documentElement.style.setProperty('--primary', newval);
});
});
wp.customize('secondary_color', function(value) {
value.bind(function(newval) {
document.documentElement.style.setProperty('--secondary', newval);
});
});
}
// Initialize all feather icons
feather.replace();
});
// WordPress Gutenberg Block Enhancer
function enhanceGutenbergBlocks() {
document.querySelectorAll('.wp-block').forEach(block => {
// Add enhancement classes to blocks
block.classList.add('transition', 'duration-200', 'ease-in-out');
});
} |