Adding Home Section 1 and 2 to all pages on Parallax Pro Theme

Step 1: Replace the current front-page.php file’s code with following code:

<?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 :

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 :

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 :

//* 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.

Share This Article

Subscribe Membership Plan ($9.99/mo)

  • Get full access to all premium tutorials
  • Get Support for the posted content
  • Request for specific how-to tutorials
  • Cancel the subscription at anytime

Reader Interactions

9 Discussion to This Post

  1. 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!

    • Why would anyone allow the home page sections to be repeated across all pages?

      It is depending on client’s requirement.

      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?

      Use Beaver Builder plugin for custom section.

  2. And thank you for all of your help! This is extremely generous of you to help me with this!

  3. 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.

  4. 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?

    • 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() ) ) {

Leave A Reply

Your email address will not be published. Required fields are marked *