Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //* Start the engine
- include_once( get_template_directory() . '/lib/init.php' );
- //* Setup Theme
- include_once( get_stylesheet_directory() . '/lib/theme-defaults.php' );
- //* Set Localization (do not remove)
- load_child_theme_textdomain( 'parallax', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'parallax' ) );
- //* Add Image upload to WordPress Theme Customizer
- add_action( 'customize_register', 'parallax_customizer' );
- function parallax_customizer(){
- require_once( get_stylesheet_directory() . '/lib/customize.php' );
- }
- //* Include Google Fonts
- add_action( 'wp_enqueue_scripts', 'add_google_fonts' );
- function add_google_fonts() {
- wp_enqueue_style( 'minimum-google-fonts', '//fonts.googleapis.com/css?family=Roboto|Open+Sans|Lato|Oswald', array() );
- }
- //* Display a custom favicon
- add_filter( 'genesis_pre_load_favicon', 'sp_favicon_filter' );
- function sp_favicon_filter( $favicon_url ) {
- return '/wp-content/themes/genesis/images/favicon.ico';
- }
- //* Include Section Image CSS
- include_once( get_stylesheet_directory() . '/lib/output.php' );
- //* Child theme (do not remove)
- define( 'CHILD_THEME_NAME', 'Parallax Pro Theme' );
- define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/parallax/' );
- define( 'CHILD_THEME_VERSION', '1.1' );
- //* Enqueue scripts and styles
- add_action( 'wp_enqueue_scripts', 'parallax_enqueue_scripts_styles' );
- function parallax_enqueue_scripts_styles() {
- wp_enqueue_script( 'parallax-responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' );
- wp_enqueue_style( 'dashicons' );
- wp_enqueue_style( 'parallax-google-fonts', '//fonts.googleapis.com/css?family=Montserrat|Sorts+Mill+Goudy', array(), CHILD_THEME_VERSION );
- }
- //* Add featured image into the feed
- add_filter( 'the_content', 'featured_image_in_feed' );
- function featured_image_in_feed( $content ) {
- global $post;
- if( is_feed() ) {
- if ( has_post_thumbnail( $post->ID ) ){
- $output = get_the_post_thumbnail( $post->ID, 'large', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) );
- $content = $output . $content;
- }
- }
- return $content;
- }
- //* Add HTML5 markup structure
- add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );
- //* Add viewport meta tag for mobile browsers
- add_theme_support( 'genesis-responsive-viewport' );
- //* Add support for 3-column footer widgets
- add_theme_support( 'genesis-footer-widgets', 1 );
- //* Reposition the primary navigation menu
- remove_action( 'genesis_after_header', 'genesis_do_nav' );
- add_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_nav' );
- //* Reposition the secondary navigation menu
- remove_action( 'genesis_after_header', 'genesis_do_subnav' );
- add_action( 'genesis_footer', 'genesis_do_subnav', 7 );
- //* Reduce the secondary navigation menu to one level depth
- add_filter( 'wp_nav_menu_args', 'parallax_secondary_menu_args' );
- function parallax_secondary_menu_args( $args ){
- if( 'secondary' != $args['theme_location'] )
- return $args;
- $args['depth'] = 1;
- return $args;
- }
- //* Unregister layout settings
- genesis_unregister_layout( 'content-sidebar-sidebar' );
- genesis_unregister_layout( 'sidebar-content-sidebar' );
- genesis_unregister_layout( 'sidebar-sidebar-content' );
- //* Add support for additional color styles
- add_theme_support( 'genesis-style-selector', array(
- 'parallax-pro-blue' => __( 'Parallax Pro Blue', 'parallax' ),
- 'parallax-pro-green' => __( 'Parallax Pro Green', 'parallax' ),
- 'parallax-pro-orange' => __( 'Parallax Pro Orange', 'parallax' ),
- 'parallax-pro-pink' => __( 'Parallax Pro Pink', 'parallax' ),
- ) );
- //* Unregister secondary sidebar
- unregister_sidebar( 'sidebar-alt' );
- //* Add support for custom header
- add_theme_support( 'custom-header', array(
- 'width' => 360,
- 'height' => 70,
- 'header-selector' => '.site-title a',
- 'header-text' => false,
- ) );
- //* Add support for structural wraps
- add_theme_support( 'genesis-structural-wraps', array(
- 'header',
- 'nav',
- 'subnav',
- 'footer-widgets',
- 'footer',
- ) );
- //* Hook after post widget after the entry content
- add_action( 'genesis_after_entry', 'parallax_after_entry', 5 );
- function parallax_after_entry() {
- if ( is_singular( 'post' ) )
- genesis_widget_area( 'after-entry', array(
- 'before' => '<div class="after-entry widget-area">',
- 'after' => '</div>',
- ) );
- }
- //* Register widget areas
- genesis_register_sidebar( array(
- 'id' => 'home-section-1',
- 'name' => __( 'Home Section 1', 'parallax' ),
- 'description' => __( 'This is the home section 1 section.', 'parallax' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'home-section-2',
- 'name' => __( 'Home Section 2', 'parallax' ),
- 'description' => __( 'This is the home section 2 section.', 'parallax' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'home-section-3',
- 'name' => __( 'Home Section 3', 'parallax' ),
- 'description' => __( 'This is the home section 3 section.', 'parallax' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'home-section-4',
- 'name' => __( 'Home Section 4', 'parallax' ),
- 'description' => __( 'This is the home section 4 section.', 'parallax' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'home-section-5',
- 'name' => __( 'Home Section 5', 'parallax' ),
- 'description' => __( 'This is the home section 5 section.', 'parallax' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'after-entry',
- 'name' => __( 'After Entry', 'parallax' ),
- 'description' => __( 'This is the after entry widget area.', 'parallax' ),
- ) );
- //* Customize the post info function
- add_filter( 'genesis_post_info', 'sp_post_info_filter' );
- function sp_post_info_filter($post_info) {
- if ( !is_page() ) {
- $post_info = 'Posted on [post_date] by [post_author_posts_link] [post_comments] [post_edit]';
- return $post_info;
- }}
- //* Relocate Post Title and Post Info
- add_action( 'genesis_after_header', 'sk_relocate_post_title_info');
- function sk_relocate_post_title_info() {
- if ( is_singular('post' ) ) {
- remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
- remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
- remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
- remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
- echo '<div class="featured-single"><div class="wrap">';
- genesis_entry_header_markup_open();
- genesis_do_post_title();
- genesis_post_info();
- genesis_entry_header_markup_close();
- echo '</div></div>';
- }
- }
- //* Enqueue site-wide scripts
- add_action( 'wp_enqueue_scripts', 'custom_load_scripts' );
- function custom_load_scripts() {
- wp_enqueue_style( 'dashicons' );
- wp_enqueue_script( 'header-fade', get_bloginfo( 'stylesheet_directory' ) . '/js/header-fade.js', array( 'jquery' ), '1.0.0', true );
- }
- //* Enqueue scripts on single Post pages
- add_action( 'wp_enqueue_scripts', 'enqueue_singular' );
- function enqueue_singular() {
- if ( is_singular('post' ) ) {
- // to add a dynamically-resized background image to .featured-single
- wp_enqueue_script( 'backstretch', get_stylesheet_directory_uri() . '/js/jquery.backstretch.min.js', array( 'jquery' ), '', true );
- wp_enqueue_script( 'backstretch-init', get_stylesheet_directory_uri() . '/js/backstretch-init.js', array( 'backstretch' ), '1.0.0', true );
- // if the post has a featured image, send it to Backstretch else use a default one
- if ( has_post_thumbnail() ) {
- wp_localize_script( 'backstretch-init', 'BackStretchImg', array( 'src' => wp_get_attachment_url( get_post_thumbnail_id() ) ) );
- }
- else {
- wp_localize_script( 'backstretch-init', 'BackStretchImg', array( 'src' => '/wp-content/themes/parallax-pro/images/bg-1.jpg' ) );
- }
- // for smooth scrolling when the down arrow is clicked
- wp_enqueue_script( 'scrollTo', get_stylesheet_directory_uri() . '/js/jquery.scrollTo.min.js', array( 'jquery' ), '', true );
- wp_enqueue_script( 'localScroll', get_stylesheet_directory_uri() . '/js/jquery.localScroll.min.js', array( 'scrollTo' ), '', true );
- // for setting the height of 'Featured Single' section so its background fills the viewport, adding the down arrow, and setting smooth scrolling speed
- wp_enqueue_script( 'singular', get_bloginfo( 'stylesheet_directory' ) . '/js/singular-scripts.js', array( 'jquery' ), '1.0.0', true );
- // for fading away Post title and info when scrolling down and fading in when scrolling up
- wp_enqueue_script( 'fade-on-scroll', get_stylesheet_directory_uri() . '/js/fade-on-scroll.js', array( 'scrollTo' ), '1.0.0', true );
- }
- }
- //* Add a ID to .site-inner
- add_filter( 'genesis_attr_site-inner', 'custom_attributes_content' );
- function custom_attributes_content( $attributes ) {
- if ( is_singular('post' ) ) {
- $attributes['id'] = 'site-inner';
- }
- return $attributes;
- }
- add_image_size( 'homepage-image', 1140, 450, TRUE );
- add_image_size( 'custom-square-thumbnail', 800, 450, TRUE );
- /**
- * Template Redirect
- * Use custom-archive.php for specified archives.
- * Props: Bill Erickson
- */
- add_filter( 'template_include', 'sk_template_redirect' );
- function sk_template_redirect( $template ) {
- if ( is_category() || is_tag() )
- $template = get_query_template( 'custom-archive' );
- return $template;
- }
- // Enable Agency Like Featured Posts after Post
- add_image_size( 'agency-after-entry', 187, 130, TRUE );
- genesis_register_sidebar( array(
- 'id' => 'agency-after-entry',
- 'name' => __( 'Agency-like Featured After Entry', 'theme-name' ),
- 'description' => __( 'This is the agency like featured posts section.', 'theme-name' ),
- ) );
- add_action( 'genesis_after_entry', 'ms_featured_posts' );
- function ms_featured_posts() {
- if ( is_singular('post' ) ) {
- genesis_widget_area( 'agency-after-entry', array(
- 'before' => '<div class="agency-like-featured-posts-entry widget-area"><div class="wrap">',
- 'after' => '</div></div>',
- ) );
- }
- }
- //* Customize the post meta function
- add_filter( 'genesis_post_meta', 'sp_post_meta_filter' );
- function sp_post_meta_filter($post_meta) {
- if ( !is_page() ) {
- $post_meta = '[post_categories before="Filed Under: "] [post_tags before="Tagged: "]';
- return $post_meta;
- }}
- //* Customize the credits
- add_filter( 'genesis_footer_creds_text', 'sp_footer_creds_text' );
- function sp_footer_creds_text() {
- echo '<div class="credsmenu"><p>';
- echo ' <a href="/about">About</a> · <a href="/contact/" title="Contact Me">Contact</a> · <a href="/feed/" title="RSS">Subscribe</a>';
- echo '</p></div>';
- echo '<div class="creds"><p>';
- echo 'Copyright © ';
- echo date('Y');
- echo ' · <a href="http://www.geekdaily.co">Geek Daily</a> · Built on the <a href="http://www.geekdaily.co/go/genesis/" title="Genesis Framework">Genesis Framework</a> · And Hosted By <a href="http://getflywheel.com" title="Flywheel">Flywheel</a>';
- echo '</p></div>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement