Skip to content

Instantly share code, notes, and snippets.

View polevaultweb's full-sized avatar

Iain Poulson polevaultweb

View GitHub Profile
input#mce-EMAIL {
width: 300px;
margin-top: 2rem;
border: none;
padding: 1rem;
border-radius: 5px;
}
input#mc-embedded-subscribe {
padding: 1rem;
<?php
/**
* Plugin Name: Ninja Forms Uploads Connect Submissions
* Plugin URI: https://ninjaforms.com/extensions/file-uploads/
* Description: Debug plugin
* Version: 3.0
* Author: polevaultweb
* Author URI: https://polevaultweb.com
*/
<?php
add_filter( 'igp_date_format', 'my_igp_date_format' );
function my_igp_date_format() {
return 'M d, Y';
}
<?php
add_filter( 'igp_image_post_taxonomy_terms', 'first_tag_to_category', 10, 4 );
function first_tag_to_category( $terms, $image, $post_id, $taxonomy ) {
$tags = isset( $image->tags ) ? maybe_unserialize( $image->tags ) : array();
if ( empty( $tags ) ) {
return $terms;
}
$first_tag = reset( $tags );
<?php
/**
* Get matching hashtag regex.
* Based on https://github.com/ngnpope/twitter-text-php
*
* @return string Regex pattern.
*/
protected function valid_hashtag_regex() {
$tmp = array();
<?php
add_filter( 'igp_image_post_taxonomy_terms', function ( $terms, $image, $post_id, $taxonomy ) {
$tags = isset( $image->tags ) ? maybe_unserialize( $image->tags ) : array();
if ( empty( $tags ) ) {
return $terms;
}
$tag_cat_mapping = array(
'whizalternatives' => 'alternatives',
@polevaultweb
polevaultweb / edd_best_sales_day.sql
Created June 25, 2020 15:13
Get your best sales day total for an Easy Digital Downloads WordPress store
SELECT Date(post_date) as Date,
Round(Sum(pm.meta_value - pm1.meta_value)) as Total
FROM wp_posts p
INNER JOIN wp_postmeta pm
ON p.id = pm.post_id
AND pm.meta_key = '_edd_payment_total'
INNER JOIN wp_postmeta pm1
ON p.id = pm1.post_id
AND pm1.meta_key = '_edd_payment_tax'
WHERE post_type = 'edd_payment'
@polevaultweb
polevaultweb / igp_post_title.php
Created June 24, 2020 21:41
Add this to the wp-content/mu-plugins directory (create if doesn't exist)
<?php
function my_igp_post_title( $title ) {
// "car model:", "engine:", "Country & City: and (no. 40)" ie.:
// Title: BMW E46 - M52 - Germany/Bavaria/Hof (no. 40)
$model = trim( get_string_between( $title, 'car model:', 'engine:' ) );
$engine = trim( get_string_between( $title, 'engine:', 'bhp:' ) );
$country = trim( get_string_between( $title, 'country & city:', 'occupation:' ) );
$number = '(no. ' . trim( get_string_between( $title, ' (no.', ')' ) ) . ')';
@polevaultweb
polevaultweb / igp_fix_tags_caption.php
Last active June 18, 2020 20:02
Intagrate - Ensure hashtags are stripped from the caption
<?php
/**
* Get matching hashtag regex.
* Based on https://github.com/ngnpope/twitter-text-php
*
* @return string Regex pattern.
*/
function igp_valid_hashtag_regex() {
$tmp = array();
@polevaultweb
polevaultweb / nf_fu_acf_gallery.php
Created October 2, 2019 10:33
Use Ninja Forms File Upload fields as the source of an ACF Gallery field, when using the Post Creation addon.