This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
/** | |
* Class NavWalker | |
* | |
* Bootstrap 4 walker with cleaner markup for wp_nav_menu() | |
* For use with Sage >= 8.5 | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if($page_builder) | |
@foreach ($page_builder as $block) | |
@include('partials/page-builder/'.$block->block_type) | |
@endforeach | |
@endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controllers; | |
use Sober\Controller\Controller; | |
use WP_Query; | |
class App extends Controller | |
{ | |
// Add all acf fields into the view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PhotoSwipe from 'photoswipe'; | |
import PhotoSwipeUI_Default from 'photoswipe/dist/photoswipe-ui-default'; | |
export default (selector) => { | |
const parseThumbnailElements = (element) => { | |
let items = []; | |
const thumbs = element.parentNode.querySelectorAll('figure'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$post = new WP_Query($args); | |
$counter = 0; | |
$start_el = '<div class="row">'; | |
$end_el = '</div><!-- .row -->'; | |
$item_per_row = 3; | |
if ( $post->have_posts() ) : | |
// Opening the first row | |
echo $start_el; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Paginate Advanced Custom Field repeater | |
*/ | |
if( get_query_var('page') ) { | |
$page = get_query_var( 'page' ); | |
} else { | |
$page = 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//BEGIN PROCESS THE FORM - NOTE $attributes global var is a merge of $_GET and $_POST - so the fields submitted in the form :); | |
if(empty($stripe_errors) && !empty($attributes['stripe_card_form_submitted'])){ | |
$customer_args = array( | |
'card' => $attributes['stripeToken'] | |
, 'description'=>trim($attributes['customer']['name']) . ';' . trim($attributes['customer']['email']) | |
, 'email'=>$attributes['customer']['email'] | |
); | |
//create a new customer | |
//ALWAYS create the customer record in the root application - NOT using the stripe connect access_token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function acf_add_local_field_group($array) { | |
// put absolute path to theme in here | |
$themePath = $_SERVER["DOCUMENT_ROOT"].'/wp-content/uploads/'; | |
$acfJsonPath = $themePath; | |
$output = json_encode($array); | |
echo '<p>Writing file to ' . $acfJsonPath . $array['key'] . '.json</p>'; | |
$file = file_put_contents( $acfJsonPath . $array['key'] . '.json', $output ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$geo = Wpengine\Geoip::instance(); | |
if($geo->country()=='RO') { | |
$country = 'Romania'; | |
} elseif($geo->country()=='UK') { | |
$country = 'United Kingdom'; | |
} elseif($geo->country()=='US') { | |
$country = 'United States'; | |
} |