Skip to content

Instantly share code, notes, and snippets.

View Jany-M's full-sized avatar
🎯
Focusing

Jany Martelli Jany-M

🎯
Focusing
View GitHub Profile
@lagden
lagden / Custom-select-box.markdown
Created November 25, 2014 22:02
Custom select box
@isGabe
isGabe / wp-bootstrap-walker-class.php
Created March 12, 2012 23:12 — forked from duanecilliers/wp-bootstrap-walker-class.php
Extended Walker Class for Twitter Bootsrap Navigation Wordpress Integration
<?php
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth ) {
//In a child UL, add the 'dropdown-menu' class
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";
@eugenoprea
eugenoprea / .htaccess
Created February 10, 2014 12:08
This code will redirect all pages to the homepage, while still allowing you to access the admin area.
# BEGIN redirect to homepage
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png|css|js|php)$
RewriteCond %{REQUEST_URI} !^/wp-admin [NC]
RewriteRule .* / [L,R=301]
#END redirect to homepage
@fulippo
fulippo / gist:3986307
Created October 31, 2012 10:26
Query to remove orphaned taxonomy terms from a WordPress DB
-- Replace %s with table prefix
DELETE tr
FROM %s_term_relationships tr
INNER JOIN %s_term_taxonomy tt
ON (tr.term_taxonomy_id = tt.term_taxonomy_id)
WHERE tt.taxonomy != 'link_category'
AND tr.object_id NOT IN (SELECT ID FROM %s_posts);
@petertwise
petertwise / debug-givewp.php
Last active March 2, 2018 19:00
Give givewp.com Donation Plugin - list of all actions and filters for testing.
<?php
/*
Plugin Name: Debug Give Wp
Plugin URI: https://gist.github.com/squarecandy/8ed8265bde0c39e42ab8a19c062bf534
Description: Help discover where all of Give's action can plop in some content, and what all the filters do
Version: 1.0
Author: Square Candy
Author URI: http://squarecandy.net
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl.txt
@evemilano
evemilano / Add this to the functions.php
Last active August 9, 2018 14:05
Add Defer & Async Attributes to many WordPress Script
function add_defer_attribute($tag, $handle) {
// add script handles to the array below
$scripts_to_defer = array('jquery-migrate', 'hoverIntent', 'superfish', 'superfish-args', 'skip-links', 'wp-embed');
foreach($scripts_to_defer as $defer_script) {
if ($defer_script === $handle) {
return str_replace(' src', ' defer="defer" src', $tag);
}
}
return $tag;
@abrudtkuhl
abrudtkuhl / wp_posts.reset.sql
Created July 22, 2014 17:54
Reset Auto_Increment in WordPress Posts table
DELETE FROM wp_posts;
DELETE FROM wp_post_meta;
TRUNCATE TABLE wp_posts;
TRUNCATE TABLE wp_post_meta;
@mwolff44
mwolff44 / gist:abfc7848e5cfa35b8c6a
Last active February 24, 2019 06:41
remove jetpack unwanted css - Wordpress
<?php
/*
MU Plugin: remove-jetpack-css
Plugin Name: WP Remove Jetpack CSS
Plugin URI: http://www.blog-des-telecoms.com
Description: Remove jetpack CSS
Version: 1.0
Author: Mathias WOLFF
Author URI: http://www.mathias-wolff.fr
License: GPLv3
@neilgee
neilgee / jetpack-all-modules.php
Last active May 5, 2019 13:08
Remove JetPack CSS
<?php
//Do not copy the above php tag
// Stop JetPacks Minified/Concatention CSS file
add_filter( 'jetpack_implode_frontend_css', '__return_false' );
//Remove JepPack CSS
function themeprefix_remove_jetpack_css() {
wp_deregister_style( 'AtD_style' ); // After the Deadline
wp_deregister_style( 'jetpack_likes' ); // Likes
@ericrasch
ericrasch / disable-xml-rpc.php
Created April 10, 2015 18:46
Disable XML-RPC + Pingback WordPress Plugin
<?php
/*
Plugin Name: Disable XML-RPC + Pingback
Plugin URI: http://www.philerb.com/wp-plugins/
Description: This plugin disables XML-RPC API + pingbacks in WordPress 3.5+, which is enabled by default. 2 WP plugins were combined together to cover all bases.
Version: 1.0.0
Author: Eric Rasch
Author URI: http://ericrasch.com
License: GPLv2
*/