roles ) ) { if($navstyle!="default"){ $navclass = "navbar-static-top"; } } echo $navclass; } function theme_add_footer() { if( wp_script_is( 'jquery', 'done' ) ) { echo ''; } } add_action( 'wp_footer', 'theme_add_footer' ); add_editor_style('style.css'); /* * Filter post title */ function the_subtitle(){ global $post; $subtitle = get_post_meta( $post->ID, 'theme_page_subtitle',true); if($subtitle){ echo $subtitle; } } /* this function will cal filter for single page and post * before was error, replace everysingle page with * the same title, any other filter please add here */ function theme_post_title($title){ global $post; $newtitle = get_post_meta( $post->ID, 'theme_page_title',true); if($newtitle){ return $newtitle; } return $title; } function add_single_filter() { add_filter('the_title','theme_post_title'); } add_action( 'loop_start', 'add_single_filter' ); function theme_get_option($option){ $frontpage_ID = get_option('page_on_front'); $suffix = wp_meta_suffix(); $options = get_post_meta($frontpage_ID,$suffix,true); if(isset($options[$option])){ return $options[$option]; } } function the_postcover(){ global $post; $cover = 0; if(has_post_thumbnail()){ $classes = 'withcover'; $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID)); $cover = 1; }else{ $classes = 'withoutcover'; } ?>
'img-responsive img-fullwidth'));?>

By | | "Twitter", "facebook"=>"Facebook", "pinterest"=>"Pinterest", ); $inpre ='
'; $url = urlencode(get_permalink()); $title = urlencode(html_entity_decode(get_the_title() .' | '.to_html(get_bloginfo()), ENT_COMPAT, 'UTF-8')); if (has_post_thumbnail( $post->ID ) ){ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ),'single-post-thumbnail'); if(!empty($image)){ $image = urlencode($image[0]); } } foreach ($sites as $key => $value){ if($key=="twitter"){ $link = "https://twitter.com/?status=".$title." ".$url; }elseif($key=="facebook"){ $link = "https://facebook.com/share.php?u=".$url; }elseif($key=="pinterest"){ if(!empty($image)){ $link = "http://pinterest.com/pin/create/button/?url=$url&media=$image&description=$title"; } } if(!empty($link)){ $inpre.=''; $inpre.=''.$value.''; $inpre.=''; } $link =""; } $inpre.='
'; return $inpre; } function theme_socialmedia(){ $social = theme_socialmedia_sites(); $inpre =""; foreach ($social as $key => $value){ $url = get_theme_mod($key); if(!empty($url)){ $inpre.=''; } } return $inpre; } function theme_replace_css($content){ $header = get_theme_mod("header"); $color = get_theme_mod("color"); $textcolor = get_theme_mod("text_color"); $brighter = theme_colors($color,10); $darker = theme_colors($color,-10); $search = array('$color','$brighter','$textcolor','$darker','$header'); $replace = array($color,$brighter,$textcolor,$darker,$header); $content = str_replace($search, $replace, $content); return $content; } function theme_file_compress($buffer) { /* remove comments */ $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); /* remove tabs, spaces, newlines, etc. */ $buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer); return $buffer; } function theme_css(){ /* call file api */ require_once(ABSPATH . 'wp-admin/includes/file.php'); WP_Filesystem(); global $wp_filesystem; $path = get_template_directory().'/custom.css'; $topath = get_template_directory().'/custom.min.css'; $filetime = filemtime($topath); $nowtime = time(); $filetime = ceil(($nowtime - $filetime) / 60); $inpre = '= 30 || current_user_can( 'manage_options' )){ $inpre.=' data-admin="1" '; $content = $wp_filesystem->get_contents($path); //file_put_contents($topath,); $wp_filesystem->put_contents($topath, theme_replace_css(theme_file_compress($content)), 0644); } $inpre.=' data-updated="'.$filetime.'" href="'.get_template_directory_uri().'/custom.min.css">'; echo $inpre; } function theme_colors($hex, $steps) { // Steps should be between -255 and 255. Negative = darker, positive = lighter $steps= ($steps / 100) * 255; $steps = max(-255, min(255, $steps)); // Normalize into a six character long hex string $hex = str_replace('#', '', $hex); if (strlen($hex) == 3) { $hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2); } // Split into three parts: R, G and B $color_parts = str_split($hex, 2); $return = '#'; foreach ($color_parts as $color) { $color = hexdec($color); // Convert to decimal $color = max(0,min(255,$color + $steps)); // Adjust color $return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code } return $return; } function theme_showsidebar(){ global $post; $style = get_post_meta( $post->ID, 'theme_page_style',true); if($style=="fullpage"){ return "hide"; }else{ return "show"; } } function theme_pagestyle(){ global $post; $style = get_post_meta( $post->ID, 'theme_page_style',true); $classes = "col-lg-9 col-md-9 col-sm-8"; if($style=="fullpage"){ $classes = "col-lg-12 col-md-12 col-sm-12 col-xs-12"; } echo $classes; } function wp_meta_add(){ global $post; $keywords = get_post_meta( $post->ID, 'theme_page_keywords',true); $description = get_post_meta( $post->ID, 'theme_page_description',true); if(!$keywords){ if(get_theme_mod('keywords')){ $keywords = get_theme_mod('keywords'); } } if(!$description){ if(get_theme_mod('description')){ $description = get_theme_mod('description'); } } if($description || $keywords){ echo ''."\n"; if($description){ echo ''."\n"; } if($keywords){ echo ''."\n"; } echo ''."\n"; } } /* * * */ add_filter( 'comment_form_default_fields', 'theme_comment_formfields' ); function theme_comment_formfields( $fields ) { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $html5 = current_theme_supports( 'html5', 'comment-form' ) ? 1 : 0; $fields = array( 'author' => '
' . ' ' . '
', 'email' => '
' . '
', 'url' => '
' . '
' ); return $fields; } /* * Add suppor for html5 */ function theme_comment_form( $args ) { $args['comment_field'] = '
'; $args['class_submit'] = 'btn btn-default'; // since WP 4.1 return $args; } add_filter( 'comment_form_defaults', 'theme_comment_form' ); /* * Add suppor for html5 */ function custom_theme_setup() { add_theme_support( 'html5', array( 'comment-list' ) ); } add_action( 'after_setup_theme', 'custom_theme_setup' ); /* * * Breadcrumbs for pagination * */ function the_breadcrumb() { echo ''; } /* * * WP HEAD APPEND * */ add_action('wp_head', 'theme_append_head'); function theme_append_head($content){?>