Skip to content

Instantly share code, notes, and snippets.

View djcowan's full-sized avatar

djcowan djcowan

View GitHub Profile
@djcowan
djcowan / laravel_valet_setup.md
Created April 25, 2024 06:41 — forked from bradtraversy/laravel_valet_setup.md
Laravel Valet install on mac

Laravel Valet Setup (Mac)

This will get you setup with Laravel & Valet on your Mac. Quentin Watt has a good video tutorial on getting setup here as well

Install Homebrew

Go to https://brew.sh/ and copy the command and run in your terminal

It will be something like this...

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@djcowan
djcowan / example-wp-list-table.php
Created March 31, 2024 05:40 — forked from paulund/example-wp-list-table.php
An example code of using the WP_List_Table class. With Pagination.
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
@djcowan
djcowan / function.php
Created February 23, 2024 08:08 — forked from mattclements/function.php
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
<?php
# SHORTS
# DIRECTORY SEPARATOR
define( 'DS', DIRECTORY_SEPARATOR );
# PATH SEPARATOR
define( 'PS', PATH_SEPARATOR );
# Absolute path to the WordPress directory.
! defined( 'ABSPATH' )
AND define( 'ABSPATH', dirname( __FILE__ ).DS );
@djcowan
djcowan / wp-config.php
Created August 30, 2023 23:32 — forked from MikeNGarrett/wp-config.php
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@djcowan
djcowan / font-stacks.css
Created November 10, 2022 03:12 — forked from don1138/font-stacks.css
CSS Modern Font Stacks
/* Modern Font Stacks */
/* System */
font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
/* System (Bootstrap 5.2.0) */
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
/* Times New Roman-based serif */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
@djcowan
djcowan / ajax-search-form.liquid
Created December 14, 2021 02:27 — forked from atikju/ajax-search-form.liquid
Shopify Ajax Search
{% comment %}
This file can be added as a snippet and add it anywhere you want to display
{% endcomment %}
<div id="pageheader">
<div class="util-area">
<div class="search-box">
<form class="search-form" action="/search" method="get" _lpchecked="1">
<i class="icon-mag"></i>
<input type="text" name="q" placeholder="Search" autocomplete="off">
<input type="submit" value="→">
@djcowan
djcowan / wpmudev-forminator-send-input-ajax-request.php
Created November 19, 2021 10:58 — forked from wpmudev-sls/wpmudev-forminator-send-input-ajax-request.php
[Forminator Pro] - Make an AJAX request upon an input
<?php
/**
* Plugin Name: [Forminator Pro] - Make an AJAX request upon an input
* Plugin URI: https://premium.wpmudev.org/
* Description: Send an AJAX request when an input is filled (as of 1.11.3)
* Author: Alessandro Kaounas @ WPMUDEV
* Author URI: https://premium.wpmudev.org/
* Task: 0/1135022585412927/1164144055767340
* License: GPLv2 or later
*/
<?php
class ClassRegistry {
/**
* @var array The store for all objects
*/
private array $store = [];
/**
@djcowan
djcowan / functions.php
Created December 1, 2019 00:42 — forked from corsonr/functions.php
Display WooCommerce product variations dropdown select on the shop page
<?php
// Display variations dropdowns on shop page for variable products
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' );
function woo_display_variation_dropdown_on_shop_page() {
global $product;
if( $product->is_type( 'variable' )) {