'
%LINKS%
',
'title_wrap' => '%TITLE%',
'no_link_next' => '‹‹',
'no_link_prev' => '››',
'title' => __('Post %CURRENT% of %MAX%', LANGUAGE_ZONE),
'next_post_class' => 'prev',
'prev_post_class' => 'next',
// 'no_next_class' => 'prev no-act',
// 'no_prev_class' => 'next no-act',
'echo' => true
);
$opts = apply_filters( 'dt_get_next_prev_post_options', wp_parse_args( $opts, $defaults ) );
$opts = wp_parse_args( $opts, $defaults );
$posts = new WP_Query( array(
'no_found_rows' => true,
'fields' => 'ids',
'posts_per_page' => -1,
'post_type' => get_post_type(),
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC'
) );
$current = 1;
foreach( $posts->posts as $index=>$post_id ) {
if( $post_id == get_the_ID() ) {
$current = $index + 1;
break;
}
}
$title = str_replace( array('%CURRENT%', '%MAX%'), array( $current, count( $posts->posts ) ), $opts['title'] );
$output = '';
$output .= str_replace( array('%TITLE%'), array($title), $opts['title_wrap'] );
// next link
ob_start();
next_post_link('%link', '‹‹');
$link = ob_get_clean();
if( $link ) {
$output .= str_replace('href=', 'class="'. $opts['next_post_class']. '" href=', $link);
}else
$output .= $opts['no_link_next'];
// previos link
ob_start();
previous_post_link('%link', '››');
$link = ob_get_clean();
if( $link ) {
$output .= str_replace('href=', 'class="'. $opts['prev_post_class']. '" href=', $link);
}else
$output .= $opts['no_link_prev'];
$output = str_replace( '%LINKS%', $output, $opts['wrap'] );
if( $opts['echo'] ) {
echo $output;
return null;
}
return $output;
}
function dt_get_simple_menu( $opts = array() ) {
$defaults = array(
'menu_name' => 'top-menu',
'wrap' => '',
'item_wrap' => '%TITLE%',
'echo' => true
);
$opts = apply_filters( 'dt_get_simple_menu_options', wp_parse_args($opts, $defaults) );
$opts = wp_parse_args($opts, $defaults);
if( ($locations = get_nav_menu_locations()) && isset($locations[$opts['menu_name']]) ) {
$menu = wp_get_nav_menu_object( $locations[$opts['menu_name']] );
if( $menu ) {
$menu_items = wp_get_nav_menu_items($menu->term_id);
$menu_list = '';
foreach ( (array) $menu_items as $key => $menu_item ) {
$title = $menu_item->title;
$url = $menu_item->url;
$menu_list .= str_replace( array('%URL%', '%TITLE%'), array($url, $title), $opts['item_wrap'] );
}
$menu_list = str_replace( '%ITEMS%', $menu_list, $opts['wrap'] );
if( $opts['echo'] ) {
echo $menu_list;
return false;
}
return $menu_list;
}
}
return null;
}
function dt_get_soc_links() {
$links = of_get_option('social_icons');
if ( empty( $links ) ) {
return '';
}
?>
$data ):
if ( 'skype' != $name ) {
$data['link'] = esc_url( $data['link'] );
} else {
$data['link'] = esc_attr( $data['link'] );
}
?>
'%SLIDER%
',
'class' => 'slider-shortcode flexslider gal',
'items_arr' => array()
);
$opts = wp_parse_args( $opts, $defaults );
if ( empty( $opts['items_arr'] ) )
return '';
$output = '';
foreach( $opts['items_arr'] as $slide ) {
$slide_link = '';
if ( ! empty( $slide['link'] ) ) {
$slide_link = '';
}
$caption = '';
if ( !empty( $slide['caption'] ) ) {
$caption = sprintf(
'%s
',
$slide['caption']
);
}
$output .= ''."\n";
if ( ! isset( $slide['is_video'] ) || $slide['is_video'] == false ) {
$output .= sprintf(
'%s
%s',
$slide_link,
$slide['src'],
( isset( $slide['alt'] ) ? $slide['alt'] : '' ),
$slide['size_str'],
$caption
);
} else {
$output .= dt_get_embed( $slide['src'], $slide['size_str'][0], $slide['size_str'][1], false );
}
$output .= '';
}
$output = '';
$output = str_replace( array(
'%SLIDER%',
'%CLASS%'
), array(
$output,
$opts['class']
), $opts['wrap']
);
if( $echo ) {
echo $output;
}else {
return $output;
}
return false;
}
function dt_get_carousel_slider( array $opts = array(), $echo = true ) {
$defaults = array(
'wrap' => '',
'item_wrap' => '',
'class' => 'list-carousel recent',
'ul_class' => 'carouFredSel_1',
'id' => '',
'items_arr' => array()
);
$opts = wp_parse_args( $opts, $defaults );
$output = '';
foreach ( $opts['items_arr'] as $item ) {
$caption = '';
if ( !isset( $item['href'] ) ) {
if ( isset( $item['post_id'] ) ) {
$item['href'] = get_permalink( $item['post_id'] );
} else {
$item['href'] = '#';
}
}
$output .= str_replace(
array( '%LINK%', '%IMG_SRC%', '%IMG_SIZE%', '%TITLE%', '%DESC%', '%ALT%' ),
array( $item['href'], $item['src'], $item['size_str'], isset($item['title'])?$item['title']:'', isset($item['desc'])?$item['desc']:'', isset($item['alt'])?$item['alt']:'' ),
$opts['item_wrap']
);
}
$ul_id = ! empty( $opts['id'] ) ? ' id="' . $opts['id'] . '"' : '';
$ul_class = ! empty( $opts['ul_class'] ) ? ' class="' . $opts['ul_class'] . '"' : '';
$output = '';
$output = str_replace( array(
'%SLIDER%',
'%CLASS%'
), array(
$output,
$opts['class']
), $opts['wrap']
);
if ( $echo ) {
echo $output;
} else {
return $output;
}
return false;
}
function dt_get_coda_slider( array $opts = array() ) {
$defaults = array(
'wrap' => '',
'item_wrap' => '',
'data' => array(),
'wrap_data' => array(),
'echo' => true
);
$opts = wp_parse_args( $opts, $defaults );
if( empty($opts['data']) || !is_array($opts['data']) ) {
return '';
}
$output = '';
foreach( $opts['data'] as $slide ) {
if( !is_array($slide) ) {
continue;
}
$replace_arr = array();
for( $i = 0; $i < count( $slide ); $i++ ) {
$replace_arr[] = '%' . ($i + 1) . '$s';
if( isset($opts['wrap_data'][$i]) ) {
$slide[$i] = sprintf( $opts['wrap_data'][$i], $slide[$i] );
}
}
$output .= str_replace( $replace_arr, $slide, $opts['item_wrap'] );
}
$output = str_replace( array('%SLIDER%'), array( $output ), $opts['wrap'] );
if( $opts['echo'] ) {
echo $output;
}else {
return $output;
}
return false;
}
function dt_get_carousel_homepage_slider( array $opts = array(), $echo = true ) {
wp_enqueue_script( 'dt_carouselHome', get_template_directory_uri() . '/js/jquery.featureCarousel.js', array('jquery') );
$defaults = array(
'wrap' => '',
'class' => '',
'id' => 'slide',
'items_arr' => array()
);
$opts = wp_parse_args( $opts, $defaults );
$output = '';
foreach( $opts['items_arr'] as $item ) {
$item_output = $no_capt_class = '';
$link = '%s';
if ( ! empty( $item['title'] ) ) {
if ( ! empty( $item['link'] ) ) {
$link = '%s';
$item_output .= '';
} else {
$item_output .= '' . sprintf( $link, $item['title'] ) . '
';
}
}
if ( ! empty( $item['caption'] ) )
$item_output .= '' . $item['caption'] . '
';
if ( ! $item_output )
$no_capt_class = ' no-slide-desc';
$item_link = '';
if ( ! empty( $item['link'] ) ) {
$item_link = '';
}
if ( $item_output )
$item_output = '' . $item_output . '
';
$alt = isset( $item['alt'] ) ? $item['alt'] : '';
$item_output = '
' . $item_output;
$output .= '' . $item_output . $item_link . '
';
}
$output = str_replace(
array( '%SLIDER%', '%CLASS%', '%ID%' ),
array( $output, $opts['class'], $opts['id'] ),
$opts['wrap']
);
if( $echo ) {
echo $output;
}else {
return $output;
}
return false;
}
function dt_get_photo_stack_slider( array $opts = array(), $echo = true ) {
wp_enqueue_script( 'dt_photo_stack', get_template_directory_uri().'/js/photo-stack.js', array('jquery') );
$defaults = array(
'wrap' => '',
'class' => '',
'id' => 'slide',
'items_arr' => array()
);
$opts = wp_parse_args( $opts, $defaults );
$output = '';
foreach ( $opts['items_arr'] as $item ) {
$item_output = $no_capt_class = '';
$link = '%s';
if ( ! empty( $item['link'] ) ) {
$link = '%s';
}
if ( ! empty( $item['title'] ) )
$item_output .= '' . sprintf( $link, $item['title'] ) . '
';
if ( ! empty( $item['caption'] ) )
$item_output .= '' . $item['caption'] . '
';
if ( $item_output )
$item_output = '' . $item_output . '
';
else
$no_capt_class = ' no-slide-desc';
if ( ! empty( $item['link'] ) ) {
$item_output .= ''. sprintf( $link, '' ). '
';
}
if ( $item_output )
$item_output = ''. $item_output. '
';
$alt = isset( $item['alt'] ) ? $item['alt'] : '';
$item_output = '
' . $item_output;
$output .= '';
}
$output = str_replace(
array( '%SLIDER%', '%CLASS%', '%ID%' ),
array( $output, $opts['class'], $opts['id'] ),
$opts['wrap']
);
if( $echo ) {
echo $output;
}else {
return $output;
}
return false;
}
// jfancy slider helper
function dt_get_jfancy_tile_slider( array $opts = array(), $echo = true ) {
wp_enqueue_script( 'dt_jfancy_tile', get_template_directory_uri().'/js/jquery.jfancytile.js', array('jquery') );
$defaults = array(
'wrap' => '',
'class' => '',
'id' => 'slide',
'items_arr' => array()
);
$opts = wp_parse_args( $opts, $defaults );
$output = '';
foreach( $opts['items_arr'] as $item ) {
$item_output = $no_capt_class = '';
$link = '%s';
/*
if( !empty($item['link']) ) {
$link = '%s';
}
*/
if( !empty($item['title']) )
$item_output .= '' . sprintf( $link, $item['title'] ) . '
';
if( !empty($item['caption']) )
$item_output .= '' . $item['caption'] . '
';
if( !$item_output )
$no_capt_class = ' no-slide-desc';
$item_link = '';
if( !empty($item['link']) ) {
$item_link = '';
}
//Ha-ha! Danil made an error here: if slide desc was empty, link was not displaying (even if there was one)
if( $item_output ) {
$item_output = $item_link. '' . $item_output . '
';
} else {
$item_output = $item_link;
}
$alt = isset( $item['alt'] ) ? $item['alt'] : '';
$item_output = '
' . $item_output;
$output .= '' . $item_output . '';
}
$output = str_replace(
array( '%SLIDER%', '%CLASS%', '%ID%' ),
array( $output, $opts['class'], $opts['id'] ),
$opts['wrap']
);
if( $echo ) {
echo $output;
}else {
return $output;
}
return false;
}
// nivo slider helper
function dt_get_nivo_slider( array $opts = array(), $echo = true ) {
$defaults = array(
'wrap' => '',
'class' => 'slider-wrapper theme-default',
'id' => 'slide',
'items_wrap' => '%IMAGES%
%CAPTIONS%',
'items_arr' => array()
);
$opts = wp_parse_args( $opts, $defaults );
if( empty($opts['items_arr']) )
return '';
$output = '';
$images = $caption = '';
$i = 1;
foreach( $opts['items_arr'] as $item ) {
$capt = $capt_class = $no_capt_class = '';
$link = '%s';
/*
if( !empty($item['link']) ) {
$link = '%s';
}
*/
if( !empty($item['title']) ) {
if( !empty($item['link']) ) {
$capt .= '';
} else {
$capt .= '' . sprintf( $link, $item['title'] ) . '
';
}
}
if( !empty($item['caption']) )
$capt .= '' . $item['caption'] . '
';
if( !$capt )
$no_capt_class = ' no-slide-desc';
$item_link = '';
if( !empty($item['link']) ) {
$item_link = ' data-link="'. esc_url($item['link']).'" data-target="'. (empty($item['in_neww'])?'':'_blank').'"';
}
if( $capt ) {
$capt_class = 'caption-' . $i;
$caption .= '';
$capt_class = '.'. $capt_class;
}
$alt = isset( $item['alt'] ) ? $item['alt'] : '';
$images .= '
';
$i++;
}
$output .= str_replace( array('%IMAGES%', '%CAPTIONS%'), array($images, $caption), $opts['items_wrap'] );
$output = str_replace(
array( '%SLIDER%', '%CLASS%', '%ID%' ),
array( $output, $opts['class'], $opts['id'] ),
$opts['wrap']
);
if( $echo ) {
echo $output;
}else {
return $output;
}
return false;
}
// supper fullscreen slider!
function dt_get_fullscreen_slider( array $opts = array(), $echo = true ) {
$defaults = array(
'wrap' => '',
'class' => 'slider-wrapper theme-default',
'id' => 'slide',
'items_wrap' => '%IMAGE%%CAPTION%',
'items_arr' => array()
);
$opts = wp_parse_args( $opts, $defaults );
if( empty($opts['items_arr']) )
return '';
$output = '';
foreach( $opts['items_arr'] as $item ) {
$capt = $capt_class = $no_capt_class = $caption = '';
if( !empty($item['title']) ) {
if( !empty($item['link']) ) {
$capt .= '';
} else {
$capt .= '' . $item['title'] . '
';
}
}
if( !empty($item['caption']) )
$capt .= '' . $item['caption'] . '
';
/*
if( !$capt )
$no_capt_class = ' no-slide-desc';
*/
$item_link = '';
if( !empty($item['link']) ) {
$item_link = '';
}
if( $capt ) {
$caption = ''. $capt . '
';
}
$caption = $caption . $item_link;
$alt = isset( $item['alt'] ) ? $item['alt'] : '';
$image = '
';
$output .= str_replace( array( '%IMAGE%', '%CAPTION%' ), array( $image, $caption ), $opts['items_wrap'] );
}
$output = str_replace(
array( '%SLIDER%', '%CLASS%', '%ID%' ),
array( $output, $opts['class'], $opts['id'] ),
$opts['wrap']
);
if( $echo ) {
echo $output;
}else {
return $output;
}
return false;
}
// OneByOne slider helper
function dt_get_obo_slider( array $items = array(), $echo = true ) {
if( empty($items) )
return '';
$presets_class = apply_filters( 'dt_get_obo_slider-preset_class', '', of_get_option( 'of-preset', 'blue' ) );
$output = $stylesheet = '';
$i = 1;
foreach( $items as $item ) {
$opts = $item['options'];
unset( $item['options'] );
if( 'after' == $opts['text_depth'] ) {
$j = count($item) + 1;
$z_index = count($item) + 5;
}else {
$j = count($item);
$z_index = count($item) + 5;
}
$item_output = '';
// get images
foreach( $item as $image ) {
$stylesheet .= "
.dt-image{$i}_{$j} {
left: {$image['pos_left']}px;
top: {$image['pos_top']}px;
z-index: {$j} !important;
position: absolute;
}
";
$item_output .= '
';
$j--;
}
$desc = ''. $opts['post_content']. '
';
if( 'after' == $opts['text_depth'] ) {
$item_output = $desc. $item_output;
}else {
$item_output .= $desc;
}
$stylesheet .= "
.dt-obo-content_{$i} {
width: {$opts['text_width']}px;
left: {$opts['text_left']}px;
top: {$opts['text_top']}px;
z-index: {$z_index} !important;
position: absolute;
}
";
$output .= ''. $item_output. '
';
$i++;
}
$stylesheet = '\n";
$output = $stylesheet. ''. $output. '
';
if( $echo ) {
echo $output;
}else {
return $output;
}
return false;
}
function dt_details_link( $post_id = null, $class = 'button' ) {
if( empty($post_id) ) {
global $post;
$post_id = $post->ID;
}
$url = get_permalink($post_id);
if( $url ) {
printf(
'',
$url, $class, __('Details', LANGUAGE_ZONE)
);
}
}
// edit post link
function dt_edit_link( $text = null, $post_id = null, $class = 'button' ) {
if( current_user_can('edit_posts')) {
global $post;
if( empty($post_id) && $post ) {
$post_id = $post->ID;
}
if ( empty( $text ) ) { $text = _x( 'Edit', 'default edit button title', LANGUAGE_ZONE ); }
if( !empty($class) )
$class = sprintf( ' class="%s"', esc_attr($class) );
printf( '',
get_edit_post_link($post_id),
$text
);
}
}
function dt_category_list( array $opts ) {
$defaults = array(
'taxonomy' => null,
'post_type' => null,
'layout' => null,
'terms' => array(),
'select' => 'all',
'layout_switcher' => true,
'count_attachments' => false,
'show' => true,
'post_ids' => array()
);
$opts = wp_parse_args( $opts, $defaults );
if( !($opts['taxonomy'] && $opts['post_type'] && $opts['layout'] && ($opts['show'] || $opts['layout_switcher'])) ) {
return '';
}
if( $opts['show'] || $opts['layout_switcher'] ):
$layout = explode('-', $opts['layout']);
if( $opts['show'] ) {
$list = dt_get_category_list( array(
'taxonomy' => $opts['taxonomy'],
'post_type' => $opts['post_type'],
'terms' => $opts['terms'],
'count_attachments' => $opts['count_attachments'],
'select' => $opts['select'],
'post_ids' => $opts['post_ids'],
'hash' => '#%TERM_ID%/%PAGE%/' . (isset($layout[1])?$layout[1]:'list')
), false );
}else
$list = false;
?>
$layout[0],
'current' => $layout[1],
'hash' => '#all/1/%s'
) );
}
?>
$logo,
'thumb_opts' => array( 'w' => $logo[1], 'h' => $logo[2], 'zc' => 0, 'force_zc' => 1, 'r_src' => $r_logo[0] )
),
'
', false
);
} else {
$img_meta = $logo ? $logo : $default;
if ( ! isset( $img_meta['size'] ) && isset( $img_meta[1], $img_meta[2] ) ) { $img_meta['size'] = image_hwstring( $img_meta[1], $img_meta[2] ); }
$output = sprintf( '
', $img_meta[0], $img_meta['size'], $custom );
}
return $output;
}
/* Set some responsivness flag based on option "misc-off_responsivness" */
function dt_is_responsive() {
return absint( ! of_get_option( 'misc-off_responsivness', 0 ) );
}
/* Set some retina flag based on option "misc-retina_images" */
function dt_is_retina_on() {
return absint( of_get_option( 'misc-retina_images', 1 ) );
}
?>