git-svn-id: https://192.168.0.254/svn/Proyectos.EstudioJuridicoAlmagro_Web/trunk@4 c22fe52d-42d7-ba4f-95f7-33effcf65713
226 lines
6.5 KiB
PHP
226 lines
6.5 KiB
PHP
<?php
|
|
|
|
global $wpv_hsidebars_widths, $wpv_slider_shortcode_styles;
|
|
|
|
$wpv_hsidebars_widths = array(
|
|
'full' => 'Full',
|
|
'one_half' => '1/2',
|
|
'one_third' => '1/3',
|
|
'one_fourth' => '1/4',
|
|
'one_fifth' => '1/5',
|
|
'one_sixth' => '1/6',
|
|
'two_thirds' => '2/3',
|
|
'three_fourths' => '3/4',
|
|
'two_fifths' => '2/5',
|
|
'three_fifths' => '3/5',
|
|
'four_fifths' => '4/5',
|
|
'five_sixths' => '5/6',
|
|
);
|
|
|
|
$wpv_slider_shortcode_styles = array(
|
|
'gallery' => __('Gallery', 'wpv') ,
|
|
'showcase' => __('Showcase', 'wpv') ,
|
|
);
|
|
|
|
function po_shortcode_slider_width($width, $style) {
|
|
if($style == 'showcase') {
|
|
$width -= 192;
|
|
}
|
|
return $width;
|
|
}
|
|
add_filter('wpv_shortcode_slider_width', 'po_shortcode_slider_width',10,2);
|
|
|
|
function get_slider_design($animation) {
|
|
$groups = array(
|
|
'fade' => 'navigation-preview',
|
|
'slide' => 'navigation-preview',
|
|
'slideMultipleCaptions' => 'navigation-preview',
|
|
'gridFadeQueue' => 'face',
|
|
'gridWaveBL2TR' => 'face',
|
|
'gridRandomSlideDown' => 'face',
|
|
'zoomIn' => 'caption-center',
|
|
'shrink' => 'side-caption',
|
|
'peek' => 'peek',
|
|
);
|
|
|
|
return $groups[$animation];
|
|
}
|
|
|
|
function po_post_header($meta) {
|
|
global $post;
|
|
|
|
$link = has_post_format('link') ?
|
|
get_post_meta($post->ID, 'post-link', true) :
|
|
get_permalink();
|
|
|
|
if(!is_single()):
|
|
?>
|
|
<header>
|
|
<h1>
|
|
<?php /*<a href="< ? php echo $link ? >" title=" < ? php the_title() ? >">< ? php the_title(); ? ></a>*/ ?>
|
|
<?php the_title(); ?>
|
|
</h1>
|
|
<?php if($meta && !wpv_get_option('hide-post-author')): ?><span class="author"><?php _e('by', 'wpv');?> <b><?php the_author_posts_link()?></b></span><?php endif ?>
|
|
</header>
|
|
<?php
|
|
endif;
|
|
}
|
|
|
|
/**
|
|
* echos the html for the post's featured image
|
|
*
|
|
* @returns 'no-image' or $img_style
|
|
*/
|
|
function po_post_image($img_style, $width='full') {
|
|
$has_image = 'no-image';
|
|
|
|
if( $img_style == 'sideimage' || $img_style == 'right sideimage'): // not full width images
|
|
$img = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');
|
|
if(isset($img[0])):
|
|
$has_image = $img_style;
|
|
|
|
$class = '';
|
|
if($img_style == 'right sideimage') {
|
|
$class .= 'alignright';
|
|
}
|
|
?>
|
|
<div class="post-thumb <?php echo $class?>">
|
|
<?php /*<a class="< ? php if(is_single()):? >lightbox< ? php endif ? >" href="< ? php echo is_single() ? $img[0] : get_permalink(); ? > ">*/ ?>
|
|
<a class="lightbox" href="<?php echo $img[0]; ?>">
|
|
<?php wpv_lazy_load(wpv_resize_image($img[0], wpv_get_option('post-thumbnail-width'), wpv_get_option('post-thumbnail-height')), get_the_title(), array(
|
|
'width' => (int)wpv_get_option('post-thumbnail-width'),
|
|
'height' => wpv_get_option('post-thumbnail-height')
|
|
)) ?>
|
|
</a>
|
|
</div>
|
|
<?php
|
|
endif;
|
|
else:
|
|
$width = ($width=='full') ? wpv_str_to_width($width)-106-10-8 : wpv_str_to_width($width);
|
|
$img = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');
|
|
if(isset($img[0])):
|
|
$has_image = $img_style;
|
|
?>
|
|
<div class="post-full-thumb">
|
|
<a class="<?php if(is_single()):?>lightbox<?php endif?>" href="<?php echo is_single() ? $img[0] : get_permalink(); ?>">
|
|
<?php wpv_lazy_load(wpv_resize_image($img[0], $width, wpv_get_option('fullimage-height')), get_the_title(), array(
|
|
'width' => $width,
|
|
'height' => wpv_get_option('fullimage-height')
|
|
))?>
|
|
</a>
|
|
</div>
|
|
<?php
|
|
endif;
|
|
endif;
|
|
|
|
return $has_image;
|
|
}
|
|
|
|
/**
|
|
* echos the html for the page's featured image
|
|
*
|
|
* @returns 'no-image' or'fullimage'
|
|
*/
|
|
function po_page_image() {
|
|
$has_image = 'no-image';
|
|
|
|
$width = wpv_get_central_column_width()-8;
|
|
$img = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');
|
|
if(isset($img[0])):
|
|
$has_image = 'fullimage';
|
|
?>
|
|
<div class="post-full-thumb">
|
|
<a class="lightbox thumbnail" href="<?php echo $img[0]; ?>">
|
|
<?php wpv_lazy_load(wpv_resize_image($img[0], $width, wpv_get_option('fullimage-height')), get_the_title())?>
|
|
</a>
|
|
</div>
|
|
<?php
|
|
endif;
|
|
|
|
return $has_image;
|
|
}
|
|
|
|
// Produces an avatar image
|
|
function po_get_gravatar() {
|
|
$avatar_email = get_comment_author_email();
|
|
$avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar( $avatar_email, 50 ) );
|
|
echo $avatar;
|
|
}
|
|
|
|
// Custom callback to list comments
|
|
function po_comments($comment, $args, $depth) {
|
|
$GLOBALS['comment'] = $comment;
|
|
$GLOBALS['comment_depth'] = $depth;
|
|
?>
|
|
<li id="comment-<?php comment_ID() ?>" <?php comment_class() ?>>
|
|
<div class="comment-author">
|
|
<?php po_get_gravatar(); ?>
|
|
<span title="<?php comment_time(); ?>"><?php comment_date(); ?></span>
|
|
</div>
|
|
<div class="comment-content">
|
|
<div class="comment-meta">
|
|
<?php comment_author_link(); ?>
|
|
<?php // echo the comment reply link with help from Justin Tadlock http://justintadlock.com/ and Will Norris http://willnorris.com/
|
|
if($args['type'] == 'all' || get_comment_type() == 'comment') :
|
|
comment_reply_link(array_merge($args, array(
|
|
'reply_text' => __('Reply','shape'),
|
|
'login_text' => __('Log in to reply.','shape'),
|
|
'depth' => $depth,
|
|
'before' => '<div class="comment-reply-link">',
|
|
'after' => '</div>'
|
|
)));
|
|
endif;
|
|
?>
|
|
</div>
|
|
<?php if ($comment->comment_approved == '0') _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'shape') ?>
|
|
<?php comment_text() ?>
|
|
<?php edit_comment_link('Edit') ?>
|
|
</div>
|
|
<div class="clearfix"></div>
|
|
<?php } // end po_comments
|
|
|
|
function po_share_class($class) {
|
|
$class .= ' wire-pad alignnone';
|
|
|
|
return $class;
|
|
}
|
|
add_filter('wpv_share_class', 'po_share_class');
|
|
|
|
function po_version_check() {
|
|
$this_version = THEME_VERSION;
|
|
|
|
$last_version = wpv_get_option('po_installed_version');
|
|
$updated = false;
|
|
|
|
if(empty($last_version)) {
|
|
$last_version = '1.0';
|
|
}
|
|
|
|
if(version_compare($last_version, '1.1', '<=')) {
|
|
po_update_prepare('1.1');
|
|
$updated = true;
|
|
}
|
|
|
|
if($updated) {
|
|
wpv_update_option('po_installed_version', $this_version);
|
|
}
|
|
}
|
|
add_action('admin_init', 'po_version_check');
|
|
|
|
function po_update_prepare($after) {
|
|
switch($after) {
|
|
case '1.1':
|
|
$posts = get_posts(array(
|
|
'post_type' => array('post', 'page', 'portfolio'),
|
|
'posts_per_page' => -1,
|
|
));
|
|
|
|
foreach($posts as $post) {
|
|
update_post_meta($post->ID, 'use-global-options', 'false');
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
|