Skip to content

Instantly share code, notes, and snippets.

Sridhar Katakam srikat

Block or report user

Report or block srikat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bradpotter
bradpotter / functions.php
Last active Aug 29, 2015
Register a sidebar for a page that has a page template selected
View functions.php
add_action('widgets_init', 'gpb_register_sidebar');
/**
* Dynamically register sidebar for pages that use specified template
*
*/
function gpb_register_sidebar() {
global $post;
global $wp_registered_sidebars;
// Find all pages that use template with dynamic sidebar
View display-gallery-as-soliloquy-dynamic-slider.php
@markjaquith
markjaquith / fix-twitter-https.php
Created Jan 21, 2014
Fix Twitter embeds in WordPress < 3.8.1
View fix-twitter-https.php
<?php
add_filter( 'oembed_providers', 'oembed_fix_twitter', 10, 1 );
function oembed_fix_twitter( $providers ) {
$providers[ '#https?://(www\.)?twitter\.com/.+?/status(es)?/.*#i' ] = array( 'https://api.twitter.com/1/statuses/oembed.{format}', true );
return $providers;
}
@calliaweb
calliaweb / filter-genesis-structural-wrap.php
Last active Sep 15, 2016
Filter Genesis Structural Wrap
View filter-genesis-structural-wrap.php
<?php
//* Do NOT include the opening php tag
add_filter( "genesis_structural_wrap-footer-widgets", 'jmw_filter_footer_widgets_structural_wrap', 10, 2);
/**
* Filter the footer-widgets context of the genesis_structural_wrap to add a div before the closing wrap div.
*
* @param string $output The markup to be returned
* @param string $original_output Set to either 'open' or 'close'
*/
@GaryJones
GaryJones / functions.php
Last active May 27, 2017
Genesis: Stop archives from using first attached image as fallback when no featured image is set.
View functions.php
<?php
// Don't include the above.
add_filter( 'genesis_get_image_default_args', 'prefix_stop_auto_featured_image' );
/**
* Stop Genesis archives from using first attached image as fallback when no featured image is set.
*
* @param array $args Default image arguments.
*
@bradpotter
bradpotter / functions.php
Last active Jul 18, 2017
How to Add “Top” and “Footer” Menus to Genesis
View functions.php
// Register and Hook Top Navigation Menu
add_action('genesis_before_header', 'sample_before_header_menu', 10);
function sample_before_header_menu() {
register_nav_menu( 'top', 'Top Navigation Menu' );
genesis_nav_menu( array(
'theme_location' => 'top',
'menu_class' => 'menu genesis-nav-menu menu-top',
) );
@robincornett
robincornett / functions.php
Created Oct 31, 2017
Code to remove landing pages from site search results. Assumes that templates are in the templates directory inside the theme.
View functions.php
<?php
add_action( 'pre_get_posts', 'leaven_search_hide_landing_page' );
/**
* Remove landing pages from the search results.
*
* @param $query \WP_Query
*
* @return mixed
*/
@GaryJones
GaryJones / readme.md
Last active Dec 17, 2017
Custom Featured Post Widget plugin: Skeleton for amending the output of the Genesis Featured Post widget.
View readme.md
@timothyjensen
timothyjensen / functions.php
Last active Feb 5, 2018
Get an auto generated post excerpt, or a manual excerpt if one has been set.
View functions.php
<?php
// Make sure to prefix the function if you do not use a namespace.
// namespace TimJensen\HelperFunctions;
/**
* Returns an auto generated post excerpt, or a manual excerpt if one has been set.
*
* @version 1.2.1
*
* @param int $post_id Required. Post ID.
@srobbin
srobbin / gist:3799775
Created Sep 28, 2012
Random Backstretch image
View gist:3799775
<script>
// Create an array of images that you'd like to use
var images = [
'image1.jpg'
, 'image2.jpg'
, 'image3.jpg'
];
// Get a random number between 0 and the number of images
var randomNumber = Math.floor( Math.random() * images.length );
You can’t perform that action at this time.