Skip to content

Instantly share code, notes, and snippets.

View brandondove's full-sized avatar

Brandon Dove brandondove

View GitHub Profile
<?php if ( isset( $_GET['variable_name'] ) && $_GET['variablename'] == 'whatever' ) { ?>
<?php return htmlspecialchars(wp_filter_post_kses(get_option($this->shortname.'_feed_email')), UTF-8); ?>
<?php return htmlspecialchars(wp_filter_post_kses(get_option($this->shortname.'_twitter')), UTF-8); ?>
<?php
function pj_convo_query_vars($vars) {
$vars[] = 'conversation-starter';
$vars[] = 'convo-id';
return $vars;
}
add_filter('query_vars', 'pj_convo_query_vars');
?>
<?php
shopp( 'catalog', 'catalog-products', 'load=true' );
if ( shopp( 'catalog', 'has-categories' ) ) :
while ( shopp( 'catalog', 'categories' ) ) :
shopp( 'catalog', 'category', 'slug='.shopp( 'category', 'slug', 'return=true' ) );
endwhile;
else :
echo "no categories yet.";
endif;
<?php
class kkiLadies {
function __construct() {
wp_register_script( 'kki-ladies', KKI_JS.'ladies.js', array( 'jquery' ), '0.1', true );
add_action( 'init', array( &$this, 'init' ) );
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
add_action( 'save_post', array( &$this, 'save_post' ) );
// add_action( 'admin_print_scripts-post-new.php', array( &$this, 'print_scripts' ) );
<?php
while( shopp( 'catalog', 'categories' ) ) :
if( shopp( 'category', 'has-images' ) ) :
$content_column.= '<div class="shopp-main-category">';
$content_column.= '<a href="'.shopp( 'category', 'url', 'return=true' ).'">';
$content_column.= shopp( 'category', 'coverimage', 'return=true&width=220&height=450&fit=crop&title='.shopp( 'category', 'name', 'return=true' ) );
$content_column.= '</a><span class="shopp-category-title"><a href="'.shopp( 'category', 'url', 'return=true' ).'">'.shopp( 'category', 'name', 'return=true' ).'</a></span>';
$content_column.= '</div>';
endif;
<?php
shopp( 'catalog', 'product', 'name=Recurring Donation&load=prices,images' );
$content_column.= shopp( 'product', 'donate', 'return=true' );
echo $content_column;
?>
Product Object
(
[prices] => Array
(
)
[pricekey] => Array
(
)
@brandondove
brandondove / gist:841869
Created February 24, 2011 06:56
query_posts 3.1 vs 3.0.5 - SQL differences
<?php
/*
this works, but is it right to separate out the two categories here? I thought I could include both cat ids in the first terms array, but it seems that if I do that, it pulls any post that matches either category instead of both.
*/
query_posts( array(
'tax_query' => array(
'relation' => 'AND',
array(
@brandondove
brandondove / gist:1306260
Created October 22, 2011 17:37
_doing_it_wrong() definition
<?php
/**
* Marks something as being incorrectly called.
*
* There is a hook doing_it_wrong_run that will be called that can be used
* to get the backtrace up to what file and function called the deprecated
* function.
*
* The current behavior is to trigger a user error if WP_DEBUG is true.
*