Skip to content

Instantly share code, notes, and snippets.

Avatar

Darren Cooney dcooney

View GitHub Profile
View filter.php
<?php
// id: team_filter, key: category
add_filter('alm_filters_team_filter_category', function(){
// Define empty array
$values = [];
// Get all categories
$args = array(
'order' => 'ASC',
View update.js
/* Setup autocomplete.js sources */
var sources = [];
var suggestion_template = wp.template( config[ 'tmpl_suggestion' ] );
var sources = [{
source: algolia.autocomplete.sources.hits( client.initIndex( config[ 'index_name' ] ), {
hitsPerPage: config[ 'max_suggestions' ],
attributesToSnippet: [
'content:10'
],
highlightPreTag: '__ais-highlight__',
@dcooney
dcooney / excerpt.php
Last active Nov 28, 2021
Custom Excerpt
View excerpt.php
<?php
// Get custom excerpt
function alm_get_excerpt($limit = 40, $after = null) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
View front.js
jQuery( function( $ ) {
/**
* @typedef ezTOC
* @type {Object} ezTOC
* @property {string} affixSelector
* @property {string} scroll_offset
* @property {string} smooth_scroll
* @property {string} visibility_hide_by_default
*/
@dcooney
dcooney / single.php
Last active Oct 23, 2021
Generate Single Template
View single.php
<?php
/**
* The Template for displaying all single posts.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
get_header(); ?>
View css.css
@import url('https://use.typekit.net/oen5jod.css');
@tailwind base;
@tailwind components;
@tailwind utilities;
/* Default Template Styles Start */
body {
&.no-scroll {
@dcooney
dcooney / functions.php
Created Aug 16, 2021
ALM Filters - Default Archive Query
View functions.php
<?php
function my_alm_filter_query_args( $args ){
// Get the archive query object.
$queried_obj = get_queried_object();
// Confirm archive and query object is available.
if ( is_archive() && $queried_obj && isset( $queried_obj->taxonomy ) ) {
// The default taxonomy query.
View ajax-load-more.min.js
var ajaxloadmore=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=95)}([function(t,e,n){var r=n(1),o=n(7),a=n(15),i=n(12),s=n(18),l=function(t,e,n){var c,u,d,f,
View experimental-theme.json
{
"global":{
"settings":{
"color":{
"custom":false,
"customGradient":false,
"gradients":[],
"link":false,
"palette":[]
},
@dcooney
dcooney / content-single.php
Created Jan 16, 2021
GeneratePress Single Template
View content-single.php
<?php
/**
* The template for displaying single posts.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}