==================================== */ add_theme_support( 'automatic-feed-links' ); } add_action( 'after_setup_theme', 'campus_setup' ); /** * Registers one widget area. * * @return void */ function campus_campus_widgets_init() { register_sidebar( array( 'name' => __( 'Homepage: Top', 'campus' ), 'id' => 'home-full-1', 'description' => __( 'Appears on the homepage of the site, before the posts loop.', 'campus' ), 'before_widget' => '
', 'after_widget' => '
 
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sidebar', 'campus' ), 'id' => 'sidebar', 'description' => __( 'Appears in the narrow column of the site.', 'campus' ), 'before_widget' => '
', 'after_widget' => '
 
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer: Column 1', 'campus' ), 'id' => 'footer-col-1', 'description' => __( 'Appears in the footer of the site.', 'campus' ), 'before_widget' => '
', 'after_widget' => '
 
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer: Column 2', 'campus' ), 'id' => 'footer-col-2', 'description' => __( 'Appears in the footer of the site.', 'campus' ), 'before_widget' => '
', 'after_widget' => '
 
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer: Column 3', 'campus' ), 'id' => 'footer-col-3', 'description' => __( 'Appears in the footer of the site.', 'campus' ), 'before_widget' => '
', 'after_widget' => '
 
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'campus_campus_widgets_init' ); /* Enable Excerpts for Static Pages ==================================== */ add_action( 'init', 'campus_excerpts_for_pages' ); function campus_excerpts_for_pages() { add_post_type_support( 'page', 'excerpt' ); } /* Custom Excerpt Length ==================================== */ function campus_new_excerpt_length($length) { return 40; } add_filter('excerpt_length', 'campus_new_excerpt_length'); /* Replace invalid ellipsis from excerpts ==================================== */ function campus_excerpt($text) { return str_replace(' [...]', '...', $text); // if there is a space before ellipsis return str_replace('[...]', '...', $text); } add_filter('the_excerpt', 'campus_excerpt'); /* Reset [gallery] shortcode styles ==================================== */ add_filter('gallery_style', create_function('$a', 'return "
";')); /** * Create a nicely formatted and more specific title element text for output * in head of document, based on current view. * * @since Campus 1.1 * * @global int $paged WordPress archive pagination page count. * @global int $page WordPress paginated post page count. * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string The filtered title. */ function campus_campus_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) { return $title; } // Add the site name. $title .= get_bloginfo( 'name', 'display' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title = "$title $sep $site_description"; } // Add a page number if necessary. if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { $title = "$title $sep " . sprintf( __( 'Page %s', 'campus' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'campus_campus_wp_title', 10, 2 ); /* Comments Custom Template ==================================== */ function campus_comments( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?>
  • id="li-comment-">
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    %s', get_comment_author_link() ) ); ?> • ' ); ?>
    comment_approved == '0' ) : ?>

     
  • id="li-comment-">

  • ================================== */ function campus_customizer_head() { /* This block refers to the functionality of the Appearance > Customize screen. */ $academia_font_main = esc_attr(get_theme_mod( 'academia_font_main' )); $academia_color_header = esc_attr(get_theme_mod( 'academia_color_header' )); $academia_color_header2 = esc_attr(get_theme_mod( 'academia_color_header2' )); $academia_color_menu_bg = esc_attr(get_theme_mod( 'academia_color_menu_bg' )); $academia_color_body = esc_attr(get_theme_mod( 'academia_color_body' )); $academia_color_link = esc_attr(get_theme_mod( 'academia_color_link' )); $academia_color_link_hover = esc_attr(get_theme_mod( 'academia_color_link_hover' )); if( $academia_font_main != '' || $academia_color_header != '' || $academia_color_body != '' || $academia_color_link != '' || $academia_color_link_hover != '') { echo ''; } } add_action('wp_head', 'campus_customizer_head'); /* Include WordPress Theme Customizer ================================== */ require_once('academia-admin/academia-customizer.php'); /* Include Additional Options and Components ================================== */ if ( !function_exists( 'get_the_image' ) ) { require_once('academia-admin/components/get-the-image.php'); } require_once('academia-admin/components/wpml.php'); // enables support for WPML plug-in require_once('academia-admin/post-options.php');