Skip to content

Instantly share code, notes, and snippets.

Alain Schlesser schlessera

Block or report user

Report or block schlessera

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@schlessera
schlessera / Controller.php
Last active May 29, 2016
Example of bootstrapping a WordPress plugin.
View Controller.php
<?php
// file: src/Controller.php
/**
* Example Plugin Controller.
*/
namespace Example\Plugin;
use BrightNucleus\Config\ConfigInterface;
@schlessera
schlessera / README.md
Created Mar 10, 2016
Accessing WP plugin code from a theme
View README.md
@schlessera
schlessera / example-plugin.php
Created Mar 10, 2016
Accessing WP plugin code from a theme
View example-plugin.php
<?php
/**
* Example plugin.
*
* @see http://wordpress.stackexchange.com/questions/220286/what-is-the-best-way-to-instantiate-a-class-of-a-plugin-in-your-wordpress-theme/
*
* @wordpress-plugin
* Plugin Name: Example plugin.
* Description: Accessing a plugin object from a theme.
* Version: 0.1.0
@schlessera
schlessera / phpfeature-example.php
Created Jan 14, 2016
PHPFeature Example Usage Code.
View phpfeature-example.php
<?php
/*
* PHPFeature example usage code
*/
// Array of strings to define what features you need.
$features = array( 'namespaces', 'traits' );
// Instantiate the PHPFeature library.
// When you don't provide a version number as the first argument,
@schlessera
schlessera / OrderedInvoke.php
Last active Sep 7, 2015
Simple WordPress Settings API class example.
View OrderedInvoke.php
<?php
/**
* OrderedInvokeTrait
*
* @package BrightNucleus_Core
* @author Alain Schlesser <alain.schlesser@gmail.com>
* @license GPL-2.0+
* @link http://www.brightnucleus.com/
* @copyright 2015 Alain Schlesser, Bright Nucleus
*/
@schlessera
schlessera / responsive-iframe.css
Last active Aug 29, 2015
Make an IFrame (like video, flash, ...) responsive.
View responsive-iframe.css
/* Responsive IFrame example
* @author Alain Schlesser <alain.schlesser@gmail.com>
/* The wrapper gets resized using padding-bottom with a percentage value. This
* way, it's height is always directly dependent on its width */
.iframe-wrapper {
/* Necessary so we can position the contained IFrame absolutely */
position: relative;
@schlessera
schlessera / _reflowing-columns.scss
Created Apr 23, 2015
Reflowing columns (CSS Multi-column)
View _reflowing-columns.scss
/**
* Reflowing columns (CSS Multi-column)
*
* This defines reflowing columns in CSS. Simply apply the class with the number
* of columns you need, like .reflow-3 . The number of columns wil be reduced if
* the individual columns go below $min-column-width.
*
* IE10+ only, all but Firefox have trouble displaying <li>s inside the columns.
*
* @author Alain Schlesser <alain.schlesser@gmail.com>
@schlessera
schlessera / adjust-svg-size.php
Last active Aug 29, 2015
Adjust the HTML that WordPress generates for SVG so they are resized to fit their container
View adjust-svg-size.php
<?php
/**
* Replace WordPress standard SVG width of 1 with 100%
* @author Alain Schlesser (alain.schlesser@gmail.com)
*
* By default, WordPress renders all SVG files uploaded through the Media
* Uploader with both width and height at "1".
*
* @param string $output HTML output that Genesis has generated for a
@schlessera
schlessera / postpone-genesis-stylesheet.php
Last active Aug 29, 2015
Postpone loading of Genesis Stylesheet so that it trumps the CSS of plugins
View postpone-genesis-stylesheet.php
<?php
/**
* Move Genesis child theme style sheet to a much later priority to give any plugins a chance to load first.
* @author Alain Schlesser (alain.schlesser@gmail.com)
*
* @see http://docs.garyjones.co.uk/genesis/2.0.0/function-genesis_load_stylesheet.html
*/
function as_postpone_genesis_stylesheet() {
@schlessera
schlessera / add-svg-upload.php
Last active Aug 29, 2015
Enable SVG file upload through WordPress Media Uploader
View add-svg-upload.php
<?php
/**
* Add the SVG Mime type to the uploader
* @author Alain Schlesser (alain.schlesser@gmail.com)
*
* @param array $mimes list of mime types that are allowed by the
* WordPress uploader
* @return array modified version of the $mimes array
*
You can’t perform that action at this time.