Skip to content

Instantly share code, notes, and snippets.

@tomharrigan
tomharrigan / gist:4466547
Created January 6, 2013 10:55
Get meta data excerpts if available, otherwise use get_the_excerpt().
if($instance['post_type'] == 'features'){
$exc = get_post_meta( get_the_ID(), 'feature_excerpt', true );
if ( $exc != '' ) {
$exc = stripslashes( $exc );
} else {
$exc = strip_tags( get_the_excerpt() );
}
} else if($instance['post_type'] == 'feedback'){
$exc = get_post_meta( get_the_ID(), 'feedback_excerpt', true );
if ( $exc != '' ) {
@tomharrigan
tomharrigan / gist:4472780
Created January 7, 2013 05:54
add fade effect to featured products slider in WooStore. Add this to functions.php
remove_action('wp_head', 'woo_jcarousel_script');
add_action('wp_head', 'woo_jcarousel_fade_script');
function woo_jcarousel_fade_script(){
if ( (is_home() || is_front_page()) && !is_paged() ) {
?>
<script type="text/javascript">
@tomharrigan
tomharrigan / gist:4489290
Created January 9, 2013 00:08
Change number or products per row to 4
// Change number or products per row to 4
add_filter( 'loop_shop_columns', 'woo_custom_loop_columns' );
if ( ! function_exists( 'woo_custom_loop_columns' ) ) {
function woo_custom_loop_columns() {
return 4;
} // End woo_custom_loop_columns()
}
@tomharrigan
tomharrigan / gist:4492805
Created January 9, 2013 12:31
Change 'Your Text Here' to your desired text.
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('Popular Products', 'Your Text Here', $translated);
return $translated;
}
$my_tax_images = get_option('taxonomy_image_plugin');
$tax_term_id = $all_term->term_taxonomy_id;
$imlink = wp_get_attachment_url( $my_tax_images[$tax_term_id]);
woo_image('src='.$imlink.'&key=image&width=139&height=81&link=img');
if ( Jetpack::is_active() ) {
remove_action('comment_form_before', 'my_container_c');
remove_action('comment_form_after', 'my_container_d');
}
@tomharrigan
tomharrigan / gist:4502393
Created January 10, 2013 14:26
social shortcode
[google_plusone size="medium" annotation="bubble" language="English (UK)" float="left"][twitter style="horizontal" float="left"] [fblike style="button_count" showfaces="false" width="90" verb="like" font="arial" float="left"]
[google_plusone size="medium" annotation="none" language="English (UK)" float="left"][twitter style="none" float="left"] [fblike style="standard" showfaces="false" width="50" verb="like" font="arial" float="left"]
@tomharrigan
tomharrigan / gist:4503154
Created January 10, 2013 15:56
This will fix the header image, navigation and ad issue
#header {
background-position: bottom center;
background-size: 100%;
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
ul.nav {
width: 85%;
margin-right: 0;
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('Product Description', 'Artist Videos', $translated);
$translated = str_ireplace('Related Products', 'Related Artists', $translated);
return $translated;
}