__( 'Primary Menu', 'belajar' ), 'select-menu' => __( 'Select Menu', 'belajar' ), ) ); /* * This theme supports custom background color and image, and here * we also set up the default background color. */ add_theme_support( 'custom-background', array( 'default-color' => 'e6e6e6', ) ); /** * Add support for the Aside and Gallery Post Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'gallery' ) ); } endif; // belajar_setup /** * Tell WordPress to run belajar_setup() when the 'after_setup_theme' hook is run. */ add_action( 'after_setup_theme', 'belajar_setup' ); /** * Tell WordPress to run belajar_setup() when the 'after_setup_theme' hook is run. */ add_action( 'after_setup_theme', 'belajar_setup' ); /** * Adds support for a custom header image. *//** '444', 'default-image' => get_template_directory_uri() . '/images/logo.png', // Set height and width, with a maximum value for the width. 'height' => 180, 'width' => 300, 'max-width' => 2000, // Support flexible height and width. 'flex-height' => true, 'flex-width' => true, // Random image rotation off by default. 'random-default' => false, // Callbacks for styling the header and the admin preview. 'wp-head-callback' => 'belajar_header_style', 'admin-head-callback' => 'belajar_admin_header_style', 'admin-preview-callback' => 'belajar_admin_header_image', ); add_theme_support( 'custom-header', $args ); } add_action( 'after_setup_theme', 'belajar_custom_header_setup' ); /** * Styles the header text displayed on the blog. * * get_header_textcolor() options: 444 is default, hide text (returns 'blank'), or any hex value. */ function belajar_header_style() { $text_color = get_header_textcolor(); // If no custom options for text are set, let's bail if ( $text_color == get_theme_support( 'custom-header', 'default-text-color' ) ) return; // If we get this far, we have custom styles. ?> Header admin panel. */ function belajar_admin_header_style() { ?> Header admin panel. */ function belajar_admin_header_image() { ?>

onclick="return false;" href="">

>

'ffffff', 'border' => 'eeeeee', 'text' => '444444', ); /** * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. */ function belajar_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'belajar_page_menu_args' ); /** * Register widgetized area and update sidebar with default widgets */ function belajar_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar 1', 'belajar' ), 'id' => 'sidebar-1', 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sidebar 2', 'belajar' ), 'id' => 'sidebar-2', 'description' => __( 'An optional second sidebar area', 'belajar' ), 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'init', 'belajar_widgets_init' ); if ( ! function_exists( 'belajar_content_nav' ) ): /** * Display navigation to next/previous pages when applicable */ function belajar_content_nav( $nav_id ) { global $wp_query; ?> comment_type ) : case 'pingback' : case 'trackback' : ?>
  • id="li-comment-">
    says:', 'belajar' ), sprintf( '%s', get_comment_author_link() ) ); ?>
    comment_approved == '0' ) : ?>
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    Posted on by ', 'belajar' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'belajar' ), get_the_author() ) ), esc_html( get_the_author() ) ); } endif; /** * Adds custom classes to the array of body classes. */ function belajar_body_classes( $classes ) { // Adds a class of single-author to blogs with only 1 published author if ( ! is_multi_author() ) { $classes[] = 'single-author'; } return $classes; } add_filter( 'body_class', 'belajar_body_classes' ); /** * Returns true if a blog has more than 1 category */ function belajar_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) { // Create an array of all the categories that are attached to posts $all_the_cool_cats = get_categories( array( 'hide_empty' => 1, ) ); // Count the number of categories that are attached to the posts $all_the_cool_cats = count( $all_the_cool_cats ); set_transient( 'all_the_cool_cats', $all_the_cool_cats ); } if ( '1' != $all_the_cool_cats ) { // This blog has more than 1 category so belajar_categorized_blog should return true return true; } else { // This blog has only 1 category so belajar_categorized_blog should return false return false; } } /** * Flush out the transients used in belajar_categorized_blog */ function belajar_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'all_the_cool_cats' ); } add_action( 'edit_category', 'belajar_category_transient_flusher' ); add_action( 'save_post', 'belajar_category_transient_flusher' ); /** * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages */ function belajar_enhanced_image_navigation( $url ) { global $post, $wp_rewrite; $id = (int) $post->ID; $object = get_post( $id ); if ( wp_attachment_is_image( $post->ID ) && ( $wp_rewrite->using_permalinks() && ( $object->post_parent > 0 ) && ( $object->post_parent != $id ) ) ) $url = $url . '#main'; return $url; } add_filter( 'attachment_link', 'belajar_enhanced_image_navigation' ); /** * select menu for small screen */ function wp_nav_menu_select( $args = array() ) { $defaults = array( 'theme_location' => '', 'menu_class' => 'select-menu', ); $args = wp_parse_args( $args, $defaults ); if ( ( $menu_locations = get_nav_menu_locations() ) && isset( $menu_locations[ $args['theme_location'] ] ) ) { $menu = wp_get_nav_menu_object( $menu_locations[ $args['theme_location'] ] ); $menu_items = wp_get_nav_menu_items( $menu->term_id ); ?>