Skip to content

Instantly share code, notes, and snippets.

View MWDelaney's full-sized avatar

Michael W. Delaney MWDelaney

View GitHub Profile
@MWDelaney
MWDelaney / App.php
Last active February 27, 2019 15:56
ACF Header Media
<?php
// app/Controllers/App.php
/**
* Set up header media from ACF or featured image
*/
public function headermedia()
{
// Initialize the return array
<?php
// Add facets
add_filter('facetwp_facets', function () {
// Video category checkboxes
$facets[] = array(
'label' => 'Video Category',
'name' => 'video_category',
'type' => 'radio',
"source" => "tax/category",
"parent_term" => "",
<?php
namespace App;
/**
* Set the Flexbox "order" of half the menu-items so that we can center the logo between them.
*/
add_action( 'wp_enqueue_scripts', function() {
// Get menu object
@MWDelaney
MWDelaney / facetwp.php
Last active February 17, 2020 13:03
Some `facetwp_pager_html` + bootstrap pagination hotness
<?php
namespace App;
add_filter( 'facetwp_pager_html', function( $output, $params ) {
$output = '<nav aria-label="Resources Pagination"><ul class="pagination mt-5">';
$page = $params['page'];
$i = 1;
$total_pages = $params['total_pages'];
$limit = ($total_pages >= 5) ? 3 : $total_pages;
$prev_disabled = ($params['page'] <= 1) ? 'disabled' : '';
$output .= '<li class="page-item ' . $prev_disabled . '"><a class="facetwp-page page-link" data-page="' . ($page - 1) . '">Prev</a></li>';
<?php
/**
* Set excerpt from ACF field
*/
add_action('acf/save_post', function($post_id) {
$post_excerpt = get_field( 'short_description', $post_id );
if ( ( !empty( $post_id ) ) AND ( $post_excerpt ) ) {
@MWDelaney
MWDelaney / wp_bootstrap4_navwalker.php
Created November 12, 2017 15:50
Bootstrap 4 navwalker for WordPress
<?php
/**
* Class Name: wp_bootstrap4_navwalker
* GitHub URI: https://github.com/twittem/wp-bootstrap-navwalker
* Description: A custom WordPress nav walker class to implement the Bootstrap 4 navigation style in a custom theme using the WordPress built in menu manager.
* Version: 2.0.4
* Author: Edward McIntyre - @twittem
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
<?php
namespace App;
/**
* WP Job Manager application form using Formidable or Formidable Pro
* Version: 1.0
* Requires: WP Job Manager, Formidable, Advanced Custom Fields Pro
* Author: Michael W. Delaney
*/
{{--
Template Name: Events
--}}
@extends('layouts.app')
@section('content')
<div id="tribe-events-pg-template">
<?php tribe_events_before_html(); ?>
<?php tribe_get_view(); ?>
@MWDelaney
MWDelaney / advanced-custom-fields.php
Last active February 20, 2019 14:51
Advanced Custom Fields drop-in functionality for Sage 9
<?php
namespace App;
/**
* Advanced Custom Fields drop-in functionality for Sage 9
* Version: 1.0
* Author: Michael W. Delaney
*/