.
add_theme_support( 'automatic-feed-links' );
// This theme uses wp_nav_menu() in 2 locations.
register_nav_menus( array(
'primary-menu' => __( 'Primary Menu', 'adventurejournal' )
) );
// This theme uses post thumbnails
add_theme_support( 'post-thumbnails' );
// We'll be using post thumbnails for custom header images on posts and pages.
// We want them to be the size of the header image that we just defined
// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
set_post_thumbnail_size( 920, 360, true );
}
endif;
/**
* Returns the default options for Adventure Journal.
*
* @since Adventure Journal 2.0
*/
function adventurejournal_get_default_theme_options() {
$default_theme_options = array(
'theme_layout' => 'col-1',
);
return apply_filters( 'adventurejournal_default_theme_options', $default_theme_options );
}
/**
* Returns the options array for Adventure Journal.
*
* @since Adventure Journal 2.0
*/
function adventurejournal_get_theme_options() {
return get_option( 'adventurejournal_theme_options', adventurejournal_get_default_theme_options() );
}
/**
* Register our sidebars and widgetized areas. Also register the default Epherma widget.
*
* @since Adventure Journal 2.0
*/
function adventurejournal_widgets_init() {
register_sidebar( array(
'name' => __( 'Primary Sidebar', 'adventurejournal' ),
'id' => 'sidebar-1',
'description' => __( 'The primary sidebar widget area', 'adventurejournal' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Secondary Sidebar', 'adventurejournal' ),
'id' => 'sidebar-2',
'description' => __( 'A secondary widget area for your sidebar, only visible with 3-column layouts', 'adventurejournal' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Area One', 'adventurejournal' ),
'id' => 'sidebar-3',
'description' => __( 'An optional widget area for your footer', 'adventurejournal' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Area Two', 'adventurejournal' ),
'id' => 'sidebar-4',
'description' => __( 'An optional widget area for your footer', 'adventurejournal' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Area Three', 'adventurejournal' ),
'id' => 'sidebar-5',
'description' => __( 'An optional widget area for your footer', 'adventurejournal' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'adventurejournal_widgets_init' );
/**
* Prints HTML with meta information for the current post—date/time and author.
*/
function adventurejournal_posted_on() {
printf( __( 'Posted on %2$s by %3$s', 'adventurejournal' ),
'meta-prep meta-prep-author',
sprintf( '%3$s',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_html( get_the_date() )
),
sprintf( '%3$s',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'adventurejournal' ), get_the_author() ) ),
esc_html( get_the_author() )
)
);
edit_post_link( __( 'Edit', 'adventurejournal' ), ' ', '' );
}
/**
* Count the number of footer sidebars to enable dynamic classes for the footer
*/
function adventurejournal_sidebar_class() {
$count = 0;
if ( is_active_sidebar( 'sidebar-3' ) )
$count++;
if ( is_active_sidebar( 'sidebar-4' ) )
$count++;
if ( is_active_sidebar( 'sidebar-5' ) )
$count++;
$class = '';
switch ( $count ) {
case '1':
$class = 'one';
break;
case '2':
$class = 'two';
break;
case '3':
$class = 'three';
break;
}
if ( $class )
printf( 'class="%s"', $class );
}
if ( ! function_exists( 'adventurejournal_get_comments' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own adventurejournal_get_comments(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @since Adventure Theme 1.0
*/
function adventurejournal_get_comments( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
', '' ); ?>
'693808',
'default-image' => get_template_directory_uri() . '/images/mp-background-tile.jpg',
) ) );
}
add_action( 'after_setup_theme', 'adventurejournal_register_custom_background' );
/**
* Enqueue scripts and styles
*/
function adventurejournal_scripts() {
wp_enqueue_style( 'adventurejournal', get_stylesheet_uri() );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
}
add_action( 'wp_enqueue_scripts', 'adventurejournal_scripts' );
/**
* Enqueue font styles.
*
* @since AdventureJournal 1.0
*/
function adventurejournal_fonts() {
wp_enqueue_style( 'adventurejournal-vollkorn', "https://fonts.googleapis.com/css?family=Vollkorn:400,700" );
}
add_action( 'wp_enqueue_scripts', 'adventurejournal_fonts' );
/**
* Filters wp_title to print a neat tag based on what is being viewed.
*
* @since AdventureJournal 2.0
*/
function adventurejournal_wp_title( $title, $sep ) {
global $page, $paged;
if ( is_feed() )
return $title;
// Add the blog name
$title .= get_bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
$title .= " $sep $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
$title .= " $sep " . sprintf( __( 'Page %s', 'adventurejournal' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'adventurejournal_wp_title', 10, 2 );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
// Load up our theme options page and related code.
require get_template_directory() . '/inc/theme-options.php';