* 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.
?>
Header admin panel.
*
* Referenced via add_custom_image_header() in liveitup_setup().
*
* @since Live it up 1.0
*/
function liveitup_admin_header_style() {
?>
' . esc_html__( 'Continue reading →', 'live-it-up' ) . '';
}
/**
* 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( "##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 '' :
?>
id="li-comment-">
esc_html__( 'Primary Widget Area', 'live-it-up' ),
'id' => 'primary-widget-area',
'description' => esc_html__( 'The primary widget area', 'live-it-up' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
// 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' => '',
'after_widget' => '
',
'before_title' => '',
) );
// 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' => '',
'after_widget' => '
',
'before_title' => '',
) );
// 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' => '',
'after_widget' => '
',
'before_title' => '',
) );
// 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' => '',
'after_widget' => '
',
'before_title' => '',
) );
// 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' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
/** 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( __( 'Posted on %2$s by %3$s', 'live-it-up' ),
'meta-prep meta-prep-author',
sprintf( '%3$s',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
get_the_date()
),
sprintf( '%3$s',
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 permalink.', '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 permalink.', 'live-it-up' );
} else {
$posted_in = esc_html__( 'Bookmark the permalink.', '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' );