Skip to content

Instantly share code, notes, and snippets.

View Magnacarter's full-sized avatar

Adam Carter Magnacarter

  • React and WordPress Dev
  • United States
View GitHub Profile
@Magnacarter
Magnacarter / class-widget-custom-fields.php
Created December 1, 2017 22:30
Implement custom-fields library class
<?php
/**
* Widget custom fields class
*
* Extends Custom_Fields class
*
* @since 1.0.0
* @author Stellar Blue Technologies
* @licence GNU-2.0+
*/
@Magnacarter
Magnacarter / class-custom-field.php
Created December 1, 2017 22:28
Custom Field Library
<?php
/**
* Custom Field
*
* Parent class defines custom fields and then builds
* arrays to assign custom fields
*
* @since 1.0.0
* @author Stellar Blue Technologies
* @licence GNU-2.0+
@Magnacarter
Magnacarter / cpt.php
Last active December 1, 2017 22:06
Dynamic CPT's and Taxonomies
<?php
/**
* Class Post Type Builder
*/
class Post_Type_Builder {
/**
* var $instance
*/
@Magnacarter
Magnacarter / .gitignore
Created October 11, 2017 19:08
Marks Media .gitignore
########################################################
# MarksMedia .gitignore for Client Sites - Version 1.0 #
########################################################
### This file should be placed in the site's root dir
# WordPress & Hosting Provider #
/index.php
/wp-*.php
/db-config.php
@Magnacarter
Magnacarter / map.php
Created September 1, 2017 22:15
Map all imported card to one array
<?php
/**
* Class Map
*/
class Map {
/**
* Map all cards
*
* if multiple cards from multiple plugins exist, return an array
@Magnacarter
Magnacarter / import-ezrecipe.php
Last active September 1, 2017 22:09
Import recipe cards from Easy Recipe plugin
<?php
/**
* Find recipes
*
* determine what posts have Easy Recipe recipe cards and place the
* post and id in an array
*
* key = to post ID; value = all post content
*
* @return array $recipe_posts
@Magnacarter
Magnacarter / script.js
Created September 1, 2017 22:03
Build an object from custom fields
/**
* saveWorkout
*
* @returns {Array}
*/
var saveWorkout = function() {
var workout = [],
els = document.getElementsByClassName( 'day-exercises' );
for ( var i = 0; i < els.length; i++ ) {
@Magnacarter
Magnacarter / recipe-array.php
Created June 1, 2017 18:56
EZ Recipe Import Data
<?php
array (
15 =>
array (
'isEasyRecipe' => true,
'recipeVersion' => '3.5.3226',
'isFormatted' => false,
'recipeIX' => 0,
'name' => 'Turkey Dinner',
'cuisine' => 'American',
@Magnacarter
Magnacarter / condition.js
Last active March 14, 2017 20:44
TeamTreehouse Conditional Challenge Solution
var question1 = prompt("Who is POSTUS?");
var question2 = prompt("How many senators are there?");
var question3 = prompt("How many braches of gov are there?");
var question4 = prompt("Who is the vice prez?");
var question5 = prompt("Who has the house majority?");
var answer1 = "Trump";
var anwser2 = "50";
var answer3 = "3";
var answer4 = "Pence";
@Magnacarter
Magnacarter / page.php
Last active February 14, 2017 04:07
Display three sections for a standard WordPress page template
<?php
/**
* Front Page
*/
global $post;
$h1_title = get_the_title( $post->ID );
$args = array(
'post_type' => 'menu' //or your cpt name
);