Skip to content

Instantly share code, notes, and snippets.

View siddharthashok's full-sized avatar

Siddharth Ashok siddharthashok

View GitHub Profile
@siddharthashok
siddharthashok / reset.css
Created May 22, 2020 14:32
Modern CSS Reset, alternative to normalize.css. Based on: https://github.com/hankchizljaw/modern-css-reset/
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Remove default padding */
ul[class],
ol[class] {
@siddharthashok
siddharthashok / excerpts
Created December 5, 2017 09:10
WordPress, custom dots […] at the end of Excerpts
function new_excerpt_more( $more ) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
@siddharthashok
siddharthashok / breadcrumbs.php
Created December 5, 2017 07:39
WordPress, make breadcrumbs
<?php
// ------------------- Breadcrumbs
function qt_custom_breadcrumbs() {
$showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show
$delimiter = '/'; // delimiter between crumbs
$home = 'Hem'; // text for the 'Home' link
$showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show
@siddharthashok
siddharthashok / numeric-pagination.php
Created December 5, 2017 07:38
WordPress, have numeric pagination
<?php
/*
// ------------------- Pagination
*/
function pagination_numeric() {
if( is_singular() )
return;
@siddharthashok
siddharthashok / gist:7a23c779026b0070d03f96d074f18fb2
Created December 5, 2017 07:36
WordPress, Stripping down Tiny MCE
/*
// ------------------- Stripping Tiny MCE
*/
add_filter("mce_buttons", "tinymce_editor_buttons", 99); //targets the first line
add_filter("mce_buttons_2", "tinymce_editor_buttons_second_row", 99); //targets the second line
function tinymce_editor_buttons($buttons) {
return array(
"bold",
@siddharthashok
siddharthashok / gist:c36fdd4f0e5fb8afb351ab039aa4a9b1
Created December 5, 2017 07:34
WordPress, remove div, class, tables and more from TINYMCE
add_filter('tiny_mce_before_init','configure_tinymce');
function configure_tinymce($in) {
$in['paste_preprocess'] = "function(plugin, args){
// Strip all HTML tags except those we have whitelisted
var whitelist = 'p,span,b,strong,i,em,h3,h4,h5,h6,ul,li,ol';
var stripped = jQuery('<div>' + args.content + '</div>');
var els = stripped.find('*').not(whitelist);
for (var i = els.length - 1; i >= 0; i--) {
var e = els[i];
@siddharthashok
siddharthashok / gist:52213a359ab6e16008921e79288b61b8
Created December 5, 2017 07:31
WordPress - REMOVE EDITOR OPTION IN ADMIN MENU
function remove_editor_menu() {
remove_action('admin_menu', '_add_themes_utility_last', 101);
}
add_action('_admin_menu', 'remove_editor_menu', 1);
@siddharthashok
siddharthashok / css_resources.md
Created August 26, 2017 19:26 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@siddharthashok
siddharthashok / javascript_resources.md
Created August 26, 2017 19:26 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
//remove update notice for forked plugins
function remove_update_notifications($value) {
if ( isset( $value ) && is_object( $value ) ) {
unset($value->response[ 'hello.php' ]);
unset($value->response[ 'akismet/akismet.php' ]);
}
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');