Skip to content

Instantly share code, notes, and snippets.

View ms-studio's full-sized avatar

Manuel Schmalstieg ms-studio

View GitHub Profile
@ms-studio
ms-studio / wp-gallery-shortcode-override.php
Last active April 17, 2019 14:13
an override of the default WP gallery shortcote
@ms-studio
ms-studio / gist:8027e39efe1c1a891419cc635220d0d4
Created January 8, 2019 13:38 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@ms-studio
ms-studio / form_name_shortcode.php
Last active October 7, 2018 17:15
Shortcode for the Formidable WordPress plugin, that returns the name of the current form (based on the entry ID).
<?php
/*
* Form Name Shortcode
* For usage in confirmation email
* Returns name of current form
* Use the shortcode like this: [frm-form-name id=[id]]
* The [id] parameter will produce the ID of current entry
* See https://formidableforms.com/help-desk/using-form_name-shortcode-in-email-notification/
*/
@ms-studio
ms-studio / casper-download-loop.js
Created March 2, 2015 09:40
CasperJS script for downloading sequential PDFs from a login-protected website
var casper = require('casper').create({
pageSettings: {
webSecurityEnabled: false
}
});
casper.start();
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)');
<?php
/*
Plugin Name: MEM Category Order
Plugin URI: https://gist.github.com/
Description: Functionality plugin for https://wordpress.org/support/topic/ordering-post/.
Version: 0.1
Author: Manuel Schmalstieg
Author URI: https://ms-studio.net
*/
@ms-studio
ms-studio / WP YouTube Video EMbed Override
Created April 30, 2018 08:31 — forked from gabrielmerovingi/WP YouTube Video EMbed Override
Override the default WordPress oEmbed for YouTube Videos to always use the myCRED Video Shortcode.
/**
* Override WP oEmbed
* @version 1.0
*/
add_filter( 'embed_oembed_html', 'mycred_override_video_shortcode', 999, 4 );
function mycred_override_video_shortcode( $original, $url, $attr, $post_ID ) {
// If myCRED is not enabled
if ( ! function_exists( 'mycred_render_shortcode_video' ) ) return $original;
// Get cache
@ms-studio
ms-studio / vimeo-responsive-embed.js
Created December 11, 2017 21:13
vimeo-responsive-embed.js
$(".entry-content > p > iframe").each(function() {
var $this = $(this);
// donner classe video-gallery-item au parent
$this.parent().addClass('video-gallery-item');
// corriger le ratio
var videoWidth = $this.attr('width');
var videoHeight = $this.attr('height');
var videoRatio = 100*(videoHeight / videoWidth);
$this.parent().css( "padding-bottom", videoRatio+"%" );
});
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@ms-studio
ms-studio / improve-slideshare-embed.js
Created December 11, 2017 21:51
Improve Slideshare embedding - Make that iframe exactly the right size!
/*
* Improve Slideshare embedding
* Make that iframe exactly the right size!
*/
$(".entry-content p iframe[src*='https://www.slideshare']").each(function() {
var $this = $(this);
var slideW = $this.attr('width');
var slideH = $this.attr('height');
@ms-studio
ms-studio / tablepress-example.html
Created November 9, 2017 19:14
tablepress example
<script>
jQuery(document).ready(function($){
$.tablesorter.themes.bootstrap = {
// these classes are added to the table. To see other table classes available,
// look here: http://getbootstrap.com/css/#tables
table : 'table table-bordered table-striped',
caption : 'caption',
// header class names