- Árbol genealógico en CSS para los caballos

git-svn-id: https://192.168.0.254/svn/Proyectos.DoubleRGroup_Web/trunk@3 9702d7ca-3799-984c-9d87-892b02c0b615
This commit is contained in:
David Arranz 2014-03-05 16:59:14 +00:00
parent 4b3ef94d84
commit 05d90ea0cd
9 changed files with 2907 additions and 658 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,96 @@
/* ÁRBOL GENEALÓGICO */
.horse-tree *, .horse-tree *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.horse-tree {
position: relative;
}
.horse-tree .branch {
position: relative;
margin-left: 175px;
}
.horse-tree .branch:before {
content: "";
width: 25px;
border-top: 2px solid #395b7b;
position: absolute;
left: -50px;
top: 50%;
margin-top: 1px;
}
.horse-tree .entry {
position: relative;
min-height: 60px;
}
.horse-tree .entry:before {
content: "";
height: 100%;
border-left: 2px solid #395b7b;
position: absolute;
left: -25px;
}
.horse-tree .entry:after {
content: "";
width: 25px;
border-top: 2px solid #395b7b;
position: absolute;
left: -25px;
top: 50%;
margin-top: 1px;
}
.horse-tree .entry:first-child:before {
width: 5px;
height: 50%;
top: 50%;
margin-top: 2px;
border-radius: 5px 0 0 0;
}
.horse-tree .entry:first-child:after {
height: 5px;
border-radius: 5px 0 0 0;
}
.horse-tree .entry:last-child:before {
width: 5px;
height: 50%;
border-radius: 0 0 0 5px;
}
.horse-tree .entry:last-child:after {
height: 5px;
border-top: none;
border-bottom: 2px solid #395b7b;
border-radius: 0 0 0 5px;
margin-top: -4px;
}
.horse-tree .entry.sole:before {
display: none;
}
.horse-tree .entry.sole:after {
width: 25px;
height: 0;
margin-top: 1px;
border-radius: 0;
}
.horse-tree .label {
background: #B4C2CD;
display: block;
width: 125px;
padding: 5px 10px;
line-height: 20px;
text-align: center;
border: 2px solid #395b7b;
border-radius: 3px;
position: absolute;
left: 0;
top: 50%;
margin-top: -15px;
color: #000;
}
/* http://codepen.io/P233/pen/Kzbsi */

View File

@ -1,9 +1,348 @@
<?php
add_action('add_meta_boxes', 'drg_horse_meta_boxes');
add_action('save_post', 'drg_save_horse_fields', 10, 2);
// Field Array
$prefix = 'drg_horse_';
$horse_meta_fields = array(
// Padre
array(
'label' => __("Father", 'double-r-group'),
'desc' => __("Father's name", 'double-r-group'),
'id' => $prefix . 'father',
'type' => 'text'
),
// Abuelos paternos
array(
'label' => __("Paternal grandfather", 'double-r-group'),
'desc' => __("Paternal grandfather's name", 'double-r-group'),
'id' => $prefix . 'paternal_grandfather',
'type' => 'text'
),
array(
'label' => __("Paternal grandmother", 'double-r-group'),
'desc' => __("Paternal grandmother's name", 'double-r-group'),
'id' => $prefix . 'paternal_grandmother',
'type' => 'text'
),
// Bisabuelos paternos
array(
'label' => __("Paternal great-grandfather", 'double-r-group'),
'desc' => __("Paternal great-grandfather's name", 'double-r-group'),
'id' => $prefix . 'paternal_great_grandfather_1',
'type' => 'text'
),
array(
'label' => __("Paternal great-grandmother", 'double-r-group'),
'desc' => __("Paternal great-grandmother's name", 'double-r-group'),
'id' => $prefix . 'paternal_great_grandmother_1',
'type' => 'text'
),
array(
'label' => __("Paternal great-grandfather", 'double-r-group'),
'desc' => __("Paternal great-grandfather's name", 'double-r-group'),
'id' => $prefix . 'paternal_great_grandfather_2',
'type' => 'text'
),
array(
'label' => __("Paternal great-grandmother", 'double-r-group'),
'desc' => __("Paternal great-grandmother's name", 'double-r-group'),
'id' => $prefix . 'paternal_great_grandmother_2',
'type' => 'text'
),
// Madre
array(
'label' => __("Mother", 'double-r-group'),
'desc' => __("Mother's name", 'double-r-group'),
'id' => $prefix . 'mother',
'type' => 'text'
),
// Abuelos maternos
array(
'label' => __("Maternal grandfather", 'double-r-group'),
'desc' => __("Maternal grandfather's name", 'double-r-group'),
'id' => $prefix . 'maternal_grandfather',
'type' => 'text'
),
array(
'label' => __("Maternal grandmother", 'double-r-group'),
'desc' => __("Maternal grandmother's name", 'double-r-group'),
'id' => $prefix . 'maternal_grandmother',
'type' => 'text'
),
// Bisabuelos maternos
array(
'label' => __("Maternal great-grandfather", 'double-r-group'),
'desc' => __("Maternal great-grandfather's name", 'double-r-group'),
'id' => $prefix . 'maternal_great_grandfather_1',
'type' => 'text'
),
array(
'label' => __("Maternal great-grandmother", 'double-r-group'),
'desc' => __("Maternal great-grandmother's name", 'double-r-group'),
'id' => $prefix . 'maternal_great_grandmother_1',
'type' => 'text'
),
array(
'label' => __("Maternal great-grandfather", 'double-r-group'),
'desc' => __("Maternal great-grandfather's name", 'double-r-group'),
'id' => $prefix . 'maternal_great_grandfather_2',
'type' => 'text'
),
array(
'label' => __("Maternal great-grandmother", 'double-r-group'),
'desc' => __("Maternal great-grandmother's name", 'double-r-group'),
'id' => $prefix . 'maternal_great_grandmother_2',
'type' => 'text'
),
);
function drg_horse_meta_boxes() {
add_action('add_meta_boxes', 'add_horse_custom_type_meta_box');
add_action('save_post', 'save_horse_custom_type_meta_box');
function add_horse_custom_type_meta_box() {
add_meta_box('horse_custom_type_meta_box', // $id
__('Genealogy', 'double-r-group'), // $title
'show_horse_custom_type_meta_box', // $callback
'drg_horse',
'normal',
'high');
}
function show_horse_custom_type_meta_box() {
global $post, $horse_meta_fields;
?>
<input type="hidden" name="horse_custom_type_meta_box_nonce" value="<?php echo wp_create_nonce(basename(__FILE__));?>" />
<table class="form-table">
<tbody>
<tr>
<td>
<table class="form-table">
<tr>
<?php $field = $horse_meta_fields[0]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
</table>
<h4><?php echo __('Paternal grandparents', 'double-r-group'); ?></h4>
<table class="form-table">
<tr>
<?php $field = $horse_meta_fields[1]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
<tr>
<?php $field = $horse_meta_fields[2]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
</table>
<h4><?php echo __('Paternal great-grandparents', 'double-r-group'); ?></h4>
<table class="form-table">
<tr>
<?php $field = $horse_meta_fields[3]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
<tr>
<?php $field = $horse_meta_fields[4]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
<tr>
<?php $field = $horse_meta_fields[5]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
<tr>
<?php $field = $horse_meta_fields[6]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
</table>
</td>
<td>
<table class="form-table">
<tr>
<?php $field = $horse_meta_fields[7]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
</table>
<h4><?php echo __('Maternal grandparents', 'double-r-group'); ?></h4>
<table class="form-table">
<tr>
<?php $field = $horse_meta_fields[8]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
<tr>
<?php $field = $horse_meta_fields[9]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
</table>
<h4><?php echo __('Maternal great-grandparents', 'double-r-group'); ?></h4>
<table class="form-table">
<tr>
<?php $field = $horse_meta_fields[10]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
<tr>
<?php $field = $horse_meta_fields[11]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
<tr>
<?php $field = $horse_meta_fields[12]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
<tr>
<?php $field = $horse_meta_fields[13]; ?>
<th><label for="<?php echo $field['id'];?>"><?php echo __($field['label'], 'double-r-group'); ?></label></th>
<td><input type="text"
name="<?php echo $field['id'];?>"
id="<?php echo $field['id'];?>"
value="<?php echo get_post_meta($post->ID, $field['id'], true); ?>"
size="30" />
<br /><span class="description"><?php echo $field['desc'];?></span>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<?php }
function save_horse_custom_type_meta_box($post_id) {
global $horse_meta_fields;
// verify nonce
if (!wp_verify_nonce($_POST['horse_custom_type_meta_box_nonce'], basename(__FILE__)))
return $post_id;
// check autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return $post_id;
// check permissions
if ('drg_horse' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id))
return $post_id;
} elseif (!current_user_can('edit_post', $post_id)) {
return $post_id;
}
// loop through fields and save the data
foreach ($horse_meta_fields as $field) {
$old = get_post_meta($post_id, $field['id'], true);
$new = $_POST[$field['id']];
if ($new && $new != $old) {
update_post_meta($post_id, $field['id'], $new);
} elseif ('' == $new && $old) {
delete_post_meta($post_id, $field['id'], $old);
}
} // end foreach
}
// Meta boxes para las plantillas de los caballos
add_action('add_meta_boxes', 'drg_horse_template_meta_boxes');
add_action('save_post', 'drg_save_horse_template_fields', 10, 2);
function drg_horse_template_meta_boxes() {
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];
// Check template
@ -15,13 +354,13 @@ function drg_horse_meta_boxes() {
if (in_array(get_post_meta($post_id, '_wp_page_template', true), $templates)) {
add_meta_box( 'horse_meta_box',
__('Horse Options', 'double-r-group'),
'drg_display_horse_meta_box',
'drg_display_horse_template_meta_box',
'page', 'side', 'default'
);
}
}
function drg_display_horse_meta_box($page) {
function drg_display_horse_template_meta_box($page) {
$horse_category = esc_html(get_post_meta($page->ID, 'horse_category', true));
@ -62,7 +401,7 @@ function drg_display_horse_meta_box($page) {
}
}
function drg_save_horse_fields($page_id, $page) {
function drg_save_horse_template_fields($page_id, $page) {
// Check template
$templates = array(
'template-caballos-competicion.php',

View File

@ -0,0 +1,957 @@
<?php
//////////////////////////////////////////////////////////////////
// Remove extra P tags
//////////////////////////////////////////////////////////////////
function drg_shortcodes_formatter($content) {
$block = join("|",array("recent_horses"));
// opening tag
$rep = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br \/>)?/","[$2$3]",$content);
// closing tag
$rep = preg_replace("/(<p>)?\[\/($block)](<\/p>|<br \/>)?/","[/$2]",$rep);
return $rep;
}
add_filter('the_content', 'drg_shortcodes_formatter');
add_filter('widget_text', 'drg_shortcodes_formatter');
//////////////////////////////////////////////////////////////////
// Horse family tree
//////////////////////////////////////////////////////////////////
add_shortcode('horse_family_tree', 'drg_horse_family_tree');
function drg_horse_family_tree($atts, $content = null) {
global $post;
$html = '';
extract(shortcode_atts(array(
'horse_id' => $post->ID,
), $atts));
$query_atts = array(
'p' => $atts['horse_id'],
'post_type' => 'drg_horse',
'paged' => 1,
'posts_per_page' => 1,
);
wp_reset_query();
$horses = new WP_Query($query_atts);
$html .= '<div id="horse-tree-' . $atts['horse_id'] . '" class="horse-tree">';
while($horses->have_posts()): $horses->the_post();
$html .= '<span class="label">' . get_the_title() . '</span>';
// Padres
$html .= '<div class="branch lv1">';
// Padre
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_father', true) . '</span>';
// Abuelos paternos
$html .= '<div class="branch lv2">';
// Abuelo paterno
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_grandfather', true) . '</span>';
// Bisabuelos paternos (1)
$html .= '<div class="branch lv3">';
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandfather_1', true) . '</span></div>';
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandmother_1', true) . '</span></div>';
$html .= '</div>';
$html .= '</div>'; // Abuelo paterno
// Abuela paterna
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_grandmother', true) . '</span>';
// Bisabuelos paternos (2)
$html .= '<div class="branch lv3">';
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandfather_2', true) . '</span></div>';
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandmother_2', true) . '</span></div>';
$html .= '</div>';
$html .= '</div>'; // Abuela paterna
$html .= '</div>'; // Abuelos paternos
$html .= '</div>'; // Padre
// Madre
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_mother', true) . '</span>';
// Abuelos maternos
$html .= '<div class="branch lv2">';
// Abuelo materno
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_grandfather', true) . '</span>';
// Bisabuelos paternos (1)
$html .= '<div class="branch lv3">';
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandfather_1', true) . '</span></div>';
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandmother_1', true) . '</span></div>';
$html .= '</div>';
$html .= '</div>'; // Abuelo materno
// Abuela paterna
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_grandmother', true) . '</span>';
// Bisabuelos naternos (2)
$html .= '<div class="branch lv3">';
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandfather_2', true) . '</span></div>';
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandmother_2', true) . '</span></div>';
$html .= '</div>';
$html .= '</div>'; // Abuela paterna
$html .= '</div>'; // Abuelos maternos
$html .= '</div>'; // Madre
/*$html .= '<ul>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandfather_1', true) . '</a></li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandmother_1', true) . '</a></li>';
$html .= '</ul>';
$html .= '</li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_grandmother', true) . '</a>';
// Bisabuelos paternos (2)
$html .= '<ul>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandfather_2', true) . '</a></li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandmother_2', true) . '</a></li>';
$html .= '</ul>';
$html .= '</li>';
$html .= '</ul>';
$html .= '</li>';
// Madre
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_mother', true) . '</a>';
// Abuelos paternos
$html .= '<ul>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_grandfather', true) . '</a>';
// Bisabuelos paternos (1)
$html .= '<ul>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandfather_1', true) . '</a></li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandmother_1', true) . '</a></li>';
$html .= '</ul>';
$html .= '</li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_grandmother', true) . '</a>';
// Bisabuelos paternos (2)
$html .= '<ul>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandfather_2', true) . '</a></li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandmother_2', true) . '</a></li>';
$html .= '</ul>';
$html .= '</li>';
$html .= '</ul>';
$html .= '</li>'; */
endwhile;
$html .= '</div>'; // .branch lv1
$html .= '</div>'; // .horse-tree
wp_reset_query();
return $html;
}
//////////////////////////////////////////////////////////////////
// Recent Posts
//////////////////////////////////////////////////////////////////
add_shortcode('recent_posts', 'drg_shortcode_recent_posts');
function drg_shortcode_recent_posts($atts, $content = null) {
global $data;
wp_enqueue_script( 'jquery.flexslider' );
extract(shortcode_atts(array(
'layout' => 'default',
'columns' => 1,
'number_posts' => 4,
'exclude_cats' => '',
'excerpt_words' => '15',
'excerpt' => 'no',
'strip_html' => 'yes',
'cat_id' => '',
'cat_slug' => '',
'animation_type' => '',
'animation_direction' => 'left',
'animation_speed' => ''
), $atts));
$direction_suffix = '';
$animation_class = '';
$animation_attribues = '';
if($animation_type) {
$animation_class = ' animated';
if($animation_type != 'flash' && $animation_type != 'shake') {
$direction_suffix = 'In'.ucfirst($animation_direction);
$animation_type .= $direction_suffix;
}
$animation_attribues = ' animation_type="'.$animation_type.'"';
if($animation_speed) {
$animation_attribues .= ' animation_duration="'.$animation_speed.'"';
}
}
if(!isset($atts['columns'])) {
$atts['columns'] = 3;
}
if(!isset($atts['excerpt_words'])) {
$atts['excerpt_words'] = 15;
}
if(!isset($atts['number_posts'])) {
$atts['number_posts'] = 3;
}
if(!isset($atts['strip_html'])) {
$atts['strip_html'] = 'true';
}
if($atts['strip_html'] == 'yes') {
$atts['strip_html'] = 'true';
} elseif($atts['strip_html'] == 'no') {
$atts['strip_html'] = 'false';
}
if(!empty($atts['cat_id']) && $atts['cat_id']){
$query_atts['category_name'] = $atts['cat_id'];
} elseif(!empty($atts['cat_slug']) && $atts['cat_slug']){
$query_atts['category_name'] = $atts['cat_slug'];
}
$query_atts['posts_per_page'] = $atts['number_posts'];
if($exclude_cats) {
$cats_to_exclude = explode(',', $exclude_cats);
foreach($cats_to_exclude as $cat_to_exclude) {
$idObj = get_category_by_slug($cat_to_exclude);
if($idObj) {
$cats_id_to_exclude[] = $idObj->term_id;
}
}
if($cats_id_to_exclude) {
$query_atts['category__not_in'] = $cats_id_to_exclude;
}
}
wp_reset_query();
$recent_posts = new WP_Query($query_atts);
if($layout == 'default'):
$attachment = '';
$html = '<div class="avada-container">';
$html .= '<section class="columns columns-'.$atts['columns'].'" style="width:100%">';
$html .= '<div class="holder">';
$count = 1;
while($recent_posts->have_posts()): $recent_posts->the_post();
$html .= '<article class="col">';
if($atts['thumbnail'] == "yes"):
if($data['legacy_posts_slideshow']):
$args = array(
'post_type' => 'attachment',
'numberposts' => $data['posts_slideshow_number']-1,
'post_status' => null,
'post_mime_type' => 'image',
'post_parent' => get_the_ID(),
'orderby' => 'menu_order',
'order' => 'ASC',
'exclude' => get_post_thumbnail_id()
);
$attachments = get_posts($args);
if($attachments || has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)):
$html .= '<div class="flexslider floated-post-slideshow'.$animation_class.'"'.$animation_attribues.'>';
$html .= '<ul class="slides">';
if(get_post_meta(get_the_ID(), 'pyre_video', true)):
$html .= '<li><div class="full-video">';
$html .= get_post_meta(get_the_ID(), 'pyre_video', true);
$html .= '</div></li>';
endif;
if(has_post_thumbnail()):
$attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'recent-posts');
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id());
$html .= '<li><span class="imageframe imageframe-glow">
<a href="'.get_permalink(get_the_ID()).'" rel=""><img class="wp-image" src="'.$attachment_image[0].'" alt="'.get_the_title().'" /></a>
</span></li>';
endif;
if($data['posts_slideshow']):
foreach($attachments as $attachment):
$attachment_image = wp_get_attachment_image_src($attachment->ID, 'recent-posts');
$full_image = wp_get_attachment_image_src($attachment->ID, 'full');
$attachment_data = wp_get_attachment_metadata($attachment->ID);
$html .= '<li><span class="imageframe imageframe-glow">
<a href="'.get_permalink(get_the_ID()).'" rel=""><img class="wp-image" src="'. $attachment_image[0].'" alt="'.$attachment->post_title.'" /></a>
</span></li>';
endforeach;
endif;
$html .= '</ul>
</div>';
endif;
else:
if(has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)):
$html .= '<div class="flexslider floated-post-slideshow'.$animation_class.'"'.$animation_attribues.'>';
$html .= '<ul class="slides">';
if(get_post_meta(get_the_ID(), 'pyre_video', true)):
$html .= '<li><div class="full-video">';
$html .= get_post_meta(get_the_ID(), 'pyre_video', true);
$html .= '</div></li>';
endif;
if(has_post_thumbnail()):
$attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'recent-posts');
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id());
$html .= '<li><span class="imageframe imageframe-glow">
<a href="'.get_permalink(get_the_ID()).'" rel=""><img class="wp-image" src="'.$attachment_image[0].'" alt="'.get_the_title().'" /></a>
</span></li>';
endif;
if($data['posts_slideshow']):
$i = 2;
while($i <= $data['posts_slideshow_number']):
$attachment_new_id = kd_mfi_get_featured_image_id('featured-image-'.$i, 'post');
if($attachment_new_id):
$attachment_image = wp_get_attachment_image_src($attachment_new_id, 'recent-posts');
$full_image = wp_get_attachment_image_src($attachment_new_id, 'full');
$attachment_data = wp_get_attachment_metadata($attachment_new_id);
$html .= '<li><span class="imageframe imageframe-glow">
<a href="'.get_permalink(get_the_ID()).'" rel=""><img class="wp-image" src="'. $attachment_image[0].'" alt="" /></a>
</span></li>';
endif;
$i++;
endwhile;
endif;
$html .= '</ul>
</div>';
endif;
endif;
endif;
if($atts['title'] == "yes"):
$html .= '<h4><a href="'.get_permalink(get_the_ID()).'">'.get_the_title().'</a></h4>';
endif;
if($atts['meta'] == "yes"):
$html .= '<ul class="meta">';
$html .= '<li><em class="date">'.get_the_time($data['date_format'], get_the_ID()).'</em></li>';
if(get_comments_number(get_the_ID()) >= 1):
$html .= '<li><a href="'.get_permalink(get_the_ID()).'">'.get_comments_number(get_the_ID()).' '.__('Comments', 'Avada').'</a></li>';
endif;
$html .= '</ul>';
endif;
if($atts['excerpt'] == "yes"):
$stripped_content = tf_content( $atts['excerpt_words'], $atts['strip_html'] );
$html .= '<p>'.$stripped_content.'</p>';
endif;
$html .= '</article>';
$count++;
endwhile;
$html .= '</div>';
$html .= '</section>';
$html .= '</div>';
elseif($layout == 'thumbnails-on-side'):
$attachment = '';
$html = '<div class="avada-container layout-'.$layout.' layout-columns-'.$columns.'">';
$html .= '<section class="columns columns-'.$atts['columns'].'" style="width:100%">';
$html .= '<div class="holder">';
$count = 1;
while($recent_posts->have_posts()): $recent_posts->the_post();
$html .= '<article class="col clearfix">';
if($atts['thumbnail'] == "yes"):
if($data['legacy_posts_slideshow']):
$args = array(
'post_type' => 'attachment',
'numberposts' => $data['posts_slideshow_number']-1,
'post_status' => null,
'post_mime_type' => 'image',
'post_parent' => get_the_ID(),
'orderby' => 'menu_order',
'order' => 'ASC',
'exclude' => get_post_thumbnail_id()
);
$attachments = get_posts($args);
if($attachments || has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)):
$html .= '<div class="flexslider floated-post-slideshow'.$animation_class.'"'.$animation_attribues.'>';
$html .= '<ul class="slides">';
if(get_post_meta(get_the_ID(), 'pyre_video', true)):
$html .= '<li><div class="full-video">';
$html .= get_post_meta(get_the_ID(), 'pyre_video', true);
$html .= '</div></li>';
endif;
if(has_post_thumbnail()):
$attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'portfolio-two');
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id());
$html .= '<li><span class="imageframe imageframe-glow">
<a href="'.get_permalink(get_the_ID()).'" rel=""><img class="wp-image" src="'.$attachment_image[0].'" alt="'.get_the_title().'" /></a>
</span></li>';
endif;
if($data['posts_slideshow']):
foreach($attachments as $attachment):
$attachment_image = wp_get_attachment_image_src($attachment->ID, 'portfolio-two');
$full_image = wp_get_attachment_image_src($attachment->ID, 'full');
$attachment_data = wp_get_attachment_metadata($attachment->ID);
$html .= '<li><span class="imageframe imageframe-glow">
<a href="'.get_permalink(get_the_ID()).'" rel=""><img class="wp-image" src="'. $attachment_image[0].'" alt="'.$attachment->post_title.'" /></a>
</span></li>';
endforeach;
endif;
$html .= '</ul>
</div>';
endif;
else:
if(has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)):
$html .= '<div class="flexslider floated-post-slideshow'.$animation_class.'"'.$animation_attribues.'>';;
$html .= '<ul class="slides">';
if(get_post_meta(get_the_ID(), 'pyre_video', true)):
$html .= '<li><div class="full-video">';
$html .= get_post_meta(get_the_ID(), 'pyre_video', true);
$html .= '</div></li>';
endif;
if(has_post_thumbnail()):
$attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'portfolio-two');
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id());
$html .= '<li><span class="imageframe imageframe-glow">
<a href="'.get_permalink(get_the_ID()).'" rel=""><img class="wp-image" src="'.$attachment_image[0].'" alt="'.get_the_title().'" /></a>
</span></li>';
endif;
if($data['posts_slideshow']):
$i = 2;
while($i <= $data['posts_slideshow_number']):
$attachment_new_id = kd_mfi_get_featured_image_id('featured-image-'.$i, 'post');
if($attachment_new_id):
$attachment_image = wp_get_attachment_image_src($attachment_new_id, 'portfolio-two');
$full_image = wp_get_attachment_image_src($attachment_new_id, 'full');
$attachment_data = wp_get_attachment_metadata($attachment_new_id);
$html .= '<li><span class="imageframe imageframe-glow">
<a href="'.get_permalink(get_the_ID()).'" rel=""><img class="wp-image" src="'. $attachment_image[0].'" alt="" /></a>
</span></li>';
endif;
$i++;
endwhile;
endif;
$html .= '</ul>
</div>';
endif;
endif;
endif;
$html .= '<div class="recent-posts-content">';
if($atts['title'] == "yes"):
$html .= '<h4><a href="'.get_permalink(get_the_ID()).'">'.get_the_title().'</a></h4>';
endif;
if($atts['meta'] == "yes"):
$html .= '<ul class="meta">';
$html .= '<li>'.get_the_time($data['date_format'], get_the_ID()).'</li>';
if(get_comments_number(get_the_ID()) >= 1):
$html .= '<li><a href="'.get_permalink(get_the_ID()).'">'.get_comments_number(get_the_ID()).' '.__('Comments', 'Avada').'</a></li>';
endif;
$html .= '</ul>';
endif;
if($atts['excerpt'] == "yes"):
$stripped_content = tf_content( $atts['excerpt_words'], $atts['strip_html'] );
$html .= $stripped_content;
endif;
$html .= '</div>';
$html .= '</article>';
$count++;
endwhile;
$html .= '</div>';
$html .= '</section>';
$html .= '</div>';
elseif($layout == 'date-on-side'):
$attachment = '';
$html = '<div class="avada-container layout-'.$layout.' layout-columns-'.$columns.'">';
$html .= '<section class="columns columns-'.$atts['columns'].'" style="width:100%">';
$html .= '<div class="holder">';
$count = 1;
while($recent_posts->have_posts()): $recent_posts->the_post();
$html .= '<article class="col clearfix">';
$html .= '<div class="date-and-formats">
<div class="date-box">
<span class="date">'.get_the_time('j').'</span>
<span class="month-year">'.get_the_time('m, Y').'</span>
</div>';
$html .= '<div class="format-box">';
switch(get_post_format()) {
case 'gallery':
$format_class = 'camera-retro';
break;
case 'link':
$format_class = 'link';
break;
case 'image':
$format_class = 'picture';
break;
case 'quote':
$format_class = 'quote-left';
break;
case 'video':
$format_class = 'film';
break;
case 'audio':
$format_class = 'headphones';
break;
case 'chat':
$format_class = 'comments-alt';
break;
default:
$format_class = 'book';
break;
}
$html .= '<i class="icon-'.$format_class.'"></i>
</div>
</div>';
$html .= '<div class="recent-posts-content">';
if($atts['title'] == "yes"):
$html .= '<h4><a href="'.get_permalink(get_the_ID()).'">'.get_the_title().'</a></h4>';
endif;
if($atts['meta'] == "yes"):
$html .= '<ul class="meta">';
$html .= '<li>'.get_the_time($data['date_format'], get_the_ID()).'</li>';
if(get_comments_number(get_the_ID()) >= 1):
$html .= '<li><a href="'.get_permalink(get_the_ID()).'">'.get_comments_number(get_the_ID()).' '.__('Comments', 'Avada').'</a></li>';
endif;
$html .= '</ul>';
endif;
if($atts['excerpt'] == "yes"):
$stripped_content = tf_content( $atts['excerpt_words'], $atts['strip_html'] );
$html .= $stripped_content;
endif;
$html .= '</div>';
$html .= '</article>';
$count++;
endwhile;
$html .= '</div>';
$html .= '</section>';
$html .= '</div>';
endif;
wp_reset_query();
return $html;
}
//////////////////////////////////////////////////////////////////
// Recent Works
//////////////////////////////////////////////////////////////////
add_shortcode('recent_horses', 'drg_shortcode_recent_horses');
function drg_shortcode_recent_horses($atts, $content = null) {
global $data;
static $recent_works_counter = 1;
wp_enqueue_script( 'jquery.isotope' );
wp_enqueue_script( 'jquery.carouFredSel' );
extract(shortcode_atts(array(
'layout' => 'carousel',
'filters' => 'true',
'columns' => 4,
'cat_slug' => '',
'number_posts' => 10,
'excerpt_words' => 15,
'animation_type' => '',
'animation_direction' => 'left',
'animation_speed' => ''
), $atts));
$direction_suffix = '';
$animation_class = '';
$animation_attribues = '';
if($animation_type) {
$animation_class = ' animated';
if($animation_type != 'flash' && $animation_type != 'shake') {
$direction_suffix = 'In'.ucfirst($animation_direction);
$animation_type .= $direction_suffix;
}
$animation_attribues = ' animation_type="'.$animation_type.'"';
if($animation_speed) {
$animation_attribues .= ' animation_duration="'.$animation_speed.'"';
}
}
if($columns == 1) {
$columns_words = 'one';
$portfolio_image_size = 'full';
} elseif($columns == 2) {
$columns_words = 'two';
$portfolio_image_size = 'portfolio-two';
} elseif($columns == 3) {
$columns_words = 'three';
$portfolio_image_size = 'portfolio-three';
} elseif($columns == 4) {
$columns_words = 'four';
$portfolio_image_size = 'portfolio-four';
}
if($filters == 'yes') {
$filters = 'true';
} elseif($filters == 'no') {
$filters = 'false';
}
$html = '';
wp_reset_query();
if($layout == 'carousel') {
$html .= '<div class="recent-works-carousel related-posts related-horses related-projects'.$animation_class.'"'.$animation_attribues.'>';
$html .= '<div id="carousel" class="es-carousel-wrapper">';
$html .= '<div class="es-carousel">';
$html .= '<ul class="">';
if(isset($atts['number_posts']) && !empty($atts['number_posts'])) {
$number_posts = $atts['number_posts'];
} else {
$number_posts = 10;
}
$args = array(
'post_type' => 'drg_horse',
'paged' => 1,
'posts_per_page' => $number_posts,
);
if(isset($atts['cat_id']) && !empty($atts['cat_id'])){
$cat_id = explode(',', $atts['cat_id']);
$args['tax_query'] = array(
array(
'taxonomy' => 'horse_categories',
'field' => 'slug',
'terms' => $cat_id
)
);
} elseif(isset($atts['cat_slug']) && !empty($atts['cat_slug'])){
$cat_id = explode(',', $atts['cat_slug']);
$args['tax_query'] = array(
array(
'taxonomy' => 'horse_categories',
'field' => 'slug',
'terms' => $cat_id
)
);
}
$works = new WP_Query($args);
while($works->have_posts()): $works->the_post();
if(has_post_thumbnail()):
$html .= '<li>';
$html .= '<div class="image" aria-haspopup="true">';
$html .= '<div class="photo-frame">';
if($data['image_rollover']):
$html .= get_the_post_thumbnail(get_the_ID(), 'related-img-vertical', array('class'=>'wp-image'));
else:
$html .= '<a href="'.get_permalink(get_the_ID()).'">'.get_the_post_thumbnail(get_the_ID(), 'related-img-vertical', array('class'=>'wp-image')).'</a>';
endif;
//$html .= '<a href="'.get_permalink(get_the_ID()).'">'.get_the_post_thumbnail(get_the_ID(), 'related-img-vertical').'</a>';
if(get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'link') {
$link_icon_css = 'display:inline-block;';
$zoom_icon_css = 'display:none;';
} elseif(get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'zoom') {
$link_icon_css = 'display:none;';
$zoom_icon_css = 'display:inline-block;';
} elseif(get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'no') {
$link_icon_css = 'display:none;';
$zoom_icon_css = 'display:none;';
} else {
$link_icon_css = 'display:inline-block;';
$zoom_icon_css = 'display:inline-block;';
}
$link_target = "";
$icon_url_check = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true); if(!empty($icon_url_check)) {
$icon_permalink = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
if(get_post_meta(get_the_ID(), 'pyre_link_icon_target', true) == "yes") {
$link_target = ' target="_blank"';
}
} else {
$icon_permalink = get_permalink(get_the_ID());
}
$html .= '<div class="image-extras">';
$html .= '<div class="image-extras-content">';
$html .= '<a style="'.$link_icon_css.'" class="icon link-icon" style="margin-right:3px;" href="'.$icon_permalink.'">';
$html .= 'Permalink';
$html .= '</a>';
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
if(get_post_meta(get_the_ID(), 'pyre_video_url', true)) {
$full_image[0] = get_post_meta(get_the_ID(), 'pyre_video_url', true);
}
$html .= '<a style="'.$zoom_icon_css.'" class="icon gallery-icon" href="'.$full_image[0].'" rel="prettyPhoto[gallery_recent_'.$recent_works_counter.']">Gallery</a>';
if($data['title_link_image_rollover']) {
$html .= '<h3 class="entry-title"><a href="'.$icon_permalink.'"'.$link_target.'>'.get_the_title().'</a></h3>';
} else {
$html .= '<h3 class="entry-title">'.get_the_title().'</h3>';
}
$html .= '</div>
</div>
</div>
</div>
</li>';
endif; endwhile;
$html .= '</ul>
</div>
<div class="es-nav"><span class="es-nav-prev">' . __('Previous', 'double-r-group') . '</span><span class="es-nav-next">' .
__('Next', 'double-r-group') . '</span></div>
</div>
</div>';
wp_reset_query();
} elseif($layout == 'grid') {
$html .= '<div class="portfolio portfolio-grid clearfix portfolio-'.$columns_words.$animation_class.'"'.$animation_attribues.' data-columns="'.$columns_words.'">';
$portfolio_category = get_terms('horse_categories');
if($portfolio_category && $filters == 'true'):
$html .= '<ul class="portfolio-tabs clearfix">
<li class="active"><a data-filter="*" href="#">'.__('All', 'Avada').'</a></li>';
foreach($portfolio_category as $portfolio_cat):
if($atts['cat_slug']):
$cat_slug = preg_replace('/\s+/', '', $atts['cat_slug']);
$cat_slug = explode(',', $cat_slug);
if(in_array($portfolio_cat->slug, $cat_slug)):
$html .='<li><a data-filter=".'.$portfolio_cat->slug.'" href="#">'.$portfolio_cat->name.'</a></li>';
endif;
else:
$html .= '<li><a data-filter=".'.$portfolio_cat->slug.'" href="#">'.$portfolio_cat->name.'</a></li>';
endif;
endforeach;
$html .= '</ul>';
endif;
$html .= '<div class="portfolio-wrapper">';
$args = array(
'post_type' => 'drg_horse',
'posts_per_page' => $number_posts
);
if(isset($atts['cat_id']) && !empty($atts['cat_id'])){
$cat_id = explode(',', $atts['cat_id']);
$args['tax_query'] = array(
array(
'taxonomy' => 'horse_categories',
'field' => 'slug',
'terms' => $cat_id
)
);
} elseif(isset($atts['cat_slug']) && !empty($atts['cat_slug'])){
$cat_id = explode(',', $atts['cat_slug']);
$args['tax_query'] = array(
array(
'taxonomy' => 'horse_categories',
'field' => 'slug',
'terms' => $cat_id
)
);
}
$gallery = new WP_Query($args);
while($gallery->have_posts()): $gallery->the_post();
if(has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)):
$item_classes = '';
$item_cats = get_the_terms(get_the_ID(), 'horse_categories');
if($item_cats):
foreach($item_cats as $item_cat) {
$item_classes .= $item_cat->slug . ' ';
}
endif;
$permalink = get_permalink();
$html .= '<div class="portfolio-item '.$item_classes.'">';
if(has_post_thumbnail()):
$html .= '<div class="image" aria-haspopup="true">';
if($data['image_rollover']):
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $portfolio_image_size);
$html .= '<img src="'.$thumbnail[0].'" alt="'.get_post_field('post_excerpt', get_post_thumbnail_id(get_the_ID())).'" />';
else:
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $portfolio_image_size);
$html .= '<a href="'.$permalink.'">'.'<img src="'.$thumbnail[0].'" alt="'.get_post_field('post_excerpt', get_post_thumbnail_id(get_the_ID())).'" />'.'</a>';
endif;
if(get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'link') {
$link_icon_css = 'display:inline-block;';
$zoom_icon_css = 'display:none;';
} elseif(get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'zoom') {
$link_icon_css = 'display:none;';
$zoom_icon_css = 'display:inline-block;';
} elseif(get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'no') {
$link_icon_css = 'display:none;';
$zoom_icon_css = 'display:none;';
} else {
$link_icon_css = 'display:inline-block;';
$zoom_icon_css = 'display:inline-block;';
}
$link_target = "";
$icon_url_check = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true); if(!empty($icon_url_check)) {
$icon_permalink = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
if(get_post_meta(get_the_ID(), 'pyre_link_icon_target', true) == "yes") {
$link_target = ' target="_blank"';
}
} else {
$icon_permalink = get_permalink(get_the_ID());
}
$html .= '<div class="image-extras">
<div class="image-extras-content">';
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
$html .= '<a style="'.$link_icon_css.'" class="icon link-icon" href="'.$icon_permalink.'">Permalink</a>';
if(get_post_meta(get_the_ID(), 'pyre_video_url', true)) {
$full_image[0] = get_post_meta(get_the_ID(), 'pyre_video_url', true);
}
$html .= '<a style="'.$zoom_icon_css.'" class="icon gallery-icon" href="'.$full_image[0].'" rel="prettyPhoto[gallery_recent_'.$recent_works_counter.']" title="'.get_post_field('post_excerpt', get_post_thumbnail_id(get_the_ID())).'"><img style="display:none;" alt="'.get_post_meta(get_post_thumbnail_id(get_the_ID()), '_wp_attachment_image_alt', true).'" />Gallery</a>';
if($data['title_link_image_rollover']) {
$html .= '<h3 class="entry-title"><a href="'.$icon_permalink.'"'.$link_target.'>'.get_the_title().'</a></h3>';
} else {
$html .= '<h3 class="entry-title">'.get_the_title().'</h3>';
}
$html .= '<h4>'.get_the_term_list(get_the_ID(), 'portfolio_category', '', ', ', '').'</h4>';
$html .= '</div>
</div>
</div>';
endif;
$html .= '</div>';
endif;
endwhile;
wp_reset_query();
$html .= '</div>';
$html .= '</div>';
} elseif($layout == 'grid-with-excerpts') {
$html .= '<div class="portfolio clearfix portfolio-'.$columns_words.'-text portfolio-'.$columns_words.'" data-columns="'.$columns_words.'">';
$portfolio_category = get_terms('horse_categories');
if($portfolio_category && $filters == 'true'):
$html .= '<ul class="portfolio-tabs clearfix">
<li class="active"><a data-filter="*" href="#">'.__('All', 'Avada').'</a></li>';
foreach($portfolio_category as $portfolio_cat):
if($atts['cat_slug']):
$cat_slug = preg_replace('/\s+/', '', $atts['cat_slug']);
$cat_slug = explode(',', $cat_slug);
if(in_array($portfolio_cat->slug, $cat_slug)):
$html .='<li><a data-filter=".'.$portfolio_cat->slug.'" href="#">'.$portfolio_cat->name.'</a></li>';
endif;
else:
$html .= '<li><a data-filter=".'.$portfolio_cat->slug.'" href="#">'.$portfolio_cat->name.'</a></li>';
endif;
endforeach;
$html .= '</ul>';
endif;
$html .= '<div class="portfolio-wrapper">';
$args = array(
'post_type' => 'drg_horse',
'posts_per_page' => $number_posts
);
if(isset($atts['cat_id']) && !empty($atts['cat_id'])){
$cat_id = explode(',', $atts['cat_id']);
$args['tax_query'] = array(
array(
'taxonomy' => 'horse_categories',
'field' => 'slug',
'terms' => $cat_id
)
);
} elseif(isset($atts['cat_slug']) && !empty($atts['cat_slug'])){
$cat_id = explode(',', $atts['cat_slug']);
$args['tax_query'] = array(
array(
'taxonomy' => 'horse_categories',
'field' => 'slug',
'terms' => $cat_id
)
);
}
$gallery = new WP_Query($args);
while($gallery->have_posts()): $gallery->the_post();
if(has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)):
$item_classes = '';
$item_cats = get_the_terms(get_the_ID(), 'horse_categories');
if($item_cats):
foreach($item_cats as $item_cat) {
$item_classes .= $item_cat->slug . ' ';
}
endif;
$permalink = get_permalink();
$html .= '<div class="portfolio-item '.$item_classes.'">';
if(has_post_thumbnail()):
$html .= '<div class="image'.$animation_class.'"'.$animation_attribues.' aria-haspopup="true">';
if($data['image_rollover']):
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $portfolio_image_size);
$html .= '<img src="'.$thumbnail[0].'" alt="'.get_post_field('post_excerpt', get_post_thumbnail_id(get_the_ID())).'" />';
else:
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $portfolio_image_size);
$html .= '<a href="'.$permalink.'"><img src="'.$thumbnail[0].'" alt="'.get_post_field('post_excerpt', get_post_thumbnail_id(get_the_ID())).'" /></a>';
endif;
if(get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'link') {
$link_icon_css = 'display:inline-block;';
$zoom_icon_css = 'display:none;';
} elseif(get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'zoom') {
$link_icon_css = 'display:none;';
$zoom_icon_css = 'display:inline-block;';
} elseif(get_post_meta(get_the_ID(), 'pyre_image_rollover_icons', true) == 'no') {
$link_icon_css = 'display:none;';
$zoom_icon_css = 'display:none;';
} else {
$link_icon_css = 'display:inline-block;';
$zoom_icon_css = 'display:inline-block;';
}
$link_target = "";
$icon_url_check = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true); if(!empty($icon_url_check)) {
$icon_permalink = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
if(get_post_meta(get_the_ID(), 'pyre_link_icon_target', true) == "yes") {
$link_target = ' target="_blank"';
}
} else {
$icon_permalink = get_permalink(get_the_ID());
}
$html .= '<div class="image-extras">
<div class="image-extras-content">';
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
$html .= '<a style="'.$link_icon_css.'" class="icon link-icon" href="'.$icon_permalink.'">Permalink</a>';
if(get_post_meta(get_the_ID(), 'pyre_video_url', true)) {
$full_image[0] = get_post_meta(get_the_ID(), 'pyre_video_url', true);
}
$html .= '<a style="'.$zoom_icon_css.'" class="icon gallery-icon" href="'.$full_image[0].'" rel="prettyPhoto[gallery_recent_'.$recent_works_counter.']" title="'.get_post_field('post_excerpt', get_post_thumbnail_id(get_the_ID())).'"><img style="display:none;" alt="'.get_post_meta(get_post_thumbnail_id(get_the_ID()), '_wp_attachment_image_alt', true).'" />Gallery</a>';
if($data['title_link_image_rollover']) {
$html .= '<h3 class="entry-title"><a href="'.$icon_permalink.'"'.$link_target.'>'.get_the_title().'</a></h3>';
} else {
$html .= '<h3 class="entry-title">'.get_the_title().'</h3>';
};
$html .= '<h4>'.get_the_term_list(get_the_ID(), 'portfolio_category', '', ', ', '').'</h4>';
$html .= '</div>
</div>
</div>';
$html .= '<div class="portfolio-content">
<h2><a href="'.$permalink.'">'.get_the_title().'</a></h2>
<h4>'.get_the_term_list(get_the_ID(), 'horse_categories', '', ', ', '').'</h4>';
$excerpt_length = $excerpt_words;
$stripped_content = strip_shortcodes( tf_content( $excerpt_length, $data['strip_html_excerpt'] ) );
$html .= $stripped_content;
if($columns == 1):
$html .= '<div class="buttons">
<a href="'.$permalink.'" class="green button small">'.__('Learn More', 'Avada').'</a>';
if(get_post_meta(get_the_ID(), 'pyre_project_url', true)):
$html .= '<a href="'.get_post_meta(get_the_ID(), 'pyre_project_url', true).'" class="green button small">'.__('View Project', 'Avada').'</a>';
endif;
$html .= '</div>';
endif;
$html .= '</div>';
endif;
$html .= '</div>';
endif;
endwhile;
wp_reset_query();
$html .= '</div>';
$html .= '</div>';
}
$recent_works_counter++;
return $html;
}

View File

@ -466,12 +466,7 @@ body,#nav ul li ul li a,#sticky-nav ul li ul li a
.avada-container h3,
.review blockquote div strong,
.footer-area h3,
#slidingbar-area h3,
.button.large,
.button.small,
.comment-form input[type="submit"],
.wpcf7-form input[type="submit"],
.gform_wrapper .gform_button{
#slidingbar-area h3 {
font-weight:bold;
}
.meta .date,
@ -529,6 +524,7 @@ table th,.project-content .project-info h4,
.comment-form input[type="submit"], .gform_button,
.wpcf7-form input[type="submit"],
.gform_wrapper .gform_button,
.button.large, .button.small,
.woocommerce-success-message .button {
font-family:<?php echo $headings_font; ?>;
}
@ -877,6 +873,7 @@ body a{color:<?php echo $data['link_color']; ?>;}
<?php if($data['sep_color']): ?>
.sep-single{background-color:<?php echo $data['sep_color']; ?> !important;}
.sep-double,.sep-dashed,.sep-dotted,.search-page-search-form{border-color:<?php echo $data['sep_color']; ?> !important;}
.ls-avada, .avada-skin-rev,.clients-carousel .es-carousel li img,h5.toggle a,.progress-bar,
#small-nav,.portfolio-tabs,.faq-tabs,.single-navigation,.project-content .project-info .project-info-box,
.post .meta-info,.grid-layout .post,.grid-layout .post .content-sep,

View File

@ -8,6 +8,7 @@ function drg_remove_post_formats() {
// Añadir tamaños de imagen
add_image_size('portfolio-three-vertical', 300, 421, true);
add_image_size('related-img-vertical', 180, 235, true);
// Custom post types
require_once(get_stylesheet_directory() . '/framework/custom_post_types.php');
@ -15,6 +16,10 @@ require_once(get_stylesheet_directory() . '/framework/custom_post_types.php');
// Custom meta boxes
require_once(get_stylesheet_directory() . '/framework/custom_meta_boxes.php');
// Custom shortcodes
require_once(get_stylesheet_directory() . '/framework/custom_shortcodes.php');
/* * ***********************************************************************************
* Escribir LOG
* *********************************************************************************** */

View File

@ -1,3 +1,5 @@
<?php wp_enqueue_style('horse-tree', get_stylesheet_directory_uri() . '/css/horse-tree.css'); ?>
<?php get_header(); ?>
<?php
global $data;

View File

@ -217,7 +217,8 @@ img[class^="wp-image"]{
border: none;
}
.post-content h2, .title h2, #main .post-content .title h2, .page-title h1, #main .post h2 a {
.recent-posts-content h4 {
text-transform: none;
}
.share-box { height: 55px; }
@ -226,13 +227,38 @@ img[class^="wp-image"]{
.image{ overflow:visible; }
.clients-carousel .es-carousel li img {
border-color: transparent !important;
}
.es-carousel ul li h5, clients-carousel .es-carousel ul li h5 {
text-align: center;
}
.caroufredsel_wrapper {
overflow: visible !important;
display: inline-block !important;
padding-bottom: 5px;
}
.recent-works-carousel {
overflow: visible;
}
.related-posts.related-horses .image{
width:180px;
height:235px;
margin-bottom:0;
}
/* FORMS */
.button.small,#reviews input#submit,.wpcf7-form input[type="submit"],.comment-form input[type="submit"],.price_slider_amount button,.gform_wrapper .gform_button {
font-size: 13px !important;
line-height: 32px !important;
}
.wpcf7-form input[type="submit"],.comment-form input[type="submit"] { font-weight: normal !important; }
.gform_wrapper .gfield input[type=text]:focus,
@ -258,11 +284,11 @@ img[class^="wp-image"]{
}
.project-content .project-description{
float:right;
width:58%;
width:68%;
}
.project-content .project-info{
float:left;
width:37%;
width:27%;
}
.project-content .project-info .heading {

View File

@ -306,12 +306,7 @@ body,#nav ul li ul li a,#sticky-nav ul li ul li a
.avada-container h3,
.review blockquote div strong,
.footer-area h3,
#slidingbar-area h3,
.button.large,
.button.small,
.comment-form input[type="submit"],
.wpcf7-form input[type="submit"],
.gform_wrapper .gform_button{
#slidingbar-area h3 {
font-weight:bold;
}
.meta .date,
@ -352,6 +347,7 @@ table th,.project-content .project-info h4,
.comment-form input[type="submit"], .gform_button,
.wpcf7-form input[type="submit"],
.gform_wrapper .gform_button,
.button.large, .button.small,
.woocommerce-success-message .button {
font-family:"Roboto", Arial, Helvetica, sans-serif !important;
}
@ -547,6 +543,7 @@ body a{color:#395b7b;}
.sep-single{background-color:#e0dede !important;}
.sep-double,.sep-dashed,.sep-dotted,.search-page-search-form{border-color:#e0dede !important;}
.ls-avada, .avada-skin-rev,.clients-carousel .es-carousel li img,h5.toggle a,.progress-bar,
#small-nav,.portfolio-tabs,.faq-tabs,.single-navigation,.project-content .project-info .project-info-box,
.post .meta-info,.grid-layout .post,.grid-layout .post .content-sep,