Skip to content

Instantly share code, notes, and snippets.

View landbryo's full-sized avatar
🤠
Always Excitied

Landon Otis landbryo

🤠
Always Excitied
View GitHub Profile
@landbryo
landbryo / picker-filters.php
Last active May 2, 2022 17:56
Fix picker image meta for MG
/**
* After attachment has been created, make sure to
* label it as an external image source so the URL can be re-written.
*/
add_filter( 'capi_image_attachment_meta', function( $metadata, $attachment_id ) {
// Mark as external image source.
update_post_meta( $attachment_id, '_external_image_source', 1 );
return $metadata;

Keybase proof

I hereby claim:

  • I am landbryo on github.
  • I am landonotis (https://keybase.io/landonotis) on keybase.
  • I have a public key ASC06Q9ubHVM4xSJKglKwRf5jScPJWuw1CLP7e1A59MiEgo

To claim this, I am signing this object:

add_filter( 'as3cf_pre_upload_attachment', [ $this, 'pre_upload_attachment' ], 99, 3 );
/**
* Abort uploading media to S3 if attachment isn't old enough
*
* @param $abort
* @param $post_id
* @param $meta
*
* @return bool
<?php
/**
* Filter's the URL Elementor uses for enqueuing generated assets
*
* @author Landon Otis
*/
add_filter( 'set_url_scheme', function ( $url, $scheme, $orig_scheme ) {
if ( preg_match( "/elementor\/css/", $url ) ) {
@landbryo
landbryo / Disable-Address-Validation-Filters.php
Last active October 16, 2020 16:07
Restrict Content Pro Avatax - Allow users to disable Avatax address validation before submitting the address.
<?php
// Disable for all registrations
add_filter( 'rcp_avatax_disable_validate_address', '__return_true' );
// Selectively disable address validation example by state/province
add_filter( 'rcp_avatax_disable_validate_address', function ( $disable, $post ) {
$state = isset( $post['rcp_card_state'] ) ? $post['rcp_card_state'] : '';
@landbryo
landbryo / view-limit-exclude.php
Last active July 24, 2021 16:14
Disable View Limit functionality for posts by providing their IDs in posts array
<?php
/**
* Plugin Name: View Limit - Exclude Posts by ID
* Description: Disable View Limit functionality for posts by providing their IDs in posts array
* Version: 0.0.1
* Requires at least: 5.2
* Requires PHP: 7.1
* Author: Landon Otis
* Author URI: https://missionlab.dev
*/
@landbryo
landbryo / laragon-cmder-phpstorm.md
Created August 21, 2020 16:56
Laragon Cmder in PHPStorm

Navigate to PHPStorm's Settings > Tools > Terminal and set...

Shell path "cmd" /k "C:\laragon\bin\cmder\vendor\init.bat"

@landbryo
landbryo / bpges-email-actions.php
Created August 11, 2020 19:19
BuddyPress Group Email Subscriptions email filters.
<?php
/**
*
* @param string $footer
* @param string $type Digest type. 'sum' or 'dig'.
*/
add_filter( 'ass_digest_footer', function ( $footer, $type ) {
return $footer;
} );
@landbryo
landbryo / gf-skip-step.js
Created April 23, 2020 22:29
Ugly but useful function to hook to a button or link allowing you to skip the current page/step. Basically just a useful UI snip.
function gfSkipStep(e) {
e.preventDefault();
jQuery('.gform_wrapper:visible .gform_page').each(function () {
if (jQuery(this).is(":visible")) {
if (jQuery(".gform_button[type=submit]").is(":visible")) {
jQuery(".gform_button[type=submit]:visible").trigger('click');
} else if (jQuery(".gform_next_button").is(":visible")) {
jQuery(".gform_next_button:visible").trigger('click');
}
@landbryo
landbryo / rcp-hide-registration-row.js
Last active April 24, 2020 15:25
Hide registration row when clicked option is level 5
jQuery(document).on('click', '#rcp_subscription_levels .rcp_level', function () {
var value = Number(this.value);
setTimeout(function () {
var levelId = 5;
var renewal = document.querySelector('.rcp_registration_total .rcp-renewal-date');
if (null != renewal) {
if (levelId === value) {
renewal.style.display = 'none';
} else {
renewal.style.display = 'table-row';