Skip to content

Instantly share code, notes, and snippets.

@isotrope
isotrope / shortcodes.php
Created June 11, 2018 20:40 — forked from gyrus/shortcodes.php
TinyMCE button for WordPress shortcode
<?php
/**
* Skeletal sample shortcode
*/
add_shortcode( 'pilau-sample', 'pilau_sample_shortcode' );
function pilau_sample_shortcode( $atts ) {
extract( shortcode_atts( array(
'text' => ''
), $atts ) );
@isotrope
isotrope / 0_reuse_code.js
Created June 12, 2017 13:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
// based on https://gist.github.com/lucasstark/dbba39215b862b446f0e
//this is very rough, but it works.
//add this to your functions file and navigate to your site http://yoururl.com/?dump-acf=1 then look in your footer area.
add_action( 'wp_footer', 'after_the_fact_documentation' );
function after_the_fact_documentation() {
if ( isset( $_GET['dump-acf'] ) ) {
$groups = acf_get_field_groups();
$object_types = array();
@isotrope
isotrope / iso-get-resized-attachment-src.php
Last active August 29, 2015 14:14 — forked from kovshenin/image-shortcode.php
Force resizes and caches images without needing to add_image_size() and bloat the /upoads/ dir
<?php
/**
* Force resizes and caches images without needing to add_image_size() and bloat the /upoads/ dir
*
* Most code is completely based on Konstantin Kovshenin's image-shortcode.php
* https://gist.github.com/kovshenin/1984363
*
* Expects the params similar to wp_get_attachment_image_src()
* http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src
*
<?php
/**
* Includes a few useful predicates in the bootstrapped `infiniteScroll` JS object
* that is served along with the rest of the document upon initial page request.
*/
add_filter( 'infinite_scroll_js_settings', 'pla_extra_js_settings' );
function pla_extra_js_settings( $js_settings ) {
$js_settings['text'] = __( "Plus de contenus", "pla" );