Skip to content

Instantly share code, notes, and snippets.

View kreamweb's full-sized avatar

Emanuela Antonina Castorina kreamweb

  • Kream di Emanuela Castorina
  • Acicatena (CT) - Italy
View GitHub Profile
@kreamweb
kreamweb / parser
Last active August 29, 2015 14:08
Parser a web font style
<?php
$handle = fopen("style.css", "r");
$file = 'config.json';
$arr = array();
if ($handle) {
$key = '';
while (($line = fgets($handle)) !== false) {
preg_match('/[\w-]+/', $line, $matches );
@kreamweb
kreamweb / functions.php
Created December 27, 2014 17:28
[Wordpress] Limit the Number of tags in a widget
<?php
//Register tag cloud filter callback
add_filter('widget_tag_cloud_args', 'tag_widget_limit');
//Limit number of tags inside widget
function tag_widget_limit($args){
//Check if taxonomy option inside widget is set to tags
if(isset($args['taxonomy']) && $args['taxonomy'] == 'post_tag'){
@kreamweb
kreamweb / functions.php
Created July 29, 2015 07:41
Ajax Search from Premium to Free
<?php
if( defined('YITH_WCAS_PREMIUM') ){
global $yith_wcas;
add_filter( 'ywrac_results', 'ywrac_custom_result', 10, 2 );
remove_action( 'pre_get_posts', array( $yith_wcas, 'pre_get_posts' ) );
}
function ywrac_custom_result( $posts, $search_keyword ){
global $woocommerce;
$ordering_args = $woocommerce->query->get_catalog_ordering_args( 'title', 'asc' );
@kreamweb
kreamweb / functions.php
Created January 14, 2016 08:14
Change text browse list in YITH WooCommerce Request a Quote
<?php
add_filter('ywraq_product_added_view_browse_list', 'ywraq_change_browse_list');
function ywraq_change_browse_list( $text ){
$text = "View the list";
return $text;
}
@kreamweb
kreamweb / functions.php
Created January 19, 2016 09:32
Change text 'Prodcut Added' in YITH WooCommerce Request a Quote
<?php
add_filter('yith_ywraq_product_added_to_list_message', 'ywraq_change_product_added');
function ywraq_change_product_added( $text ){
$text = "Done!";
return $text;
}
@kreamweb
kreamweb / functions.php
Created January 28, 2016 08:54
Keep list in YITH WooCommerce Request a Quote after sent the request
<?php
if( defined( 'YITH_YWRAQ_PREMIUM' ) ){
add_filter( 'ywraq_clear_list_after_send_quote', 'ywraq_clear_list_after_send_quote', 10, 2);
function ywraq_clear_list_after_send_quote( $clear, $raq ){
return false;
}
}
@kreamweb
kreamweb / functions.php
Created January 28, 2016 14:38
YITH WooCommerce Social Login Wp Engine Fix
<?php
function ywsl_process_login_start()
{
setcookie( LOGGED_IN_COOKIE, md5(rand()), time()+15, preg_replace('|https?://[^/]+|i', '', YITH_YWSL_HYBRID_URL ) );
}
add_filter( 'ywsl_process_login_start', 'ywsl_process_login_start' );
?>
@kreamweb
kreamweb / code.txt
Created February 4, 2016 06:48
YITH WooCommerce Ajax Search Shortcode
To show the search form,
you can use
[yith_woocommerce_ajax_search]
or php code:
<?php echo do_shortcode('[yith_woocommerce_ajax_search]​'); ?>
@kreamweb
kreamweb / functions.php
Created March 4, 2016 15:25
Change order of search in woocommerce
<?php
add_filter('woocommerce_get_catalog_ordering_args', 'ywcas_woocommerce_catalog_orderby');
function ywcas_woocommerce_catalog_orderby( $args ) {
$args['orderby'] = 'meta_value';
$args['order'] = 'asc';
$args['meta_key'] = '_sku';
return $args;
@kreamweb
kreamweb / functions.php
Last active March 16, 2016 14:41
YITH WooCommerce Subscription add list of all renew in the order status list
<?php
///Renewal subscription
add_filter( 'views_edit-shop_order', 'yith_add_renewal_subscription' );
function yith_add_renewal_subscription( $views ) {
$post_status = wc_get_order_statuses();
$args = array(
'post_type' => 'shop_order',