Skip to content

Instantly share code, notes, and snippets.

View calvez's full-sized avatar
🏠
Working from home

calvez calvez

🏠
Working from home
  • Budapest, Hungary
View GitHub Profile
TASK [nodejs server npm install] ***********************************************
fatal: [default]: FAILED! => {"changed": true, "cmd": "npm config set package-lock false\nnpm install\n", "delta": "0:00:24.087374", "end": "2020-04-17 10:52:54.682873", "msg": "non-zero return code", "rc": 254, "start": "2020-04-17 10:52:30.595499", "stderr": "npm WARN deprecated joi@6.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).\nnpm WARN deprecated topo@1.1.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).\nnpm WARN depr
SELECT table_schema AS "Database name", SUM(data_length + index_length) / 1024 / 1024 AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema;
@calvez
calvez / wc-override-checkout-fields.php
Created March 14, 2019 12:37 — forked from woogists/wc-override-checkout-fields.php
[Customizing checkout fields using actions and filters] Add new shipping fields to WooCommerce
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
$fields['shipping']['shipping_phone'] = array(
'label' => __('Phone', 'woocommerce'),
'placeholder' => _x('Phone', 'placeholder', 'woocommerce'),
'required' => false,
'class' => array('form-row-wide'),
@calvez
calvez / shipping-phone-number.php
Created March 14, 2019 12:03
shipping phone number - woocommerce hooks
<?php
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
$fields['shipping']['shipping_phone'] = array(
'label' => __('Phone', 'woocommerce'),
'placeholder' => _x('Phone', 'placeholder', 'woocommerce'),
'required' => false,
@calvez
calvez / WP - get custom post
Created March 14, 2019 10:21 — forked from gianlucacandiotti/WP - get custom post
Get all posts for a custom post type and query them.
<?php
$type = 'custom_post_type';
$args = array(
'post_type' => $type,
'post_status' => 'publish',
'posts_per_page' => -1,
'ignore_sticky_posts'=> true
);
$my_query = null;
$my_query = new WP_Query($args);
@calvez
calvez / modal-close.html
Created February 19, 2019 08:03
don't close bootstrap 3 modal with key or click outside
<!--
source: https://stackoverflow.com/a/22208662
-->
<button data-target="#myModal" data-toggle="modal" data-backdrop="static" data-keyboard="false">
Launch demo modal
</button>`
@calvez
calvez / add-form-alter.php
Last active February 7, 2019 14:09
drupal theme suggestions
<?php
/**
* Implements hook_theme_suggestions_HOOK() for contact form suggestion.
*/
function THEMENAME_theme_suggestions_form_alter(array &$suggestions, array $variables) {
$suggestions[] = 'form__' . $variables['element']['#form_id'];
}
@calvez
calvez / post_types_author_archives()
Created February 4, 2019 13:04 — forked from Kevinlearynet/post_types_author_archives()
Add custom post types to author archives in WordPress
/**
* Add Custom Post Types to Author Archives
*/
function post_types_author_archives($query) {
// Add 'videos' post type to author archives
if ( $query->is_author )
$query->set( 'post_type', array('videos', 'post') );
// Remove the action after it's run
@calvez
calvez / WC_Variable_Product_Price_Range
Created January 30, 2019 18:27 — forked from maion11/WC_Variable_Product_Price_Range
Changing WooCommerce Variable Products Price Range
function wc_varb_price_range( $wcv_price, $product ) {
$prefix = sprintf('%s: ', __('From', 'wcvp_range'));
$wcv_reg_min_price = $product->get_variation_regular_price( 'min', true );
$wcv_min_sale_price = $product->get_variation_sale_price( 'min', true );
$wcv_max_price = $product->get_variation_price( 'max', true );
$wcv_min_price = $product->get_variation_price( 'min', true );
$wcv_price = ( $wcv_min_sale_price == $wcv_reg_min_price ) ?
function gavias_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
if ($hook == 'form' & !empty($variables['element']['#id'])) {
$suggestions[] = 'form__' . str_replace('-', '_', $variables['element']['#id']);
}
}