Skip to content

Instantly share code, notes, and snippets.

@awakekat
awakekat / acf-nest-repeat.txt
Created September 19, 2016 02:20
Advanced Custom Fields - Nested Repeater
<?php if( have_rows('grade_repeat') ): ?>
<?php while ( have_rows('grade_repeat') ) : the_row(); ?>
<h3><?php the_sub_field('class_level'); ?></h3>
<?php if( have_rows('class_repeater') ): ?>
<?php while( have_rows('class_repeater') ): the_row(); ?>
@awakekat
awakekat / Gulp Jade Example
Created December 18, 2014 03:42
Example of Gulp Jade
//From http://stackoverflow.com/questions/25384796/can-i-set-gulp-livereload-to-run-after-all-files-are-compiled
var gulp = require('gulp');
var jade = require('gulp-jade');
var gutil = require('gulp-util');
var stylus = require('gulp-stylus');
var jeet = require('jeet');
var nib = require('nib');
var uglify = require('gulp-uglify');
var livereload = require('gulp-livereload');
@awakekat
awakekat / monthly-switch.txt
Created February 19, 2019 17:29
Monthly Elementor Shortcode Switch
<?php $month = date('F');
switch ($month) {
case "January":
echo do_shortcode('[INSERT_ELEMENTOR id="XXX"]');
break;
case "February":
echo do_shortcode('[INSERT_ELEMENTOR id="XXX"]');
break;
case "March":
@awakekat
awakekat / daily-switch.txt
Last active February 19, 2019 17:28
Elementor Daily shortcode switching
<?php $weekday = date('l');
switch ($weekday) {
case "Monday":
echo do_shortcode('[INSERT_ELEMENTOR id="XXX"]');
break;
case "Tuesday":
echo do_shortcode('[INSERT_ELEMENTOR id="XXX"]');
break;
case "Wednesday":
@awakekat
awakekat / custom_loop_1.txt
Last active February 17, 2019 20:13
Custom WP Dated Loop
<?php
/* Template Name: Front Page Template */
get_header(); ?>
<div id="primary" <?php astra_primary_class(); ?>>
<?php astra_primary_content_top(); ?>
<div style="background-color: #F2EBCB;padding:15px 15px 0 15px;">
<h3 style="text-align:center;padding-bottom:15px;text-weight:bold;">Upcoming Sunday Services:</h3>
<div style="display:flex;flex-direction:row;width:75%;margin:0 auto;">
<?php
@awakekat
awakekat / custom_loop_2.txt
Created February 17, 2019 20:12
Custom Dates WP Loop #2
<?php
/* Template Name: Services Template */
get_header(); ?>
<div id="primary" <?php astra_primary_class(); ?>>
<?php astra_primary_content_top(); ?>
<?php // CUSTOM SERVICES LOOP
$today = current_time('Ymd');
$args = array(
'post_type' => 'service',
/**
* Enqueue Parent and Child Styles
*/
function enqueue_styles() {
// enqueue parent styles
wp_enqueue_style('parent-theme', get_template_directory_uri() .'/style.css');
// enqueue child styles
@awakekat
awakekat / gist:27842b533bbd14de4a14123654d6a241
Created December 12, 2018 21:17
Address for Gutenberg Block code
https://webdevstudios.com/2018/12/11/advanced-custom-fields-and-gutenberg/
const { __, setLocaleData } = wp.i18n;
const { registerBlockType } = wp.blocks;
const blockStyle = {
backgroundColor: '#900',
color: '#fff',
padding: '20px',
};
setLocaleData( window.gutenberg_examples_01_esnext.localeData, 'gutenberg-examples' );
@awakekat
awakekat / Gutenburp blahk
Created December 12, 2018 21:14
Vanilla Gutenberg Block
/**
* vanilla-gutenberg-block.js
*
* Hello World: Step 1
*
* Simple block, renders and saves the same content without interactivity.
*
* Using inline styles - no external stylesheet needed. Not recommended
* because all of these styles will appear in `post_content`.
*/