Skip to content

Instantly share code, notes, and snippets.

Avatar

David Eleuterius davideleuterius

View GitHub Profile
@davideleuterius
davideleuterius / wordpress-import-update.php
Created Dec 9, 2019 — forked from ssuess/wordpress-import-update.php
Force the WordPress importer to update existing posts instead of skipping them
View wordpress-import-update.php
<?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 Sep 26, 2017
auto expiring WordPress posts by custom timestamp (unix)
View auto_expire_posts.php
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';
View auto_set_featured_image.php
@davideleuterius
davideleuterius / swap.js
Created Sep 1, 2017
swap WordPress template partial by screen size / media query
View swap.js
(function ($, window, document, undefined) {
"use strict";
$(function() {
var swapContent = debounce(function() {
var currentSize = $(window).width();
var swapPath = '/wp-content/themes/twentyseventeen/template-parts/';
View reorder-options.js
$( '#select > option[value="value"]' ).insertAfter( $('#select > option').eq(0) );