File: /datos/www/www.colombia.co/public_html/wp-content/themes/colombia2016/category-empresas.php
<?php
require_once 'functions/slider.php';
get_header();
global $wp_query, $paged;
$locale = get_locale();
$cat_id = get_cat_ID(single_cat_title('', false));
//$general_setting_data = get_field('category_slider', 'category_' . $cat_id);
if ($locale == "es_CO") {
$parent_id = 3455;
$alidos_id = 13;
$contact_form_id = 36901;
} else if ($locale == "en_US") {
// $parent_id = 1962;
// $alidos_id=1941;
/*Stage id*/
$parent_id = 2075;
$alidos_id = 2074;
$contact_form_id = 34316;
} else if ($locale == "fr_FR") {
$parent_id = 235;
$alidos_id = 234;
$contact_form_id = 34301;
}
$cat_dropdown = get_categories(
array('parent' => $parent_id)
);
$acf_slider = get_field('category_slider', 'category_' . $parent_id);
?>
<main class="alidos alidos-in">
<?php colombiaco_slider($acf_slider); ?>
<section>
<div id="content-wrapper" class="l-container l-flex">
<div class="content-box">
<div class="inner-box-over">
<div class="post-sharing">
<a href="<?php echo get_category_link($alidos_id); ?>" class="btn btn-danger slide-cta hidden-xs">volver</a>
</div>
<div class="detailpart no-border">
<h2>Nuestros aliados</h2>
</div>
<select name="menu-796" id="select_cat_aliados" class="wpcf7-form-control wpcf7-select wpcf7-validates-as-required" aria-required="true" aria-invalid="false">
<option value="<?php echo get_category_link($parent_id); ?>">Categoria</option>
<?php foreach ($cat_dropdown as $cat) { ?>
<option value="<?php echo get_category_link($cat->term_id); ?>" <?php if ($cat->term_id == $cat_id) {
echo "selected";
} ?>><?php echo $cat->name; ?></option>
<?php } ?>
</select>
<a id="filter_aliados" href="<?php echo get_category_link($cat_id); ?>" class="btn btn-darkjgray slide-cta">filtrar</a>
</div>
<section id="posts" class="l-flex country_brand">
<?php while (have_posts()) : the_post(); ?>
<article class="category- post-31445 post type-post status-publish format-standard has-post-thumbnail hentry category-actualidad category-noticias tag-bogota tag-cartagena tag-colombia tag-gastronomia tag-pereira tag-visita-colombia" id="post-28368">
<figure class="post-img">
<a href="<?php echo get_field("company_url"); ?>" <?php if (!empty(get_field("open_link_in_new_tab"))) {
echo "target='_blank'";
} ?>>
<img src="<?php echo get_field("company_logo"); ?>" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="<?php the_title(); ?>"> </a>
</figure>
<div class="post-category">
<ul class="post-categories">
<?php
$cat_id = get_cat_ID(single_cat_title('', false));
$category_list = wp_get_post_categories($post->ID);
$cat = array();
foreach ($category_list as $list) {
if ($list != $parent_id) {
$cat[] = get_cat_name($list);
}
}
$category_data = implode(',', $cat);
?>
<li><a href="<?php echo get_field("company_url"); ?>" <?php if (!empty(get_field("open_link_in_new_tab"))) {
echo "target='_blank'";
} ?>><?php if ($category_data != "") {
echo $category_data;
} else {
echo "aliados";
} ?></a></li>
</ul>
</div>
<div class="post-title">
<h2><a href="<?php echo get_field("company_url"); ?>" <?php if (!empty(get_field("open_link_in_new_tab"))) {
echo "target='_blank'";
} ?>><?php the_title(); ?></a></h2>
</div>
<a href="<?php echo get_field("company_url"); ?>" <?php if (!empty(get_field("open_link_in_new_tab"))) {
echo "target='_blank'";
} ?>>
<div class="post-excerpt">
<div class="excerpt-wrapper">
<?php the_excerpt(); ?>
<span class="read-more"><i class="icon-read-more"></i><br>Ver más</span>
</div>
</div>
</a>
</article>
<?php endwhile; ?>
</section>
<?php if ($wp_query->max_num_pages > 1) { ?>
<div id="pagination">
<button id="load-more" class="btn-secondary" type="button" data-current-page="<?php echo $paged; ?>" data-total-pages="<?php echo $wp_query->max_num_pages; ?>">VER MÁS</button>
</div>
<?php } ?>
<section class="page-template-contact">
<article id="page-content">
<p>Si tienes preguntas sobre la Marca País Colombia, o tienes algo que contarnos, puedes hacerlo a través de este formulario.</p>
<?php echo do_shortcode('[contact-form-7 id="' . $contact_form_id . '" title="Formulario de contacto (aliados)"]'); //local?>
</article>
</section>
</div>
<?php
get_sidebar();
?>
</div>
</section>
</main>
<script type="text/javascript">
var sel = document.getElementById('select_cat_aliados');
sel.onchange = function () {
document.getElementById("filter_aliados").href = this.value;
}
</script>
<?php get_footer(); ?>