Skip to content

Instantly share code, notes, and snippets.

Avatar

Iain Poulson polevaultweb

View GitHub Profile
View digitalprcourse.css
input#mce-EMAIL {
width: 300px;
margin-top: 2rem;
border: none;
padding: 1rem;
border-radius: 5px;
}
input#mc-embedded-subscribe {
padding: 1rem;
View nf_fu_reconnect_uploads_with_submissions.php
<?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
*/
@polevaultweb
polevaultweb / pvw_logging.php
Created Sep 25, 2020
WordPress mu-plugin for logging stacktraces in WordPress code
View pvw_logging.php
<?php
// Add this file to the wp-content/mu-plugins/ directory.
// It may need to be created if it doesn't exist
/**
* These constants must be set in wp-config.php
*
* define('WP_DEBUG', true);
* define('WP_DEBUG_LOG', true);
View igp_change_date_format.php
<?php
add_filter( 'igp_date_format', 'my_igp_date_format' );
function my_igp_date_format() {
return 'M d, Y';
}
View igp_first_hashtag_as_category.php
<?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 );
View igp_hashtags.php
<?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();
View igp_tag_category_mapping.php
<?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 Jun 25, 2020
Get your best sales day total for an Easy Digital Downloads WordPress store
View edd_best_sales_day.sql
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 Jun 24, 2020
Add this to the wp-content/mu-plugins directory (create if doesn't exist)
View igp_post_title.php
<?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 Jun 18, 2020
Intagrate - Ensure hashtags are stripped from the caption
View igp_fix_tags_caption.php
<?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();