Skip to content

Instantly share code, notes, and snippets.

@restored316 restored316/functions.php Secret
Last active Jul 13, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.