Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View srikat's full-sized avatar

Sridhar Katakam srikat

View GitHub Profile
@srikat
srikat / gist:6144828b9d4572ecbf2a470290b596c5
Created October 18, 2023 05:38
Adding Posts in the Homepage and Posts page dropdowns at Settings > Reading in WP admin
add_filter( 'get_pages', function ( $pages, $r ) {
if ( function_exists( 'get_current_screen' ) && 'options-reading' === get_current_screen()->id ) {
$pages = array_merge( $pages, get_posts( ['post_type' => 'post'] ) );
}
return $pages;
}, 10, 2 );
@srikat
srikat / Stylefile.yml
Last active July 31, 2018 23:45
Customizations for www.elected.com.au via StyleURL.
---
version: 1.0
domains:
- www.elected.com.au
url_patterns:
- www.elected.com.au/*
timestamp: '2018-07-31T23:44:01Z'
id: BKFt
redirect_url: http://www.elected.com.au/oxygen/lets-talk/
shared_via: StyleURL - (https://styleurl.app) import and export CSS changes from Chrome
@srikat
srikat / test.html
Created May 8, 2018 06:48
Dummy Content for Gutenberg
<!-- wp:heading -->
<h2>Heading Block (H2)</h2>
<!-- /wp:heading -->
<!-- wp:heading -->
<h3>You are looking at one. (H3)</h3>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>Subhead Block</h2>
@srikat
srikat / keyboard-action-active-plugins.php
Last active March 15, 2018 08:05
Additional custom Actions for Keyboard Action to navigate to the list of active and inactive plugins
<?php
/**
* Plugin Name: Keyboard Action - Active Plugins
* Description: Additional custom Action for Keyboard Action to navigate to the list of active plugins
* Version: 0.1.0
* Author: Sridhar Katakam
* Author URI: https://sridharkatakam.com/
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<?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 October 13, 2019 23:49
Remove "Select options" button from (variable) products on the main WooCommerce shop page. https://sridharkatakam.com/remove-select-options-button-variable-products-main-woocommerce-shop-page/
// Remove "Select options" button from (variable) products on the main WooCommerce shop page.
add_filter( 'woocommerce_loop_add_to_cart_link', function( $product ) {
global $product;
if ( is_shop() && 'variable' === $product->product_type ) {
return '';
} else {
sprintf( '<a href="%s" data-quantity="%s" class="%s" %s>%s</a>',
esc_url( $product->add_to_cart_url() ),
add_filter( 'genesis_seo_title', 'custom_header_inline_logo', 10, 3 );
/**
* Add an image inline in the site title element for the logo
*
* @param string $title Current markup of title.
* @param string $inside Markup inside the title.
* @param string $wrap Wrapping element for the title.
*
* @author @_AlphaBlossom
* @author @_neilgee
add_filter( 'manage_media_columns', 'sk_media_columns_filesize' );
/**
* Filter the Media list table columns to add a File Size column.
*
* @param array $posts_columns Existing array of columns displayed in the Media list table.
* @return array Amended array of columns to be displayed in the Media list table.
*/
function sk_media_columns_filesize( $posts_columns ) {
$posts_columns['filesize'] = __( 'File Size', 'my-theme-text-domain' );
@srikat
srikat / notes
Last active April 12, 2017 07:45
stylelint and ESLint for WordPress CSS & JavaScript Coding Standards
0) Install node via nvm
1) npm install -g eslint stylelint stylelint-config-wordpress eslint-config-wordpress
2) install SublimeLinter-contrib-stylelint ST package.
3) Create file named .stylelintrc in a locaton, say /Users/sridharkatakam/Documents/Websites having https://bbpress.trac.wordpress.org/browser/trunk/.stylelintrc
4) In SublimeLinter User Settings,
@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').
*