Skip to content

Instantly share code, notes, and snippets.

View andreiglingeanu's full-sized avatar

Andrei Glingeanu andreiglingeanu

View GitHub Profile
@andreiglingeanu
andreiglingeanu / freemius-api-license-validation.php
Created October 2, 2024 11:04 — forked from vovafeldman/freemius-api-license-validation.php
Validates a license key using Freemius API using the PHP SDK
<?php
// Freemius PHP SDK - https://github.com/Freemius/freemius-php-sdk
require_once './php-sdk-master/freemius/Freemius.php';
define( 'FS__API_SCOPE', 'developer' );
define( 'FS__API_DEV_ID', 1234 );
define( 'FS__API_PUBLIC_KEY', 'pk_YOUR_PUBLIC_KEY' );
define( 'FS__API_SECRET_KEY', 'sk_YOUR_SECRET_KEY' );
// Init SDK.
@andreiglingeanu
andreiglingeanu / gist:eea0846aaf889e82a17402c5fade17b3
Created September 18, 2024 10:06 — forked from yunusga/gist:33cf0ba9e311e12df4046722e93d4123
Debug WordPress 404 issues (permalinks, rewrite rules, etc.)
/* Produces a dump on the state of WordPress when a not found error occurs */
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
echo '<pre>';
add_action( 'parse_request', 'debug_404_rewrite_dump' );
function debug_404_rewrite_dump( &$wp ) {
<?php
add_filter(
'blocksy:woocommerce:product-card:thumbnail:ratio',
function ($ratio) {
// Please change this
$my_page_id = 123;
if (is_page($my_page_id)) {
// Your custom ratio
<?php
add_filter(
'blocksy:general:blocks:query:args',
function ($query_args, $attributes) {
if (
isset($attributes['uniqueId'])
&&
$attributes['uniqueId'] === '9afc2324'
) {
<?php
add_filter(
'blocksy:pro:content-blocks:condition-match',
function ($matches, $content_block_id) {
if ($content_block_id === 15054) {
$resume_id = get_queried_object_id();
if (! resume_manager_user_can_view_resume($resume_id)) {
<?php
add_action(
'init',
function () {
global $wpdb;
$wpdb->query(
"
DELETE
<?php
if (! function_exists('write_log')) {
function write_log($log) {
if (is_array($log) || is_object($log)) {
error_log(print_r($log, true));
} else {
error_log($log);
}
}
<?php
add_filter(
'rest_post_search_query',
function ($args) {
$args['post_type'] = array_diff(
$args['post_type'],
['ct_content_block']
);
<?php
add_filter(
'blocksy:pro:custom-post-type:output-content',
function ($content, $id) {
$BLOCKSY_THANK_YOU_PAGE_ID = 2478;
if ($id !== $BLOCKSY_THANK_YOU_PAGE_ID) {
return $content;
}
<?php
add_filter(
'blocksy:pro:woocommerce-extra:swatches:has-single-product-swatches',
function ($has_single_product_swatches) {
global $product;
if (has_term(array('sneakers'), 'product_cat', $product->get_id())) {
return false;
}