',
'before_title' => '
',
) );
// Area 3, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'First Footer Widget Area', 'discover' ),
'id' => 'first-footer-widget-area',
'description' => __( 'The first footer widget area', 'discover' ),
'before_widget' => '
',
'after_widget' => ' ',
'before_title' => '
',
) );
// Area 4, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Second Footer Widget Area', 'discover' ),
'id' => 'second-footer-widget-area',
'description' => __( 'The second footer widget area', 'discover' ),
'before_widget' => '
',
'after_widget' => ' ',
'before_title' => '
',
) );
// Area 5, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Third Footer Widget Area', 'discover' ),
'id' => 'third-footer-widget-area',
'description' => __( 'The third footer widget area', 'discover' ),
'before_widget' => '
',
'after_widget' => ' ',
'before_title' => '
',
) );
}
if ( ! function_exists( 'discover_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
* Create your own discover_posted_on to override in a child theme
*
* @since Twenty Eleven 1.0
*/
function discover_posted_on() {
printf( __( '
Posted on %4$s by %7$s ', 'discover' ),
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', 'discover' ), get_the_author() ) ),
get_the_author()
);
}
endif;
/** Register sidebars by running discover_widgets_init() on the widgets_init hook. */
add_action( 'widgets_init', 'discover_widgets_init' );
/** Excerpt */
function discover_excerpt_length( $length ) {
return 30;
}
add_filter( 'excerpt_length', 'discover_excerpt_length' );
function discover_auto_excerpt_more( $more ) {
return ' …' ;
}
add_filter( 'excerpt_more', 'discover_auto_excerpt_more' );
/** filter function for wp_title */
function discover_filter_wp_title( $old_title, $sep, $sep_location ){
// add padding to the sep
$ssep = ' ' . $sep . ' ';
// find the type of index page this is
if( is_category() ) $insert = $ssep . 'Category';
elseif( is_tag() ) $insert = $ssep . 'Tag';
elseif( is_author() ) $insert = $ssep . 'Author';
elseif( is_year() || is_month() || is_day() ) $insert = $ssep . 'Archives';
else $insert = NULL;
// get the page number we're on (index)
if( get_query_var( 'paged' ) )
$num = $ssep . 'page ' . get_query_var( 'paged' );
// get the page number we're on (multipage post)
elseif( get_query_var( 'page' ) )
$num = $ssep . 'page ' . get_query_var( 'page' );
// else
else $num = NULL;
// concoct and return new title
return get_bloginfo( 'name' ) . $insert . $old_title . $num;
}
// call our custom wp_title filter, with normal (10) priority, and 3 args
add_filter( 'wp_title', 'discover_filter_wp_title', 10, 3 );
// custom function
function discover_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'discover_page_menu_args' );
// custom function
/*-----------------------------------------------------------------------------------*/
/* Exclude categories from displaying on the "Blog" page template.
/*-----------------------------------------------------------------------------------*/
// Exclude categories on the "Blog" page template.
add_filter( 'discover_blog_template_query_args', 'discover_exclude_categories_blogtemplate' );
function discover_exclude_categories_blogtemplate ( $args ) {
if ( ! function_exists( 'discover_prepare_category_ids_from_option' ) ) { return $args; }
$excluded_cats = array();
// Process the category data and convert all categories to IDs.
$excluded_cats = discover_prepare_category_ids_from_option( 'exclude_cat' );
if ( count( $excluded_cats ) > 0 ) {
// Setup the categories as a string, because "category__not_in" doesn't seem to work
// when using query_posts().
foreach ( $excluded_cats as $k => $v ) { $excluded_cats[$k] = '-' . $v; }
$cats = join( ',', $excluded_cats );
$args['cat'] = $cats;
}
return $args;
}
/*-----------------------------------------------------------------------------------*/
/* discover_prepare_category_ids_from_option()
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'discover_prepare_category_ids_from_option' ) ) {
function discover_prepare_category_ids_from_option ( $option ) {
$cats = array();
$stored_cats = themeszen_get_option( $option );
$cats_raw = explode( ',', $stored_cats );
if ( is_array( $cats_raw ) && ( count( $cats_raw ) > 0 ) ) {
foreach ( $cats_raw as $k => $v ) {
$value = trim( $v );
if ( is_numeric( $value ) ) {
$cats_raw[$k] = $value;
} else {
$cat_obj = get_category_by_slug( $value );
if ( isset( $cat_obj->term_id ) ) {
$cats_raw[$k] = $cat_obj->term_id;
}
}
$cats = $cats_raw;
}
}
return $cats;
}
}
function discover_date_on() {
printf( __( '
Posted on %2$s', 'discover' ),
'meta-prep meta-prep-author',
sprintf( '
%3$s ',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date()
)
);
}
function discover_of_register_js() {
if (!is_admin()) {
wp_register_script('superfish', get_template_directory_uri() . '/js/superfish.js', 'jquery', '1.0', TRUE);
wp_register_script('discover_custom', get_template_directory_uri() . '/js/jquery.custom.js', 'jquery', '1.0', TRUE);
wp_register_script('fitvids', get_template_directory_uri() . '/js/jquery.fitvids.js', 'jquery', '1.0', TRUE);
wp_register_script('selectnav', get_template_directory_uri() . '/js/selectnav.js', 'jquery', '0.1', TRUE);
wp_register_script('flexslider', get_template_directory_uri() . '/js/jquery.flexslider.js', 'jquery', '2.1', TRUE);
wp_register_script('modernizr', get_template_directory_uri() . '/js/modernizr.js', 'jquery', '2.6.1', false);
wp_register_script('responsive', get_template_directory_uri() . '/js/responsive-scripts.js', 'jquery', '1.2.1', TRUE);
wp_enqueue_script('jquery');
wp_enqueue_script('superfish');
wp_enqueue_script('discover_custom');
wp_enqueue_script('fitvids');
wp_enqueue_script('flexslider');
wp_enqueue_script('selectnav');
wp_enqueue_script('modernizr');
wp_enqueue_script('responsive');
}
}
add_action('init', 'discover_of_register_js');
function discover_of_single_scripts() {
if(is_singular()) wp_enqueue_script( 'comment-reply' ); // loads the javascript required for threaded comments
}
add_action('wp_print_scripts', 'discover_of_single_scripts');
function discover_of_styles() {
wp_register_style( 'superfish', get_template_directory_uri() . '/css/superfish.css' );
wp_register_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css' );
wp_register_style( 'foundation', get_template_directory_uri() . '/css/foundation.css' );
wp_enqueue_style( 'superfish' );
wp_enqueue_style( 'flexslider' );
wp_enqueue_style( 'foundation' );
}
add_action('wp_print_styles', 'discover_of_styles');
// WooCommerce
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'discover_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'discover_wrapper_end', 10);
function discover_wrapper_start() {
echo '
';
}
function discover_wrapper_end() {
echo '
';
wp_link_pages( array( 'before' => '' . __( 'Pages:', 'discover' ), 'after' => '' ) );
echo '
';
get_sidebar();
echo '
';
}
function discover_tracking_admin_notice() {
global $current_user;
$user_id = $current_user->ID;
/* Check that the user hasn't already clicked to ignore the message */
if (!get_user_meta($user_id, 'wp_tracking_ignore_notice')) {
?>