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
@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 ) ?
@calvez
calvez / wordpress.nginx
Created October 14, 2018 08:03 — forked from LeCoupa/wordpress.nginx
WordPress - Nginx Configuration File (with SSL) --> https://github.com/LeCoupa/awesome-cheatsheets
##
# @server studio
# @host hackisition.com
# @desc nginx host rules
# @author Julien Le Coupanec <julien@gentlenode.com>
##
# HTTP Server
server {
listen 80;
@calvez
calvez / fix-drupal8-permissions.sh
Created September 23, 2018 19:26 — forked from GreenSkunk/fix-drupal8-permissions.sh
Drupal - Bash shell script to fix Drupal 8 permissions where the PHP Handler is FastCGI.
#!/bin/bash
path=${1%/}
user=${2}
group=${2}
help="\nHelp: This script is used to fix permissions of a Drupal 8 installation in which the PHP Handler is FastCGI\nYou need to provide the following arguments:\n\t 1) Path to your drupal installation\n\t 2) Username of the user that you want to give files/directories ownership\n\nNote: This script assumes that the group is the same as the username if your PHP is compiled to run as FastCGI. If this is different you need to modify it manually by editing this script or checking out forks on GitHub.\nUsage: bash ${0##*/} drupal_path user_name\n"
echo "Refer to https://www.Drupal.org/node/244924"
@calvez
calvez / gnome-keyring-daemon-use-100percent-cpu.mkd
Created August 24, 2018 09:04 — forked from noromanba/gnome-keyring-daemon-use-100percent-cpu.mkd
gnome-keyring use 100% CPU usage when Google Chrome started
@calvez
calvez / functions.php
Created July 24, 2018 09:23 — forked from furtive/functions.php
In WooCommerce, make the online store notice only show up in store pages as opposed to the entire site, which is the default behaviour.
if ( ! function_exists( 'woocommerce_demo_store' ) ) {
/**
* Adds a demo store banner to the site if enabled
*
* @access public
* @return void
*/
function woocommerce_demo_store() {
if ( get_option( 'woocommerce_demo_store' ) == 'no' )
<?php
header('Content-Type: application/json');
//$xmlfile = 'xml/EIT_00002_20140507.xml';
function xml2json($file) {
if (file_exists($file)) {
$xml = simplexml_load_file($file);
$date = $xml->EventDate;
@calvez
calvez / wp-update.sh
Created May 17, 2018 04:39 — forked from bananana/wp-update.sh
Bash script to run automatic updates and backups using wp-cli
#!/bin/bash
#
# Backup and update WordPress using wp-cli
#
# Set the -e shell option so the script exits immediately if any command within
# it exits with a non-zero status.
set -e
# Set PATH environment variable
@calvez
calvez / README.md
Created August 3, 2017 14:22 — forked from joyrexus/README.md
curl tutorial

An introduction to curl using GitHub's API.

Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin

Includes HTTP-Header information in the output

@calvez
calvez / fail2ban-allstatus.sh
Created April 16, 2017 15:28 — forked from kamermans/fail2ban-allstatus.sh
Show status of all fail2ban jails at once
#!/bin/bash
JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'`
for JAIL in $JAILS
do
fail2ban-client status $JAIL
done