Skip to content

Instantly share code, notes, and snippets.

@laras126
laras126 / gist:854657
Created March 4, 2011 14:13
change wp editor style
<?php
function change_editor_font(){
echo "<style type='text/css'>
#editorcontainer textarea#content {
font-family: Monaco, Consolas, \"Andale Mono\", \"Dejavu Sans Mono\", monospace;
font-size:14px;
color:#333;
}
</style>";
@laras126
laras126 / gist:856824
Created March 5, 2011 23:27
filter example
function change_site_title() {
echo '<?php bloginfo("name", false); ?><?php wp_title("|"); ?>';
}
add_filter('wp_title', 'change_site_title', 10, 2);
void keyPressed() {
if (key == CODED){
if (keyCode == BACK) {
background(100, 200, 98);
}
}
if (key == CODED && keyCode == KeyEvent.KEYCODE_BACK) {
keyCode = 0; // don't quit by default
<?php
// Code from tutorial 'How to Create a Better Meta Box in WordPress Post Editing Page' on Deluxe Blog Tips: http://www.deluxeblogtips.com/2010/04/how-to-create-meta-box-wordpress-post.html
// Thanks!
$prefix = 'dbt_';
$meta_box = array(
'id' => 'wpfolio-meta-box',
@laras126
laras126 / gist:878782
Created March 20, 2011 23:23
wpalchemy in functions.php
<?php
// custom constant (opposite of TEMPLATEPATH)
define('_TEMPLATEURL', WP_CONTENT_URL . '/' . stristr(TEMPLATEPATH, 'themes'));
include_once 'WPAlchemy/MetaBox.php';
// include css to style the custom meta boxes, this should be a global
// stylesheet used by all similar meta boxes
if (is_admin())
{
@laras126
laras126 / gist:878792
Created March 20, 2011 23:41
show meta-info in post
<?php
// Display artwork info in post, below post content
add_filter('thematic_post', 'display_artwork_info');
function display_artwork_info() {
global $artworkinfo_metabox;
echo the_content();
@laras126
laras126 / gist:889631
Created March 27, 2011 21:22
autofocus+ function for options framework
<?php
//Load Color Options
function of_options_output_css() { ?>
<style type="text/css">
/* <![CDATA[ */
<?php $of_css_options_output = dirname( __FILE__ ) . '/style-output.php'; if( is_file( $of_css_options_output ) ) require $of_css_options_output; ?>
/* ]]> */
</style>
<?php }
?>
@laras126
laras126 / gist:889693
Created March 27, 2011 22:19
output-styles.php
<?php
$shortname = get_option('of_shortname');
$output = '';
// Variables containing style options
$hdr_bg_color = get_option($shortname . '_hdr_bg_color');
$body_bg_color = get_option($shortname . '_body_bg_color');
$body_font = get_option($shortname . '_body_font');
// Output styles
@laras126
laras126 / gist:889725
Created March 27, 2011 22:44
dynamic stylesheet
body {font-family:<?php echo $body_font; ?>;background-color:<?php echo $body_bg_color ?>;}
#header {background-color: <?php echo $hdr_bg_color ?>;}
@laras126
laras126 / gist:889741
Created March 27, 2011 23:07
sample options
<?php
$options[] = array( "name" => "Header Color",
"desc" => "Color selected.",
"id" => $shortname."_hdr_bg_color",
"std" => "#2098a8",
"type" => "color");
$options[] = array( "name" => "Body Background Color",
"desc" => "Color selected.",
"id" => $shortname."_body_bg_color",