Skip to content

Instantly share code, notes, and snippets.

View fourstacks's full-sized avatar

John Wyles fourstacks

View GitHub Profile
@fourstacks
fourstacks / TestCase.php
Created September 9, 2020 08:25
Example TestCase using Laravel 8 model factories
<?php
namespace Tests;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Str;
abstract class TestCase extends BaseTestCase
{
@fourstacks
fourstacks / Taxonomy.php
Last active January 6, 2023 03:15
Pulling in Yoast SEO meta for terms using Corcel
<?php
// This model simply inherits from the base Corcel Taxonomy model.
// It allows us to set our DB connection and also implement the
// ImportsTermSeo trait (see next file)
namespace App\Models\Corcel;
use App\Wordpress\ImportsTermSeo;
@fourstacks
fourstacks / gist:9806658
Created March 27, 2014 12:40
Mega menu using nested ACF repeaters/flex
<?php
// check parent repeater
if( have_rows('parent_navigation_items', 'options') ):
echo '<ul class="nav primary-header-nav">';
// loop parent items
while ( have_rows('parent_navigation_items', 'options') ) : the_row();
echo '<li>';
@fourstacks
fourstacks / gist:9806486
Last active August 29, 2015 13:57
Debug output of nested ACF fields
<pre>
Array
(
[0] => Array
(
[parent_link_text] => About Us
[parent_link] => WP_Post Object
(
[ID] => 6
[post_author] => 1
@fourstacks
fourstacks / gist:9366170
Created March 5, 2014 12:20
A .gitignore for wordpress
kudos to - http://bigwilliam.com/gitignore-for-wordpress-projects/
###############################################################################
## #
## GIT IGNORE FOR WORDPRESS SITES #
## ------------------------------ #
## By: BigWilliam <hello@bigwilliam.com> #
## License: MIT - aka you can use/modify this how you want :) #
## #
###############################################################################