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' );
- add_action( 'after_switch_theme', 'init_theme_settings');
- function init_theme_settings(){
- $genesis_settings = get_option('genesis-settings');
- $genesis_settings['site_layout'] = "content-sidebar";
- update_option('genesis-settings', $genesis_settings);
- $theme_mod = get_theme_mod("nav_menu_locations");
- $theme_mod["secondary"] = 0;
- $theme_mod["primary"] = 0;
- set_theme_mod("nav_menu_locations", $theme_mod);
- }
- function parallax_customizer(){
- require_once( get_stylesheet_directory() . '/lib/customize.php' );
- }
- //* 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.2' );
- //* 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 HTML5 markup structure
- add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
- //* Add viewport meta tag for mobile browsers
- add_theme_support( 'genesis-responsive-viewport' );
- //* 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' ),
- ) );
- add_theme_support( 'custom-background' );
- //* 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',
- ) );
- //* Modify the size of the Gravatar in the author box
- add_filter( 'genesis_author_box_gravatar_size', 'parallax_author_box_gravatar' );
- function parallax_author_box_gravatar( $size ) {
- return 176;
- }
- //* Modify the size of the Gravatar in the entry comments
- add_filter( 'genesis_comment_list_args', 'parallax_comments_gravatar' );
- function parallax_comments_gravatar( $args ) {
- $args['avatar_size'] = 120;
- return $args;
- }
- add_filter("widget_update_callback", "wid_update_function", 20, 4);
- add_filter( 'sidebar_admin_setup', 'wid_update_function', 20, 4);
- function wid_update_function($instance, $new_instance, $old_instance, $this){
- $section_base = "home-section-";
- for ($i=1; $i <= 5; $i++) {
- $index = $i-1;
- $parallax_settings = get_option("th_parallax_settings");
- if(is_active_sidebar($section_base.$i)){
- if(!$parallax_settings){
- $parallax_settings = array('max_blocks' => 5,
- 'blocks' => array(
- array('empty' => true),
- array('empty' => true),
- array('empty' => true),
- array('empty' => true),
- array('empty' => true)));
- $parallax_settings['blocks'][$index] = array('custom' => true);
- update_option("th_parallax_settings", $parallax_settings);
- }
- else{
- $parallax_settings['blocks'][$index] = array('custom' => true);
- update_option("th_parallax_settings", $parallax_settings);
- }
- }
- else{
- if(!$parallax_settings){
- $parallax_settings = array('max_blocks' => 5,
- 'blocks' => array(
- array('empty' => true),
- array('empty' => true),
- array('empty' => true),
- array('empty' => true),
- array('empty' => true)));
- update_option("th_parallax_settings", $parallax_settings);
- }
- else{
- if($parallax_settings['blocks'][$index]['custom']){
- $parallax_settings['blocks'][$index] = array('empty' => true);
- update_option("th_parallax_settings", $parallax_settings);
- }
- }
- }
- }
- return $instance;
- }
- //* Add support for 3-column footer widgets
- add_theme_support( 'genesis-footer-widgets', 1 );
- //* Add support for after entry widget
- add_theme_support( 'genesis-after-entry-widget-area' );
- //* Relocate after entry widget
- remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' );
- add_action( 'genesis_after_entry', 'genesis_after_entry_widget_area', 5 );
- $parallax_settings = get_option("th_parallax_settings");
- if($parallax_settings){
- $parallax_settings["max_blocks"] = 5;
- }
- else{
- $home_page_id = get_option("page_on_front");
- $parallax_settings = array('max_blocks' => 5,
- 'blocks' => array(
- array('ID' => $home_page_id),
- array('empty' => true),
- array('empty' => true),
- array('empty' => true),
- array('empty' => true)));
- }
- update_option("th_parallax_settings", $parallax_settings);
- //* 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' ),
- ) );
- /* Customize footer credits */
- add_filter( 'genesis_footer_creds_text', 'custom_footer_creds_text' );
- function custom_footer_creds_text() {
- $address = str_replace( '</br>', '', get_option('th_company_address'));
- $name = get_option('blogname');
- echo '<div class="creds"><p>';
- echo 'Copyright © ';
- echo date('Y');
- echo ' · <a href="/">'.$name.'</a> · '.$address.' · Powered by <a href="http://www.wordpress.org" target="_new" title="ThriveHive" rel="nofollow">Wordpress</a>';
- echo '</p></div>';
- }
- @add_theme_support( 'genesis-custom-header', array('flex-height' => true, 'width' => 300, 'height' => 88, 'header_image' => "http://www.www.site/wp-content/uploads/2025/12/image.png" ) );
Advertisement
Add Comment
Please, Sign In to add comment