__('Primary Menu', 'nusantara'), 'secondary' => __('Secondary Menu', 'nusantara') ) );
add_theme_support('custom-background');
add_theme_support('automatic-feed-links');
add_theme_support('post-thumbnails');
add_editor_style();
}
// -- add_filter() is a WordPress function.
// -- add_filter() is used to hook a function into a WordPress action
// -- add_filter( \$tag, \$function_to_add, \$priority, \$accepted_args ) accepts four arguments
add_filter('excerpt_more', 'nusantara_excerpt_more');
add_filter('excerpt_length', 'nusantara_excerpt_length');
add_filter('the_title', 'nusantara_takberjudul');
add_filter( 'wp_title', 'nusantara_filter_title' );
add_filter( 'body_class', 'nusantara_layout_classes' );
add_filter( 'body_class', 'nusantara_menu_primary_classes' );
add_filter( 'body_class', 'nusantara_menu_classes' );
// -- add_action() is a WordPress function.
// -- add_action() is used to hook a function into a WordPress action
// -- add_action( \$tag, \$function_to_add, \$priority, \$accepted_args ) accepts four arguments
add_action('widgets_init', 'nusantara_widgets_init');
add_action('after_setup_theme', 'nusantara_setup' );
add_action('wp_head', 'nusantara_google_verifications');
add_action('wp_head', 'nusantara_bing_verifications');
add_action('wp_head', 'nusantara_google_plus');
add_action('wp_head', 'nusantara_alexa_verifications');
add_action('wp_footer', 'nusantara_statistics_code');
add_action('save_post','nusantara_save_postdata');
add_action('edit_post','nusantara_save_postdata');
add_action('publish_page','nusantara_save_postdata');
add_action('publish_post','nusantara_save_postdata');
add_action('admin_menu', 'nusantara_add_meta_box');
add_action('the_content', 'nusantara_inline');
add_action('wp_enqueue_scripts', 'nusantara_enqueue_comment_reply');
add_action( 'wp_head', 'nusantara_print_ie_scripts');
add_action('wp_enqueue_scripts', 'nusantara_slider_enqueue_scripts_style');
// -- require_once( \$file ) will include the file specified by the \$file argument
// -- require_once() will return a fatal error if the specified file cannot be included.
// -- Also, if theme specified file has already been included, require_once() will not attempt to include it again
// -- require_once( \$file ) accepts one argument
require( get_template_directory() . '/inc/widgets/widget-ads.php' );
require( get_template_directory() . '/inc/widgets/widgets.php' );
require( get_template_directory(). '/inc/widgets/twitter.php');
require( get_template_directory(). '/inc/widgets/text.php');
require( get_template_directory(). '/inc/mediauploader.php');
require( get_template_directory(). '/inc/logical-element.php');
require( get_template_directory(). '/inc/options.php');
require( get_template_directory(). '/inc/interface.php');
require( get_template_directory(). '/inc/classes/options-page.php');
require( get_template_directory() . '/inc/custom-css.php' );
require( get_template_directory() . '/inc/compress.php' );
require( get_template_directory() .'/inc/custom-template.php' );
require( get_template_directory() .'/script/jscript.php' );
require( get_template_directory() .'/inc/portfolio-functions.php' );
if ( ! isset( $content_width ) )$content_width = 584;
// -- Function Name : nusantara_enqueue_comment_reply
// -- Code Reference: http://codex.wordpress.org/Function_Reference/wp_enqueue_script
function nusantara_enqueue_comment_reply() {
if ( is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
// -- Function Name : nusantara_slider_enqueue_scripts_style
// -- Code Reference: http://codex.wordpress.org/Function_Reference/wp_enqueue_script
function nusantara_slider_enqueue_scripts_style(){
if ( is_home() || is_front_page()) {
wp_enqueue_script('jquery');
wp_enqueue_script('nusantara_slideshow', get_template_directory_uri() .'/script/jquery.flexslider-min.js');
wp_enqueue_style( 'flexslider', get_template_directory_uri() . '/script/slider.css');
nusantara_include_jscript();
}
}
function nusantara_print_ie_scripts() {
?>
__('one-column','nusantara'),
'description' => __('One column area', 'nusantara'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'));
register_sidebar(array(
'name' => __('one-column-left','nusantara'),
'description' => __('One column left area', 'nusantara'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'));
register_sidebar(array(
'name' => __('one-column-right','nusantara'),
'description' => __('One column right area', 'nusantara'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'));
//portfolio sidebar
register_sidebar(array(
'name' => __('portfolio-sidebar','nusantara'),
'description' => __('This only for portfolio sidebar', 'nusantara'),
'before_widget' => ' ',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'));
//two column area widget
register_sidebar(array(
'name' => __('two-columns-region1','nusantara'),
'description' => __('Two columns area - 1', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
register_sidebar(array(
'name' => __('two-columns-region2','nusantara'),
'description' => __('Two columns area - 2', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
//Three column area widget
register_sidebar(array(
'name' => __('three-columns-region1','nusantara'),
'description' => __('Three columns area - 1', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
register_sidebar(array(
'name' => __('three-columns-region2','nusantara'),
'description' => __('Three columns area - 2', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
register_sidebar(array(
'name' => __('three-columns-region3','nusantara'),
'description' => __('Three columns area - 3', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
//four columns area widgets
register_sidebar(array(
'name' => __('four-columns-region1','nusantara'),
'description' => __('Four columns area - 3', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
register_sidebar(array(
'name' => __('four-columns-region2','nusantara'),
'description' => __('Four columns area - 3', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
register_sidebar(array(
'name' => __('four-columns-region3','nusantara'),
'description' => __('Four columns area - 3', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
register_sidebar(array(
'name' => __('four-columns-region4','nusantara'),
'description' => __('Four columns area - 4', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
//footer area widgets
register_sidebar(array(
'name' => __('footer left','nusantara'),
'description' => __('footer left area', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
register_sidebar(array(
'name' => __('footer midlle','nusantara'),
'description' => __('footer midle area', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
register_sidebar(array(
'name' => __('footer right','nusantara'),
'description' => __('fotter right area', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
register_sidebar(array(
'name' => __('footer right last','nusantara'),
'description' => __('fotter right area - the last', 'nusantara'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
'));
}
// -- Function Name : nusantara_takberjudul
// -- Params : $title
// -- Code Reference:
function nusantara_takberjudul($title) {
if ($title == '') {
return 'Untitled';
} else {
return $title;
}
}
// -- Function Name : nusantara_default_menu
// -- Params :
// -- Code Reference:
function nusantara_default_menu() {
echo ''. wp_list_pages('title_li=&echo=0') .'
';
}
// -- Function Name : nusantara_secondary_menu
// -- Params :
// -- Code Reference:
function nusantara_secondary_menu() {
echo '';
}
// -- Function Name : nusantara_excerpt_length
// -- Params : $length
// -- Code Reference:
function nusantara_excerpt_length( $length ) {
return 100;
}
// -- Function Name : nusantara_continue_reading_link
// -- Params :
// -- Code Reference:
function nusantara_continue_reading_link() {
return '' . __( 'Read more »', 'nusantara' ) . '';
}
// -- Function Name : nusantara_excerpt_more
// -- Params : $more
// -- Code Reference:
function nusantara_excerpt_more( $more ) {
return ' …' . nusantara_continue_reading_link();
}
add_theme_support( 'custom-header', array(
'default-image'=> get_template_directory_uri() . '/images/logo-nusantara.png',
'header-text'=> false,
'flex-width' => true,
'width'=> 274,
'flex-height' => true,
'height'=> 63));
if ( ! function_exists( 'get_custom_header' ) ) {
define('HEADER_TEXTCOLOR', '');
define('HEADER_IMAGE', '%s/images/logo-nusantara.png');
define('HEADER_IMAGE_WIDTH', 274);
define('HEADER_IMAGE_HEIGHT', 63);
define('NO_HEADER_TEXT', true);
}
// -- Function Name : nusantara_comment
// -- Params : $comment, $args, $depth
// -- Code Reference:
function nusantara_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
', '' ); ?>
id="li-comment-">
Read more »', 'nusantara' ));
break;
default:
$nusantara_con = the_excerpt();
break;
}
} else{
$nusantara_con = the_excerpt();
}
return $nusantara_con;
}
// -- Function Name : nusantara_filter_title
// -- Params : $filter_title
// -- Code Reference:
function nusantara_filter_title( $filter_title ) {
global $page, $paged;
$filter_title = str_replace( '»', '', $filter_title );
$site_description = get_bloginfo( 'description', 'display' );
$separator = '#124';
if ( is_singular() ) {
if ( $paged >= 2 || $page >= 2 )$filter_title .= ', ' . __( 'Page', 'nusantara' ) . ' ' . max( $paged, $page );
} else {
if( ! is_home() )$filter_title .= ' &' . $separator . '; ';
$filter_title .= get_bloginfo( 'name' );
if ( $paged >= 2 || $page >= 2 )$filter_title .= ', ' . __( 'Page', 'nusantara' ) . ' ' . max( $paged, $page );
}
if ( is_home() && $site_description )$filter_title .= ' &' . $separator . '; ' . $site_description;
return $filter_title;
}
// -- Function Name : nusantara_content_nav
// -- Params :
// -- Code Reference:
function nusantara_content_nav() {
global $wp_query;
$paged = ( get_query_var( 'paged' ) ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = get_pagenum_link();
$url_parts = parse_url( $pagenum_link );
$format = ( get_option('permalink_structure') ) ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
if ( isset($url_parts['query']) ) {
$pagenum_link = "{$url_parts['scheme']}://{$url_parts['host']}{$url_parts['path']}%_%?{$url_parts['query']}";
} else {
$pagenum_link .= '%_%';
}
$links = paginate_links( array(
'base' => $pagenum_link,
'format' => $format,
'total' => $wp_query->max_num_pages,
'current' => $paged,
'mid_size' => 2,
'type' => 'list'
) );
if ( $links ) {
echo "{$links}
";
}
}
// -- Function Name : nusantara_menu_classes
// -- Params : $classes
// -- Code Reference:
function nusantara_menu_classes( $classes ) {
$nusantara_options = get_option('nusantara_options');
if(!empty($nusantara_options['nusantara_menu_layout'])) {
switch($nusantara_options['nusantara_menu_layout']) {
case 'right secondary menu':
$classes[] = '';
break;
case 'left secondary menu':
$classes[] = 'lmenu';
break;
default:
$classes[] = '';
break;
}
} else{
$classes[] = 'lmenu';
}
return $classes;
}
// -- Function Name : nusantara_menu_primary_classes
// -- Params : $classes
// -- Code Reference:
function nusantara_menu_primary_classes( $classes ) {
$nusantara_options = get_option('nusantara_options');
if(!empty($nusantara_options['nusantara_primary_menu_layout'])) {
switch($nusantara_options['nusantara_primary_menu_layout']) {
case 'left primary menu':
$classes[] = '';
break;
case 'right primary menu':
$classes[] = 'rprimary';
break;
default:
$classes[] = '';
break;
}
} else{
$classes[] = '';
}
return $classes;
}
// -- Function Name : nusantara_layout_classes
// -- Params : $classes
// -- Code Reference:
function nusantara_layout_classes( $classes ) {
$nusantara_options = get_option('nusantara_options');
if(!empty($nusantara_options['nusantara_layout_flex'])) {
switch($nusantara_options['nusantara_layout_flex']) {
case 'fluid responsive':
$classes[] = 'flex0';
break;
case '960px':
$classes[] = 'flex1';
break;
case '900px':
$classes[] = 'flex2';
break;
case '800px':
$classes[] = 'flex3';
break;
case '750px':
$classes[] = 'flex4';
break;
case '700px':
$classes[] = 'flex5';
break;
case '680px':
$classes[] = 'flex6';
break;
case '650px':
$classes[] = 'flex7';
break;
case '550px':
$classes[] = 'flex8';
break;
case '400px':
$classes[] = 'flex9';
break;
case '320px':
$classes[] = 'flex10';
break;
default:
$classes[] = '';
break;
}
} else{
$classes[] = '';
}
return $classes;
}
// -- Function Name : nusantara_google_verifications
// -- Params :
// -- Code Reference:
function nusantara_google_verifications() {
$nusantara_options = get_option('nusantara_options');
if ( isset($nusantara_options['nusantara_google_meta']) and $nusantara_options['nusantara_google_meta'] <> '' ) {
echo '' . "\n";
}
}
// -- Function Name : nusantara_bing_verifications
// -- Params :
// -- Code Reference:
function nusantara_bing_verifications() {
$nusantara_options = get_option('nusantara_options');
if ( isset($nusantara_options['nusantara_bing_meta']) and $nusantara_options['nusantara_bing_meta'] <> '' ) {
echo '' . "\n";
}
}
// -- Function Name : nusantara_google_plus
// -- Params :
// -- Code Reference:
function nusantara_google_plus() {
$nusantara_options = get_option('nusantara_options');
if ( isset($nusantara_options['nusantara_googleplus_meta']) and $nusantara_options['nusantara_googleplus_meta'] <> '' ) {
echo '' . "\n";
}
}
// -- Function Name : nusantara_alexa_verifications
// -- Params :
// -- Code Reference:
function nusantara_alexa_verifications() {
$nusantara_options = get_option('nusantara_options');
if ( isset($nusantara_options['nusantara_alexa_meta']) and $nusantara_options['nusantara_alexa_meta'] <> '' ) {
echo '' . "\n";
}
}
// -- Function Name : nusantara_statistics_code
// -- Params :
// -- Code Reference:
function nusantara_statistics_code() {
$nusantara_options = get_option('nusantara_options');
if (!empty($nusantara_options['nusantara_analitic_code'])and $nusantara_options['nusantara_analitic_code'] <> '') {
echo $nusantara_options['nusantara_analitic_code'];
}
}
// -- Function Name : nusantara_breadcrumb
// -- I got from responsive theme by emiluzelac, thank's emil this great for bbpress
// -- bbPress compatibility patch by Dan Smith
function nusantara_breadcrumb () {
$nusantara = '›';
$home = __('Home','nusantara'); // text for the 'Home' link
$before = ''; // tag before the current crumb
$after = ''; // tag after the current crumb
if ( !is_home() && !is_front_page() || is_paged() ) {
echo '';
global $post;
$homeLink = home_url();
echo '
' . $home . ' ' . $nusantara . ' ';
if ( is_category() ) {
global $wp_query;
$cat_obj = $wp_query->get_queried_object();
$thisCat = $cat_obj->term_id;
$thisCat = get_category($thisCat);
$parentCat = get_category($thisCat->parent);
if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $nusantara . ' '));
echo $before . __('Archive for ','nusantara') . single_cat_title('', false) . $after;
} elseif ( is_day() ) {
echo '
' . get_the_time('Y') . ' ' . $nusantara . ' ';
echo '
' . get_the_time('F') . ' ' . $nusantara . ' ';
echo $before . get_the_time('d') . $after;
} elseif ( is_month() ) {
echo '
' . get_the_time('Y') . ' ' . $nusantara . ' ';
echo $before . get_the_time('F') . $after;
} elseif ( is_year() ) {
echo $before . get_the_time('Y') . $after;
} elseif ( is_single() && !is_attachment() ) {
if ( get_post_type() != 'post' ) {
$post_type = get_post_type_object(get_post_type());
$slug = $post_type->rewrite;
echo '
' . $post_type->labels->singular_name . ' ' . $nusantara . ' ';
echo $before . get_the_title() . $after;
} else {
$cat = get_the_category(); $cat = $cat[0];
echo get_category_parents($cat, TRUE, ' ' . $nusantara . ' ');
echo $before . get_the_title() . $after;
}
} elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) {
$post_type = get_post_type_object(get_post_type());
echo $before . $post_type->labels->singular_name . $after;
} elseif ( is_attachment() ) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID); $cat = $cat[0];
echo get_category_parents($cat, TRUE, ' ' . $nusantara . ' ');
echo '
' . $parent->post_title . ' ' . $nusantara . ' ';
echo $before . get_the_title() . $after;
} elseif ( is_page() && !$post->post_parent ) {
echo $before . get_the_title() . $after;
} elseif ( is_page() && $post->post_parent ) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '
' . get_the_title($page->ID) . '';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb) echo $crumb . ' ' . $nusantara . ' ';
echo $before . get_the_title() . $after;
} elseif ( is_search() ) {
echo $before . __('Search results for ','nusantara') . get_search_query() . $after;
} elseif ( is_tag() ) {
echo $before . __('Posts tagged ','nusantara') . single_tag_title('', false) . $after;
} elseif ( is_author() ) {
global $author;
$userdata = get_userdata($author);
echo $before . __('All posts by ','nusantara') . $userdata->display_name . $after;
} elseif ( is_404() ) {
echo $before . __('Error 404 ','nusantara') . $after;
}
if ( get_query_var('paged') ) {
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
echo __('Page','nusantara') . ' ' . get_query_var('paged');
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';
}
echo '
';
}
}