Skip to content

Instantly share code, notes, and snippets.

View adamslowe's full-sized avatar

Adam Lowe adamslowe

View GitHub Profile
@thisbit
thisbit / overlay.css
Last active June 5, 2023 20:13
Popupt that opens 5.5 seconds after load, and its removal gets stored in the cookie
.overlay {
transform: scale(0);
}
.overlay.show {
transform: scale(1);
}
.overlay.show.not {
transform: scale(0);
}
@zackpyle
zackpyle / styles.css
Last active February 28, 2023 18:57
Starter CSS
/** TABLE OF CONTENTS
---------------------------------------------------------------------------/
1.0 - Global Styles
1.1 - General
1.2 - Selection Highlight
1.3 - Buttons
1.4 - Typography
1.5 - Custom Font Face
@davidwebca
davidwebca / custom-wp-nav-menu-classes.php
Last active February 11, 2024 01:35
Allow adding custom classes to WordPress menu ul, li, a and at different depths. Perfect for TailwindCSS and AlpineJS usage.
<?php
/**
* WordPress filters to allow custom arguments to wp_nav_menu to,
* in turn, allow custom classes to every element of a menu.
*
* You can apply a class only to certain depth of your menu as well.
*
* The filters use the depth argument given by WordPress
* which is an index, thus starts with level 0 (zero).
*
<?php
// This code snippet will purge the Nginx cache using the Nginx Helper if it's installed and active on the site
// You can add this to MainWP Code Snippets
// For the MainWP Snippet Type, choose "Return info from Child Sites"
// This may also work with ManageWP Code Snippets
global $nginx_purger;
if(isset($nginx_purger))
{
$nginx_purger->purge_all();
<?php
add_action( 'upgrader_process_complete', 'sentree_upgrader_process_complete', 10, 0 );
function sentree_upgrader_process_complete()
{
error_log('Upgrade process complete');
global $nginx_purger;
if(isset($nginx_purger))
{
$nginx_purger->purge_all();
@zackpyle
zackpyle / *Best Snippets*
Last active May 1, 2024 20:05
Best PHP/JS Snippets
This is a collection of my most used or most useful PHP and JS snippets
**Disclaimer, I didn't write most of these - I just curated them over the years**
@yankiara
yankiara / oxygen-repeater-dynamic-query.php
Last active September 6, 2023 19:25
Use dynamic queries with Oxygen's repeater
/* I'll put here different examples of dynamic query for Oxygen repeater :
* - Use one of the following repeater_dynamic_query definitions
* in code block just BEFORE the repeater
* - Set the repeater custom query settings : post type, number of posts, order...
* - Add the remove_action in a code block AFTER the repeater
*/
/****************************************************************************************************
* Display related posts for any CPT with taxonomy:
@mcguffin
mcguffin / acf-quick-edit-rgba-color-picker.php
Last active June 29, 2021 16:57
ACF RGBA Color Picker + ACF Quick Edit Fields
<?php
/**
* Bringing ACF RGBA Color Picker and ACF QuickEdit Fields together.
* https://github.com/mcguffin/acf-quick-edit-fields
* https://wordpress.org/plugins/acf-rgba-color-picker/
*/
/**
* Add field support
*/
@heiswayi
heiswayi / repo-reset.md
Created February 5, 2017 01:32
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@m-thomson
m-thomson / import-image-fix.md
Last active June 23, 2023 14:12
WP All Import duplicate image problem

When an image is imported, the name used in the media library is derived from the URL "basename". This can cause problems, especially when using the option "Search through the Media Library for existing images before importing new images". For example, even though they are different images, these URLs all have the same "basename" (in bold). They will generate the same file my-image.jpg in the WordPress library:

http:// example.com/ my-image.jpg
http:// example.com/ my-image?id=1
http:// example.com/subfolder/ my-image.jpg

The solution is to put this PHP code in your function editor:

function fix_img_url($url){