Skip to content

Instantly share code, notes, and snippets.

View leoken's full-sized avatar

Erik James Albaugh leoken

  • Maintain Web
  • Long Beach, CA
  • X @leoken
View GitHub Profile
<?php
function custom_nav_menu_css_class($classes, $item) {
if (get_post_type() == 'event') {
if ($item->title == 'Resources') {
$classes[] = 'current-menu-parent';
}
if ($item->title == 'Events') {
$classes[] = 'current-menu-parent';
//
// Alerts
// --------------------------------------------------
// Base styles
// -------------------------
.alert,
.validation_error,
<pre><?php
require 'wp-load.php';
$postmeta_field_name = 'video_url'; // fill it
echo $query = "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = '$postmeta_field_name';";
$data = $wpdb->get_results( $query );
<?php
/**
* Register Styles and Scripts
*/
add_action( 'wp_enqueue_scripts', 'ft_scripts_styles' );
function ft_scripts_styles() {
<?php
function getDateDiff($date)
{
$diff_info=array();
$timestamp=strtotime($date);
$timestamp_diff=$timestamp-time();
//test if $date is future
$diff_info['future']=$timestamp_diff>0;
@leoken
leoken / rscapi.php
Created December 1, 2012 04:35 — forked from icambridge/rscapi.php
Rackspace Cloud Server API PHP Library - modified
<?php
/**
* Rackspace Cloud Server API PHP Library
*
* @package RscApi
*/
/**
* Rackspace Cloud Server API PHP Library
*
@leoken
leoken / gist:4180564
Created December 1, 2012 04:33 — forked from cearls/gist:1245316
Rackspace Cloud Site backup script
#!/bin/bash
export ACCOUNT_ROOT="account root"
export WEB_ROOT="${ACCOUNT_ROOT}/web/content"
export DB_HOST="db host"
export DB_USER="db user"
export DB_PASSWORD="db password"
export DB_NAME="db name"
echo "Rotating backups..."
@leoken
leoken / wordpress-htaccess-rackspace-sites
Created December 1, 2012 04:33 — forked from rachelbaker/wordpress-htaccess-rackspace-sites
Rackspace Cloud .htaccess file fixes for WordPress
# PHP Site Settings for Rackspace Cloud Sites
php_value max_execution_time 3600
php_value upload_max_filesize 100M
php_value post_max_size 220M
php_value memory_limit 256M
# End PHP Site Settings
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
@leoken
leoken / gist:3896863
Created October 16, 2012 01:57 — forked from retlehs/gist:2703644
Add a class to widgets in a specific sidebar
<?php
/**
* Add 'class="span4"' to all widgets in the Content Bottom sidebar
*/
function bb_content_bottom_widget_class($params) {
if ($params[0]['id'] == 'roots-content-bottom') {
$class = 'class="span4 ';
$params[0]['before_widget'] = preg_replace('/class=\"/', "$class", $params[0]['before_widget'], 1);
}
@leoken
leoken / gist:3896862
Created October 16, 2012 01:57
Subnav widget
<?php
/**
* Subnav widget
*
* Base CSS:
*
* .widget_roots_subpages ul {
* margin-top: 10px;
* padding: 0;