Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Enqueue Tweet Script
*
*/
function be_enqueue_tweet_script() {
wp_enqueue_script( 'be-tweet', get_stylesheet_directory_uri() . '/tweet-quote.js', array( 'jquery' ), '1.0', true );
}
add_action( 'wp_enqueue_scripts', 'be_enqueue_tweet_script' );
$data = DB::table( 'wp_usermeta' )
->join('wp_users', 'wp_users.ID', '=', 'wp_usermeta.user_id')
->where('wp_usermeta.meta_key', '=', 'wp_user_level')
->where('wp_usermeta.meta_value', '>', '0')
->orderBy('wp_users.display_name', 'asc')
->select('wp_users.ID as id', 'wp_users.display_name as name' )
->get();
@jb510
jb510 / dev-functions.php
Created September 13, 2013 23:26
Three functions for manipulating existing WordPress data
<?php
/**
* echo_r function.
*
* Jon's favorite little debug function
*
* @access public
* @param mixed $array
* @return void
*/
@csakiistvan
csakiistvan / mediaqueries.css
Created August 18, 2013 11:20
Media Queries
@media only screen and (min-width: 480px) {
}
@media only screen and (min-width: 600px) {
}
@media only screen and (min-width: 768px) {
}
@media only screen and (min-width: 992px) {
}
@media only screen and (min-width: 1382px) {
}
@jgalea
jgalea / new-post-type-capabilities.php
Last active May 15, 2020 02:01
Creating a new post type with capabilities.
<?php
add_action( 'init', 'create_my_post_types' );
function create_my_post_types() {
register_post_type(
'movie',
array(
'public' => true,
'capability_type' => 'movie',
'capabilities' => array(
@jgalea
jgalea / user-can.php
Created July 12, 2013 10:24
Check if a user has a capability or role.
<?php
// Checking for capability
if ( user_can( 6, 'read' ) ) {
// Do something
}
// Checking for role
if ( user_can( 6, 'administrator' ) ) {
// Do something
}
<?php
global $current_user;
get_currentuserinfo();
$url = home_url() . '/members/' . $current_user->user_login . '/classifieds/my-classifieds';
wp_redirect( $url );
exit;
@codesynapse
codesynapse / style.css
Created July 7, 2013 17:50
Revero Genesis HTML5 CSS Update
/*
Theme Name: Revero
Description: Revero sample theme created for the Genesis Framework.
Author: Mahesh
Author URI: http://www.sparxengine.net
Version: 2
Tags: black, orange, white, one-column, two-columns, three-columns, fixed-width, custom-menu, full-width-template, sticky-post, theme-options, threaded-comments, translation-ready
@scottweisman
scottweisman / bootstrap_form_override.css
Created July 3, 2013 21:04
Override Bootstrap's Blue Glowing Forms (to green as an example)
textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="datetime"]:focus,
input[type="datetime-local"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="time"]:focus,
input[type="week"]:focus,
input[type="number"]:focus,
@jgalea
jgalea / remove-billing.php
Last active June 9, 2020 19:58
Remove billing details from WooCommerce checkout.
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);