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:400,700', 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' );
- }
- //* 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() {
- if ( wp_is_mobile() ) {
- return;
- }
- 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 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 );
- }
- }
- //* Add an 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;
- }
- //* 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>';
- }
- //* Add social buttons after 1st paragraph
- function ads_added_above_last_p( $text ) {
- if( is_single() ) :
- $ads_text = '<div class="a" style="text-align: left;"><div class="opt-social_paragraph vertical-paragraph-top">
- <a class="opt-social_paragraph_link facebook" href="https://www.facebook.com/sharer/sharer.php" onclick="var sharerFb = \'https://www.facebook.com/sharer/sharer.php?u=\'; window.open(sharerFb + location.href, \'sharerFb\', \'width=626,height=436\'); return false;">Share</a>
- <a class="opt-social_paragraph_link twitter" href="https://twitter.com/share" onclick="var sharerTw = \'https://twitter.com/share?url=\'; window.open(sharerTw + location.href, \'sharerTw\', \'width=550,height=520\'); return false;">Tweet</a>
- <a class="opt-social_paragraph_link google" href="https://plus.google.com/share" onclick="var sharerGp = \'https://plus.google.com/share?url=\'; window.open(sharerGp + location.href, \'sharerGp\', \'width=840,height=464\'); return false;">+1</a>
- <a class="opt-social_paragraph_link reddit" href="http://www.reddit.com/submit" onclick="var sharerRd = \'http://www.reddit.com/submit?url=\'; window.open(sharerRd + location.href, \'sharerRd\', \'width=840,height=464\'); return false;">Submit</a>
- </div></div>';
- if( $pos1 = strpos( $text, '<p>', strpos( $text, '<p>' ) + 3 ) ){
- $text1 = substr( $text, 0, $pos1 );
- $text2 = substr( $text, $pos1 );
- $text = $text1 . $ads_text . $text2;
- }
- endif;
- return $text;
- }
- add_filter( 'the_content', 'ads_added_above_last_p' );
- //* Helps to remove ? content for pageload
- function _remove_script_version( $src ){
- $parts = explode( '?ver', $src );
- return $parts[0];
- }
- add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
- add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
- //* 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;
- }}
Add Comment
Please, Sign In to add comment