Box sizing

/* apply a natural box layout model to all elements */
* { box-sizing: border-box; -moz-box-sizing: border-box; }

Admin bar on bottom

<?php
function admin_bar_on_bottom() { ?>
<style type="text/css">
body {
margin-top: -28px;
padding-bottom: 28px;
}
body.admin-bar #wphead {
padding-top: 0;
}
body.admin-bar #footer {
padding-bottom: 28px;
}
#wpadminbar {
top: auto !important;
bottom: 0;
}
#wpadminbar .quicklinks .menupop ul {
bottom: 28px;
}
</style>
<?php }
add_action( 'wp_head', 'admin_bar_on_bottom' );
add_action( 'admin_head', 'admin_bar_on_bottom' );
?>

Randomize SQL

//After WHERE and all the AND's
AND RAND()<(SELECT ((5/COUNT(*))*10)) ORDER BY RAND()
LIMIT 0, 5

//Standalone
SELECT * FROM myTable WHERE RAND()<(SELECT ((1/COUNT(*))*10) FROM myTable) ORDER BY RAND() LIMIT 1;

Self comment template

<?php

/* Template Comment */
function wco_template_comment($file){
$replace = '/var/www/adam/weddingcolorado.org/wp-content/';
$template_loc = str_replace($replace,'',$file);
echo "<!-- Template: $template_loc -->";
}

//Add to the top of your template
wco_template_comment(__FILE__);

?>

Fake dropdown for a list

<h2>Shop by Brand</h2>

<a id="brandsButton">Select a Brand</a>
<div id="brandsPanel" style="display: none;">
<div class="BlockContent">
<ul>
<li>item 1</li>
<li>item 2</li>
</ul>
</div>
</div>

<script type="text/javascript">
$(document).ready(function(){
$("div#brandsPanel").hide(); $("#brandsButton").click(function () { $("div#brandsPanel").slideToggle("normal"); });
});
</script>

Save plugin options multisite 3.1

<?php
//Snippet1 - New action for creating your buddypress submenu pages - replace 'create_my_submenu_page' with the name of your function

add_action(is_multisite() ? 'network_admin_menu' : 'admin_menu','create_my_submenu_page');

//Snippet2 - This is the form for submitting your plugin options. This works for plugins that only function on the main site, to account for plugins that are used on the network you may want to replace the update_options() with update_site_options() and check ahead of time to decide which to use.

<?php

function my_plugin_admin_form(){
if(isset($_POST['my_submit'])){
if(!isset($_POST['my_option']['my_display_tool'])) $_POST['my_option']['my_display_tool'] = 'false';//If no checked box in post set value to false

foreach((array)$_POST['my_option'] as $key => $value){//Add more my_option[FIELDNAME] to form for more fields
update_option($key,$value);
}
}
$my_display_tool = get_option('my_display_tool');
?>

<div class="wrap">
<h2>My Settings</h2>
<?php if(isset($_POST['my_submit'])) : ?>
<div id="message" class="updated fade">
<p>
<?php _e( 'Settings Saved', 'my' ) ?>
</p>
</div>
<?php endif; ?>
<form method="post" action="">
<?php settings_fields('my_settings'); ?>
<p style="margin-bottom:30px;">
<label style="display:block;" class="input_label">ON/OFF Switch:</label>
<br />
<input name="my_option[my_display_tool]" type="checkbox" <?php if($my_display_tool == 'true') echo 'checked'; ?> value="true" />
<!-- Add more my_option[FIELDNAME] to form for more fields -->
<span class="checkbox_text">Turn This On</span><br />
</p>
<p>
<input name="my_submit" type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>
</div><!-- /.wrap -->
<?
}
?>