[' => '[', ']
' => ']', ']]*>)(.*?)!is', 'eg_clean_pre', $pee ); return $pee; } function eg_clean_pre($matches) { if ( is_array($matches) ) $text = $matches[1] . $matches[2] . ""; else $text = $matches; $text = str_replace('
]*?>.*?
@si', '', $text); $text = str_replace('\]\]\>', ']]>', $text); $text = strip_tags($text, '');
$excerpt_length = 50;
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words)> $excerpt_length) {
array_pop($words);
array_push($words, '... ');
$text = implode(' ', $words);
} else {
$text .= '';
}
}
return $text;
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'icefit_improved_trim_excerpt');
/*--------------------- Rewrite Gallery Shortcode ---------------------*/
function icefit_gallery_shortcode($attr) {
$post = get_post();
static $instance = 0;
$instance++;
if ( ! empty( $attr['ids'] ) ) {
// 'ids' is explicitly ordered, unless you specify otherwise.
if ( empty( $attr['orderby'] ) )
$attr['orderby'] = 'post__in';
$attr['include'] = $attr['ids'];
}
// Allow plugins/themes to override the default gallery template.
$output = apply_filters('post_gallery', '', $attr);
if ( $output != '' )
return $output;
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
if ( isset( $attr['orderby'] ) ) {
$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
if ( !$attr['orderby'] )
unset( $attr['orderby'] );
}
extract(shortcode_atts(array(
'order' => 'ASC',
'orderby' => 'menu_order ID',
'id' => $post->ID,
'itemtag' => 'dl',
'icontag' => 'dt',
'captiontag' => 'dd',
'columns' => 3,
'size' => 'thumbnail',
'include' => '',
'exclude' => ''
), $attr));
$id = intval($id);
if ( 'RAND' == $order )
$orderby = 'none';
if ( !empty($include) ) {
$_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
$attachments = array();
foreach ( $_attachments as $key => $val ) {
$attachments[$val->ID] = $_attachments[$key];
}
} elseif ( !empty($exclude) ) {
$attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
} else {
$attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
}
if ( empty($attachments) )
return '';
if ( is_feed() ) {
$output = "\n";
foreach ( $attachments as $att_id => $attachment )
$output .= wp_get_attachment_link($att_id, $size, true) . "\n";
return $output;
}
$itemtag = tag_escape($itemtag);
$captiontag = tag_escape($captiontag);
$icontag = tag_escape($icontag);
$valid_tags = wp_kses_allowed_html( 'post' );
if ( ! isset( $valid_tags[ $itemtag ] ) )
$itemtag = 'dl';
if ( ! isset( $valid_tags[ $captiontag ] ) )
$captiontag = 'dd';
if ( ! isset( $valid_tags[ $icontag ] ) )
$icontag = 'dt';
$columns = intval($columns);
$itemwidth = $columns > 0 ? floor(90/$columns) : 100;
$float = is_rtl() ? 'right' : 'left';
$selector = "gallery-{$instance}";
$gallery_style = $gallery_div = '';
if ( apply_filters( 'use_default_gallery_style', true ) )
$gallery_style = "
";
$size_class = sanitize_html_class( $size );
$gallery_div = "
';
}
$output .= "
',
'after_title' => '
',
)
);
register_sidebar( array(
'name' => __( 'Footer', 'icefit' ),
'id' => 'footer-sidebar',
'description' => '',
'class' => '',
'before_widget' => '',
'after_title' => '
',
)
);
/*--------------- Dynamic Footer Code -------------*/
function icefit_dynamic_footer() {
echo icefit_get_option('tracking_code');
}
add_action('wp_footer', 'icefit_dynamic_footer');
/*--------------- Dynamic CSS -------------*/
// Add 'dynamiccss' to the list of valid query vars
function icefit_dynamiccss_query_vars($vars) {
$new_vars = array('dynamiccss');
$vars = $new_vars + $vars;
return $vars;
}
add_filter('query_vars', 'icefit_dynamiccss_query_vars');
// Check request args and proceed to output dynamic CSS
function icefit_dynamiccss_parse_request($wp) {
// only process requests with "dynamiccss=1"
if (array_key_exists('dynamiccss', $wp->query_vars)
&& $wp->query_vars['dynamiccss'] == '1') {
icefit_dynamiccss_output($wp);
}
}
add_action('parse_request', 'icefit_dynamiccss_parse_request');
// Generate dynamic CSS
function icefit_dynamiccss_output() {
$custom_css = "";
$custom_css .= "#main-wrap { background: white; }";
// Boxed layout
if ('Boxed' == icefit_get_option('layout') ) {
$background_color = icefit_get_option('background_color');
$background_image = icefit_get_option('background_image');
$custom_css .= "body {
background-image: url('".$background_image."');
background-color: ".$background_color.";
}";
}
// Headings font
$custom_css .= 'h1, h2, h3, h4, h5, h6, h1.page-title, h1.entry-title, #page-container h1, #page-container h2, #page-container h3, #page-container h4, #page-container h5, #page-container h6, #page-container h1 a, #page-container h2 a, #page-container h3 a, #page-container h4 a, #page-container h5 a, #page-container h6 a, #page-container h1 a:visited, #page-container h2 a:visited, #page-container h3 a:visited, #page-container h4 a:visited, #page-container h5 a:visited, #page-container h6 a:visited, #navbar, .flex-caption, .meta-date, .meta-comments, .editlink, .read-more, .page_nav div, .paged_nav, .article_nav div, .commentlist .comment-author, .commentlist .commentmetadata, .commentlist .comment .comment-body .reply, .comments_nav div, label, input[type="submit"], input[type="reset"], input[type="button"], #sidebar, #sidebar .widget-title, #sidebar > li > *, #footer, #footer .widget-title, #footer li > *, .single-post .tags, .dropcap, .button, ul.tabs li a, .toggle p.trigger, .accordions .accordion p.trigger, .slide-title, #page-container.portfolio-page .filter li a, .meta-client, .meta-category, .testimonial-author {font-family: '.icefit_get_option('headings_font').', Helvetica, Arial, Verdana, sans-serif;}';
// Main color
$custom_css .= '#navbar .current-menu-item, #navbar ul li:hover, #navbar ul li:focus, .flex-caption, .meta-date, .read-more, .page_nav div, .paged_nav a, .article_nav div, .commentlist .comment .comment-body .reply, .comments_nav div, input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus, textarea:focus, input[type="submit"], input[type="reset"], input[type="button"], #footer .tagcloud a:hover, #footer .tagcloud a:focus, .single-post .tags a:hover, .single-post .tags a:focus, .button, ul.tabs li a.active, ul.tabs li a:hover, .toggle p.trigger:hover, .accordions .accordion p.trigger:hover, #page-container.portfolio-page .filter li.current a, #page-container.portfolio-page .filter li:hover a, .caroufredsel-wrap .prev:hover, .caroufredsel-wrap .next:hover, ul.contactinfo-widget li.contactinfo-widget-form a, .flex-direction-nav li a:hover {background-color:'.icefit_get_option('main_color').";}";
$custom_css .= '#page-container h1 a, #page-container h2 a, #page-container h3 a, #page-container h4 a, #page-container h5 a, #page-container h6 a, #page-container h3.entry-title a:hover, a, a:visited, #sidebar > li > * a:hover, #footer .container .widget a:hover, #footer .container .widget a:focus, .sub-footer-right .menu li a:hover, .sub-footer-right .menu li a:focus {color: '.icefit_get_option('main_color').';}';
$custom_css .= 'ul.tabs-content {border-top-color:'.icefit_get_option('main_color').';}';
$custom_css .= '.portfolio-desc, .cta-button a {border-bottom-color : '.icefit_get_option('main_color').';}';
$custom_css .= '.cta {border-left-color : '.icefit_get_option('main_color').';}';
// User defined additional custom CSS
$custom_css .= icefit_get_option('custom_css');
header('Content-type: text/css');
echo $custom_css;
die();
}
?>