isMobile(); $kippis_options = kippis_get_options(); if ($kippis_is_smartphone) add_filter('stylesheet_uri','kippis_stylesheet_uri'); require(get_template_directory() . '/inc/define.php'); load_theme_textdomain('kippis',get_template_directory() . '/languages'); $locale = get_locale(); $locale_file = get_template_directory() . "/languages/$locale.php"; if (is_readable($locale_file)) require_once($locale_file); add_editor_style(); register_nav_menus(array('primary' => __('Primary Menu' ,'kippis') ,'secondary' => __('Secondary menu','kippis') )); add_theme_support('automatic-feed-links'); add_theme_support('post-formats',array('gallery','image')); add_theme_support('post-thumbnails'); set_post_thumbnail_size(KIPPIS_THUMBNAIL_WIDTH,KIPPIS_THUMBNAIL_HEIGHT,true); add_image_size('pic-icon' ,KIPPIS_IMAGE_ICON_WIDTH ,KIPPIS_IMAGE_ICON_HEIGHT ); // Mobile thumbnails. add_action('wp_enqueue_scripts','kippis_enqueue_scripts'); add_action('admin_menu' ,'kippis_adjust_admin_menu',999); if (is_admin()) require_once(get_template_directory() . '/options/kippis_admin.php'); }} require(get_template_directory() . '/inc/widget_post.php' ); if (!function_exists('kippis_enqueue_scripts')) { function kippis_enqueue_scripts() { wp_enqueue_script('jquery'); wp_enqueue_script('kippis_script_js',get_template_directory_uri() . '/inc/script.js'); if (is_singular() && get_option('thread_comments')) wp_enqueue_script('comment-reply'); }} if (!function_exists('kippis_get_options')) { function kippis_get_options() { if (get_option('kippis_all_background') !== false) kippis_get_options_upgrade_options(); include get_template_directory() . '/options/init_fields.php'; $kippis_options = array(); $arrOptions = get_option('kippis'); if (empty($arrOptions)) { // If upgraded from a version prior to 1.10, convert options. foreach ($options as $option) { if (!(($option['type'] == 'open') || ($option['type'] == 'close') || ($option['type'] == 'displayonly'))) { $kippis_options[$option['id']] = $option['std']; } } update_option('kippis',$kippis_options); } else { foreach ($options as $option) { if (!(($option['type'] == 'open') || ($option['type'] == 'close') || ($option['type'] == 'displayonly'))) { if (isset($arrOptions[$option['id']])) $kippis_options[$option['id']] = $arrOptions[$option['id']]; else $kippis_options[$option['id']] = $option['std']; // New items. } } } return $kippis_options; }} if (!function_exists('kippis_get_options_upgrade_options')) { function kippis_get_options_upgrade_options() { // Upgrade from 0.99.20, where options were stored one row per item in the wp_options table. Now it's a single row. global $wpdb; $data = $wpdb->get_results('select option_name,option_value from wp_options where option_name like "kippis_%" order by option_name','ARRAY_A'); $istop = count($data); if ($istop > 0) { $arrOptions = array(); for ($i = 0; $i < $istop; $i++) { if (($data[$i]['option_name'] == 'kippis_body_image') || ($data[$i]['option_name'] == 'kippis_header_image')) { $val = get_option($data[$i]['option_name']); $arrOptions[$data[$i]['option_name']] = array('url' => $val['url' ] ,'file' => $val['file' ] ,'width' => $val['width' ] ,'height' => $val['height']); } else $arrOptions[$data[$i]['option_name']] = $data[$i]['option_value']; delete_option($data[$i]['option_name']); } update_option('kippis',$arrOptions); } }} if (!function_exists('kippis_stylesheet_uri')) { function kippis_stylesheet_uri() { $stylesheet_uri = get_template_directory_uri() . "/style_mobile.css"; return $stylesheet_uri; }} if (!function_exists('kippis_echo_css')) { function kippis_echo_css() { global $kippis_is_smartphone; global $kippis_options; global $kippis_sidebar_enable_left; global $kippis_sidebar_enable_right; global $kippis_sidebars_left; global $kippis_sidebars_right; $options_css = get_option('kippis_css'); if (empty($options_css)) { include get_template_directory() . '/options/generate_css.php'; kippis_update_options_css(); $options_css = get_option('kippis_css'); } echo '' . "\n"; }} if (!function_exists('kippis_admin_header_image')) { function kippis_admin_header_image() { ?>
' . __('Continue reading ','kippis') . ''; }} if (!function_exists('kippis_auto_excerpt_more')) { function kippis_auto_excerpt_more($more) { return ' …' . kippis_continue_reading_link(); }} if (!function_exists('kippis_custom_excerpt_more')) { function kippis_custom_excerpt_more($output) { if (has_excerpt() && !is_attachment()) { $output .= kippis_continue_reading_link(); } return $output; }} add_filter('excerpt_length' ,'kippis_excerpt_length' ); add_filter('excerpt_more' ,'kippis_auto_excerpt_more' ); add_filter('get_the_excerpt','kippis_custom_excerpt_more'); // // Excerpt End // //----------------------------------------------------------------------------------------------------------------------------- if (!function_exists('kippis_page_menu_args')) { function kippis_page_menu_args($args) { $args['show_home'] = true; return $args; }} add_filter('wp_page_menu_args','kippis_page_menu_args'); if (!function_exists('kippis_content_nav')) { function kippis_content_nav($nav_id) { global $wp_query; if ($wp_query->max_num_pages > 1) { ?> ]*?href=[\'"](.+?)[\'"]/is',get_the_content(),$matches)) return false; return esc_url_raw($matches[1]); }} //----------------------------------------------------------------------------------------------------------------------------- // // Sidebars Begin // if (!function_exists('kippis_enable_sidebars')) { function kippis_enable_sidebars() { global $kippis_options; global $kippis_sidebars_left; global $kippis_sidebars_right; global $kippis_sidebar_enable_left; global $kippis_sidebar_enable_right; $kippis_sidebars_left = $kippis_options['kippis_sidebars_position'] == 'left'; $kippis_sidebars_right = $kippis_options['kippis_sidebars_position'] == 'right'; $kippis_sidebar_enable_left = (($kippis_options['kippis_sidebar_left_enable' ] == 'on') & ($kippis_options['kippis_sidebar_left_width' ] > 0)); $kippis_sidebar_enable_right = (($kippis_options['kippis_sidebar_right_enable'] == 'on') & ($kippis_options['kippis_sidebar_right_width'] > 0)); if ($kippis_sidebar_enable_left || $kippis_sidebar_enable_right) { $bSingular = is_singular(); $post_format = get_post_format(); $post_type = get_post_type(); $bGallery = ($post_format == 'gallery') || ($post_type == 'attachment'); $bPage = get_post_type() == 'page'; $bPost = (!$bPage) && ( $bSingular); $bPosts = (!$bPage) && (!$bSingular); if ($kippis_sidebar_enable_left) { if ($bGallery) $kippis_sidebar_enable_left = $kippis_options['kippis_sidebar_left_enable_gallery' ] == 'on'; else if ($bPage ) $kippis_sidebar_enable_left = $kippis_options['kippis_sidebar_left_enable_page' ] == 'on'; else if ($bPost ) $kippis_sidebar_enable_left = $kippis_options['kippis_sidebar_left_enable_post' ] == 'on'; else if ($bPosts ) $kippis_sidebar_enable_left = $kippis_options['kippis_sidebar_left_enable_posts' ] == 'on'; } if ($kippis_sidebar_enable_right) { if ($bGallery) $kippis_sidebar_enable_right = $kippis_options['kippis_sidebar_right_enable_gallery'] == 'on'; else if ($bPage ) $kippis_sidebar_enable_right = $kippis_options['kippis_sidebar_right_enable_page' ] == 'on'; else if ($bPost ) $kippis_sidebar_enable_right = $kippis_options['kippis_sidebar_right_enable_post' ] == 'on'; else if ($bPosts ) $kippis_sidebar_enable_right = $kippis_options['kippis_sidebar_right_enable_posts' ] == 'on'; } } }} if (!function_exists('kippis_register_sidebar')) { function kippis_register_sidebar($id,$name,$desc = '') { register_sidebar(array('id' => $id // Sidebar id - Must be all in lowercase, with no spaces. ,'name' => $name // Sidebar name. ,'description' => $desc // Text description of what/where the sidebar is. Shown(?) on widget management screen. ,'before_widget' => '' // HTML to place after every widget. ,'before_title' => '',''); kippis_delete_comment_link(get_comment_ID()); ?>
" . htmlentities($matches[1]) . ""."code>";'),$src);
if ($encoded) return $encoded;
else return $src;
}}
add_filter('pre_comment_content','kippis_encode_code_in_comment');
if (!function_exists('kippis_posted_on')) {
function kippis_posted_on()
{
global $kippis_options;
$show_author = $kippis_options['kippis_posts_author_enable'] == 'on';
$show_date = $kippis_options['kippis_posts_date_enable' ] == 'on';
if ($show_author || $show_date) {
printf('%1$s'
. ''
. ' '
,($show_date ? __('Posted on','kippis') . ' ' : '')
,($show_date ? esc_url (get_permalink()) : '')
,($show_date ? esc_attr(get_the_time()) : '')
,($show_date ? esc_attr(get_the_date('c')) : '')
,($show_date ? esc_html(get_the_date()) : '')
,($show_author ? ' ' . __('by','kippis') .' ' : '')
,($show_author ? esc_url (get_author_posts_url(get_the_author_meta('ID'))) : '')
,($show_author ? sprintf (esc_attr__('View all posts by %s','kippis'),get_the_author()) : '')
,($show_author ? esc_html(get_the_author()) : '')
);
}
}}
if (!function_exists('kippis_body_classes')) {
function kippis_body_classes($classes)
{
if (!is_multi_author()) $classes[] = 'single-author';
if ((is_singular()) && (!is_home()) && (!is_page_template('showcase.php')) && (!is_page_template('sidebar-page.php'))) $classes[] = 'singular';
return $classes;
}}
add_filter('body_class','kippis_body_classes');
if (!function_exists('kippis_get_theme_data')) {
function kippis_get_theme_data()
{
return wp_get_theme();
}}
if (!function_exists('kippis_credits')) {
function kippis_credits()
{
$theme_data = kippis_get_theme_data();
echo ''
. 'WordPress theme: '
. '' . $theme_data->get('Name') . ' ' . $theme_data->get('Version') . ''
. '';
}}
if (!function_exists('kippis_is_smartphone')) {
function kippis_is_smartphone()
{
global $kippis_is_smartphone;
return $kippis_is_smartphone;
}}