Skip to content

Instantly share code, notes, and snippets.

@igorbenic
igorbenic / live.php
Created November 23, 2022 22:17
A simple shortcode to display results from World Cup 2022 using api-football.com APIs
<?php
/**
* Plugin Name: Live API
*/
add_action( 'init', function(){
add_shortcode( 'live_api', 'live_api_shortcode' );
});
function live_api_shortcode() {
/* To disable the Gutenberg’s CSS loading on the front-end */
function tw_unload_files() {
wp_dequeue_style ( 'wp-block-library' );
wp_dequeue_style ( 'wp-block-library-theme' );
}
add_action( 'wp_enqueue_scripts', 'tw_unload_files', 100 );
/* To disable Elementor’s Google font */
@nathaningram
nathaningram / cfcore.php
Last active October 25, 2024 03:59
Creating a Starter Site - Custom Functions - Core
<?php
/*
Plugin Name: Custom Core Functions
Plugin URI: https://nathaningram.com
Description: Customize the WP Core
Version: 2023.11
Author: Nathan Ingram
Author URI: https://nathaningram.com
License: GPL2
*/
@esedic
esedic / import-optimizations.md
Created October 26, 2022 14:38 — forked from trey8611/import-optimizations.md
WP All Import - Optimize your import speed.
@pacotole
pacotole / creame-optimize.php
Last active October 31, 2024 21:15
WordPress must-use plugin with site optimizations
<?php
/*
Plugin Name: Creame Optimize
Plugin URI: https://crea.me/
Description: Optimizaciones de Creame para mejorar tu <em>site</em>.
Version: 2.1.5
Author: Creame
Author URI: https://crea.me/
License: MIT License
*/
@jazzsequence
jazzsequence / loader.php
Created October 5, 2022 20:44
MU Plugin Loader
<?php
/**
* Plugin Name: Pantheon MU Plugin Loader
* Description: Loads the MU plugins required to run the site
* Author: Pantheon Systems
* Author URI: https://pantheon.io
* Version: 1.0
*/
if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) {
@trey8611
trey8611 / remove-image-sizes-from-url.md
Last active April 17, 2024 17:24
Remove image sizes from image URLs in content

Remove -000x000.ext from image URLs in content by passing the content to a custom PHP function:

[my_fix_images({content[1]})]

Code (save in the Function Editor at All Import › Settings):

function my_fix_img( $img = '' ) {
@ArtemFokin
ArtemFokin / curves-tilda-analytics.js
Last active April 7, 2024 22:24
Handle clicks on element and forms and send analytics events to GA and YA
var gaFbAnalyticsFrameQueue = [];
var frameIsReady = false;
var YA_ID = "00000";
var yaDisableGDPR = 1;
var FORM_SUCCESS_CB_DATA_ATTRIBUTE = "successCallback"; //camel-case(in html it's cebab-case, exp in html data-success-callback -> successCallback)
//Edit only this array for add new events triggers, you can skip ya_goal or ga_event(or both)
var clickGoals = [
{
tilda_event_url: "/tilda/click/rec483475555/button1641908411542",
@ujjawalsidhpura
ujjawalsidhpura / enable-ga-tracking-using-gtag.html
Last active October 9, 2024 10:09
web-vitals-tracking-code
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_TRACKING_ID');
</script>
@LeMiira
LeMiira / google-detect.php
Created July 21, 2022 10:55
Detect Google Bots
<?php
$remote_add=$_SERVER['REMOTE_ADDR'];
$hostname = gethostbyaddr($remote_add);
$googlebot = 'googlebot.com';
$google = 'google.com';
if (stripos(strrev($hostname), strrev($googlebot)) === 0 or stripos(strrev($hostname),strrev($google)) === 0 )
{
//add your code
}
?>