Fem servir ACF per crear els CPT.
Es important no tocar aquest opció, encara que sigui la més evident (deixar la opció en blanc):

Sinó que hem de tocar-ho aquí:

Així després podem fer la traducció al WPML:

Fem servir ACF per crear els CPT.
Es important no tocar aquest opció, encara que sigui la més evident (deixar la opció en blanc):
Sinó que hem de tocar-ho aquí:
Així després podem fer la traducció al WPML:
// WPML translate CPT 'immoble' archive title on es
function wpml_translate_cpt_archive_title($title)
{
if (apply_filters( 'wpml_current_language', null ) == 'es' && is_post_type_archive('immoble')) {
$title = __('Inmuebles', 'kadence-child');
}
return $title;
}
add_filter('get_the_archive_title', 'wpml_translate_cpt_archive_title', 100);
Integració a la capçalera de kadence theme
/* wpml */
.header-html .wpml-ls-legacy-list-horizontal.wpml-ls-statics-footer {
margin-bottom: 0;
}
.wpml-ls-item {
position: relative;
}
.wpml-ls-item .wpml-ls-link {
padding-left: calc(2em / 2);
padding-right: calc(2em / 2);
padding-top: 0.6em;
padding-bottom: 0.6em;
}
.wpml-ls-item.wpml-ls-current-language:after {
content: '';
width: 100%;
position: absolute;
bottom: 0px;
height: 2px;
right: 50%;
background: var(--global-palette1);
-webkit-transform: scale(0, 0) translate(-50%, 0);
transform: scale(0, 0) translate(-50%, 0);
transition: color .0s ease-in-out, -webkit-transform .2s ease-in-out;
transition: transform .2s ease-in-out, color .0s ease-in-out;
transition: transform .2s ease-in-out, color .0s ease-in-out, -webkit-transform .2s ease-in-out;
width: calc(100% - 2em);
transform: scale(1, 1) translate(50%, 0);
}
.transparent-header .wpml-ls-item.wpml-ls-current-language:after {
background: var(--global-palette9);
}
.wpml-ls-item.wpml-ls-current-language .wpml-ls-link {
color: var(--global-palette1);
}
/* Si posem el shortcode dins del menú mobile, sinó esborrar o no actua */
#mobile-drawer .wpml-ls-item.wpml-ls-current-language:after,
#mobile-drawer .mobile-html .wpml-ls-item.wpml-ls-current-language .wpml-ls-link {
color: var(--global-palette9);
}
RewriteRule ^$ /es/ [R=301,L]
Simplement afegim aquest codi al htaccess.
Redirecciona el root cap a lárrel del idioma seleccionat.
add_filter('mod_rewrite_rules', 'fix_rewritebase');
function fix_rewritebase($rules){
$home_root = parse_url(home_url());
if ( isset( $home_root['path'] ) ) {
$home_root = trailingslashit($home_root['path']);
} else {
$home_root = '/';
}
$wpml_root = parse_url(get_option('home'));
if ( isset( $wpml_root['path'] ) ) {
$wpml_root = trailingslashit($wpml_root['path']);
} else {
$wpml_root = '/';
}
$rules = str_replace("RewriteBase $home_root", "RewriteBase $wpml_root", $rules);
$rules = str_replace("RewriteRule . $home_root", "RewriteRule . $wpml_root", $rules);
return $rules;
}