Skip to content

Instantly share code, notes, and snippets.

@rezzz-dev
rezzz-dev / gist:3489697
Created August 27, 2012 15:48
Add a checkbox to Taxonomy
// Edit term page
function summit_taxonomy_edit_meta_field($term) {
// put the term ID into a variable
$t_id = $term->term_id;
// retrieve the existing value(s) for this meta field. This returns an array
$term_meta = get_option( "taxonomy_$t_id" ); ?>
<tr class="form-field">
<th scope="row" valign="top"><label for="term_meta[displayed]"><?php _e( 'Display Category', 'summit' ); ?></label></th>
@rezzz-dev
rezzz-dev / gist:3489914
Created August 27, 2012 16:09
Adding a checkbox to meta fields
// Add term page
function summit_taxonomy_add_new_meta_field() {
// this will add the custom meta field to the add new term page
?>
<div class="form-field">
<label for="term_meta[displayed]"><?php _e( 'Display Category', 'summit' ); ?></label>
<input type="hidden" name="term_meta[helpme]" value="z">
<input type="checkbox" name="term_meta[displayed]" id="term_meta[displayed]" value="1">
<p class="description"><?php _e( 'Check to have the Category to displayed on the Sales Page','summit' ); ?></p>
</div>
@rezzz-dev
rezzz-dev / gist:4570625
Created January 19, 2013 03:35
Chart for Activity Graph in Genesis CRM
http://chart.apis.google.com/chart?chtt=&chxl=0:|Jan%202013&chxr=0,0,5|1,0,5&chxs=0,676767,11.5,0,lt,676767&chxt=x,y&chs=280x120&cht=lc&chco=3D7930&chm=B,C5D4B5BB,0,0,0&chf=bg,s,FFFFFF&chd=t:4&chds=0,5&chls=2,4,0&chg=-1,-1,1,1
@rezzz-dev
rezzz-dev / gist:5476979
Created April 28, 2013 14:03
Snippet: WP: Limit Content by X Words
function jr_limit_content($limit, $thecontent = "") {
if ($thecontent) {
$content = explode(' ', $thecontent, $limit);
}
else {
$content = explode(' ', get_the_content(), $limit);
}
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content).'...';
@rezzz-dev
rezzz-dev / gist:5482134
Created April 29, 2013 14:58
Snippet: WP: Detect Image for Singular
<?php
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() && has_post_thumbnail( $post->ID ) ) :
// Houston, we have a new header image!
echo get_the_post_thumbnail( $post->ID, 'full' );
endif;
?>
@rezzz-dev
rezzz-dev / gist:5509174
Created May 3, 2013 13:44
Snippet: WP: Display Sidebar
if ( is_active_sidebar( 'homepage-widget-area' ) ) :
dynamic_sidebar( 'homepage-widget-area' );
endif;
@rezzz-dev
rezzz-dev / gist:5509182
Created May 3, 2013 13:44
Snippet: WP: Widgets Init
function jr_widgets_init ()
{
if ( function_exists('register_sidebar') )
register_sidebar( array(
'name' => __( 'Homepage Footer Area', 'twentyten' ),
'id' => 'homepage-widget-area',
'description' => __( 'Homepage Footer Area', 'twentyten' ),
'before_widget' => '<div id="%1$s" class="span4 widget-container %2$s">',
'after_widget' => '<div class="clear"></div></div>',
'before_title' => '<h3 class="jr-title widget-title">',
@rezzz-dev
rezzz-dev / gist:5547553
Created May 9, 2013 13:52
Snippet: WP: Disable Admin Bar
/* Disable the Admin Bar & Setting in Profile. */
add_filter( 'show_admin_bar', '__return_false' );
function jr_hide_admin_bar_settings() {
?>
<style type="text/css">
.show-admin-bar {
display: none;
}
</style>
@rezzz-dev
rezzz-dev / .gitignore
Created May 19, 2013 17:00
Template for .git managed WordPress websites
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: As a result, we only stick the site's wp-content in the repo
#
# See the comments below for more info on how to add exceptions for your
# content. Or see git's documentation for more info on .gitignore files:
# http://kernel.org/pub/software/scm/git/docs/gitignore.html
@rezzz-dev
rezzz-dev / gist:5642924
Created May 24, 2013 11:38
Snippet: WP Custom Login Logo
/**
* Custom admin login header logo
*/
function jr_custom_login_logo() {
echo '<style type="text/css">'.
'h1 a { background-size: 201px 35px !important; background-image:url('.get_bloginfo( 'template_directory' ).'/images/logo.png) !important; }'.
'</style>';
}
add_action( 'login_head', 'jr_custom_login_logo' );