Skip to content

Instantly share code, notes, and snippets.

View shivapoudel's full-sized avatar
🎯
Focusing

Shiva Poudel shivapoudel

🎯
Focusing
View GitHub Profile
@shivapoudel
shivapoudel / everest-forms-auto-updates.php
Created June 11, 2019 06:40
Auto-updates Everest Forms to the latest stable version.
<?php
/**
* Plugin Name: Everest Forms - Auto Updates
* Plugin URI: https://github.com/wpeverest/everest-forms-auto-updates
* Description: Auto-updates Everest Forms to the latest stable version.
* Version: 1.0.0
* Author: WPEverest
* Author URI: https://wpeverest.com
* License: GPLv3 or later
*
@shivapoudel
shivapoudel / commands.sh
Last active October 8, 2019 13:07
Docker reset
docker system prune -f --volumes
docker container prune -f
docker container stop $(docker container ls -aq)
docker container rm $(docker container ls -aq)
docker image prune -f -a
docker volume prune -f
docker network prune -f
@shivapoudel
shivapoudel / functions.php
Created November 22, 2019 11:38
Everest Forms display form entries with a custom shortcode.
<?php
/**
* Custom shortcode to display form entries.
*
* Usage [everest_forms_entries_table id="FORMID"]
*
* @param array $atts Shortcode attributes.
*/
function evf_entries_table( $atts ) {
$atts = shortcode_atts(
@shivapoudel
shivapoudel / local-restore.md
Last active December 12, 2023 20:57
How can I restore a site from a Local site folder?

In case you are just needing to restore a Local site from an existing Local site folder, here’s how:

Note: There must be SQL files present in app/sql in order for this to work. Otherwise, the database won’t be able to be restored.

  1. Rename htdocs with htdocs-backup.
  2. Create new sites for each using existing domains and paths. Now go to Open Site SSH and browse the directory.
D:
cd ..
@shivapoudel
shivapoudel / 1-git.md
Last active February 19, 2023 19:47
WSL setup for Ubuntu environment.

Installing Git on WSL

Git appears to come as standard as part of the WSL install. You can test this by running:

$ git --version

If for some reason Git is not installed then you can simply pull it down:

@shivapoudel
shivapoudel / functions.php
Last active July 21, 2020 07:30
Everest Forms - Support reCAPTCHA v2 Language code. (Updated for 1.7.0)
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_filter( 'everest_forms_frontend_recaptcha_url', 'evf_recaptcha_lang_code', 10, 2 );
/**
* Language code support for reCAPTCHA v2.
*
@shivapoudel
shivapoudel / Learn.php
Last active April 9, 2021 11:52
Learning some PHP use cases!
<?php
class Logger {
public function log( $message ) {
return "LOG : {$message}" . PHP_EOL;
}
}
interface MailSentAction {
public function sent( $message );
@shivapoudel
shivapoudel / action-schedular.php
Last active January 29, 2022 08:49
Action Schedular queue in loop
<?php
function args_update() {
$loop = 0;
$args = array(
'name',
'surname'
);
foreach ( $args as $arg ) {
WC()->queue()->schedule_single(
@shivapoudel
shivapoudel / woocommerce-hidden-products-from-cart.php
Last active January 13, 2023 04:12
Exclude hidden products from cart area.
<?php
/**
* Filter hidden product from cart.
*
* @since 1.0.0
*
* @param bool $visibility Visibility.
* @param array $cart_item Cart item.
* @param string $cart_item_key Cart item key.
*/
@shivapoudel
shivapoudel / functions.php
Created February 24, 2023 05:42
Redirect homepage depending on country code.
<?php // Do not include this if already open!
/**
* Return the country code.
*
* @since 1.0.0
*/
function get_user_country_code() {
return 'GB'; // This is main United Kingdom front page.
}