Skip to content

Instantly share code, notes, and snippets.

View srikat's full-sized avatar

Sridhar Katakam srikat

View GitHub Profile
//* Add a CSS ID to main element
add_filter( 'genesis_attr_content', 'custom_attributes_content' );
function custom_attributes_content( $attributes ) {
if ( is_home() || is_archive() ) {
$attributes['id'] = 'main-content-area';
}
return $attributes;
}
@srikat
srikat / functions.php
Last active December 26, 2015 12:19
For displaying Portfolio entries on homepage in Minimum Pro when using Display Posts Shortcode plugin. http://sridharkatakam.com/show-portfolio-entries-minimum-pros-homepage-addition-posts/
//* Customize the output of individual Portfolio entries
add_filter( 'display_posts_shortcode_output', 'sk_title_above_image', 10, 9 );
function sk_title_above_image( $output, $atts, $image, $title, $date, $excerpt, $inner_wrapper, $content, $class ) {
$title = '<h2 itemprop="headline" class="entry-title"><a rel="bookmark" href="' . apply_filters( 'the_permalink', get_permalink() ) . '">' . apply_filters( 'the_title', get_the_title() ) . '</a></h2>';
if ( $atts['image_size'] )
$image = '<div class="portfolio-image"><a rel="bookmark" href="' . get_permalink() . '">' . get_the_post_thumbnail( $post->ID, $image_size ) . '</a></div> ';
else $image = '';
@srikat
srikat / page_banner.php
Created October 26, 2013 18:11
Custom Page Template in Genesis that shows Featured Image as a Banner. http://sridharkatakam.com/custom-page-template-genesis-shows-featured-image-banner/
<?php
/**
* This file adds the Banner template.
*
* @author Sridhar Katakam
* @package Generate
* @subpackage Customizations
*/
/*
@srikat
srikat / functions.php
Created October 28, 2013 14:36
Code for iThemes Builder to apply a layout to Timely’s All-in-One Event Calendar's events archive page, single event pages and calendar Page.
function set_custom_layout( $layout_id ) {
if ( is_post_type_archive('ai1ec_event') || is_singular('ai1ec_event') || is_page('calendar') )
return '526e727b11aca';
return $layout_id;
}
add_filter( 'builder_filter_current_layout', 'set_custom_layout' );
genesis_register_sidebar( array(
'id' => 'after-entry',
'name' => __( 'After Entry', 'metro' ),
'description' => __( 'This is the after entry section.', 'metro' ),
) );
//* Hooks after-entry widget area to single posts
add_action( 'genesis_entry_footer', 'metro_after_post' );
function metro_after_post() {
Using Genesis Sample child theme.
1) Rename logo.png in images directory to logo-notusing.png and logo@2x.png to logo@2x-notusing.png
2) Upload this image as logo.png in images directory: http://i.imgur.com/v2F2rjU.png
3) Add the following at the end of child theme's style.css:
body {
background: #222;
.page .site-inner {
margin-top: 60px;
margin-top: 6rem;
padding: 40px 0;
padding: 4rem 0;
}
.minimum-landing .site-inner {
margin: 40px auto;
margin: 4rem auto;
//* Add support for structural wraps
add_theme_support( 'genesis-structural-wraps', array(
'header',
'nav',
'subnav',
'site-inner',
'footer-widgets',
'footer',
'header-image'
) );
<?php
//* Force full width content layout
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'custom_do_loop' );
function custom_do_loop() { ?>
<?php
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'sk_show_subcategories_do_loop' );
/**
* Displays a list of linked child categories on category pages
*
*/
function sk_show_subcategories_do_loop() {