This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($){ | |
$('.thumbnails>a>img').click(function(e){ | |
e.stopPropagation(); | |
$('.woocommerce-main-image img').attr('src', $(this).attr('src').replace('-87x87','-564x564')); | |
return false; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Set products per row | |
add_filter( 'loop_shop_columns', create_function( '$cols', 'return 3;' ), 20 ); | |
//Set products per page | |
add_filter( 'loop_shop_per_page', create_function( '$num', 'return 12;' ), 20 ); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$product_ids_raw = $wpdb->get_results( | |
"SELECT wp_posts.ID, wp_posts.post_parent | |
FROM wp_posts | |
INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) | |
INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id) | |
WHERE | |
wp_posts.post_status = 'publish' | |
AND (mt1.meta_key = '_sale_price_dates_to' AND mt1.meta_value >= ".time().") | |
GROUP BY wp_posts.ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('the_content', 'set_first_word_color', 10); | |
function set_first_word_color( $content ) | |
{ | |
$color = '#FF0000'; | |
$pos = strpos(ltrim($content), ' '); | |
$new_content = '<span style="color: '.$color.'"'.substr($content, 0, $pos).'</span>'.substr($content, $pos); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gets the current global post type if one is set | |
*/ | |
function x_get_current_post_type() { | |
global $post, $typenow, $current_screen; | |
if( $post && $post->post_type ) | |
$post_type = $post->post_type; | |
elseif( $typenow ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function include_template( $template, $args = array() ) | |
{ | |
//Allow plugins to manipulate the tempalte data before sending it to the template | |
$data = apply_filters('prefix_template_data', $args, $template); | |
//Look in theme folder first, then plugin folder | |
if(locate_template($template) === '') | |
{ | |
include PREFIX_PLUGIN_PATH . 'templates/' . $template; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Improved and much cleaner version of https://gist.github.com/andyl/6360906 | |
// | |
// | |
// Bootstrap Mid-Small - col-ms-* - the missing grid set for Bootstrap3. | |
// | |
// This is a hack to fill the gap between 480 and 760 pixels - a missing range | |
// in the bootstrap responsive grid structure. Use these classes to style pages | |
// on cellphones when they transition from portrait to landscape. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Only database backup | |
declare -a SITES=('site1' 'site2' 'site3' 'site4'); | |
SITES_PATH_BASE=/var/www/ | |
SITES_PATH_SUFIX=/repo/public | |
SITES_BACKUP_FOLDER=backups | |
CURRENT_DATE=`date +%Y-%m-%d`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_single_product_summary', 'my_add_read_more_about_category', 25); | |
function my_add_read_more_about_category() | |
{ | |
global $product; | |
$cat_post_map = array( | |
// category id => array(<page id to link to>, <category plural label (optional)>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( class_exists( 'PE_Post_Type_Creator' ) ) | |
{ | |
$ptc = new PE_Post_Type_Creator(); | |
$text_domain = 'text-domain'; | |
$ptc->set_taxonomies(array( | |
'min-taxonomi' => array( | |
'singular_label' => _x('Min taxonomi', 'Post type plural', $text_domain), |
OlderNewer