Skip to content

Instantly share code, notes, and snippets.

View hiranthi's full-sized avatar

Hiranthi Herlaar hiranthi

View GitHub Profile
@miltonbolonha
miltonbolonha / plugins-install.sh
Created April 7, 2021 02:04
bash plugins install for wordpress
sudo chmod -R 775 /home/milton/www/projects/system* && mkdir wp-content/plugins
curl -L https://downloads.wordpress.org/plugin/wp-super-cache.1.7.2.zip -o /tmp/wp-super-cache.1.7.2.zip
curl -L https://downloads.wordpress.org/plugin/advanced-custom-fields.5.9.5.zip -o /tmp/advanced-custom-fields.5.9.5.zip && unzip /tmp/advanced-custom-fields.5.9.5.zip -d ./wp-content/plugins
curl -L https://downloads.wordpress.org/plugin/custom-post-type-ui.1.8.2.zip -o /tmp/custom-post-type-ui.1.8.2.zip && unzip /tmp/custom-post-type-ui.1.8.2.zip -d ./wp-content/plugins
curl -L https://downloads.wordpress.org/plugin/learnpress.zip -o /tmp/learnpress.zip && unzip /tmp/learnpress.zip -d ./wp-content/plugins
curl -L https://downloads.wordpress.org/plugin/shins-pageload-magic.zip -o /tmp/shins-pageload-magic.zip && unzip /tmp/shins-pageload-magic.zip -d ./wp-content/plugins
curl -L https://downloads.wordpress.org/plugin/wordpress-seo.16.0.0.zip -o /tmp/wordpress-seo.16.0.0.zip && unzip /tmp/wordpress-seo.16.0.0.zip -d ./wp-conten
@paaljoachim
paaljoachim / functions.php
Last active March 7, 2023 18:50
WooCommerce: Adding multiple custom fields to the order notes area in the checkout page
/* 1. Adds a custom field. NB. I am using some Norwegian words in the below text.
* 2. Then adds a validate error message if person does not fill out the field.
* 3. Then adds the custom field to the order page.
https://businessbloomer.com/woocommerce-add-custom-checkout-field-php/
https://businessbloomer.com/woocommerce-add-shipping-phone-checkout/
https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/#section-6
*/
add_action( 'woocommerce_before_order_notes', 'my_custom_checkout_field' );
function my_custom_checkout_field( $checkout ) {
@tfirdaus
tfirdaus / wp-cli-convert-to-innodb.sh
Created October 26, 2018 11:07
Convert MyISAM tables to InnoDB with WP-CLI
#!/usr/bin/env bash
# Author Mike https://guides.wp-bullet.com
# Purpose - Convert MyISAM tables to InnoDB with WP-CLI
# create array of MyISAM tables
WPTABLES=($(wp db query "SHOW TABLE STATUS WHERE Engine = 'MyISAM'" --silent --skip-column-names | awk '{ print $1}'))
# loop through array and alter tables
for WPTABLE in ${WPTABLES[@]}
do
@petskratt
petskratt / clinup
Last active March 12, 2024 23:21
Use wp-cli to clean up WordPress installs (force core & plugins reinstall, track changes in git allowing easy reverts etc)
#!/usr/bin/env bash
# for debug output, uncomment:
#set -x
function help {
echo "WordPress cleanup -v 0.5 2018-06-26 / peeter@zone.ee
Usage:
@woogists
woogists / wc-auto-add-product-to-cart.php
Last active March 22, 2023 15:31
Automatically add product to cart on visit
/**
* Automatically add product to cart on visit
*/
add_action( 'template_redirect', 'add_product_to_cart' );
function add_product_to_cart() {
if ( ! is_admin() ) {
$product_id = 64; //replace with your own product id
$found = false;
//check if product already in cart
if ( sizeof( WC()->cart->get_cart() ) > 0 ) {
@amboutwe
amboutwe / yoast_seo_title_change-variable.php
Last active May 23, 2022 17:09
Change existing or add custom title or meta template variables
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO Change existing title or meta template variable
* Credit: Moshe Harush
* https://stackoverflow.com/questions/36281915/yoast-seo-how-to-create-custom-variables
* Last Tested: Unknown
*/
// define the wpseo_replacements callback
function filter_wpseo_replacements( $replacements ) {
@JeroenSormani
JeroenSormani / hide-shipping-if-free-shipping-is-available.php
Last active October 20, 2022 09:36
New - Hide paid shipping rates when free is available. DOES show Local Pickup. Considered ANY shipping rate that is $0 as free (so the 'Free shipping' shipping method is not a requirement)
<?php
/**
* Copy from here to your (child) themes functions.php
* Recommended to do so via FTP.
*/
/**
* Hide all but the free shipping options when free is available.
*
@corsonr
corsonr / functions.php
Created September 28, 2016 08:33
Display WooCommerce product variations dropdown select on the shop page
<?php
// Display variations dropdowns on shop page for variable products
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' );
function woo_display_variation_dropdown_on_shop_page() {
global $product;
if( $product->is_type( 'variable' )) {
@lopspower
lopspower / README.md
Last active May 3, 2024 13:26
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

<?php
/*
Plugin Name: Programmatically add Gravity Forms
Plugin URI: https://daan.kortenba.ch/programmatically-add-gravity-forms/
Description: Programmatically add persistent Gravity Forms forms.
Author: Daan Kortenbach
Version: 0.1
Author URI: https://daan.kortenba.ch/
License: GPLv2 or later
*/