for posts and comments.
add_theme_support( 'automatic-feed-links' );
// This theme supports seven post formats.
add_theme_support( 'post-formats', array( 'audio', 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) );
// This theme supports custom background.
add_theme_support( 'custom-background');
// This theme supports custom header.
add_theme_support( 'custom-header' );
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'primary', __( 'Dropdown Menu', 'arete' ) );
// This theme uses a custom image size for featured images.
add_theme_support( 'post-thumbnails' );
add_image_size( 'full-thumb', 1140, 9999 );
add_image_size( '2-columns-thumb', 570, 9999 );
add_image_size( '3-columns-thumb', 380, 9999 );
add_image_size( '4-columns-thumb', 285, 9999 );
add_image_size( '5-columns-thumb', 228, 9999 );
add_image_size( '6-columns-thumb', 190, 9999 );
add_image_size( '7-columns-thumb', 163, 9999 );
}
add_action( 'after_setup_theme', 'arete_setup' );
// INCLUDES
include_once( get_template_directory() . '/includes/custom-header.php' );
// Include Theme Options
if ( !function_exists( 'optionsframework_init' ) ) {
define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/includes/theme-options/' );
require_once ( get_template_directory() . '/includes/theme-options/options-framework.php');
require_once ( get_template_directory() . '/includes/theme-options/options.php');
include_once( get_template_directory() . '/includes/theme-options/arete-options-functions.php' );
}
// TITLE
/**
* Creates a nicely formatted and more specific title element text
* for output in head of document, based on current view.
*
*/
function arete_wp_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() )
return $title;
// Add the site name.
$title .= get_bloginfo( 'name' );
// 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 )
$title = "$title $sep " . sprintf( __( 'Page %s', 'arete' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'arete_wp_title', 10, 2 );
/**
* Makes wp_nav_menu() fallback -- wp_page_menu() -- show a home link.
*
*/
function arete_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'arete_page_menu_args' );
// Registers nine widget areas.
function arete_widgets_init() {
register_sidebar( array(
'name' => __( 'BLOG', 'arete' ),
'id' => 'sidebar-blog',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'HEADER', 'arete' ),
'id' => 'sidebar-header',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'PAGE', 'arete' ),
'id' => 'sidebar-page',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'WIDGETABLE // Sidebar 1', 'arete' ),
'id' => 'sidebar-area-1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
) );
register_sidebar( array(
'name' => __( 'WIDGETABLE // Sidebar 2', 'arete' ),
'id' => 'sidebar-area-2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
) );
register_sidebar( array(
'name' => __( 'WIDGETABLE // Sidebar 3', 'arete' ),
'id' => 'sidebar-area-3',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
) );
register_sidebar( array(
'name' => __( 'FOOTER', 'arete' ),
'id' => 'sidebar-footer',
'before_widget' => '',
'before_title' => ''
) );
}
add_action( 'widgets_init', 'arete_widgets_init' );
/**
* Enqueues scripts and styles for front end.
*
*/
function add_theme_scripts() {
// Loads stylesheet.
wp_enqueue_style( 'style', get_stylesheet_uri(), false, '1.0', 'all' );
wp_enqueue_script( 'jquery' );
// Adds JavaScript to pages with the comment form to support sites with
// threaded comments (when in use).
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
// Adds Masonry to handle vertical alignment of gallery, blog posts, project posts.
wp_enqueue_script( 'jquery-masonry' );
// Loads JavaScript file with functionality specific to Arete.
wp_enqueue_script( 'arete-script', get_template_directory_uri() . '/javascript/arete-scripts.js', array( 'jquery' ), '1.0', true );
// Loads custom scripts.
wp_deregister_script('superfish');
wp_register_script('superfish', get_template_directory_uri().'/javascript/superfish.js', false, '1.5.1', true);
wp_enqueue_script('superfish');
wp_deregister_script('supersubs');
wp_register_script('supersubs', get_template_directory_uri().'/javascript/supersubs.js', false, '0.2b', true);
wp_enqueue_script('supersubs');
}
add_action( 'wp_enqueue_scripts', 'add_theme_scripts' );
// Pagination
function arete_pagination_archive() {
global $wp_query;
$big = 999999999; // need an unlikely integer
echo 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,
'prev_text' => __('«', 'arete'),
'next_text' => __('»', 'arete'),
'type' => 'plain',
) );
}
// Excerpt & More
function arete_excerpt_length( $length ) {
return 25;
}
add_filter( 'excerpt_length', 'arete_excerpt_length' );
// Puts link in excerpts more tag
function arete_excerpt_more( $more ) {
global $post;
return '' .__( " more...", "arete" ).' ';
}
add_filter( 'excerpt_more', 'arete_excerpt_more' );
// Comments
if ( ! function_exists( 'arete_comments' ) ) :
function arete_comments( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment; ?>
>
]+>\s*)?
]+>(?:\s*)?)(.*)#is', $content, $matches ) ) {
$content = $matches[1];
$attr['caption'] = trim( $matches[2] );
}
}
// Allow plugins/themes to override the default caption template.
$output = apply_filters('img_caption_shortcode', '', $attr, $content);
if ( $output != '' )
return $output;
extract(shortcode_atts(array(
'id' => '',
'align' => 'alignnone',
'width' => '',
'caption' => ''
), $attr));
if ( 1 > (int) $width || empty($caption) )
return $content;
if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
return ''
. do_shortcode( $content ) . '
' . $caption . '
';
}
// Thumbnail Caption
function arete_thumbnail_caption() {
global $post;
$thumbnail_id = get_post_thumbnail_id( $post->ID );
$thumbnail_image = get_posts( array( 'p' => $thumbnail_id, 'post_type' => 'attachment' ) );
if ( $thumbnail_image && isset( $thumbnail_image[0] ) ) {
if ( ! empty( $thumbnail_image[0]->post_excerpt ) OR ( $thumbnail_image[0]->post_content ) ) {
echo '';
echo '
' . $thumbnail_image[0]->post_excerpt . '
';
echo '
' . $thumbnail_image[0]->post_content . '
';
echo '
';
}
}
}
// Page Attachment Count
function arete_attachment_count() {
global $wpdb;
global $post;
echo $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_type = 'attachment'" );
}
comment_approved == '0' ) : ?>