* add_action( 'after_setup_theme', 'my_child_theme_setup' ); * function my_child_theme_setup() { * // We are providing our own filter for excerpt_length (or using the unfiltered value) * remove_filter( 'excerpt_length', 'liveitup_excerpt_length' ); * ... * } * * * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API. * * */ /** * Set the content width based on the theme's design and stylesheet. * * Used to set the width of images and content. Should be equal to the width the theme * is designed for, generally via the style.css stylesheet. */ if ( ! isset( $content_width ) ) $content_width = 630; /** Tell WordPress to run liveitup_setup() when the 'after_setup_theme' hook is run. */ add_action( 'after_setup_theme', 'liveitup_setup' ); if ( ! function_exists( 'liveitup_setup' ) ): /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which runs * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. * * To override liveitup_setup() in a child theme, add your own liveitup_setup to your child theme's * functions.php file. * * @uses add_theme_support() To add support for post thumbnails and automatic feed links. * @uses register_nav_menus() To add support for navigation menus. * @uses add_editor_style() To style the visual editor. * @uses load_theme_textdomain() For translation/localization support. * @uses add_custom_image_header() To add support for a custom header. * @uses register_default_headers() To register the default custom header images provided with the theme. * @uses set_post_thumbnail_size() To set a custom post thumbnail size. * * @since Live it up 1.0 */ function liveitup_setup() { // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style('editor-style.css?=' . time()); // This theme uses post thumbnails add_theme_support( 'post-thumbnails' ); // Add default posts and comments RSS feed links to head add_theme_support( 'automatic-feed-links' ); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'liveitup_custom_background_args', array( 'default-color' => 'f3f3f3', 'default-image' => '', ) ) ); add_theme_support( 'custom-header', apply_filters( 'liveitup_custom_header_args', array( 'default-image' => '', 'default-text-color' => '000000', 'width' => 1000, 'height' => 250, 'flex-height' => true, 'wp-head-callback' => 'liveitup_header_style', ) ) ); // Make theme available for translation // Translations can be filed in the /languages/ directory load_theme_textdomain( 'live-it-up', get_template_directory_uri() . '/languages' ); $locale = get_locale(); $locale_file = get_template_directory_uri() . "/languages/$locale.php"; if ( is_readable( $locale_file ) ) require_once( $locale_file ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary Navigation', 'live-it-up' ), ) ); // Don't support text inside the header image. define( 'NO_HEADER_TEXT', true ); // Add a way for the custom header to be styled in the admin panel that controls // custom headers. See liveitup_admin_header_style(), below. //add_custom_image_header( '', 'liveitup_admin_header_style' ); // ... and thus ends the changeable header business. // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. register_default_headers( array( 'berries' => array( 'url' => '%s/images/headers/berries.jpg', 'thumbnail_url' => '%s/images/headers/berries-thumbnail.jpg', /* translators: header image description */ 'description' => esc_html__( 'Berries', 'live-it-up' ) ), 'cherryblossom' => array( 'url' => '%s/images/headers/cherryblossoms.jpg', 'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg', /* translators: header image description */ 'description' => esc_html__( 'Cherry Blossoms', 'live-it-up' ) ), 'concave' => array( 'url' => '%s/images/headers/concave.jpg', 'thumbnail_url' => '%s/images/headers/concave-thumbnail.jpg', /* translators: header image description */ 'description' => esc_html__( 'Concave', 'live-it-up' ) ), 'fern' => array( 'url' => '%s/images/headers/fern.jpg', 'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg', /* translators: header image description */ 'description' => esc_html__( 'Fern', 'live-it-up' ) ), 'forestfloor' => array( 'url' => '%s/images/headers/forestfloor.jpg', 'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg', /* translators: header image description */ 'description' => esc_html__( 'Forest Floor', 'live-it-up' ) ), 'inkwell' => array( 'url' => '%s/images/headers/inkwell.jpg', 'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg', /* translators: header image description */ 'description' => esc_html__( 'Inkwell', 'live-it-up' ) ), 'path' => array( 'url' => '%s/images/headers/path.jpg', 'thumbnail_url' => '%s/images/headers/path-thumbnail.jpg', /* translators: header image description */ 'description' => esc_html__( 'Path', 'live-it-up' ) ), 'sunset' => array( 'url' => '%s/images/headers/sunset.jpg', 'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg', /* translators: header image description */ 'description' => esc_html__( 'Sunset', 'live-it-up' ) ) ) ); } endif; if ( ! function_exists( 'liveitup_header_style' ) ) : /** * Styles the header image and text displayed on the blog. * * @see liveitup_custom_header_setup(). */ function liveitup_header_style() { $header_text_color = get_header_textcolor(); /* * If no custom options for text are set, let's bail. * get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: HEADER_TEXTCOLOR. */ if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) { return; } // If we get this far, we have custom styles. Let's do this. ?> <style id="custom-header-styles" type="text/css"> <?php // Has the text been hidden? if ( 'blank' === $header_text_color ) : ?> .site-title, .site-description { position: absolute; clip: rect(1px, 1px, 1px, 1px); } <?php // If the user has set a custom color for the text use that. else : ?> .site-title a, .site-description { color: #<?php echo esc_attr( $header_text_color ); ?>; } <?php endif; ?> </style> <?php } endif; if ( ! function_exists( 'liveitup_admin_header_style' ) ) : /** * Styles the header image displayed on the Appearance > Header admin panel. * * Referenced via add_custom_image_header() in liveitup_setup(). * * @since Live it up 1.0 */ function liveitup_admin_header_style() { ?> <style type="text/css"> /* Shows the same border as on front end */ #headimg { border-bottom: 1px solid #000; border-top: 4px solid #000; } /* If NO_HEADER_TEXT is false, you would style the text with these selectors: #headimg #name { } #headimg #desc { } */ </style> <?php } endif; /** * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. * * To override this in a child theme, remove the filter and optionally add * your own function tied to the wp_page_menu_args filter hook. * * @since Live it up 1.0 */ function liveitup_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'liveitup_page_menu_args' ); /** * Sets the post excerpt length to 40 characters. * * To override this length in a child theme, remove the filter and add your own * function tied to the excerpt_length filter hook. * * @since Live it up 1.0 * @return int */ function liveitup_excerpt_length( $length ) { return 40; } add_filter( 'excerpt_length', 'liveitup_excerpt_length' ); /** * Returns a "Continue Reading" link for excerpts * * @since Live it up 1.0 * @return string "Continue Reading" link */ function liveitup_continue_reading_link() { return ' <a href="'. esc_url( get_permalink() ) . '">' . esc_html__( 'Continue reading <span class="meta-nav">→</span>', 'live-it-up' ) . '</a>'; } /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and liveitup_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. * * @since Live it up 1.0 * @return string An ellipsis */ function liveitup_auto_excerpt_more( $more ) { return ' …' . liveitup_continue_reading_link(); } add_filter( 'excerpt_more', 'liveitup_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. * * @since Live it up 1.0 * @return string Excerpt with a pretty "Continue Reading" link */ function liveitup_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= liveitup_continue_reading_link(); } return $output; } add_filter( 'get_the_excerpt', 'liveitup_custom_excerpt_more' ); /** * Remove inline styles printed when the gallery shortcode is used. * * Galleries are styled by the theme in Live it up's style.css. * * @since Live it up 1.0 * @return string The gallery style filter, with the styles themselves removed. */ function liveitup_remove_gallery_css( $css ) { return preg_replace( "#<style type='text/css'>(.*?)</style>#s", '', $css ); } add_filter( 'gallery_style', 'liveitup_remove_gallery_css' ); if ( ! function_exists( 'liveitup_comment' ) ) : /** * Template for comments and pingbacks. * * To override this walker in a child theme without modifying the comments template * simply create your own liveitup_comment(), and that function will be used instead. * * Used as a callback by wp_list_comments() for displaying the comments. * * @since Live it up 1.0 */ function liveitup_comment( $comment, $args, $depth ) { switch ( $comment->comment_type ) : case '' : ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> <div id="comment-<?php comment_ID(); ?>"> <div class="comment-author vcard"> <?php echo get_avatar( $comment, 40 ); ?> <?php printf( esc_html__( '%s <span class="says">says:</span>', 'live-it-up' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?> </div><!-- .comment-author .vcard --> <?php if ( $comment->comment_approved == '0' ) : ?> <em><?php esc_html_e( 'Your comment is awaiting moderation.', 'live-it-up' ); ?></em> <br /> <?php endif; ?> <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"> <?php /* translators: 1: date, 2: time */ printf( esc_html__( '%1$s at %2$s', 'live-it-up' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( esc_html__( '(Edit)','live-it-up' ), ' ' ); ?> </div><!-- .comment-meta .commentmetadata --> <div class="comment-body"><?php comment_text(); ?></div> <div class="reply"> <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> </div><!-- .reply --> </div><!-- #comment-## --> <?php break; case 'pingback' : case 'trackback' : ?> <li class="post pingback"> <p><?php esc_html_e( 'Pingback:', 'live-it-up' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( esc_html__('(Edit)','live-it-up'), ' ' ); ?></p> <?php break; endswitch; } endif; /** * Register widgetized areas, including two sidebars and four widget-ready columns in the footer. * * To override liveitup_widgets_init() in a child theme, remove the action hook and add your own * function tied to the init hook. * * @since Live it up 1.0 * @uses register_sidebar */ function liveitup_widgets_init() { // Area 1, located at the top of the sidebar. register_sidebar( array( 'name' => esc_html__( 'Primary Widget Area', 'live-it-up' ), 'id' => 'primary-widget-area', 'description' => esc_html__( 'The primary widget area', 'live-it-up' ), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li> <div class="widget-footer"></div> ', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); // Area 2, located below the Primary Widget Area in the sidebar. Empty by default. register_sidebar( array( 'name' => esc_html__( 'Secondary Widget Area', 'live-it-up' ), 'id' => 'secondary-widget-area', 'description' => esc_html__( 'The secondary widget area', 'live-it-up' ), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li> <div class="widget-footer"></div> ', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); // Area 3, located in the footer. Empty by default. register_sidebar( array( 'name' => esc_html__( 'First Footer Widget Area', 'live-it-up' ), 'id' => 'first-footer-widget-area', 'description' => esc_html__( 'The first footer widget area', 'live-it-up' ), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li> <div class="widget-footer"></div> ', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); // Area 4, located in the footer. Empty by default. register_sidebar( array( 'name' => esc_html__( 'Second Footer Widget Area', 'live-it-up' ), 'id' => 'second-footer-widget-area', 'description' => esc_html__( 'The second footer widget area', 'live-it-up' ), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li> <div class="widget-footer"></div> ', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); // Area 5, located in the footer. Empty by default. register_sidebar( array( 'name' => esc_html__( 'Third Footer Widget Area', 'live-it-up' ), 'id' => 'third-footer-widget-area', 'description' => esc_html__( 'The third footer widget area', 'live-it-up' ), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li> <div class="widget-footer"></div> ', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); // Area 6, located in the footer. Empty by default. register_sidebar( array( 'name' => esc_html__( 'Fourth Footer Widget Area', 'live-it-up' ), 'id' => 'fourth-footer-widget-area', 'description' => esc_html__( 'The fourth footer widget area', 'live-it-up' ), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li> <div class="widget-footer"></div> ', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); } /** Register sidebars by running liveitup_widgets_init() on the widgets_init hook. */ add_action( 'widgets_init', 'liveitup_widgets_init' ); /** * Removes the default styles that are packaged with the Recent Comments widget. * * To override this in a child theme, remove the filter and optionally add your own * function tied to the widgets_init action hook. * * @since Live it up 1.0 */ function liveitup_remove_recent_comments_style() { global $wp_widget_factory; remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); } add_action( 'widgets_init', 'liveitup_remove_recent_comments_style' ); if ( ! function_exists( 'liveitup_posted_on' ) ) : /** * Prints HTML with meta information for the current post—date/time and author. * * @since Live it up 1.0 */ function liveitup_posted_on() { printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'live-it-up' ), 'meta-prep meta-prep-author', sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>', esc_url( get_permalink() ), esc_attr( get_the_time() ), get_the_date() ), sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), sprintf( esc_attr__( 'View all posts by %s', 'live-it-up' ), get_the_author() ), get_the_author() ) ); } endif; if ( ! function_exists( 'liveitup_posted_in' ) ) : /** * Prints HTML with meta information for the current post (category, tags and permalink). * * @since Live it up 1.0 */ function liveitup_posted_in() { // Retrieves tag list of current post, separated by commas. $tag_list = get_the_tag_list( '', ', ' ); if ( $tag_list ) { $posted_in = esc_html__( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'live-it-up' ); } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) { $posted_in = esc_html__( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'live-it-up' ); } else { $posted_in = esc_html__( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'live-it-up' ); } // Prints the string, replacing the placeholders. printf( $posted_in, get_the_category_list( esc_html__( ', ', 'live-it-up' ) ), $tag_list, esc_url( get_permalink() ), the_title_attribute( 'echo=0' ) ); } endif; /** * By default, if a widget doesn't have a title, Wordpress doesn't show the widget header * To fix this, this function adds a space if no title is set. * * */ function liveitup_fix_widget_title ($title){ if (!$title) $title = ' '; return $title; } add_filter('widget_title','liveitup_fix_widget_title'); /** * Enqueue scripts and styles. */ function liveitup_scripts() { wp_enqueue_style( 'liveitup-style', get_stylesheet_uri() ); $fonts_url='http://fonts.googleapis.com/css?family=Arimo|Armata'; if(!empty($fonts_url)){ wp_enqueue_style('liveitup-font-name',esc_url_raw($fonts_url),array(),null); } //wp_enqueue_style('font-awesome', get_template_directory_uri() . '/css/font-awesome.css', array()); //wp_enqueue_script( 'staymore-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true ); //wp_enqueue_script( 'staymore-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true ); /*if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); }*/ } add_action( 'wp_enqueue_scripts', 'liveitup_scripts' );