Skip to content

Instantly share code, notes, and snippets.

View benwhit's full-sized avatar

Ben Whit benwhit

View GitHub Profile
function my_rest_prepare_post($data, $post, $request) {
$_data = $data->data;
$fields = get_fields($post->ID);
foreach ($fields as $key => $value){
$_data[$key] = get_field($key, $post->ID);
}
$data->data = $_data;
return $data;
@benwhit
benwhit / masonry.css
Last active June 24, 2018 22:10
Simple Vertical Masonry Bootstrap 4 Grid
/* highlight col-* */
.row [class*='col-'] {
background-color: #cceeee;
background-clip: content-box;
min-height: 120px;
margin-bottom: 30px;
}
.tall {
height: 160px;
@benwhit
benwhit / gulpfile.js
Last active May 31, 2017 03:51
Gulp + BrowserSync
var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync');
gulp.task('sass', function () {
gulp.src('scss/styles.scss')
.pipe(sass({includePaths: ['scss']}))
.pipe(gulp.dest('css'));
});
@benwhit
benwhit / wp-post-thumbnail.php
Last active June 24, 2018 22:12
Featured Image URL WordPress
<?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<div class="full-wd-header" style="background-image: url('<?php echo $image[0]; ?>')">
<?php the_title( '<h1 class="entry-title text-center">', '</h1>' ); ?>
</div>
<?php endif; ?>