5846c515f3
- 4 temas WordPress: persona-cv (activo), lumina, apex-cv, cvolio - Plugin pflores-cv-fields con CMB2 (100% gratuito) — admin editable - Generador PDF dinámico con Chromium headless (?cv_pdf=1) - Datos del CV de Patricia Flores cargados en CMB2 - URL dinámica con soporte proxy SSL (NPM/X-Forwarded-Proto) - WP Mail SMTP instalado (pendiente config SMTP) - Documentación completa: PROMPT_IA.md, DEPLOY_WEB.md, PRODUCCION.md, VERSIONADO.md
135 lines
3.3 KiB
PHP
135 lines
3.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once get_template_directory() . '/inc/customizer.php';
|
|
require_once get_template_directory() . '/inc/cv-data.php';
|
|
require_once get_template_directory() . '/inc/patterns.php';
|
|
require_once get_template_directory() . '/inc/visits.php';
|
|
|
|
function cvolio_setup(): void
|
|
{
|
|
add_theme_support('title-tag');
|
|
add_theme_support('post-thumbnails');
|
|
add_theme_support('editor-styles');
|
|
add_theme_support('responsive-embeds');
|
|
add_theme_support('wp-block-styles');
|
|
add_theme_support('align-wide');
|
|
|
|
register_nav_menus([
|
|
'primary' => __('Menu principal', 'cvolio'),
|
|
]);
|
|
}
|
|
add_action('after_setup_theme', 'cvolio_setup');
|
|
|
|
function cvolio_enqueue_assets(): void
|
|
{
|
|
wp_enqueue_style(
|
|
'cvolio-fonts',
|
|
'https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Cormorant+Garamond:wght@500;600;700&display=swap',
|
|
[],
|
|
null
|
|
);
|
|
|
|
wp_enqueue_style(
|
|
'cvolio-theme',
|
|
get_template_directory_uri() . '/assets/css/theme.css',
|
|
['cvolio-fonts'],
|
|
wp_get_theme()->get('Version')
|
|
);
|
|
|
|
wp_enqueue_script(
|
|
'cvolio-theme',
|
|
get_template_directory_uri() . '/assets/js/theme.js',
|
|
[],
|
|
wp_get_theme()->get('Version'),
|
|
true
|
|
);
|
|
}
|
|
add_action('wp_enqueue_scripts', 'cvolio_enqueue_assets');
|
|
|
|
function cvolio_body_classes(array $classes): array
|
|
{
|
|
$classes[] = 'cvolio-shell';
|
|
|
|
if (is_front_page()) {
|
|
$classes[] = 'cvolio-front-page';
|
|
}
|
|
|
|
return $classes;
|
|
}
|
|
add_filter('body_class', 'cvolio_body_classes');
|
|
|
|
function cvolio_redirect_default_sample_page(): void
|
|
{
|
|
if (! is_page()) {
|
|
return;
|
|
}
|
|
|
|
$samplePage = get_queried_object();
|
|
if (! $samplePage instanceof WP_Post) {
|
|
return;
|
|
}
|
|
|
|
if ($samplePage->post_name !== 'pagina-ejemplo') {
|
|
return;
|
|
}
|
|
|
|
wp_safe_redirect(home_url('/'), 301);
|
|
exit;
|
|
}
|
|
add_action('template_redirect', 'cvolio_redirect_default_sample_page', 1);
|
|
|
|
function cvolio_render_primary_menu(): string
|
|
{
|
|
if (has_nav_menu('primary')) {
|
|
return trim((string) wp_nav_menu([
|
|
'theme_location' => 'primary',
|
|
'container' => false,
|
|
'fallback_cb' => false,
|
|
'menu_class' => 'site-nav__menu',
|
|
'echo' => false,
|
|
]));
|
|
}
|
|
|
|
$items = [
|
|
'#resumen' => __('Resumen', 'cvolio'),
|
|
'#impacto' => __('Impacto', 'cvolio'),
|
|
'#experiencia' => __('Experiencia', 'cvolio'),
|
|
'#formacion' => __('Formación', 'cvolio'),
|
|
'#certificaciones' => __('Certificaciones', 'cvolio'),
|
|
'#contacto' => __('Contacto', 'cvolio'),
|
|
];
|
|
|
|
$html = '<ul class="site-nav__menu">';
|
|
foreach ($items as $href => $label) {
|
|
$html .= sprintf(
|
|
'<li><a href="%s">%s</a></li>',
|
|
esc_url($href),
|
|
esc_html($label)
|
|
);
|
|
}
|
|
$html .= '</ul>';
|
|
|
|
return $html;
|
|
}
|
|
|
|
function cvolio_render_contact_link(string $type, string $value): string
|
|
{
|
|
if ($value === '') {
|
|
return '';
|
|
}
|
|
|
|
$href = match ($type) {
|
|
'email' => 'mailto:' . antispambot($value),
|
|
'phone' => 'tel:' . preg_replace('/[^0-9+]/', '', $value),
|
|
default => esc_url($value),
|
|
};
|
|
|
|
return sprintf(
|
|
'<a class="cv-chip" href="%s">%s</a>',
|
|
esc_url($href),
|
|
esc_html($value)
|
|
);
|
|
}
|