.
add_theme_support( 'automatic-feed-links' );
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'primary', __( 'Primary Menu', 'bloxy' ) );
// Add support for a variety of post formats
add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'video', 'audio', 'quote', 'image' ) );
}
endif; // bloxy_setup
/**
* Sets the post excerpt length to 40 words.
*/
function bloxy_excerpt_length( $length ) {
return 40;
}
add_filter( 'excerpt_length', 'bloxy_excerpt_length' );
/**
* Returns a "Continue Reading" link for excerpts
*/
function bloxy_continue_reading_link() {
return ' ' . __( 'Continue reading', 'bloxy' ) . '';
}
/**
* Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and bloxy_continue_reading_link().
*
*/
function bloxy_auto_excerpt_more( $more ) {
return ' …' . bloxy_continue_reading_link();
}
add_filter( 'excerpt_more', 'bloxy_auto_excerpt_more' );
/**
* Adds a pretty "Continue Reading" link to custom post excerpts.
*
* To override this link in a child theme, remove the filter and add your own
* function tied to the get_the_excerpt filter hook.
*/
function bloxy_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= bloxy_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'bloxy_custom_excerpt_more' );
/**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
*/
function bloxy_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'bloxy_page_menu_args' );
/**
* Register our sidebars and widgetized areas. Also register the default Epherma widget.
*
*/
function bloxy_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Sidebar', 'bloxy' ),
'id' => 'sidebar-1',
'description' => __( 'An orange widget area for your sidebar', 'bloxy' ),
'before_widget' => '
',
'before_title' => '
',
'after_title' => '
',
'after_widget' => '
',
) );
register_sidebar( array(
'name' => __( 'Secondary Sidebar', 'bloxy' ),
'id' => 'sidebar-2',
'description' => __( 'A blue widget area for your sidebar', 'bloxy' ),
'before_widget' => '
',
'before_title' => '
',
'after_title' => '
',
'after_widget' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer Area One', 'bloxy' ),
'id' => 'sidebar-3',
'description' => __( 'An optional widget area for your site footer (left)', 'bloxy' ),
'before_widget' => '
',
'before_title' => '
',
'after_title' => '
',
'after_widget' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer Area Two', 'bloxy' ),
'id' => 'sidebar-4',
'description' => __( 'An optional widget area for your site footer (center)', 'bloxy' ),
'before_widget' => '
',
'before_title' => '
',
'after_title' => '
',
'after_widget' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer Area Three', 'bloxy' ),
'id' => 'sidebar-5',
'description' => __( 'An optional widget area for your site footer (right)', 'bloxy' ),
'before_widget' => '
',
'before_title' => '
',
'after_title' => '
',
'after_widget' => '
',
) );
}
add_action( 'widgets_init', 'bloxy_widgets_init' );
if ( ! function_exists( 'bloxy_content_nav' ) ) :
/**
* Display navigation to next/previous pages when applicable
*/
function bloxy_content_nav( $nav_id ) {
global $wp_query, $paged;
if($paged == 0 || $paged == "") { $paged = 1; }
if ( $wp_query->max_num_pages > 1 ) : ?>
]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) )
return false;
return esc_url_raw( $matches[1] );
}
if ( ! function_exists( 'bloxy_comment' ) ) :
/**
* Template for comments and pingbacks.
*
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
*/
function bloxy_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
id="li-comment-">
comment_approved == '0') : ?>
Posted on by %7$s', 'bloxy' ),
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', 'bloxy' ), get_the_author() ) ),
get_the_author()
);
}
endif;
/**
* Adds a class to the array of body classes.
* If a singular post being displayed.
*
*/
function bloxy_body_classes( $classes ) {
if ( is_singular() && ! is_home() )
$classes[] = 'singular';
return $classes;
}
add_filter( 'body_class', 'bloxy_body_classes' );