Skip to content

Instantly share code, notes, and snippets.

@blha303
blha303 / wp-sitemap.php
Created July 24, 2019 01:09
Generates a sitemap.xml from Wordpress
<?php
include( './wp-load.php' );
header("Content-Type: application/xml");
?>
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <?php
foreach(get_pages() as $page) { ?>
<url>
<loc><?php echo get_page_link( $page->ID ); ?></loc>
<lastmod><?php echo date("Y-m-d", strtotime($page->post_modified)); ?></lastmod>
/**
@ Remove WP Cruft
*/
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'template_redirect', 'rest_output_link_header' );
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'index_rel_link' );
@spivurno
spivurno / gw-gravity-forms-checkbox-count.php
Last active April 20, 2024 21:21
Gravity Wiz // Gravity Forms // Checkbox Count
<?php
/**
* --------------------------------------------------------------------------
* IMPORTANT!
* This snippet has been superceded by the Choice Counter snippet.
* https://gist.github.com/spivurno/00af5ee7e21dd5d6903fbae6fecd85ce
* --------------------------------------------------------------------------
*
* Gravity Wiz // Gravity Forms // Checkbox Count
*
@kidGodzilla
kidGodzilla / mailthisto-ajax-example.js
Last active April 26, 2023 19:57
MailThis.to Ajax Example
// The following example POSTS data to mailthis.to, redirects the user to a confirmation page, and then sends an email (upon the successful completion of Recaptcha verification)
$.post('https://mailthis.to/[email protected]', {
email: '[email protected]',
_subject: 'hi!',
message: 'Test'
}).then(function () {
location.href = 'https://mailthis.to/confirm'
});
@butlerblog
butlerblog / functions.php
Last active September 24, 2024 21:50
SMTP using wp-config.php for settings #smtp #wp_mail
<?php // Don't use this line.
/*
* Add the script below to wherever you store custom code snippets
* in your site, whether that's your child theme's functions.php,
* a custom plugin file, or through a code snippet plugin.
*/
/**
* This function will connect wp_mail to your authenticated
@srikat
srikat / functions.php
Last active October 30, 2022 06:35
Playing a sound on hover/click of an element in WordPress. http://sridharkatakam.com/play-sound-hoverclick-element-wordpress/
<?php
//* Do NOT include the opening php tag
//* Enqueue audio script
add_action( 'wp_enqueue_scripts', 'enqueue_audio_on_menu_items_click' );
function enqueue_audio_on_menu_items_click() {
wp_enqueue_script( 'load-audio', get_stylesheet_directory_uri() . '/js/load-audio.js', array( 'jquery' ), '', true );
}
@yanatan16
yanatan16 / A-Pen-by-Jon-Eisen.markdown
Last active June 15, 2019 02:17
Spotlight and shadow effects in all css/javascript.
@prime31
prime31 / gist:5675017
Last active June 2, 2025 06:29
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@spencejs
spencejs / Featured Image Instructions
Created March 22, 2013 03:35
Add Instruction Text To Featured Image Box In Wordpress Admin