Skip to content

Instantly share code, notes, and snippets.

View srikat's full-sized avatar

Sridhar Katakam srikat

View GitHub Profile
@srikat
srikat / Media Queries
Created May 9, 2013 03:33
Taken from Skype.
@media only screen and (min-width: 0px) and (max-width: 320px) {
}
/* Smartphones (portrait and landscape) ----------- */
@srikat
srikat / functions.php
Created May 14, 2013 04:02
Adding a search box in nav bar in WooThemes Canvas
<?php
add_action( 'woo_nav_inside', 'woo_add_nav_search', 30 );
if ( ! function_exists( 'woo_add_nav_search' ) ) {
function woo_add_nav_search () { ?>
<div class="fr">
<?php get_search_form(); ?>
</div>
@srikat
srikat / functions.php
Created May 15, 2013 05:14
Change URL of logo in Canvas from the default (site homepage) to a custom one. Code is to be added in child theme's functions.php.
<?php
// Remove logo code from Canvas
add_action('wp_head', 'remove_woo_logo');
function remove_woo_logo() {
remove_action('woo_header_inside','woo_logo');
}
/*-----------------------------------------------------------------------------------*/
@srikat
srikat / 1. Step 1
Last active January 13, 2016 20:50
Mobile nav for custom menu in a HTML module in iThemes Builder
Using BuilderChild-Air. Can be used in any child theme in conjunction with http://ithemes.com/codex/page/Plugin_related_and_other_generic_customizations_2#How_to_Create_Mobile_Navigation_like_the_new_Air_Theme
Code in PHP enabled HTML module (2nd module from top in layout) where "All Pages" is the name of custom menu:
<a id="logo" href="<?php bloginfo('url'); ?>"><img src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/100x50.gif" alt="Home" /></a>
<?php wp_nav_menu( array( 'menu' => 'All Pages', 'menu_class' => 'builder-module-navigation') ); ?>
@srikat
srikat / new_gist_file
Created July 27, 2013 17:38
To display YouTube video with player when the video URL has been entered in a custom field attached to a CPT in WordPress. Details: http://sridharkatakam.com/how-to-render-youtube-video-url-with-player-when-using-views
[pb_vidembed title="" caption="" url='[types field="youtube-link" class="youtube-video" raw="true"][/types]' type="yt" w="270" h="217"]
@srikat
srikat / functions.php
Created August 29, 2013 12:35
Adding date shortcodes before entry content for articles in Genesis using "genesis_before_entry_content" action. http://sridharkatakam.com/how-to-add-circular-date-for-posts-in-genesis/
add_action( 'genesis_before_entry_content','sri_add_date');
function sri_add_date () {
if (is_home() || is_archive()) { ?>
<div class="my-date">
<span class="my-date-day"><?php echo do_shortcode("[post_date format='j']"); ?></span>
<span class="my-date-month"><?php echo do_shortcode("[post_date format='M']"); ?></span>
</div>
<?php }
}
//* Customize the post info function
@srikat
srikat / google-translator-in-nav.php
Created August 31, 2013 08:37
Add this in functions.php to insert a div that shows the output of Google Language Translator WordPress plugin. Details: http://sridharkatakam.com/how-to-add-google-translator-in-primary-navigation-of-genesis/
<?php
//* Do NOT include the opening php tag
add_filter( 'genesis_nav_items', 'sk_google_translator', 10, 2 );
add_filter( 'wp_nav_menu_items', 'sk_google_translator', 10, 2 );
function sk_google_translator($menu, $args) {
$args = (array)$args;
if ( 'primary' !== $args['theme_location'] )
return $menu;
@srikat
srikat / genesis-masonry.php
Last active April 9, 2019 16:20
Pinterest-like Masonry layout for Posts page and Archives in Genesis. Details: http://sridharkatakam.com/using-masonry-genesis-pinterest-like-layout/
<?php
//* Do NOT include the opening php tag
// =================================================================
// = Pinterest-like Masonry layout for Posts page and Archives =
// =================================================================
//* Enqueue and initialize jQuery Masonry script
function sk_masonry_script() {
if (is_home() || is_archive()) {
@srikat
srikat / style.css
Last active December 23, 2015 03:09
CSS for Pinterest-like Masonry layout in Genesis. Details: http://sridharkatakam.com/using-masonry-genesis-pinterest-like-layout/
/****************************************************************
Pinterest-like Masonry layout for Posts page and Archives
****************************************************************/
.masonry-page .content .entry {
padding: 0;
border-radius: 0;
width: 255px;
overflow: hidden;
}
@srikat
srikat / Blog Post with Date.html
Created September 26, 2013 09:16
Views plugins' Content Template code to display month and day for each post. Details: http://sridharkatakam.com/show-calendar-style-dates-recent-posts-list/
<article>
<header>
<h4><a title="[wpv-post-title]" href="[wpv-post-url]">[wpv-post-title]</a></h4>
<em class="date">
<time datetime="[wpv-post-date format="c"]" itemprop="datePublished">
<span class="month">[wpv-post-date format="M"]</span>
<span class="day">[wpv-post-date format="j"]</span>
</time>
</em>
</header>