tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ //add_theme_support( 'post-thumbnails' ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => __( 'Primary Menu', 'mediaphase' ), 'social' => __( 'Social', 'mediaphase' ), ) ); // Add default items to primary menu $default_primary_menu_created = get_option( 'default_primary_menu_created' ); if ( !$default_primary_menu_created ) { $name = 'primary'; $menu_id = wp_create_nav_menu( $name ); $menu = get_term_by( 'name', $name, 'nav_menu' ); wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'Home', 'mediaphase' ), 'menu-item-url' => home_url( '/' ), 'menu-item-status' => 'publish' ) ); $product_id = wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'Products', 'mediaphase' ), 'menu-item-url' => home_url( '/' ), 'menu-item-status' => 'publish' ) ); wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'Product 1', 'mediaphase' ), 'menu-item-url' => home_url( '/' ), 'menu-item-status' => 'publish', 'menu-item-parent-id' => $product_id, ) ); wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'Product 2', 'mediaphase' ), 'menu-item-url' => home_url( '/' ), 'menu-item-status' => 'publish', 'menu-item-parent-id' => $product_id, ) ); wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'Product 3', 'mediaphase' ), 'menu-item-url' => home_url( '/' ), 'menu-item-status' => 'publish', 'menu-item-parent-id' => $product_id, ) ); wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'About', 'mediaphase' ), 'menu-item-url' => home_url( '/' ), 'menu-item-status' => 'publish' ) ); wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'Contact', 'mediaphase' ), 'menu-item-url' => home_url( '/' ), 'menu-item-status' => 'publish' ) ); $locations = get_theme_mod( 'nav_menu_locations' ); $locations['primary'] = $menu->term_id; set_theme_mod( 'nav_menu_locations', $locations ); update_option( 'default_primary_menu_created', true ); } // Add default items to social menu $default_social_menu_created = get_option( 'default_social_menu_created' ); if ( !$default_social_menu_created ) { $name = 'social'; $menu_id = wp_create_nav_menu( $name ); $menu = get_term_by( 'name', $name, 'nav_menu' ); wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'Twitter', 'mediaphase' ), 'menu-item-url' => 'http://twitter.com/themefurnace', 'menu-item-status' => 'publish' ) ); wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'Wordpress', 'mediaphase' ), 'menu-item-url' => 'http://wordpress.com', 'menu-item-status' => 'publish' ) ); wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'Facebook', 'mediaphase' ), 'menu-item-url' => 'http://facebook.com/themefurnace', 'menu-item-status' => 'publish' ) ); wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'Dribbble', 'mediaphase' ), 'menu-item-url' => 'http://dribbble.com/themefurnace', 'menu-item-status' => 'publish' ) ); wp_update_nav_menu_item( $menu->term_id, 0, array( 'menu-item-title' => __( 'Google+', 'mediaphase' ), 'menu-item-url' => 'http://plus.google.com/+Wplift', 'menu-item-status' => 'publish' ) ); $locations = get_theme_mod( 'nav_menu_locations' ); $locations['social'] = $menu->term_id; set_theme_mod( 'nav_menu_locations', $locations ); update_option( 'default_social_menu_created', true ); } /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // enable featured images add_theme_support( 'post-thumbnails' ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'mediaphase_custom_background_args', array( 'default-color' => 'e2e2e2', 'default-image' => '', 'panel' => 'mediaphase_colors', ) ) ); add_image_size( 'mediaphase-frontpage-news', 300, 220, true ); add_image_size( 'mediaphase-blog-large', 700, 313, true ); } endif; // mediaphase_setup add_action( 'after_setup_theme', 'mediaphase_setup' ); /** * Register widget area. * * @link http://codex.wordpress.org/Function_Reference/register_sidebar */ function mediaphase_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'mediaphase' ), 'id' => 'mediaphase-sidebar', 'description' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Main Features Left', 'mediaphase' ), 'id' => 'mediaphase-main-features-left', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Main Features Right', 'mediaphase' ), 'id' => 'mediaphase-main-features-right', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sub Features', 'mediaphase' ), 'id' => 'mediaphase-sub-features', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer', 'mediaphase' ), 'id' => 'mediaphase-footer', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Team', 'mediaphase' ), 'id' => 'mediaphase-team', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'mediaphase_widgets_init' ); // Load Roboto Font function mediaphase_fonts_url() { $fonts_url = ''; $roboto = _x( 'on', 'Roboto font: on or off', 'mediaphase' ); if ( 'off' !== $roboto ) { $font_families = array(); $font_families[] = 'Roboto:300,400,700,300italic,400italic,700italic'; $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' ); } return $fonts_url; } /** * Enqueue scripts and styles. */ function mediaphase_scripts() { wp_enqueue_style( 'mediaphase-style', get_stylesheet_uri() ); wp_enqueue_style( 'mediaphase-font-awesome', get_template_directory_uri() . '/inc/css/font-awesome-4.3.0.min.css' ); wp_enqueue_style( 'mediaphase-fonts', mediaphase_fonts_url(), array(), null ); wp_enqueue_script( 'mediaphase-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true ); wp_enqueue_script( 'mediaphase-fade', get_template_directory_uri() . '/inc/js/fade.js', array( 'jquery' ), '20120206', true ); wp_enqueue_script( 'mediaphase-menu', get_template_directory_uri() . '/inc/js/script.js', array( 'jquery' ), '20120206', true ); wp_enqueue_script( 'mediaphase-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', 'mediaphase_scripts' ); function mediaphase_set_sample_content() { if ( !get_option( 'mediaphase_content_set' ) ) { // set up default widgets $active_sidebars = get_option( 'sidebars_widgets' ); $search_widget = get_option( 'widget_search' ); $search_widget[1] = array( 'title' => __( 'Search', 'mediaphase' ) ); $categories_widget = get_option( 'widget_categories' ); $categories_widget[1] = array( 'title' => __( 'Categories', 'mediaphase' ), 'count' => 1 ); $recent_posts_widget = get_option( 'widget_recent-posts' ); $recent_posts_widget[1] = array( 'title' => __( 'Recent Posts', 'mediaphase' ), 'show_date' => 1, 'number' => 5 ); $recent_posts_widget[2] = array( 'title' => __( 'Recent Posts', 'mediaphase' ), 'show_date' => 1, 'number' => 5 ); $recent_comments_widget = get_option( 'widget_recent-comments' ); $recent_comments_widget[1] = array( 'title' => __( 'Recent Comments', 'mediaphase' ) ); $meta_widget = get_option( 'widget_meta' ); $meta_widget[1] = array( 'title' => __( 'Meta', 'mediaphase' ) ); $text_widget = get_option( 'widget_text' ); $text_widget[1] = array( 'title' => __( 'Text Widget', 'mediaphase' ), 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean dapibus erat eget rhoncus facilisis. Duis et lacus ut tellus fermentum ultricies quis sit amet mauris. Nullam molestie, mauris ac ultrices tincidunt, sapien turpis rhoncus tellus, sed sagittis dui felis molestie risus.' ); $navigation_widget = get_option( 'widget_nav_menu' ); $navigation_widget[1] = array( 'title' => __( 'Browse Site', 'mediaphase' ), 'nav_menu' => 'primary.' ); $team_member_widget = get_option( 'widget_mediaphase-team-member-widget' ); $team_member_widget[1] = array( 'title' => __( 'Member 1', 'mediaphase' ), 'textbox' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque', 'social_twitter' => 'http://twitter.com', 'social_facebook' => 'http://facebook.com', 'social_dribbble' => 'http://dribbble.com', 'social_linkedin' => 'http://linkedin.com', 'social_gplus' => 'http://plus.google.com', 'image_url' => get_template_directory_uri() . '/img/staff1.jpg' ); $team_member_widget[2] = array( 'title' => __( 'Member 2', 'mediaphase' ), 'textbox' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque', 'social_twitter' => 'http://twitter.com', 'social_facebook' => 'http://facebook.com', 'social_dribbble' => 'http://dribbble.com', 'social_linkedin' => 'http://linkedin.com', 'social_gplus' => 'http://plus.google.com', 'image_url' => get_template_directory_uri() . '/img/staff1.jpg' ); $team_member_widget[3] = array( 'title' => __( 'Member 3', 'mediaphase' ), 'textbox' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque', 'social_twitter' => 'http://twitter.com', 'social_facebook' => 'http://facebook.com', 'social_dribbble' => 'http://dribbble.com', 'social_linkedin' => 'http://linkedin.com', 'social_gplus' => 'http://plus.google.com', 'image_url' => get_template_directory_uri() . '/img/staff1.jpg' ); $main_features_widget = get_option( 'widget_mediaphase-feature-widget' ); $main_features_widget[1] = array( 'title' => 'Feature 1', 'textbox' => '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque

', 'url' => home_url( '/' ), 'icon' => 'fa-camera' ); $main_features_widget[2] = array( 'title' => 'Feature 2', 'textbox' => '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque

', 'url' => home_url( '/' ), 'icon' => 'fa-check' ); $main_features_widget[3] = array( 'title' => 'Feature 3', 'textbox' => '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque

', 'url' => home_url( '/' ), 'icon' => 'fa-eye' ); $main_features_widget[4] = array( 'title' => 'Feature 4', 'textbox' => '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque

', 'url' => home_url( '/' ), 'icon' => 'fa-info' ); $main_features_widget[5] = array( 'title' => 'Sub Feature 1', 'textbox' => '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque

Read More ', 'url' => home_url( '/' ), 'icon' => 'fa-camera' ); $main_features_widget[6] = array( 'title' => 'Sub Feature 2', 'textbox' => '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque

Read More ', 'url' => home_url( '/' ), 'icon' => 'fa-check' ); $main_features_widget[7] = array( 'title' => 'Sub Feature 3', 'textbox' => '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc dapibus, eros at accumsan auctor, felis eros condimentum quam, non porttitor est urna vel neque

Read More ', 'url' => home_url( '/' ), 'icon' => 'fa-eye' ); $active_sidebars['mediaphase-footer'] = array( 'recent-posts-1', 'recent-comments-1', 'meta-1' ); update_option( 'widget_recent-posts', $recent_posts_widget ); update_option( 'widget_recent-comments', $recent_comments_widget ); update_option( 'widget_meta', $meta_widget ); update_option( 'sidebars_widgets', $active_sidebars ); $active_sidebars['mediaphase-sidebar'] = array( 'recent-posts-2', 'text-1', 'search-1', 'nav_menu-1', 'categories-1' ); update_option( 'widget_search', $search_widget ); update_option( 'widget_categories', $categories_widget ); update_option( 'widget_text', $text_widget ); update_option( 'widget_nav_menu', $navigation_widget ); update_option( 'sidebars_widgets', $active_sidebars ); $active_sidebars['mediaphase-team'] = array( 'mediaphase-team-member-widget-1', 'mediaphase-team-member-widget-2', 'mediaphase-team-member-widget-3' ); update_option( 'widget_mediaphase-team-member-widget', $team_member_widget ); update_option( 'sidebars_widgets', $active_sidebars ); $active_sidebars['mediaphase-main-features-left'] = array( 'mediaphase-feature-widget-1', 'mediaphase-feature-widget-2' ); update_option( 'widget_mediaphase-feature-widget', $main_features_widget ); update_option( 'sidebars_widgets', $active_sidebars ); $active_sidebars['mediaphase-main-features-right'] = array( 'mediaphase-feature-widget-3', 'mediaphase-feature-widget-4' ); $active_sidebars['mediaphase-sub-features'] = array( 'mediaphase-feature-widget-5', 'mediaphase-feature-widget-6', 'mediaphase-feature-widget-7' ); update_option( 'widget_mediaphase-feature-widget', $main_features_widget ); update_option( 'sidebars_widgets', $active_sidebars ); // set customizer options set_theme_mod( 'mediaphase_header_logo_image', get_template_directory_uri() . '/img/logo.png' ); set_theme_mod( 'mediaphase_header_logo_text', 'Mediaphase' ); set_theme_mod( 'mediaphase_header_contacts_phone', '0800 123 4567' ); set_theme_mod( 'mediaphase_header_contacts_email', 'contact@themefurnace.com' ); set_theme_mod( 'mediaphase_hero_bg_image', get_template_directory_uri() . '/img/hero.jpg' ); set_theme_mod( 'mediaphase_hero_title', 'MediaPhase is a Sweet MultiPurpose Theme' ); set_theme_mod( 'mediaphase_hero_text', '

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vel interdum diam, in ultricies diam. Proin vehicula sagittis lorem, nec.

Read More Join Now ' ); set_theme_mod( 'mediaphase_top_ribbon_bg_image', get_template_directory_uri() . '/img/ribbon1.png' ); set_theme_mod( 'mediaphase_top_ribbon_text', 'Download it free from the WordPress Repository ' ); set_theme_mod( 'mediaphase_main_features_title', 'MediaPhase is a Sweet MultiPurpose Theme' ); set_theme_mod( 'mediaphase_main_features_bg_image', get_template_directory_uri() . '/img/iphones.png' ); set_theme_mod( 'mediaphase_about_us_title', 'About Us' ); set_theme_mod( 'mediaphase_about_us_text', 'Here is a special area where you can write about yourself or your company, use it to write a short intro or a welcome message. Use it to tell the world how great your are and draw attention to some of your businesses sucess stories.This text is editable via the customizer, if you wish you can also hide this block from view completely.' ); set_theme_mod( 'mediaphase_middle_ribbon_bg_image', get_template_directory_uri() . '/img/ribbon2.png' ); set_theme_mod( 'mediaphase_middle_ribbon_text', '

Download it free from the WordPress Repository

Join Now ' ); set_theme_mod( 'mediaphase_meet_the_team_title', 'Meet The Team' ); set_theme_mod( 'mediaphase_meet_the_team_text', 'We have built some custom widgets so you can show off your staff members here along with their social media profile links. You can edit this text in the customizer.' ); set_theme_mod( 'mediaphase_latest_news_title', 'Latest News' ); set_theme_mod( 'mediaphase_latest_news_text', 'This is where you can display your latest blog posts, you can choose how many items to show or hide this block completely - this text is editable in the customizer.' ); set_theme_mod( 'mediaphase_bottom_ribbon_bg_image', get_template_directory_uri() . '/img/ribbon3.png' ); set_theme_mod( 'mediaphase_bottom_ribbon_text', '

Download it free from the WordPress Repository

Join Now ' ); set_theme_mod( 'mediaphase_logos_image', get_template_directory_uri() . '/img/logos.png' ); set_theme_mod( 'mediaphase_footer_logo_image', get_template_directory_uri() . '/img/logo.png' ); update_option( 'mediaphase_content_set', 1 ); } } add_action( 'wp_loaded', 'mediaphase_set_sample_content', 100 ); function mediaphase_pagination() { global $wp_query; if ( $wp_query->max_num_pages < 2 ) { return; } $big = 999999999; // need an unlikely integer echo ''; } /** * Custom Breadcrumbs */ function mediaphase_breadcrumb() { if ( !is_home() ) { echo ''; bloginfo( 'name' ); echo " "; if ( is_category() || is_single() ) { the_category( ', ' ); if ( is_single() ) { echo " "; the_title(); } } elseif ( is_page() ) { echo the_title(); } } } /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis) and sets character length to 35 */ function mediaphase_excerpt( $text ) { if ( $text == '' ) { $text = get_the_content( '' ); $text = strip_shortcodes( $text ); $text = apply_filters( 'the_content', $text ); $text = str_replace( ']]>', ']]>', $text ); $text = strip_tags( $text ); $text = nl2br( $text ); $excerpt_length = apply_filters( 'excerpt_length', 45 ); $words = explode( ' ', $text, $excerpt_length + 1 ); if ( count( $words ) > $excerpt_length ) { array_pop( $words ); array_push( $words, '' ); $text = implode( ' ', $words ); } } return $text; } remove_filter( 'get_the_excerpt', 'wp_trim_excerpt' ); add_filter( 'get_the_excerpt', 'mediaphase_excerpt' ); /* This code filters the Categories archive widget to include the post count inside the link */ function mediaphase_cat_count_span( $links ) { $links = str_replace( ' (', ' (', $links ); $links = str_replace( ')', ')', $links ); return $links; } add_filter( 'wp_list_categories', 'mediaphase_cat_count_span' ); /* This code filters the Archive widget to include the post count inside the link */ function mediaphase_archive_count_span( $links ) { $links = str_replace( ' (', ' (', $links ); $links = str_replace( ')', ')', $links ); return $links; } add_filter( 'get_archives_link', 'mediaphase_archive_count_span' ); // Style the Tag Cloud function mediaphase_custom_tag_cloud_widget( $args ) { $args['largest'] = 12; //largest tag $args['smallest'] = 12; //smallest tag $args['unit'] = 'px'; //tag font unit $args['number'] = '8'; //number of tags return $args; } add_filter( 'widget_tag_cloud_args', 'mediaphase_custom_tag_cloud_widget' ); /** * Declare WooCommerce Compatibility */ function mediaphase_woocommerce_support() { add_theme_support( 'woocommerce' ); } add_action( 'after_setup_theme', 'mediaphase_woocommerce_support' ); /** * Upsell links and content */ require get_template_directory() . '/inc/mediaphase-upsell.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Customizer styles, fonts */ require get_template_directory() . '/inc/themesetup.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'; /** * Mediaphase Custom Widgets */ require get_template_directory() . '/inc/widgets/feature-widget.php'; require get_template_directory() . '/inc/widgets/team-member-widget.php'; /** * Load "time ago" library */ if ( !function_exists( 'mediaphase_time_ago_in_words' ) ) { require get_template_directory() . '/inc/timeago.inc.php'; }