Skip to content

Instantly share code, notes, and snippets.

Thierry Pigot thierrypigot

Block or report user

Report or block thierrypigot

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
@Rahe
Rahe / class-terms-fields.php
Last active Jan 30, 2018
Load all ACF terms Fields into the term object
View class-terms-fields.php
<?php
/**
* Class ACF_Terms_Fields
* @version 1.1.0
*
* Fill all the taxonomy terms with ACF metas
*/
class ACF_Terms_Fields {
/**
@jmau111
jmau111 / rwd-youtube-wp.php
Created Feb 21, 2015
Wrapper for YouTube iFrame in WordPress
View rwd-youtube-wp.php
<?php
/**
* @link https://developer.wordpress.org/reference/hooks/oembed_dataparse/
* @author Julien Maury
*/
add_filter( 'oembed_dataparse', '_rwd_oembed_dataparse', 10, 3 );
function _rwd_oembed_dataparse( $return, $data, $url ){
if ( 'YouTube' === $data->provider_name ) {
return '<div class="iframe-container ">' . $return . '</div>';
}
@jmau111
jmau111 / is-active-widget.php
Last active Oct 6, 2015
If WP widget is active :
View is-active-widget.php
<?php
/*
* @link http://codex.wordpress.org/Function_Reference/is_active_widget
* In my class (the class that extends WP_Widget)
*/
class My_Widget extends WP_Widget(){
public function __construct(){
/* some code blabla
@Rarst
Rarst / WordPress.xml
Last active Jun 7, 2019
WordPress Live Templates for PhpStorm
View WordPress.xml
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="WordPress">
<template name="aa" value="add_action( '$hook$', '$callback$' );&#10;$END$" description="add_action" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="callback" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
@eltonmesquita
eltonmesquita / onViewport.js
Last active Sep 6, 2019
A simple jQuery function that adds a class when the target(s) is in the viewport
View onViewport.js
function onViewport(el, elClass, offset, callback) {
/*** Based on http://ejohn.org/blog/learning-from-twitter/ ***/
var didScroll = false;
var this_top;
var height;
var top;
if(!offset) { var offset = 0; }
$(window).scroll(function() {
View gist:1207324668fc59255dee
add_action( 'wp_footer', 'infinite_load' );
function infinite_load() {
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
?>
<script>
jQuery(document).ready(function($){
if( window.history && history.pushState ) {
var $page = <?php echo $paged; ?>;
@Ciantic
Ciantic / gist:8a09107fcd9bed8bede0
Created Jun 24, 2014
WordPress select and checkboxes metabox callback
View gist:8a09107fcd9bed8bede0
<?php
/**
* Show taxonomy selection in WordPress admin as single <select> box or checkboxes
*
* @author Jari Pennanen / https://github.com/ciantic
* @license Public Domain
**/
// Usage example:
register_taxonomy("my_taxonomy", array("post"), array(
@herewithme
herewithme / bea-acf-helpers.php
Created Dec 3, 2013
Small class helper for get ACF fields for a specific post type
View bea-acf-helpers.php
<?php
class BEA_ACF_Helpers {
// Fields to not add to the available fields of acf
private static $unauth_fields = array(
'repeater',
'relationship',
'flexible_content'
);
/**
You can’t perform that action at this time.