$word_limit)
array_pop($words);
return implode(' ', $words);
}
if ( ! function_exists( 'skt_iamone_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*/
function skt_iamone_setup() {
if ( ! isset( $content_width ) )
$content_width = 640; /* pixels */
load_theme_textdomain( 'skt-iamone', get_template_directory() . '/languages' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
add_image_size('homepage-thumb',240,145,true);
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'skt-iamone' ),
) );
add_theme_support( 'custom-background', array(
'default-color' => '000000'
) );
add_editor_style( 'editor-style.css' );
}
endif; // skt_iamone_setup
add_action( 'after_setup_theme', 'skt_iamone_setup' );
function skt_iamone_widgets_init() {
register_sidebar( array(
'name' => __( 'Blog Sidebar', 'skt-iamone' ),
'description' => __( 'Appears on blog page sidebar', 'skt-iamone' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'skt_iamone_widgets_init' );
if ( !function_exists( 'optionsframework_init' ) ) {
define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/' );
require_once dirname( __FILE__ ) . '/inc/options-framework.php';
}
function skt_iamone_scripts() {
wp_enqueue_style( 'skt_iamone-gfonts-opensans', '//fonts.googleapis.com/css?family=Open+Sans:400,600,700' );
wp_enqueue_style( 'skt_iamone-gfonts-roboto', '//fonts.googleapis.com/css?family=Roboto:400,100,300,500,700' );
wp_enqueue_style( 'skt_iamone-gfonts-lobster', '//fonts.googleapis.com/css?family=Lobster' );
wp_enqueue_style( 'skt_iamone-gfonts-opensanscondensed', '//fonts.googleapis.com/css?family=Open+Sans+Condensed:300' );
wp_enqueue_style( 'skt_iamone-gfonts-lato', '//fonts.googleapis.com/css?family=Lato:400,900,400italic,700,300italic,300,700italic' );
wp_enqueue_style( 'skt_iamone-basic-style', get_stylesheet_uri() );
wp_enqueue_style( 'skt_iamone-editor-style', get_template_directory_uri().'/editor-style.css' );
wp_enqueue_style( 'skt_iamone-base-style', get_template_directory_uri().'/css/style_base.css' );
if ( (of_get_option('innerpageslider', true) != 'hide') || is_home() || is_front_page() ) {
wp_enqueue_style( 'skt_iamone-supersized-default-theme', get_template_directory_uri().'/css/supersized.css' );
wp_enqueue_style( 'skt_iamone-supersized-style', get_template_directory_uri().'/css/supersized.shutter.css' );
wp_enqueue_script( 'skt_iamone-supersized-easing', get_template_directory_uri() . '/js/jquery.easing.min.js', array('jquery') );
wp_enqueue_script( 'skt_iamone-supersized-slider', get_template_directory_uri() . '/js/supersized.3.2.7.min.js', array('jquery') );
wp_enqueue_script( 'skt_iamone-supersized-shutter', get_template_directory_uri() . '/js/supersized.shutter.js', array('jquery') );
}
wp_enqueue_style( 'skt_iamone-prettyphoto-style', get_template_directory_uri().'/css/prettyPhoto.css' );
wp_enqueue_script( 'skt_iamone-prettyphoto-script', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array('jquery') );
wp_enqueue_script( 'skt_iamone-customscripts', get_template_directory_uri() . '/js/custom.js', array('jquery') );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'skt_iamone_scripts' );
function media_css_hook(){
$output = '';
$output ='
';
echo $output;
if ( (of_get_option('innerpageslider', true) != 'hide') || is_home() || is_front_page() ) {
$slAr = array();
for ($i=1; $i<6; $i++) {
if ( of_get_option('slide'.$i, true) != "" ) {
$imgUrl = of_get_option('slide'.$i, true);
$imgTitle = of_get_option('slidetitle'.$i, true);
if ( strlen($imgUrl) > 3 ) $slAr[$i] = of_get_option('slide'.$i, true);
}
}
?>
". esc_html( of_get_option('style2', true) ) ."";
}
}
}
add_action('wp_head', 'skt_iamone_custom_head_codes');
function skt_iamone_pagination() {
global $wp_query;
$big = 12345678;
$page_format = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'type' => 'array'
) );
if( is_array($page_format) ) {
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
echo '';
}
}
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* Load custom functions file.
*/
require get_template_directory() . '/inc/custom-functions.php';
function skt_iamone_custom_blogpost_pagination( $wp_query ){
$big = 999999999; // need an unlikely integer
if ( get_query_var('paged') ) { $pageVar = 'paged'; }
elseif ( get_query_var('page') ) { $pageVar = 'page'; }
else { $pageVar = 'paged'; }
$pagin = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?'.$pageVar.'=%#%',
'current' => max( 1, get_query_var($pageVar) ),
'total' => $wp_query->max_num_pages,
'prev_text' => '« Prev',
'next_text' => 'Next »',
'type' => 'array'
) );
if( is_array($pagin) ) {
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
echo '';
}
}
// get slug by id
function skt_iamone_get_slug_by_id($id) {
$post_data = get_post($id, ARRAY_A);
$slug = $post_data['post_name'];
return $slug;
}
// Add custom script in admin footer
function custom_admin_footer_js() {
echo '"';
}
add_action('admin_footer', 'custom_admin_footer_js');
// add shortcode for features
function skt_iamone_features($skt_var, $content = null){
extract( shortcode_atts(array(
'title' => 'title',
'icon' => get_template_directory_uri().'/images/icon-customizable.png',
), $skt_var));
return '
'.$title.'
'.$content.'
';
}
add_shortcode('feature','skt_iamone_features');
// add shortcode for work
function skt_iamone_work($skt_work, $work_content = null) {
extract( shortcode_atts(array(
'title' => 'title',
'step' => 'step',
'icon' => get_template_directory_uri().'/images/icon-discuss.png',
), $skt_work));
return '
'.$title.'
'.$work_content.'
';
}
add_shortcode('work','skt_iamone_work');
// add shortcode for statistics
function skt_iamone_stat($skt_stat_var, $stat_content = null){
extract( shortcode_atts(array(
'value' => 'value',
), $skt_stat_var));
return '
'.$value.'
'.$stat_content.'
';
}
add_shortcode('stat','skt_iamone_stat');
// add shortcode for sercices
function skt_iamone_services($skt_service, $service_content = null){
extract( shortcode_atts(array(
'title' => 'title',
'icon' => get_template_directory_uri().'/images/icon-doc.png',
), $skt_service));
return '
'.$title.'
'.$service_content.'
';
}
add_shortcode('service','skt_iamone_services');
function remove_header_menu(){
remove_submenu_page( 'themes.php', 'custom-header' );
remove_submenu_page( 'themes.php', 'custom-background' );
}
add_action( 'admin_menu', 'remove_header_menu', 999 );
function skt_credit_link(){
echo 'I am one theme by SKTThemes.';
}