Skip to content

Instantly share code, notes, and snippets.

View ThierryA's full-sized avatar

Thierry Muller ThierryA

View GitHub Profile
anonymous
@ThierryA
ThierryA / functions.php
Last active August 17, 2016 21:04
PHP: simply get array values.
<?php
/**
* Get value from $_GET or defined $haystack.
*
* @since 1.0.0
*
* @param string $needle Name of the searched key.
* @param string $haystack Optional. Associative array. If false, $_GET is set to be the $haystack.
* @param mixed $default Optional. Value returned if the searched key isn't found.
@ThierryA
ThierryA / functions.php
Created January 18, 2016 11:23
Beans: remove post more link #more-{id} anchor.
<?php
// Do not include the opening php tag if it is already included in your file.
add_filter( 'beans_post_more_link_attributes', 'beans_child_post_more_link_attributes' );
function beans_child_post_more_link_attributes( $attributes ) {
$attributes['href'] = esc_url( get_permalink() );
return $attributes;
@ThierryA
ThierryA / functions.php
Created January 15, 2016 06:14
Beans: enqueue UIkit Slider components.
<?php
// Do not include the opening php tag if it is already included in your file.
add_action( 'beans_uikit_enqueue_scripts', 'beans_child_enqueue_uikit_components' );
function beans_child_enqueue_uikit_components() {
// Components advised for the slider to work smoothly depending on your needs.
// Uncomment slideshow-fx if fancy animations are used.
beans_uikit_enqueue_components( array( 'animation', 'flex' ) );
@ThierryA
ThierryA / functions.php
Last active October 5, 2016 21:33
Beans: split post image/content in two columns.
<?php
// Do not include the opening php tag if it is already included in your file.
add_action( 'wp', 'beans_child_setup_document' );
function beans_child_setup_document() {
// Only apply to non-singular layouts.
if ( !is_singular() ) {
@ThierryA
ThierryA / functions.js
Created December 23, 2015 13:04
jQuery: call after CSS transition.
(function ($) {
"use strict";
function afterTransition( element, callback ) {
var transitions = [0];
// Check if the transition has a duration.
element.each( function() {
@ThierryA
ThierryA / functions.js
Created December 23, 2015 13:02
jQuery: is visible on screen.
(function ($) {
"use strict";
function isSceenVisible( element ) {
var $el = $( element );
// Stop here if the element isn't visible.
if ( !$el.is( ':visible' ) || '0' == $el.css( 'opacity' ) )
@ThierryA
ThierryA / functions.php
Created December 2, 2015 12:36
Beans: change UIkit style to gradient.
<?php
// Do not include the opening php tag if it is already included in your file.
add_action( 'beans_uikit_enqueue_scripts', 'beans_child_uikit_themes', 4 );
function beans_child_uikit_themes() {
// Remove default style for performance purposes.
beans_uikit_dequeue_theme( 'default' );
@ThierryA
ThierryA / functions.php
Last active March 23, 2016 07:27
Beans: display posts in a responsive grid.
<?php
// Do not include the opening php tag if it is already included in your file.
// Display posts in a responsive grid.
add_action( 'wp', 'beans_child_posts_grid' );
function beans_child_posts_grid() {
// Stop here if we are on a singular view.
if ( is_singular() )
@ThierryA
ThierryA / functions.php
Last active November 25, 2015 06:00
Beans: sticky primary sidebar.
<?php
// Do not include the opening php tag if it is already included in your file.
add_action( 'beans_uikit_enqueue_scripts', 'beans_child_uikit_enqueue_scripts' );
function beans_child_uikit_enqueue_scripts() {
beans_uikit_enqueue_components( array( 'sticky' ), 'add-ons' );
}