Skip to content

Instantly share code, notes, and snippets.

View owldesign's full-sized avatar
🔥
making stuff

Vadim Goncharov owldesign

🔥
making stuff
View GitHub Profile
function wp_api_encode_acf($data,$post,$context){
$data['meta'] = array_merge($data['meta'],get_fields($post['ID']));
return $data;
}
if( function_exists('get_fields') ){
add_filter('json_prepare_post', 'wp_api_encode_acf', 10, 3);
}
<!--
Web Application with Backbone: BEGINNER TUTORIAL
Backbone.js is a very popular and light(weight) JavaScript library
for building Web Applications.
However, learning it I found frustratingly few simple examples of
true workable applications with all lines of code explained.
Here is my attempt to hack the popular Jerome Gravel-Niquet's Backbone Todo App
@owldesign
owldesign / gist:eb2bfe7569a51a61808d
Created January 16, 2015 00:11
ACF image field to display attachment_metadata for EXIF
/*
* format_value()
*
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
*
* @type filter
* @since 3.6
* @date 23/01/13
*
* @param $value (mixed) the value which was loaded from the database
@owldesign
owldesign / gist:3de9ccd58508e556bcfe
Created January 16, 2015 00:41
ACF gallery field to display attachment_metadata for EXIF
<?php
/*
* ACF Gallery Field Class
*
* All the logic for this field type
*
* @class acf_field_gallery
* @extends acf_field
* @package ACF
@owldesign
owldesign / gist:74bf0c13cfa59e1c3bbd
Created June 18, 2015 18:52
HTML5 Page Structure
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Your Website</title>
</head>
<body>
@owldesign
owldesign / samplecode.twig
Created November 17, 2015 01:57
Frontend Sample Code
{% if entry.selectForm != '0' %}
{% set form = craft.formBuilder2.getFormById(entry.selectForm) %}
{{ form |raw }}
{% endif %}
@owldesign
owldesign / inputplaceholder
Created January 6, 2016 22:44
IE9 Placeholder Fallback
//IE9 placeholder fallback
//credits http://www.hagenburger.net/BLOG/HTML5-Input-Placeholder-Fix-With-jQuery.html
if(!Modernizr.input.placeholder){
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
}
}).blur(function() {
var input = $(this);
@owldesign
owldesign / Check IE10
Created March 14, 2016 21:19
Web Detection Tools
<!--[if !IE]><!--><script>if(/*@cc_on!@*/false){document.documentElement.className+=' ie10';}</script><!--<![endif]-->
@owldesign
owldesign / states_hash.json
Created April 4, 2017 21:36 — forked from mshafrir/states_hash.json
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@owldesign
owldesign / gist:864c0127e18918ad64402744080af4ec
Created September 27, 2018 15:55
Craft CMS 3 Sending Mail through a plugin
use craft\mail\Message;
/**
* @param $html
* @param $subject
* @param null $mail
* @param array $attachments
* @return bool
*/
private function sendMail($html, $subject, $mail = null, array $attachments = array()): bool