.
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'infinite-scroll', array(
'container' => 'main'
) );
// Add support for a variety of post formats
add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image', 'video', 'audio', 'chat' ) );
$args = array(
'flex-width' => true,
'flex-height' => true,
'uploads' => true,
);
add_theme_support( 'custom-header', $args );
// This theme uses Featured Images (also known as post thumbnails) for per-post/per-page Custom Header images
add_theme_support( 'post-thumbnails' );
add_theme_support( 'custom-background' );
}
endif; // fanoe_setup
/*
* Print the
tag based on what is being viewed.
*/
function fanoe_custom_wp_title($title) {
global $page, $paged;
if ( is_feed() )
return $title;
$site_description = get_bloginfo( 'description' );
$filtered_title = $title . get_bloginfo( 'name' );
$filtered_title .= ( ! empty( $site_description ) && ( is_home() || is_front_page() ) ) ? ' | ' . $site_description: '';
$filtered_title .= ( 2 <= $paged || 2 <= $page ) ? ' | ' . sprintf( __( 'Page %s', 'fanoe' ), max( $paged, $page ) ) : '';
return $filtered_title;
}
add_filter( 'wp_title', 'fanoe_custom_wp_title');
/**
* Enqueues scripts and styles for front-end.
*
*/
function fanoe_scripts_styles() {
global $wp_styles;
/*
* 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 JavaScript for handling the navigation menu hide-and-show behavior.
*/
if(!is_admin())
wp_enqueue_script( 'fanoe-sidebar', get_template_directory_uri() . '/js/sidebar.js', array( 'jquery' ), false, true );
wp_enqueue_style( 'fanoe-fonts', 'http://fonts.googleapis.com/css?family=Source+Code+Pro|Libre+Baskerville:400,400italic,700', array(), null );
/*
* Loads our main stylesheet.
*/
wp_enqueue_style( 'fanoe-style', get_stylesheet_uri(), array(), null );
wp_enqueue_style( 'fanoe-ie', get_template_directory_uri() . '/conditional/lte-ie7.css');
wp_style_add_data( 'fanoe-ie', 'conditional', 'lt IE 8' );
}
add_action( 'wp_enqueue_scripts', 'fanoe_scripts_styles' );
// add ie conditional html5 shim to header
if(!is_admin()){
function fanoe_add_ie_conditional () {
global $is_IE;
if ($is_IE){
echo '';
}
}
add_action('wp_head', 'fanoe_add_ie_conditional');
}
function fanoe_menus() {
register_nav_menus(
array(
'sidebar-menu' => __( 'Sidebar Menu', 'fanoe' ),
)
);
}
add_action( 'init', 'fanoe_menus' );
/**
* Sets the post excerpt length to 40 words.
*
* To override this length in a child theme, remove the filter and add your own
* function tied to the excerpt_length filter hook.
*/
function fanoe_excerpt_length( $length ) {
return 40;
}
add_filter( 'excerpt_length', 'fanoe_excerpt_length' );
if ( ! function_exists( 'fanoe_continue_reading_link' ) ) :
/**
* Returns a "Continue Reading" link for excerpts
*/
function fanoe_continue_reading_link() {
return ' ' . __( 'Continue reading →', 'fanoe' ) . '';
}
endif; // fanoe_continue_reading_link
/**
* Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and fanoe_continue_reading_link().
*
* To override this in a child theme, remove the filter and add your own
* function tied to the excerpt_more filter hook.
*/
function fanoe_auto_excerpt_more( $more ) {
return ' …' . fanoe_continue_reading_link();
}
add_filter( 'excerpt_more', 'fanoe_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 fanoe_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= fanoe_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'fanoe_custom_excerpt_more' );
/**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
*/
function fanoe_page_menu_args( $args ) {
if ( ! isset( $args['show_home'] ) )
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'fanoe_page_menu_args' );
function fanoe_remove_more_jump_link($link) {
$offset = strpos($link, '#more-');
if ($offset) {
$end = strpos($link, '"',$offset);
}
if ($end) {
$link = substr_replace($link, '', $offset, $end-$offset);
}
return $link;
}
add_filter('the_content_more_link', 'fanoe_remove_more_jump_link');
if ( ! function_exists( 'fanoe_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own fanoe_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*/
function fanoe_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
// Display trackbacks differently than normal comments.
?>
id="comment-">
', '' ); ?>
id="li-comment-">
%1$s %2$s',
get_comment_author_link(),
// If current post author is also comment author, make it known visually.
( $comment->user_id === $post->post_author ) ? ' ' . __( 'Post author', 'fanoe' ) . '' : ''
);
printf( '',
esc_url( get_comment_link( $comment->comment_ID ) ),
get_comment_time( 'c' ),
/* translators: 1: date, 2: time */
sprintf( __( '%1$s @ %2$s', 'fanoe' ), get_comment_date(__('F j, Y', 'fanoe')), get_comment_time(__('g:i a', 'fanoe')) )
);
?>
comment_approved ) : ?>
', '' ); ?>
";
$output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
$i = 0;
foreach ( $attachments as $id => $attachment ) {
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
$output .= "<{$itemtag} class='gallery-item'>";
$output .= "
<{$icontag} class='gallery-icon'>
$link
{$icontag}>";
/*
* This is the caption part so i'll comment that out
* #2 in question
*/
/*
if ( $captiontag && trim($attachment->post_excerpt) ) {
$output .= "
<{$captiontag} class='wp-caption-text gallery-caption'>
" . wptexturize($attachment->post_excerpt) . "
{$captiontag}>";
}*/
$output .= "{$itemtag}>";
if ( $columns > 0 && ++$i % $columns == 0 )
$output .= ' ';
}
/**
* this is the extra br you want to remove so we change it to jus closing div tag
* #3 in question
*/
/*$output .= "
\n";
*/
$output .= "
\n";
return $output;
}
add_filter("post_gallery", "fanoe_my_own_gallery",10,2);
/**
* Menu fallback. Link to the menu editor if that is useful.
*
* @param array $args
* @return string
*/
function fanoe_link_to_menu_editor( $args )
{
if ( ! current_user_can( 'manage_options' ) )
{
return;
}
// see wp-includes/nav-menu-template.php for available arguments
extract( $args );
$link = $link_before
. '' . $before . __('Add a menu', 'fanoe') . $after . ''
. $link_after;
// We have a list
if ( FALSE !== stripos( $items_wrap, '