Skip to content

Instantly share code, notes, and snippets.

View sixtyseven-multimedia's full-sized avatar

André sixtyseven-multimedia

View GitHub Profile
@jakebellacera
jakebellacera / ICS.php
Last active February 21, 2025 15:25
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@jcanfield
jcanfield / wp-modifydb.php
Created March 29, 2012 17:06
Serialized PHP Search and Replace
<?php
/**
*
* Safe Search and Replace on Database with Serialized Data v2.0.1
*
* This script is to solve the problem of doing database search and replace when
* developers have only gone and used the non-relational concept of serializing
* PHP arrays into single database columns. It will search for all matching
* data on the database and change it, even if it's within a serialized PHP
* array.
@iamntz
iamntz / select.php
Created April 9, 2012 12:02
country selector for wp-contact form 7
<?php
/**
** A base module for [select] and [select*]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'select', 'wpcf7_select_shortcode_handler', true );
wpcf7_add_shortcode( 'select*', 'wpcf7_select_shortcode_handler', true );
@wpscholar
wpscholar / functions.php
Last active October 20, 2024 14:01
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
@nciske
nciske / add_screenshot_as_ogimage.php
Last active January 19, 2021 02:36
Add screenshot of current page as Open Graph image. Primes the wp.com cache by including the image at the bottom of the page as well.
<?php
add_action( 'wp_head', 'add_screenshot_as_ogimage' );
function add_screenshot_as_ogimage(){
// default width = 1500 -- 200px minimum, Facebook recommends 1500x1500, max image size of 5mb
echo '<meta property="og:image" content="http://s.wordpress.com/mshots/v1/'.urlencode( $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] ).'?w=1500"/>';
@morales2k
morales2k / jquery-sidr.js
Created July 8, 2014 17:31
The jquery-sidr fix that made it work for me in all browsers. Try it out and see if it helps!
/*
* Sidr
* https://github.com/artberri/sidr
*
* Copyright (c) 2013 Alberto Varela
* Licensed under the MIT license.
*/
;(function( $ ){
@mcguffin
mcguffin / acf-get-field-key.php
Last active June 13, 2023 13:32
WordPress Advanced Custom Fields get field key from field name
<?php
/**
* Get field key for field name.
* Will return first matched acf field key for a give field name.
*
* ACF somehow requires a field key, where a sane developer would prefer a human readable field name.
* http://www.advancedcustomfields.com/resources/update_field/#field_key-vs%20field_name
*
* This function will return the field_key of a certain field.
@seoagentur-hamburg
seoagentur-hamburg / .htaccess
Last active January 30, 2023 10:58
Die optimale .htaccess-Datei für mehr Speed und Sicherheit
# ----------------------------------------------------------------------
# | Komprimierung und Caching |
# ----------------------------------------------------------------------
# Serve resources with far-future expires headers.
#
# (!) If you don't control versioning with filename-based
# cache busting, you should consider lowering the cache times
# to something like one week.
#
@shizhua
shizhua / ajax.js
Last active April 27, 2017 04:59
Frontend Image Uploader in WordPress
( function( $ ) {
$('#upload_form').on('submit', function(e){
e.preventDefault();
var $this = $(this),
nonce = $this.find('#image_upload_nonce').val(),
images_wrap = $('#images_wrap'),
status = $('#status'),
formdata = false;
if ( $this.find('#images').val() == '' ) {
@iamphilrae
iamphilrae / phpMyAdmin Export Filename Template, Including Date and Time
Last active January 10, 2025 02:50
phpMyAdmin Export Filename Template, Including Date and Time
@DATABASE@__%Y-%m-%d_%H-%M-%S