Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View schlessera's full-sized avatar

Alain Schlesser schlessera

View GitHub Profile
@schlessera
schlessera / modify-stylesheet-location.php
Last active August 29, 2015 14:18
Modify location of main stylesheet
<?php
/**
* Modify location of main stylesheet
* N.B.: style.css in the theme's root is still needed to provide WordPress
* with the necessary metadata about the theme
* @author Alain Schlesser (alain.schlesser@gmail.com)
*
* @param string $stylesheet_uri Stylesheet URI for the current theme/
* child theme
@schlessera
schlessera / shortcode-copyright.php
Created April 4, 2015 20:03
Shortcode to display copyright notice with current year
@schlessera
schlessera / postpone-genesis-stylesheet.php
Last active August 29, 2015 14:18
Postpone loading of Genesis Stylesheet so that it trumps the CSS of plugins
<?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 / adjust-svg-size.php
Last active August 29, 2015 14:18
Adjust the HTML that WordPress generates for SVG so they are resized to fit their container
<?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 / add-svg-upload.php
Last active August 29, 2015 14:18
Enable SVG file upload through WordPress Media Uploader
<?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
*
@schlessera
schlessera / modify-search-genesis.php
Last active August 29, 2015 14:12
Add one or more classes to the Genesis search form's 'Submit' button
<?php
/**
* Add one or more classes to the Genesis search form's 'Submit' button
* @author Alain Schlesser (alain.schlesser@gmail.com)
* @link http://www.brightnucleus.com/add-class-wordpress-search-button/
*
* @param string $form the search form HTML output
* @param string $search_text text inside the search text entry box
* @param string $button_text caption of the search button
@schlessera
schlessera / modify-search.php
Last active August 29, 2015 14:12
Add one or more classes to the WordPress search form's 'Search' button
<?php
/**
* Add one or more classes to the WordPress search form's 'Search' button
* @author Alain Schlesser (alain.schlesser@gmail.com)
* @link http://www.brightnucleus.com/add-class-wordpress-search-button/
*
* @param string $form the search form HTML output
* @return string modified version of the search form HTML output
*
@schlessera
schlessera / modify-comments.php
Last active August 29, 2015 14:12
Add one or more classes to the WordPress comment form's 'Submit' button
<?php
/**
* Add one or more classes to the WordPress comment form's 'Submit' button
* NB: This only works as of WordPress 4.1
* @author Alain Schlesser (alain.schlesser@gmail.com)
* @link http://www.brightnucleus.com/add-class-wordpress-comment-submit-button/
*
* @param array $arg contains all the default values used by the comment form
* @return array modified array that goes back to the comment renderer