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) {
}
<?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,

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
<?php
function create_onetime_nonce( $action = -1 ) {
$time = time();
$nonce = wp_create_nonce( $time . $action );
set_transient( '_nonce_' . $time, 1, 60*60 ); // adjust the lifetime of the transient
return $nonce . '-' . $time;
}
function verify_onetime_nonce( $_nonce, $action = -1 ) {
@list( $nonce, $time ) = explode( '-', $_nonce );
@mikeschinkel
mikeschinkel / class-mysite-auth.php
Created May 30, 2013 01:00
Example class showing how to redirect to a custom login page.
class Mysite_Auth {
function __construct() {
add_filter( 'login_redirect', array( $this, 'login_redirect' ) );
}
function login_redirect( $redirect_url ) {
if ( is_user_logged_in() ) {
wp_safe_redirect( '/custom-login' );
exit;
}