Skip to content

Instantly share code, notes, and snippets.

View unculturedswine's full-sized avatar

Joel Jenkins unculturedswine

View GitHub Profile
## Potentially (Hopefully!) block the .*.ico malware that keeps infecting everything
## Those files contain malicious PHP that injects all sorts of garbage all around the server
## To see if you have any .ico files run this command: find / -name ".*.ico" -print
## This command will search the full server
## The files will be hidden and look something like .u834R9u4.ico
## Ultimately these will create random themes and/or plugins in your site folders that send spam
## This is easy to remove (just delete) but it's a PITA as they just keep coming back within days
## If you'd like to bulk delete them all, run this command: find /var/www -name ".*.ico" -print0 | xargs -0 rm
## This command will search only the /var/www folder and sub-folder
@unculturedswine
unculturedswine / cronjobs.txt
Last active January 11, 2024 23:44
WordOps NGINX Config settings for Mautic 4.4.6+
# These tasks need to be added to your cron job
# crontab -e
# will bring up the editor. Replace your php and file path in the code below
* * * * * /usr/bin/php /var/www/example.com/htdocs/bin/console mautic:campaigns:trigger >/dev/null 2>&1
0 * * * * /usr/bin/php /var/www/example.com/htdocs/bin/console mautic:segments:update >/dev/null 2>&1
0 * * * * /usr/bin/php /var/www/example.com/htdocs/bin/console mautic:campaigns:update >/dev/null 2>&1
0 * * * * /usr/bin/php /var/www/example.com/htdocs/bin/console mautic:leadlists:update >/dev/null 2>&1
0 0 * * * /usr/bin/php /var/www/example.com/htdocs/bin/console mautic:cleanup >/dev/null 2>&1
@unculturedswine
unculturedswine / index.php
Created August 31, 2022 16:46
How to include the Advanced Custom Fields plugin inside your own plugin.
<?php
// Define path and URL to the ACF plugin.
// Including in a theme uses get_stylesheet_directory on line 4, but for a plugin you need a different call.
// This is the correct way to call the ACF plugin inside a plugin
define( 'MY_ACF_PATH', plugin_dir_path( __FILE__ ) . '/includes/acf/' );
define( 'MY_ACF_URL', plugin_dir_url( __FILE__ ) . '/includes/acf/' );
// Include the ACF plugin.
include_once( MY_ACF_PATH . 'acf.php' );
@unculturedswine
unculturedswine / EE-acme.sh.txt
Created August 3, 2021 15:29
When Easy Engine V3 Default Lets Encrypt stops renewing certs - Install and start using the acme.sh protocol
# clone the repository
git clone https://github.com/Neilpang/acme.sh.git /opt/acme.sh -q
# create conf directory
mkdir -p /etc/letsencrypt/{config,live,renewal}
# install acme.sh
cd /opt/acme.sh
./acme.sh --install \
--home /etc/letsencrypt \
@unculturedswine
unculturedswine / dropdowns.php
Created December 4, 2020 22:09
Create a dropdown menu of WP Nav Menu links using a <select> wrapper
<?php
$menuLocations = get_nav_menu_locations(); // Retrieves Menus
$menuID = $menuLocations['primary']; // Gets the Primary Menu (Change for your Menu Name)
$primaryNav = wp_get_nav_menu_items($menuID); // Sets up the Foreach Variable
echo '<select>';
foreach ( $primaryNav as $navItem ) {
$link = $navItem->url;
$title = $navItem->title;
echo '<option id="'.$link.'">'.$title.'</option>';
}
@unculturedswine
unculturedswine / add_in_ssl.conf
Created April 6, 2020 18:54
Fixes the ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY Chrome Error on SSL
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:EECDH:EDH:!MD5:!RC4:!LOW:!MEDIUM:!CAMELLIA:!ECDSA:!DES:!DSS:!3DES:!NULL;
@unculturedswine
unculturedswine / fix.css
Last active October 3, 2019 21:24
Mobile Browser 100vh JS/CSS Fix
.selector {
height: 90vh;
height: calc(var(--vh, 1vh) * 100);
}

Keybase proof

I hereby claim:

  • I am unculturedswine on github.
  • I am unculturedswine (https://keybase.io/unculturedswine) on keybase.
  • I have a public key ASDO9UOgWgTk9EUxhXky9MOlTnVe9ORa37hkIFXA_HFFBAo

To claim this, I am signing this object:

@unculturedswine
unculturedswine / _imagesizes.inc.php
Created February 6, 2018 03:34
RICG for Wordpress
<?php
add_image_size( '480', 480, 9999, FALSE );
add_image_size( '768', 768, 9999, FALSE );
add_image_size( '1440', 1440, 9999, FALSE );
add_image_size( '1920', 1920, 9999, FALSE );
add_image_size( '2560', 2560, 9999, FALSE );
@unculturedswine
unculturedswine / functions.php
Created May 24, 2017 15:06
WooCommerce Subscriptions Custom Thank You Page Redirect
add_action( 'template_redirect', 'wc_custom_redirect_after_purchase' );
function wc_custom_redirect_after_purchase() {
global $wp;
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
wp_redirect( '#' );
exit;
}
}