__( 'Primary Menu', 'pictorial' ), ) ); /** * Enable support for Post Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); /* * This theme supports custom background color and image, and here * we also set up the default background color. */ add_theme_support( 'custom-background', array( 'default-color' => '00c6c0', 'default-image' => '', ) ); } endif; // pictorial_setup add_action( 'after_setup_theme', 'pictorial_setup' ); // Lets load our custom functions and scripts now require( get_template_directory() . '/inc/smart-widgets.php' ); /** * Register Lato Google font for Pictorial. * * @since Pictorial 1.0 * * @return void */ function pictorial_font_url() { $font_url = ''; /* * Translators: If there are characters in your language that are not supported * by Lato, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Lato font: on or off', 'pictorial' ) ) { $font_url = add_query_arg( 'family', urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), "//fonts.googleapis.com/css" ); } return $font_url; } /** * Enqueue scripts and styles */ function pictorial_scripts() { global $wp_styles; // Bump this when changes are made to bust cache $version = '1.0.2'; // CSS Scripts $protocol = is_ssl() ? 'https' : 'http'; $query_args = array( 'family' => 'Yanone+Kaffeesatz:200,300,400,700', ); wp_enqueue_style( 'pictorial-fonts', add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ) ); // Add Lato font, used in the main stylesheet. //wp_enqueue_style( 'pictorial-lato', pictorial_font_url(), array(), null ); wp_enqueue_style('pictorial-style', get_template_directory_uri().'/css/style.css', false ,$version, 'all' ); wp_enqueue_style('pictorial-bootstrap', get_template_directory_uri().'/css/app.css', false ,$version, 'all' ); wp_enqueue_style('pictorial-responsive', get_template_directory_uri().'/css/app-responsive.css', false ,$version, 'all' ); wp_enqueue_style('pictorial-custom', get_template_directory_uri().'/css/custom.css', false ,$version, 'all' ); // Load style.css from child theme if (is_child_theme()) { wp_enqueue_style('pictorial_child', get_stylesheet_uri(), false, $version, null); } if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script('bootstrap.min.js', get_template_directory_uri().'/js/app.js', array('jquery'),$version, true ); wp_enqueue_script( 'pictorial-bootstrapnav', get_template_directory_uri() . '/js/twitter-bootstrap-hover-dropdown.js', array(), $version, true ); wp_enqueue_script('bootstrap.min.js', get_template_directory_uri().'/js/modernizr.custom.79639.js', array('jquery'),$version, false ); } add_action( 'wp_enqueue_scripts', 'pictorial_scripts' ); /* IE js header /* ------------------------------------ */ function pictorial_ie_support_header() { echo ''. "\n"; } add_action( 'wp_head', 'pictorial_ie_support_header' ); /* IE js footer /* ------------------------------------ */ function pictorial_ie_support_footer() { echo ''. "\n"; } add_action( 'wp_footer', 'pictorial_ie_support_footer', 20 ); if ( !wp_is_mobile() ) { require get_template_directory() . '/inc/nav-menu-walker.php'; } else { require get_template_directory() . '/inc/nav-mobile-walker.php'; } /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/inc/extras.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ //require get_template_directory() . '/inc/jetpack.php'; // Lets do a separate excerpt length for the showcase recent post function pictorial_showcase_excerpt () { $theContent = trim(strip_tags(get_the_content())); $output = str_replace( '"', '', $theContent); $output = str_replace( '\r\n', ' ', $output); $output = str_replace( '\n', ' ', $output); if (get_theme_mod( 'pictorial_showcase_excerpt_length' )) : $limit = get_theme_mod( 'pictorial_showcase_excerpt_length' ); else : $limit = '15'; endif; $content = explode(' ', $output, $limit); array_pop($content); $content = implode(" ",$content)." "; return strip_tags($content, ' '); } // Lets do a separate excerpt length for the alternative recent post widget function pictorial_recentpost_excerpt () { $theContent = trim(strip_tags(get_the_content())); $output = str_replace( '"', '', $theContent); $output = str_replace( '\r\n', ' ', $output); $output = str_replace( '\n', ' ', $output); if (get_theme_mod( 'pictorial_recentpost_excerpt_length' )) : $limit = get_theme_mod( 'pictorial_recentpost_excerpt_length' ); else : $limit = '15'; endif; $content = explode(' ', $output, $limit); array_pop($content); $content = implode(" ",$content)." "; return strip_tags($content, ' '); } if ( ! function_exists( 'pictorial_entry_meta' ) ) : /** * Prints HTML with meta information for current post: categories, tags, permalink, author, and date. * * Create your own pictorial_entry_meta() to override in a child theme. * * @since Pictorial 1.0.0 * * @return void */ function pictorial_entry_meta() { if ( is_sticky() && is_home() && ! is_paged() ) echo '' . __( 'Sticky', 'pictorial' ) . ''; if ( ! has_post_format( 'aside' ) && ! has_post_format( 'link' ) && 'post' == get_post_type() ) pictorial_entry_date(); // Translators: used between list items, there is a space after the comma. $categories_list = get_the_category_list( __( ', ', 'pictorial' ) ); if ( $categories_list ) { echo '' . $categories_list . ''; } // Translators: used between list items, there is a space after the comma. $tag_list = get_the_tag_list( '', __( ', ', 'pictorial' ) ); if ( $tag_list ) { echo '' . $tag_list . ''; } // Post author if ( 'post' == get_post_type() ) { printf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'pictorial' ), get_the_author() ) ), get_the_author() ); } } endif; if ( ! function_exists( 'pictorial_entry_date' ) ) : /** * Prints HTML with date information for current post. * * Create your own pictorial_entry_date() to override in a child theme. * * @since Pictorial 1.0.0 * * @param boolean $echo Whether to echo the date. Default true. * @return string */ function pictorial_entry_date( $echo = true ) { $format_prefix = ( has_post_format( 'chat' ) || has_post_format( 'status' ) ) ? _x( '%1$s on %2$s', '1: post format name. 2: date', 'pictorial' ): '%2$s'; $date = sprintf( '', esc_url( get_permalink() ), esc_attr( sprintf( __( 'Permalink to %s', 'pictorial' ), the_title_attribute( 'echo=0' ) ) ), esc_attr( get_the_date( 'c' ) ), esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) ) ); if ( $echo ) echo $date; return $date; } endif; function pictorial_body_class( $classes ) { $background_color = get_background_color(); if ( empty( $background_color ) ) $classes[] = 'custom-background-empty'; elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) ) $classes[] = 'custom-background-white'; return $classes; } add_filter( 'body_class', 'pictorial_body_class' ); /** * Returns number of widgets in a widget position - used in the Header Showcase widget area. * * @since Pictorial 1.0.0 */ function pictorial_header_sidebar_class() { $count = 0; if ( is_active_sidebar( 'header-showcase1' ) ) $count++; if ( is_active_sidebar( 'header-showcase2' ) ) $count++; if ( is_active_sidebar( 'header-showcase3' ) ) $count++; if ( is_active_sidebar( 'header-showcase4' ) ) $count++; $class = ''; switch ( $count ) { case '1': $class = 'one'; break; case '2': $class = 'two'; break; case '3': $class = 'three'; break; case '4': $class = 'four'; break; } if ( $class ) echo 'class="' . $class . '"'; } /** * Returns number of widgets in a widget position - used in the Footer Showcase widget area. * * @since Pictorial 1.0.0 */ function pictorial_footer_sidebar_class() { $count = 0; if ( is_active_sidebar( 'footer-showcase1' ) ) $count++; if ( is_active_sidebar( 'footer-showcase2' ) ) $count++; if ( is_active_sidebar( 'footer-showcase3' ) ) $count++; if ( is_active_sidebar( 'footer-showcase4' ) ) $count++; $class = ''; switch ( $count ) { case '1': $class = 'one'; break; case '2': $class = 'two'; break; case '3': $class = 'three'; break; case '4': $class = 'four'; break; } if ( $class ) echo 'class="' . $class . '"'; }