Skip to content

Instantly share code, notes, and snippets.

@restored316
Last active July 13, 2018 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save restored316/594fe8114c3f6d3a527926ee0119b8eb to your computer and use it in GitHub Desktop.
Save restored316/594fe8114c3f6d3a527926ee0119b8eb to your computer and use it in GitHub Desktop.
Add Instagram Page to your website
// Register instagram page widget area
genesis_register_sidebar( array(
'id' => 'instagram',
'name' => __( 'Custom Instagram Page', 'r316' ),
'description' => __( 'This widget area that appears on the Instagram page when using the Instagram page template.', 'r316' ),
) );
<?php
/**
* This file adds the Instagram Page Template to your theme.
*/
/*
Template Name: Instagram
*/
//* Add custom body class to the head
add_filter( 'body_class', 'r316_add_body_class' );
function r316_add_body_class( $classes ) {
$classes[] = 'custom-instagram';
return $classes;
}
//* Add widget support for category index. If no widgets are active, display the default loop.
add_action( 'genesis_meta', 'r316_category_genesis_meta' );
function r316_category_genesis_meta() {
if ( is_active_sidebar( 'instagram' )) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'r316_instagram_sections' );
}
}
//* Add the widget space
function r316_instagram_sections() {
genesis_widget_area( 'instagram', array(
'before' => '<div class="instagram widget-area">',
'after' => '</div>',
) );
}
//* Force full width content layout
add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' );
//* Remove the header right widget area
unregister_sidebar( 'header-right' );
//* Remove navigation
remove_action( 'genesis_before_header', 'genesis_do_nav', 7 );
remove_action( 'genesis_header', 'genesis_do_subnav', 12 );
remove_action( 'genesis_before_footer', 'r316_footer_menu', 7 );
//* Remove Top Banner
remove_action( 'genesis_before', 'r316_do_top_banner' );
//* Remove Site Wide CTA
remove_action( 'genesis_before_footer', 'r316_site_wide_cta', 11 );
//* Remove site footer widgets
remove_action( 'genesis_before_footer', 'r316_footer_widgets', 9 );
//* Remove widget below footer
remove_action( 'genesis_before_footer', 'r316_widget_below_footer', 10 );
//* Remove site footer elements
remove_action( 'genesis_footer', 'genesis_footer_markup_open', 5 );
remove_action( 'genesis_footer', 'genesis_do_footer' );
remove_action( 'genesis_footer', 'genesis_footer_markup_close', 15 );
//* Run the Genesis loop
genesis();
/* Custom Instagram
--------------------------------------------- */
.custom-instagram li {
background: #243E50;
margin: 10px 0;
padding: 10px;
text-align: center;
}
.custom-instagram li a {
color: #fff;
}
.custom-instagram .widget {
margin-bottom: 50px;
}
.custom-instagram .featured-content .entry {
box-shadow: none;
float: left;
padding: 1%;
width: 33%;
}
@media only screen and (max-width: 500px) {
.custom-instagram .featured-content .entry {
float: none;
width: 100%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment