File: /datos/www/www.colombia.co/public_html/wp-content/themes/colombia2016/archive.php
<?php
require_once 'functions/loop-posts.php';
get_header();
global $wp_query, $paged;
$cat = get_cat_ID(single_cat_title('', false));
$cat_id = get_cat_ID(single_cat_title('', false));
// saber si es una categoria padre
$os = array(27, 3458, 30, 31, 5, 45, 3460, 3459, 8, 20, 3457, 34, 33, 35, 18, 17, 44, 3, 3461, 2, 19, 23, 28, 30, 22, 7, 6, 26, 4, 25, 106, 9, 11, 12, 13, 14, 15, 16, 1797, 1801, 22, 30, 37);
$real_id = get_cat_ID($cat_id);
if ($locale == "es_CO") {
$parent_id = 3455;
//$parent_id = 3154; //stage
$alidos_id = 13;
} else if ($locale == "en_US") {
// $parent_id = 1962;
// $alidos_id=1941;
/*Stage id*/
$parent_id = 2075;
$alidos_id = 2074;
} else if ($locale == "fr_FR") {
$parent_id = 235;
$alidos_id = 234;
}
$category_check = get_category($cat_id);
if (!empty($category_check) && (($cat_id == $parent_id) || ($category_check->category_parent == $parent_id))) {
include(TEMPLATEPATH . '/category-empresas.php');
die;
} elseif (!empty($category_check) && (($cat_id == $alidos_id))) {
include(TEMPLATEPATH . '/category-aliados.php');
die;
}
// Acá definimos $subtitulo, $category_color y $category_image para usarlos donde sea necesario
$images = get_option('taxonomy_image_plugin'); // get the taxonomy images array
if (array_key_exists($cat_id, $images)) { // check if term has an image
$category_image = wp_get_attachment_image_src($images[$cat_id], 'full'); // if it does, echo that image
}
$category_color = get_term_meta($cat_id, 'category_color', true);
$category_color_rgb = array(hexdec($category_color[1] . $category_color[2]), hexdec($category_color[3] . $category_color[4]), hexdec($category_color[5] . $category_color[6]));
$subtitulo = get_term_meta($cat_id, 'category_subtitle', true);
if(in_array($cat_id, $os)){
// color texto titulos
$title_color = get_term_meta($cat_id, 'color_titulo_categoria', true);
// color texto subtitulos
$subtitle_color = get_term_meta($cat_id, 'color_descripcion', true);
// color background banner
$banner_category_color = get_term_meta($cat_id, 'color_banner_categoria', true);
}
?>
<style>
<?php
/*Estos estilos se dejan para la categoria de banners ya que son dinamicos*/
if(in_array($cat_id, $os)){
if(($category_image)||($category_color)): ?>
#category-header .cat-description, #post-header .cat-description {
padding: 3% 10%;
margin: auto;
}
.container-header-one {
background-color: <?php echo $banner_category_color; ?>;
background-size: inherit;
width: 25%;
float:left;
padding: 5% 0 0 0;
height: 550px;
}
#category-header h1.cat-title {
color: <?php echo $title_color ?>;
}
#category-header {
background-image: inherit!important;
background-size: cover;
}
.container-header-two {
background-image: url(<?php echo $category_image[0]; ?>);
background-size: cover;
width: 75%;
float:left;
display:block;
background-repeat: no-repeat;
height: 550px;
}
.cat-description p{
color: <?php echo $subtitle_color; ?>;
}
@media screen and (max-width: 1366px){
#category-header .cat-title {
padding: 7%!important;
}
.container-header-one {
padding: 3% 0;
height: 422px;
}
.container-header-two {
height: 422px;
}
body.archive.category #category-header {
height: 414px;
}
}
@media screen and (max-width:800px) {
.container-header-one {
width: 100%;
}
.container-header-two {
display:none;
}
}
<?php endif;
}else{
if (($category_image) || ($category_color)): ?>
body.archive.category #category-header .cat-title {
font: 35px 'Raleway',sans-serif!important;
padding: 18% 10% 15% 10%!important;
font-weight: 700;
padding: 0!important;
font-size: 1.8rem!important;
margin-top: 22px!important;
width: 72%!important;
text-align: center;
}
body.archive.category #category-header .cat-name, body.archive.category #category-header .cat-description p{
text-align: center;
}
#category-header .cat-description, #post-header .cat-description {
width: 100%!important;
margin: 1% 0% 0% 0%;
}
#category-header .cat-title {
font: 45px raleway,sans-serif!important;
font-weight: 700!important;
width: 60%!important;
}
<?php if($category_image): ?>
#category-header {
background-image: url(<?php echo $category_image[0]; ?>) !important;
background-size: cover;
padding: 0!important;
height: 435px!important;
}
<?php endif; ?>
<?php if($category_color): ?>
#posts .post-categories li {
background-color: <?php echo $category_color; ?>;
}
#posts .post-excerpt {
background-color: rgba(<?php echo $category_color_rgb[0]; ?>,<?php echo $category_color_rgb[1]; ?>,<?php echo $category_color_rgb[2]; ?>, 0.9);
}
<?php endif; ?>
@media screen and (max-width: 767px){
.l-flex #category-header {
background-image: url(<?php echo $category_image[0]; ?>) !important;
}
}
<?php endif;
} ?>
</style>
<main role="main" class="l-flex">
<div id="category-header">
<?php
if(in_array($cat_id, $os)){
?>
<div class="container-header-one">
<h1 class="cat-title"><?php echo $subtitulo; ?></h1>
<?php $cat_desc = category_description(get_cat_ID(single_cat_title('', false))); ?>
<?php
if ($cat_desc) {
?>
<div class="cat-description"><?php echo $cat_desc; ?></div>
<?php } ?>
</div>
<div class="container-header-two"></div>
<?php
}else{
?>
<div class="l-container l-flex">
<?php
$cat_desc = category_description(get_cat_ID(single_cat_title('', false)));
?>
<div class="cat-header-container">
<?php if (is_category()): ?>
<?php
if ($subtitulo) {
?>
<h2 class="cat-name"><?php single_cat_title(); ?></h2>
<h1 class="cat-title"><?php echo $subtitulo; ?></h1>
<?php
} else {
?>
<h1 class="cat-title"><?php single_cat_title(); ?></h1>
<?php } ?>
<?php
if ($cat_desc) {
?>
<div class="cat-description"><?php echo $cat_desc; ?></div>
<?php } ?>
<?php elseif (is_tag()): ?>
<h2 class="cat-name">Tag</h2>
<h1 class="cat-title"><?php single_cat_title(); ?></h1>
<?php endif; ?>
</div>
</div>
<?php
}
?>
</div>
<div id="content-wrapper" class="l-container l-flex">
<?php colombiaco_loop_posts($covid_q); ?>
<?php get_sidebar(); ?>
</div>
</main>
<?php get_footer(); ?>