change url opinion and author_Alias

This commit is contained in:
2026-03-03 09:33:15 +00:00
parent 0403e6ed50
commit c750a4f969
4 changed files with 28 additions and 5 deletions

View File

@@ -76,3 +76,11 @@ foreach(['/es/documentos/page/:paged','/eu/dokumentuak/page/:paged'] as $route)
Routes::load('archive-documentos.php', $params, $query, 200);
});
}
// SOLO UNA VEZ
// add_action('init', function() {
// $posts = get_posts(['post_type' => 'opinion', 'numberposts' => -1]);
// foreach ($posts as $post) {
// update_post_meta($post->ID, '_author_alias', 'field_author_alias');
// }
// });

View File

@@ -482,10 +482,20 @@ class StarterSite extends Site {
//otros
$context = array_merge($context, $this->getPolylangData());
$context['opinion_url'] = $this->getOpinionUrl($context['current_language']);
return $context;
}
public function getOpinionUrl($current_lang)
{
if ($current_lang === 'es') {
return "/".$current_lang."/opinion";
} else {
return "/".$current_lang."/iritzia";
}
}
/**
* Funciones public 'Template-Portada'
*/

View File

@@ -116,8 +116,9 @@
{# Segunda columna - Último artículo de opinión #}
<div class="col-lg-4 col-12 opinion-article d-flex flex-column order-1 order-lg-2 ">
<a href="{{ opinion_url }}" class="text-decoration-none text-dark" style="width: fit-content;">
<h2 class="mb-4 position-relative fs-4 fw-bold sp-module-title">{{ __('Opinión', 'Sindikatua')|upper}}</h2>
</a>
<div class="flex-grow-1 d-flex">
{% if last_posts_opinion and last_posts_opinion|length > 0 %}
{% for article in last_posts_opinion %}

View File

@@ -19,7 +19,11 @@
<h1 class="article-h1">{{ post.title }}</h1>
<p class="blog-author mt-4 mb-3 border-dark border-bottom">
<span>{{ __('Autor', 'Sindikatua')}}:</span>
<a href="{{ post.author.path }}">{{ post.author.name }}</a>
{% if post.post_type == 'opinion' %}
<span>{{ post.author_alias }}</span>
{% else %}
<span>{{ post.author.name }}</span>
{% endif %}
<span>&bull;</span>
<time datetime="{{ post.date|date('Y-m-d H:i:s') }}">{{ post.date }}</time>
</p>