This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="map"> | |
<img src="http://maps.google.com/maps/api/staticmap | |
?center=Capetown+SouthAfrica | |
&zoom=14 | |
&size=480x240 | |
&maptype=roadmap | |
&markers=color:red|31.4211,35.1144 | |
&sensor=false" | |
width="480" height="240" alt="Map of Cape Town, SA" | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# used to create a database | |
CREATE DATABASE your_database_name; | |
# switches context to the database you specify | |
USE your_database_name; | |
# lists the available databases | |
SHOW databases; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Run this code on 'after_theme_setup', when plugins have already been loaded. | |
add_action('after_setup_theme', 'my_load_plugin'); | |
// This function loads the plugin. | |
function my_load_plugin() { | |
// Check to see if your plugin has already been loaded. This can be done in several | |
// ways - here are a few examples: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Display Videos | |
// Utility function - allow us to strpos an array | |
if ( ! function_exists( 'video_strpos_arr' )) { | |
function video_strpos_arr($haystack, $needle) { | |
if( !is_array($needle) ) $needle = array($needle); | |
foreach( $needle as $what ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// only if the two arrays don't hold the same number of elements | |
if (count($data) != count($colors)) { | |
// handle if $colors is less than $data | |
while (count($colors) < count($data)) { | |
// NOTE : we are using array_values($colors) to make sure we use | |
// numeric keys. | |
// See http://php.net/manual/en/function.array-merge.php) | |
$colors = array_merge($colors, array_values($colors)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hex2rgb($hex) { | |
$hex = str_replace("#", "", $hex); | |
if(strlen($hex) == 3) { | |
$r = hexdec(substr($hex,0,1).substr($hex,0,1)); | |
$g = hexdec(substr($hex,1,1).substr($hex,1,1)); | |
$b = hexdec(substr($hex,2,1).substr($hex,2,1)); | |
} else { | |
$r = hexdec(substr($hex,0,2)); | |
$g = hexdec(substr($hex,2,2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package Redirect to homepage after logout | |
* @version 0.1 | |
*/ | |
/* | |
Plugin Name: Redirect to homepage after logout | |
Plugin URI: http://daankortenbach.nl/wordpress/redirect-to-homepage-after-logout/ | |
Description: Redirects the user to the homepage after logout | |
Author: Daan Kortenbach |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php # -*- coding: utf-8 -*- | |
/** | |
* Plugin Name: T5 Silent Flush | |
* Description: Flushes rewrite rules whenever a custom post type or taxonomy is registered and not already part of these rules. This is a soft flush, the .htaccess will not be rewritten. | |
* Version: 2013.05.04 | |
* Author: Thomas Scholz <info@toscho.de> | |
* Author URI: http://toscho.de | |
* License: MIT | |
* License URI: http://www.opensource.org/licenses/mit-license.php | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Disable the WordPress Admin Bar for all Users and Visitors | |
Turn off the toolbar with one simple line. | |
view plain | |
/* | |
* Disable the WordPress Admin Bar for all Users and Visitors | |
*/ | |
remove_action( 'init', '_wp_admin_bar_init' ); | |
^ top | |
Enable the WordPress Admin Bar for admins only |