I don’t want to create a child theme. What would happen if I selected “download zip” and used it on another site to override the theme? Will I lose my customizations if there is a theme update?
Also, what would happen if I select to save my changes to the theme? Will those customizations load faster? Will those changes will be lost with theme updates?
Thanks so much.
]]>The functions.php file inside the English (/en) child theme:
<?php
function language_redirect() {
if ( !is_user_logged_in() && !is_admin() ) {
$user_lang = substr( $_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2 );
if ( $user_lang == 'fr' ) {
wp_redirect( home_url( '/fr/' ) );
exit();
}
}
}
add_action( 'template_redirect', 'language_redirect' );
functions.php file inside the French (/fr) child theme:
<?php
function language_redirect() {
if ( !is_user_logged_in() && !is_admin() ) {
$user_lang = substr( $_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2 );
if ( $user_lang == 'en' ) {
wp_redirect( home_url( '/en/' ) );
exit();
}
}
}
add_action( 'template_redirect', 'language_redirect' );
( Thank you to narolainfotech (@narolainfotech) )
I suspect the problem might be that the wp_redirect appends the home_url with either “/en/” or “/fr/”. But as the two home_url’s are already example.com/en and example.com/fr this code results in “example.com/en/fr/“, “example.com/fr/en/“, example.com/en/en/, etc .. which don’t exist.
Is there a way to fix this? Or is this code correct and the problem is elsewhere (like between my keyboard and my chair <g>) ….?
]]>I update the file and using DevTools, I can see the files in one site on the network are the most up to date files, but the base site still has old versions of the files.
And it seems site with the updated files is using the old file versions.
In my functions.php file I have the following code to enqueue the child theme and my script. I have tried changing the version, removing, refreshing my cache (browser and the breeze cache on the site) and I still can’t seem to get the updated code.
Any ideas on what I could be doing wrong?
Thanks!
]]>So far I have a multisite installation working properly using two sub-folders (/en and /fr) for their respective english and french versions. Each uses its own child template of the Twenty Twenty-Four Theme.
In the original html website I added code to the .htaccess file to redirect visitors to the appropriate sub folder based on their browser language. Can the WordPress multisite’s .htaccess file be used to do something similar?
I tried copying and pasting the same code used on the old static site below the multisite “WordPress” code in the .htaccess file, but it doesn’t appear to work (didn’t break anything either).
As the “/en” and “/fr” folders are dynamically created by WP I’m thinking that an htaccess redirect based on the visitor’s browser language might not be possible.
Is there a recommended way to do this (other than pay $$ for a plugin)?
Thank you for any advice.
Russell
R
]]>"elements": {
"link": {
"color": {
"text": "#212121"
},
"typography": {
"textDecoration": "none"
},
"typography": {
"textDecoration": "none"
},
"color":{
"text": "#00C7B1 "
}
}
}
},
When i check the browser inspector, the navigation menu is only reading the link color declaration as inherit. Which this is overriding my custom theme.json color.
.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content {
color: inherit;
}
.wp-block-navigation a:where(:not(.wp-element-button)):hover {
color: #00BCC6;
text-decoration: none;
}
It appears that the only way for the navigation links to show my color choice on front-end is to add !important to the theme.json file
"elements": {
"link": {
"color": {
"text": "#212121"
},
typography": {
"textDecoration": "none"
},
":hover": {
"typography": {
"textDecoration": "none"
},
"color":{
"text": "#00C7B1 !important"
}
}
}
},
Not sure why does the global Style link hover only works when !important is added to Theme.json file?
Thanks for any help or assistance with this.
Adobe provides a stylesheet that one can import (described here), but I don’t know how to add that to the typography section of theme.json.
The format of the file provided by Adobe is:
@font-face {
font-family:"trade-gothic-next";
src:url("https://use.typekit.net/af/.../....") format("woff2"),url("https://use.typekit.net/af/.../....") format("woff"),url("https://use.typekit.net/af/.../....") format("opentype");
font-display:auto;font-style:normal;font-weight:700;font-stretch:normal;
}
(… is individual strings related to my license AFAIK).
I guess I somehow can add the src provided in this file to the theme.json typography section? Does that work?