Skip to content

Instantly share code, notes, and snippets.

@timneutkens
timneutkens / wordpress-dbsync.sh
Created April 24, 2016 20:45
Export / import wordpress database oneliner
# Uses these 2 tools:
# http://wp-cli.org/
# https://github.com/xwp/wp-cli-ssh
# Remote to local
wp ssh db export - --host=production | wp db import -
# Local to remote BEWARE THIS IS DANGEROUS BUT KEPT AS REFERENCE
wp db export - | wp ssh db import - --host=production
@noelboss
noelboss / git-deployment.md
Last active May 2, 2024 15:47
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@duroe5698
duroe5698 / add-custom-menu-item-and-endpoint-to-woocommerce-my-account-page.php
Last active July 8, 2023 18:05
Add custom menu item and endpoint to WooCommerce my-account page
/* Add custom menu item and endpoint to WooCommerce My-Account page */
function my_custom_endpoints() {
add_rewrite_endpoint( 'refunds-returns', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'my_custom_endpoints' );
function my_custom_query_vars( $vars ) {
$vars[] = 'refunds-returns';
@stefanmaric
stefanmaric / copy-to-clipboard-bookmarklet.md
Created September 7, 2016 20:54
Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard

Copy-to-clipboard Bookmarklet

Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard.

This is the base javascript:

(function (text) {
  var node = document.createElement('textarea')
  var selection = document.getSelection()
@RadGH
RadGH / capture-acf-form-save-post.php
Last active July 12, 2020 17:38
Capture a submitted ACF form with fields, and do not create a post out of the data
<?php
// Adds a new hook that catches a submitted acf_form by field group key. Only supports a single field group, but could be expanded.
// Just use the new action:
// capture-acf-form/field_group=%%%%%%%%%%%
// Replace %%%%%%% with your field group key.
/**
* Capture user registration form for processing.
<?php
/*
This script will allow you to send a custom email from anywhere within wordpress
but using the woocommerce template so that your emails look the same.
Created by craig@123marbella.com on 27th of July 2017
Put the script below into a function or anywhere you want to send a custom email
*/
@JohnDinhDev
JohnDinhDev / Reset Udemy Progress.md
Last active April 29, 2024 18:36
Reset Udemy Progress

Reset Udemy Progress

Last Updated: 09/30/2022

Step 1. Go to Udemy course in browser

Go to the course and have any video up. The following code relies on the right sidebar to be visible to uncheck all your progress.

Step 2. Open browser console

You can do this with ctrl+shift+j and making sure the console tab is selected for chrome/brave