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
@srikat
srikat / functions.php
Last active Apr 9, 2019
Add Content below Title for Posts page inside div.posts-page-description in Genesis. https://sridharkatakam.com/adding-content-title-inside-div-posts-page-description-genesis/
View functions.php
// Bring back the missing editor for Posts page
add_action( 'edit_form_after_title', 'rgc_posts_page_edit_form' );
function rgc_posts_page_edit_form( $post ) {
$posts_page = get_option( 'page_for_posts' );
if ( $posts_page === $post->ID ) {
add_post_type_support( 'page', 'editor' );
}
@srikat
srikat / class-custom-featured-post.php
Last active Apr 9, 2019 — forked from GaryJones/readme.md
Custom Featured Posts Widget plugin: Skeleton for amending the output of the Genesis Featured Posts widget. https://sridharkatakam.com/custom-featured-post-widget-plugin/
View class-custom-featured-post.php
<?php
/**
* Plugin Name
*
* @package Custom_Featured_Post_Widget
* @author Gary Jones
* @license GPL-2.0+
* @link http://gamajo.com/
* @copyright 2013 Gary Jones, Gamajo Tech
*/
@srikat
srikat / functions.php
Last active Aug 22, 2016
Add custom taxonomy term in the singular CPT entry permalinks. Source: http://wordpress.stackexchange.com/a/5313/14380. Below is an example for Portfolio. Before: http://d.pr/i/Wt6r, After: http://d.pr/i/QhHN. Make you save changes at Settings > Permalinks.
View functions.php
add_action( 'init', 'vc_portfolio_init' );
/**
* Register a portfolio post type.
*
* @link http://codex.wordpress.org/Function_Reference/register_post_type
*/
function vc_portfolio_init() {
$labels = array(
'name' => _x( 'Portfolio', 'post type general name', 'your-plugin-textdomain' ),
'singular_name' => _x( 'Portfolio Item', 'post type singular name', 'your-plugin-textdomain' ),
@srikat
srikat / functions.php
Created Aug 19, 2016
Change skiplinks heading tag from h2 to h1 in Genesis
View functions.php
remove_action ( 'genesis_before_header', 'genesis_skip_links', 5 );
add_action ( 'genesis_before_header', 'sk_skip_links', 5 );
/**
* Add skiplinks for screen readers and keyboard navigation
*
* @since 2.2.0
*/
function sk_skip_links() {
if ( ! genesis_a11y( 'skip-links' ) ) {
View functions.php
// Add Google Tag Manager code in <head>
add_action( 'wp_head', 'sk_google_tag_manager1' );
function sk_google_tag_manager1() { ?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->
@srikat
srikat / functions.php
Last active Feb 15, 2017
Make BuddyPress Members page obey its Page layout setting in Genesis. https://sridharkatakam.com/make-buddypress-members-page-obey-page-layout-setting-genesis/
View functions.php
/**
* Make BuddyPress Members page obey its Page layout setting
*/
add_filter( 'genesis_pre_get_option_site_layout', 'sk_do_members_page_layout' );
function sk_do_members_page_layout( $opt ) {
// if the current page is not the members directory, abort.
if ( ! bp_is_members_directory() ) {
return;
}
@srikat
srikat / functions.php
Last active Feb 20, 2017
How to add font icons before navigation menu items in Genesis using Dashicons. http://sridharkatakam.com/add-font-icons-navigation-menu-items-genesis-using-dashicons/
View functions.php
//* Enqueue Dashicons
add_action( 'wp_enqueue_scripts', 'enqueue_dashicons' );
function enqueue_dashicons() {
wp_enqueue_style( 'dashicons' );
}
@srikat
srikat / functions.php
Last active Apr 9, 2019
How to add first, last and numbered classes automatically to widgets in WordPress. http://sridharkatakam.com/add-first-last-numbered-classes-automatically-widgets-wordpress/
View functions.php
/**
* Add "first" and "last" CSS classes to dynamic sidebar widgets. Also adds numeric index class for each widget (widget-1, widget-2, etc.)
*/
function widget_first_last_classes( $params ) {
global $my_widget_num; // Global a counter array
$this_id = $params[0]['id']; // Get the id for the current sidebar we're processing
$arr_registered_widgets = wp_get_sidebars_widgets(); // Get an array of ALL registered widgets
if( !$my_widget_num ) {// If the counter array doesn't exist, create it
@srikat
srikat / functions.php
Last active Oct 29, 2016
How to move Secondary Navigation below Slider in Outreach Pro. http://sridharkatakam.com/move-secondary-navigation-slider-outreach-pro/
View functions.php
// Remove the secondary navigation menu on front page
add_action( 'genesis_header', 'sk_conditional_secondary_nav' );
function sk_conditional_secondary_nav() {
// if we are not on front page, abort.
if ( !is_front_page() ) {
return;
}
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
View functions.php
/**
* AJAX Load More
* @link http://www.billerickson.net/infinite-scroll-in-wordpress
*/
function be_ajax_load_more() {
$args = isset( $_POST['query'] ) ? array_map( 'esc_attr', $_POST['query'] ) : array();
$args['post_type'] = isset( $args['post_type'] ) ? esc_attr( $args['post_type'] ) : 'post';
$args['paged'] = esc_attr( $_POST['page'] );
$args['post_status'] = 'publish';
You can’t perform that action at this time.