Skip to content

Instantly share code, notes, and snippets.

View cristianraiber's full-sized avatar
🏠
Working from home

Raiber Cristian cristianraiber

🏠
Working from home
View GitHub Profile
@cristianraiber
cristianraiber / htaccess-deflate-example
Created January 5, 2023 11:09
htaccess deflate module
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/xhtml+xml
application/xml
@cristianraiber
cristianraiber / attached_pdf_to_downloadable_file.php
Created October 6, 2022 13:20 — forked from saqibsarwar/attached_pdf_to_downloadable_file.php
Download Monitor and WP ALL Import - Attach PDF files to download CPT to make them downloadable.
<?php
// Start preparing an array to insert Download Monitor's Download Version (which is a CPT with Download as parent post).
$dlm_download_version = array(
'post_title' => 'Download #' . $download_id . ' File Version',
'post_type' => 'dlm_download_version',
'post_status' => 'publish',
'post_parent' => $download_id,
'post_author' => $attachment->post_author,
);
@cristianraiber
cristianraiber / canceled-subscriptions.sql
Created October 4, 2022 13:15 — forked from webzunft/canceled-subscriptions.sql
SQL queries to analyse canceled subscriptions managed with EDD Recurring Payments
# Basic queries to analyse canceled subscriptions using EDD Recurring Payments pre EDD 3.0
# Use EXPLAIN if you have large stores since the "notes" column is not indexed and queries can take some time
# Some of these reports might be worth storing as Views and look at the graphs PHPMyAdmin can also create from them
# List subscription cancelation with creation and cancelation date, as well as the user who canceled
# good as a basis for further queries
SELECT ID,
created,
REGEXP_SUBSTR( REGEXP_SUBSTR( notes, '.* Status changed from active to cancelled .*' ), '^[a-z]+ [0-9]+, [0-9]+' ) AS 'date',
@cristianraiber
cristianraiber / DownloadStats.php
Created April 3, 2021 18:13 — forked from fredbradley/DownloadStats.php
Dashboard Widget showing Download Stats for all Download Monitor Downloads in Wordpress
<?php
/**
* Created by PhpStorm.
* User: fredbradley
* Date: 05/10/2017
* Time: 11:43
*/
namespace FredBradley\CranleighWPAdmin;
@cristianraiber
cristianraiber / kb-support-ninja-forms.php
Created March 11, 2021 08:48
KB Support + Ninja forms
<?php
/**
* Plugin Name: KB Support - Ninja Forms
* Plugin URI: https://kb-support.com/
* Description: Custom KBS functions for Ninja Forms
* Version: 1.0
* Date: 17th December 2019
* Author: KB Support <contact@kb-support.com>
* Author URI: http://kb-support.com
* Text Domain: kbs-ninja
@cristianraiber
cristianraiber / functions.php
Created January 18, 2021 08:15
Modula Whitelabel Config
/*
* The code below should be placed in your functions.php file, inside your (currently) active theme.
**/
/*
* The filter we use to provide Modula with our custom config aka the values we want to overwrite in Modula's backend.
* Note: the second parameter in add_filter has to be the same as the function name - as provided in the exampel below.
* To learn more about filters, visit this link: https://developer.wordpress.org/reference/functions/add_filter/
**/
add_filter( 'modula_whitelabel_config', 'whitelabel_advanced_config' );
@cristianraiber
cristianraiber / hide_modula_license.php
Created May 28, 2019 13:22
Hide Modula's license key menu entry AFTER entering the license key
add_filter( 'modula_admin_page_tabs', 'remove_license_tab', 99 );
function remove_license_tab( $tabs ){
unset( $tabs['licenses'] );
return $tabs;
}
@cristianraiber
cristianraiber / plugin-headers.php
Last active February 15, 2022 12:25
proper-plugin-headers
<?php
/**
* Plugin Name: {Plugin_Name}
* Plugin URI: https://www.siteurl.com
* Description: {Short Description Message Goes here}
* Version: 1.0.0
* Author: WPChill
* Author URI: https://wpchill.com
* License: GPLv3 or Later
*
@cristianraiber
cristianraiber / edd-pdf-invoices-vat.php
Created December 24, 2018 13:26
EDD PDF VAT info + more
if ( ! function_exists( 'mt_pdf_template_extra_fields' ) ) {
/**
* Implements filter: eddpdfi_pdf_template_extra_fields
*
* Adds extra information to the PDF document. The VAT PDF template was created from
* the 'blue' template of the PDF Invoices plugin. It did not include address information
* and different countries have different requirements for addressing. So filter shows
* how basic buyer address information and their IP address can be added to the invoice.
*
* The PDF plug-in uses some arbitrary units of measurement and each line in the template
<?php
/**
* Template part for displaying a frontpage section
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Portum
*/
$frontpage = Epsilon_Page_Generator::get_instance( 'portum_frontpage_sections_' . get_the_ID(), get_the_ID() );