Skip to content

Instantly share code, notes, and snippets.

View srikat's full-sized avatar

Sridhar Katakam srikat

View GitHub Profile
// Load Font Awesome
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
function enqueue_font_awesome() {
wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css' );
}
@srikat
srikat / functions.php
Last active May 18, 2021 16:50
Display Portfolio CPT's linked taxonomy terms (categories and tags) in Genesis entry meta. https://sridharkatakam.com/displaying-cpt-taxonomy-terms-genesis-entry-footer/
add_shortcode( 'portfolio_terms', 'custom_portfolio_terms_shortcode' );
/**
* Produces the linked post taxonomy terms list.
*
* Supported shortcode attributes are:
* after (output after link, default is empty string),
* before (output before link, default is 'Tagged With: '),
* sep (separator string between tags, default is ', '),
* taxonomy (name of the taxonomy, default is 'category').
*
<?php
/**
* Genesis Sample.
*
* This file adds functions to the Genesis Sample Theme.
*
* @package Genesis Sample
* @author StudioPress
* @license GPL-2.0+
* @link http://www.studiopress.com/
@srikat
srikat / functions.php
Last active April 29, 2021 22:22
CSS for Multi-Column Footer Widgets in Genesis. http://sridharkatakam.com/css-multi-column-footer-widgets-genesis/
//* Add support for 3-column footer widgets
add_theme_support( 'genesis-footer-widgets', 3 );
@srikat
srikat / functions.php
Last active April 22, 2021 11:48
Showing a different menu in Primary Navigation location conditionally in Genesis
<?php
//* Do NOT include the opening php tag
add_action( 'genesis_before', 'sk_replace_menu_in_primary' );
/**
* Conditionally replace Custom Menu in Primary Navigation.
*
* @author Sridhar Katakam
* @link http://sridharkatakam.com/conditionally-replace-navigation-menu-genesis/
*/
@srikat
srikat / functions.php
Last active December 16, 2020 01:48
Moving Post Title and Post Info from Entry Header to Entry Content in Genesis. http://sridharkatakam.com/move-post-title-post-info-entry-header-entry-content-genesis/
//* Move Post Title and Post Info from inside Entry Header to Entry Content on Posts page
add_action( 'genesis_before_entry', 'reposition_entry_header' );
function reposition_entry_header() {
if ( is_home() ) {
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
@srikat
srikat / functions.php
Last active December 14, 2020 16:49
Adding Simple Social Icons to Navigation bar in Genesis. http://sridharkatakam.com/adding-simple-social-icons-navigation-bar-genesis/
genesis_register_sidebar( array(
'id' => 'nav-social-menu',
'name' => __( 'Nav Social Menu', 'your-theme-slug' ),
'description' => __( 'This is the nav social menu section.', 'your-theme-slug' ),
) );
add_filter( 'genesis_nav_items', 'sws_social_icons', 10, 2 );
add_filter( 'wp_nav_menu_items', 'sws_social_icons', 10, 2 );
function sws_social_icons($menu, $args) {
@srikat
srikat / functions.php
Last active December 12, 2020 23:45
Adding a cart icon with number of items and total cost in nav menu when using WooCommerce. http://sridharkatakam.com/adding-cart-icon-number-items-total-cost-nav-menu-using-woocommerce/
//* Make Font Awesome available
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
function enqueue_font_awesome() {
wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css' );
}
/**
* Place a cart icon with number of items and total cost in the menu bar.
@srikat
srikat / page-for-rent.php
Last active May 17, 2020 23:34
Page Templates for displaying 'For Sale' and 'For Rent' Listings in AgentPress Pro. http://sridharkatakam.com/page-templates-displaying-sale-rent-listings-agentpress-pro/
<?php
/**
* This file displays Listings that are available for Rent.
*
*/
add_filter( 'body_class', 'sk_body_class' );
/**
* Adds a css class to the body element
*
// * Relocate titles on Page, Post and other single pages
add_action( 'genesis_after_header','relocate_entry_title_singular' );
function relocate_entry_title_singular() {
if ( ! is_singular() )
return;
echo '<div class="entry-header-wrapper"><div class="wrap">';
genesis_do_post_title();
genesis_post_info();
echo '</div></div>';