Skip to content

Instantly share code, notes, and snippets.

Aaron Rutley AaronRutley

Block or report user

Report or block AaronRutley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 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:

View count-repeater.php
<?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 Apr 4, 2017
Save ACF Testimonials to post content
View ar_save_testimonials_to_content.php
<?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
View wp-api-custom-meta.php
<?php
function ar_register_project_meta() {
register_api_field(
'project',
'meta',
array(
'get_callback' => 'ar_register_project_meta_get',
)
);
}
View wp-api-custom-endpoint.php
<?php
function ar_custom_project_endpoint($data) {
$args = array(
'posts_per_page' => -1,
'offset' => 0,
'category' => '',
'category_name' => '',
'orderby' => 'title',
'order' => 'ASC',
View post_types.php
<?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',
View ar_responsive_image.php
<?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
View right.sh
## right time prompt
RPROMPT='[%t]'
View ig_gist.php
<?php
function ar_ig_get_photos() {
// set end point (json)
$endpoint = "https://api.instagram.com/v1/users/etc-json";
// Initiate curl
$ch = curl_init();
View wp-api-jquery-ajax.html
<!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 {
You can’t perform that action at this time.