Skip to content

Instantly share code, notes, and snippets.

View yratof's full-sized avatar
🍊
Eating an orange

Andrew yratof

🍊
Eating an orange
View GitHub Profile
@yratof
yratof / icons.php
Created February 16, 2016 08:01
Using wpzoom icons with ACF
<!doctype html>
<html>
<head>
<title>WPZoom Icons</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<img src="symbols.svg" alt="defs not loaded"/>
<div class="glyph">
@yratof
yratof / f.php
Last active September 16, 2022 10:44
acf load json files and sync
<?php
function acf_fields() {
// Load field files dynamically
$field_files = glob( dirname(__FILE__) .'/acf-fields/*.json' );
foreach ( $field_files as $file ) {
if ( apply_filters( 'midsona_allow_acf_file', true, $file ) ) {
$json = json_decode( file_get_contents( $file ), true );
$json[0]['local'] = 'json';
// $json[] =
acf_add_local_field_group( $json[0] );
@yratof
yratof / config.txt
Created February 9, 2016 14:31
tidyhtml config file
write-back: yes
output-html: yes
join-classes: no
logical-emphasis: no
doctype: auto
drop-empty-paras: no
fix-uri: no
literal-attributes: no
merge-divs: no
numeric-entities: no
// Scaling Variables
$golden: 1.618;
$minor-second: 1.067;
$major-second: 1.125;
$minor-third: 1.2;
$major-third: 1.25;
$perfect-fourth: 1.333;
$augmented-fourth: 1.414;
$perfect-fifth: 1.5;
$minor-sixth: 1.6;
@yratof
yratof / front-page.php
Created January 29, 2016 14:45
Advanced custom fields with Wordpress 4.4 SRCSET
<div class="product__images">
<?php
$image = get_field('billboard_featured_image');
if( !empty( $image ) ) {?>
<img <?php acf_srcset( $image['id'], 'medium', '480px' ); ?> alt="<?php echo $image['alt']; ?>" />
<?php
} else if( has_post_thumbnail() ) {
the_post_thumbnail( 'medium' );
}
?>
@yratof
yratof / script.js
Created January 29, 2016 09:34
Close Foundation dropdown when you click outside of the element
// Close the dropdown when we click anything other than the dropdown
$(document).on('click', function(event) {
// If we click outside of this element...
if (!$(event.target).closest('.dropdown-container').length) {
// ...then use Foundation to trigger the dropdown close
Foundation.libs.dropdown.close($('#dropdown'));
}
});
@yratof
yratof / jquery_remove_spaces.js
Created January 28, 2016 09:21
Remove spaces
jQuery( document ).ready( function( $ ) {
$( ".price" ).each( function() {
var $this = $( this );
$this.html( $this.html().replace( /&nbsp;/g, '' ) );
} );
});
@yratof
yratof / remove-products.php
Created January 19, 2016 14:54
Remove products that are not needed. stupid products.
<?php
if ( 'supersecret' == @$_GET['supersecret']) {
add_action( 'wp_footer', function() {
$ids = [2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511, 2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, 2554, 2555, 2556, 2557, 2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567, 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585, 2586, 2587, 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2595, 2596, 2597, 2598, 2599, 2600, 2601, 2602, 2603, 2604, 2605, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631, 2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639,
@yratof
yratof / map.php
Created January 18, 2016 14:26
ACF Google map with styles
<?php $location = get_field('location'); if( !empty($location) ): ?>
<div class="acf-map" style="width: 100%; height: 100%; position: absolute; left: 0; top: 0;">
<div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>"></div>
</div>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript">
(function(e){function t(t){
var i=t.find(".marker");
@yratof
yratof / iframe-container.html
Created January 18, 2016 10:43
Change the colours of an iframe when you don't have access to any css
<!--[if IE]>
<style>
.iframe--blend{
background-color: #fffdf3;
}
</style>
<![endif]-->
<style>
#iframe {