Skip to content

Instantly share code, notes, and snippets.

View wpbullet's full-sized avatar
💭
Find me https://guides.wp-bullet.com/codeable-hire

WP Bullet wpbullet

💭
Find me https://guides.wp-bullet.com/codeable-hire
View GitHub Profile
@wpbullet
wpbullet / functions.php
Created September 9, 2017 03:24 — forked from schilke/functions.php
How to load CSS files asynchronously in WordPress (using Scott Jehl's "loadCSS")
<?php
// This is the cleaner code per request of a thread in the LinkedIn group "WordPress"
// ...
// register and enqueue loadCSS
function load_scripts_and_styles() {
// register loadCSS
wp_register_script( 'load-css-async', get_stylesheet_directory_uri() . '/path/to/js/loadCSS.js', array(), '', false );
<?php
define('INBOUND_FAST_AJAX' , true );
/**
* Enable Fast Ajax
*/
add_filter( 'option_active_plugins', 'ajax_disable_plugins' );
function ajax_disable_plugins($plugins){
@wpbullet
wpbullet / get-user-role.php
Last active July 27, 2017 03:09 — forked from kellenmace/get-user-role.php
Get user role in WordPress
<?php
/*
* Get user's role
*
* If $user parameter is not provided, returns the current user's role.
* Only returns the user's first role, even if they have more than one.
* Returns false on failure.
*
* @param mixed $user User ID or object.
* @return string|bool The User's role, or false on failure.
@wpbullet
wpbullet / xml.py
Last active October 18, 2018 11:15 — forked from chrisguitarguy/xml.py
Parse an XML sitemap with Python, requests and BeautifulSoup
from __future__ import with_statement # we'll use this later, has to be here
#!/usr/bin/env python2.7
# Author Mike https://guides.wp-bullet.com/
# Forked from https://gist.github.com/chrisguitarguy/1305010
from argparse import ArgumentParser
import csv
from itertools import izip
import requests
from BeautifulSoup import BeautifulStoneSoup as Soup