Step 1: Replace the current front-page.php file’s code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
<?php /** * This file adds the Home Page to the Parallax Pro Theme. * * @author StudioPress * @package Parallax * @subpackage Customizations */ add_action( 'genesis_meta', 'parallax_home_genesis_meta' ); /** * Add widget support for homepage. If no widgets active, display the default loop. * */ function parallax_home_genesis_meta() { if ( is_active_sidebar( 'home-section-1' ) || is_active_sidebar( 'home-section-2' ) || is_active_sidebar( 'home-section-3' ) || is_active_sidebar( 'home-section-4' ) || is_active_sidebar( 'home-section-5' ) ) { //* Add parallax-home body class add_filter( 'body_class', 'parallax_body_class' ); function parallax_body_class( $classes ) { $classes[] = 'parallax-home'; return $classes; } //* Force full width content layout add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); //* Remove primary navigation remove_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_nav' ); //* Remove breadcrumbs remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs'); //* Remove the default Genesis loop remove_action( 'genesis_loop', 'genesis_do_loop' ); //* Add homepage widgets add_action( 'genesis_loop', 'parallax_homepage_widgets' ); } } //* Add markup for homepage widgets function parallax_homepage_widgets() { genesis_widget_area( 'home-section-3', array( 'before' => '<div class="home-odd home-section-3 widget-area"><div class="wrap">', 'after' => '</div></div>', ) ); genesis_widget_area( 'home-section-4', array( 'before' => '<div class="home-even home-section-4 widget-area"><div class="wrap">', 'after' => '</div></div>', ) ); genesis_widget_area( 'home-section-5', array( 'before' => '<div class="home-odd home-section-5 widget-area"><div class="wrap">', 'after' => '</div></div>', ) ); } genesis(); |
Step 2: Open your functions.php file and add the following code inside the parallax_enqueue_scripts_styles() function :
1 2 3 4 5 |
if ( ! wp_is_mobile() ) { wp_enqueue_script( 'parallax-script', get_bloginfo( 'stylesheet_directory' ) . '/js/parallax.js', array( 'jquery' ), '1.0.0' ); } |
So here is the complete code of parallax_enqueue_scripts_styles() function :
1 2 3 4 5 6 7 8 9 10 11 12 13 |
function parallax_enqueue_scripts_styles() { if ( ! wp_is_mobile() ) { wp_enqueue_script( 'parallax-script', get_bloginfo( 'stylesheet_directory' ) . '/js/parallax.js', array( 'jquery' ), '1.0.0' ); } 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 ); } |
Lastly add this new code in functions.php file :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
//* Display Home Section 1 and Section 2 to all pages add_action( 'genesis_after_header', 'parallax_home_section', 7 ); function parallax_home_section() { if ( ( is_active_sidebar( 'home-section-1' ) || is_active_sidebar( 'home-section-2' ) ) && ( is_singular('page') || is_home() ) ) { genesis_widget_area( 'home-section-1', array( 'before' => '<div class="home-odd home-section-1 widget-area"><div class="wrap">', 'after' => '</div></div>', ) ); genesis_widget_area( 'home-section-2', array( 'before' => '<div class="home-even home-section-2 widget-area"><div class="wrap">', 'after' => '</div></div>', ) ); } } |
All are done. Now browse your site and Home Section 1 & 2 will appear on all pages.
Susanta says
I was under the impression that I could achieve something like this: http://cimnethub.com/about/
After following your tutorials, I saw that it repeats the same sections across all pages.
Why would anyone allow the home page sections to be repeated across all pages?
Is it possible to add any code snippets that allow me to add custom widgets (just like front/home page widgets on Parallax Pro) so I could use the section to style the page as I please?
Thanks for your advice in advance!
Paul says
It is depending on client’s requirement.
Use Beaver Builder plugin for custom section.
Ramona says
And thank you for all of your help! This is extremely generous of you to help me with this!
Ramona says
I changed that out and it gives me an Internal Server Error. So I switched it back, the website worked, tried again and got the same error.
Paul says
Still are you getting the syntax error?
Ramona says
Nope! It is working perfectly now!! Thank you so much. This was fabulous!
Paul says
Great.
Glad to help you.
Ramona says
I followed the instructions above to add the widgets 1 and 2 from the parallax theme to all the pages on my website. However, it took it off my homepage. Now, they are appearing on everything else, such as blog page, but they are missing from my home page. What did I miss?
Paul says
Sorry for the issue. I did a small mistake. Edit your functions.php file and replace following line
if ( ( is_active_sidebar( 'home-section-1' ) || is_active_sidebar( 'home-section-2' ) ) && is_singular('page') ) {
WITH
if ( ( is_active_sidebar( 'home-section-1' ) || is_active_sidebar( 'home-section-2' ) ) && ( is_singular('page') || is_home() ) ) {