Skip to content

Instantly share code, notes, and snippets.

View AaronRutley's full-sized avatar

Aaron Rutley AaronRutley

  • Melbourne, Australia
View GitHub Profile
@AaronRutley
AaronRutley / keybase.md
Created July 19, 2017 06:31
keybase.md

Keybase proof

I hereby claim:

  • I am aaronrutley on github.
  • I am aaronrutley (https://keybase.io/aaronrutley) on keybase.
  • I have a public key ASBzb1uA4KUevirp6YyfU502POCLNUueKtrGegputpECMwo

To claim this, I am signing this object:

<?php
if (have_rows('my_repeater_field')) {
$mycounter = 0;
while (have_rows('my_repeater_field')) {
the_row();
$mycounter++;
echo $mycounter;
}
}
?>
@AaronRutley
AaronRutley / ar_save_testimonials_to_content.php
Last active December 30, 2020 14:48
Save ACF Testimonials to post content
<?php // Save ACF Testimonials to post content
function ar_save_testimonials_to_content( $post_id ) {
// Only run this code if we're on a particilar post / page
if( $post_id === 1234 ) {
// Start an output buffer
ob_start();
// Loop over our testimonials
<?php
function ar_register_project_meta() {
register_api_field(
'project',
'meta',
array(
'get_callback' => 'ar_register_project_meta_get',
)
);
}
<?php
function ar_custom_project_endpoint($data) {
$args = array(
'posts_per_page' => -1,
'offset' => 0,
'category' => '',
'category_name' => '',
'orderby' => 'title',
'order' => 'ASC',
<?php // Function Partial : Custom Post Types
add_action('init', 'turbo_custom_post_types');
// Register Custom Post Type
function turbo_custom_post_types() {
$types = array(
array(
'the_type' => 'work',
'single' => 'Work Item',
'plural' => 'Work Items',
@AaronRutley
AaronRutley / ar_responsive_image.php
Created December 31, 2015 23:21
ar_responsive_image
<?php
function ar_responsive_image($image_id,$image_size,$max_width){
// check the image ID is not blank
if($image_id != '') {
// set the default src image size
$image_src = wp_get_attachment_image_url( $image_id, $image_size );
// set the src set with various image sizes
$image_srcset = wp_get_attachment_image_srcset( $image_id, $image_size );
// generate the markup for the responsive image
@AaronRutley
AaronRutley / right.sh
Created November 11, 2015 01:56
right.sh
## right time prompt
RPROMPT='[%t]'
<?php
function ar_ig_get_photos() {
// set end point (json)
$endpoint = "https://api.instagram.com/v1/users/etc-json";
// Initiate curl
$ch = curl_init();
@AaronRutley
AaronRutley / wp-api-jquery-ajax.html
Created October 6, 2015 06:20 — forked from scottopolis/wp-api-jquery-ajax.html
Simple WP-API Ajax to get posts
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>My App</title>
<style type="text/css">
body {