Skip to content

Instantly share code, notes, and snippets.

View davideleuterius's full-sized avatar

David Eleuterius davideleuterius

View GitHub Profile
@davideleuterius
davideleuterius / wordpress-import-update.php
Created December 9, 2019 16:07 — forked from ssuess/wordpress-import-update.php
Force the WordPress importer to update existing posts instead of skipping them
<?php
/**
* When using the WordPress Importer, update existing
* posts instead of skipping them. Updates content according
* to the import file even if the existing post was updated
* more recently.
*
* To use, drop this file into your /mu-plugins/ folder or
* copy this code into your functions.php file.
@davideleuterius
davideleuterius / auto_expire_posts.php
Created September 26, 2017 14:28
auto expiring WordPress posts by custom timestamp (unix)
define( 'EV_POST_TYPE', 'event' );
define( 'EV_DATE_FIELD', 'event_start_date' );
define( 'EV_TIMESTAMP', 'event_timestamp' );
// save start date as unix timestamp
function custom_timestamp ( $post_id ) {
$ev_post_type = 'event';
$ev_date_field = 'event_start_date';
$ev_timestamp = 'event_timestamp';
@davideleuterius
davideleuterius / auto_set_featured_image.php
Created September 21, 2017 13:58
mass set featured image
@davideleuterius
davideleuterius / swap.js
Created September 1, 2017 18:41
swap WordPress template partial by screen size / media query
(function ($, window, document, undefined) {
"use strict";
$(function() {
var swapContent = debounce(function() {
var currentSize = $(window).width();
var swapPath = '/wp-content/themes/twentyseventeen/template-parts/';
@davideleuterius
davideleuterius / reorder-options.js
Created August 27, 2017 20:22
jQuery reorder options
$( '#select > option[value="value"]' ).insertAfter( $('#select > option').eq(0) );