Skip to content

Instantly share code, notes, and snippets.

View ambercouch's full-sized avatar

Richard Arnold ambercouch

View GitHub Profile
@ambercouch
ambercouch / plugin.php
Created July 18, 2023 14:22
WP AFC - include acf if not already active
<?php
add_action('init', 'acsab_init', 0);
function acsab_init(){
if((! is_plugin_active('advanced-custom-fields/acf.php'))&& ( ! is_plugin_active('advanced-custom-fields-pro/acf.php')))
{
// Define path and URL to the ACF plugin.
define( 'ACSAB_ACF_PATH', 'inc/acf/' );
define( 'ACSAB_ACF_URL', plugin_dir_url( __FILE__ ) . 'inc/acf/' );
@ambercouch
ambercouch / refreshat.js
Last active March 22, 2023 18:24
Refresh the browser and a specific time (23:00:00)
function refreshAt(hours, minutes, seconds) {
var now = new Date();
var then = new Date();
if(now.getHours() > hours ||
(now.getHours() == hours && now.getMinutes() > minutes) ||
now.getHours() == hours && now.getMinutes() == minutes && now.getSeconds() >= seconds) {
then.setDate(now.getDate() + 1);
}
then.setHours(hours);
<?php
/**
*******************************************************************************
* MAL: Maintenance Auto-Login.
*******************************************************************************
* Automatically logs you in as the first admin user found in the WordPress
* database.
*
* How to use it:
*
df -hT
sudo resize2fs /dev/nvme0n1p1
@ambercouch
ambercouch / functions.php
Last active June 26, 2022 14:38
Allow access for WordPress editor to the Flamingo CF7 database
<?php
function fl_map_meta_cap($meta_caps){
$meta_caps = array(
'flamingo_edit_contact' => 'delete_pages',
'flamingo_edit_contacts' => 'delete_pages',
'flamingo_delete_contact' => 'delete_pages',
'flamingo_delete_contacts' => 'delete_pages', //May not be a thing???
'flamingo_edit_inbound_message' => 'delete_pages',
'flamingo_edit_inbound_messages' => 'delete_pages',
@ambercouch
ambercouch / contact-form-7-default-form.html
Last active December 31, 2021 18:54
A default contact form for contact form 7
<div class="c-contact-form__content" >
<label class="c-contact-form__label" >
<span class="c-contact-form__label-text" >
Your Name <small>(required)</small>
</span>
<span class="c-contact-form__input-wrapper" >
[text* your-name placeholder "Name"]
</span>
</label>
<label class="c-contact-form__label">
sudo chmod -R 777 .env composer.* config storage vendor public/cpresources
#From the root of your wordpress install
#cd in to the theme folder
cd wp-content/themes/
#download ac timber
git clone git@github.com:ambercouch/ac_timber.git ac_timber
#Swich to the master branch or whatever branch you want to use
cd ac_timber
@ambercouch
ambercouch / copy-database.sh
Last active May 25, 2021 10:45
Mysql copy database
sudo mysqldump -u root --password=<pwd> <original db> | sudo mysql -u root --password=<pwd> <new db>
@ambercouch
ambercouch / Import-sql.txt
Last active January 28, 2021 20:05
MySQL commands
mysql -u username -p database_name < file.sql