Use Home Slider Widget Site Wide

Many child themes for StudioPress include a home slider function hard coded into the home.php file. This means it only displays on the homepage when populated or active.

If you want to display the slider on other pages of your site you have several choices:

  1. You can create a new function and register a new widget in your child themes functions.php file as well as add styling for the widget in your child themes style.css file.
  2. Or you can simply use your existing home slider widget and hook it to any other pages on your site so its exactly the same site wide.

The second solution is more efficient as it also uses the CSS code already contained in your child themes style.css file as well as the PHP code which registers the widget for the home page slider.

All you need to do is add another function in your child themes functions.php file and your home slider displays site wide.

The above code uses the same code as whats used in the Executive child theme.

Simply use another conditional tag if you want more control over where your slider displays and change the hook position if needed.

Use Other Home Page Widgets Site Wide

Other themes like Metro name the home page slider widget, home-top however the same method applies.

add_action( 'genesis_before_content_sidebar_wrap', 'extend_slider_sitewide', 5 );
function extend_slider_sitewide() {
	if ( is_home( ) )
	return;
	genesis_widget_area( 'home-top', array(
		'before' => '<div class="home-top widget-area">',
	) );
}

The code above will display the home-top widget in the Metro theme site wide.

If you want to change the styling for this widget on all pages other than the home page simply change the name of the class from home-top to something else like top-widget and use it in your style sheet with CSS.

You can also duplicate any of your home featured widgets on other pages or posts with the same styling as your home page.

Or you can use existing home page widgets with different styling site wide.

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.