Skip to content

Instantly share code, notes, and snippets.

View interplaydesign's full-sized avatar

interplaydesign

View GitHub Profile
/**
* Hotfix: load SkyVerge framework before Clover checkout script.
* Remove after updating Clover so it enqueues this itself.
*/
add_action('wp_enqueue_scripts', function () {
if (!function_exists('is_checkout') || !is_checkout()) return;
// Absolute path to the framework file you found:
$fw_path = WP_PLUGIN_DIR . '/woocommerce-gateway-firstdata/vendor/skyverge/wc-plugin-framework/woocommerce/payment-gateway/assets/dist/frontend/sv-wc-payment-gateway-pay>
@interplaydesign
interplaydesign / template-tags.php
Created March 16, 2021 16:13
Post navigation (next/previous) Custom Fuction
if ( ! function_exists( 'intro_post_navigation' ) ) :
/**
* Display navigation to next/previous post when applicable.
*
* @return void
*/
function intro_post_navigation() {
// Don't print empty markup if there's nowhere to navigate.
$intro_previous_attachment = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
$intro_next_attachment = get_adjacent_post( false, '', false );
@interplaydesign
interplaydesign / template-functions.php
Created March 16, 2021 16:09
wp_nav_menu_objects filter
/**
* Menu customizations
*/
add_filter('wp_nav_menu_objects', 'intro_nav_menu_objects', 10, 2);
function intro_nav_menu_objects( $items, $args ) {
//If our menu has the id primary-menu in the wp_nav_menu in our header.php
if ( $args->menu_id == 'primary-menu' ){
//var_dump( $items );
//For each item in the menu. the $item->ID is the menu item ID not the page/post ID
//The post id will be the $item->object_id if it is a post/page
@interplaydesign
interplaydesign / core-block-customizations.css
Created March 2, 2021 21:22
Block Customization Plugin 4 css/core-block-customizations.css
.is-style-fancy-quote {
font-size: 3rem;
font-style: italic;
}
/**
* Used to style our customizations or add CSS animations
*/
.is-style-fancy-paragraph {
font-size: 125%;
@interplaydesign
interplaydesign / core-block-customizations.js
Created March 2, 2021 21:20
Block Customization Plugin 3 js/core-block-customizations.js
/**
* Examples of registering custom styles for core blocks
* Can be targeted in our public javascript folder to add
* animation, elements, or svgs to it
*/
wp.blocks.registerBlockStyle( 'core/quote', {
name: 'fancy-quote',
label: 'Fancy Quote',
} );
@interplaydesign
interplaydesign / core-block-customizations-public.js
Created March 2, 2021 21:19
Block Customization Plugin 2 js/core-block-customizations-public.js
/**
* This is in the js folder in our plugin folder.
* This looks for our custom class that is added as a style option
* In this case that is .is-style-add-custom-element
*/
( function() {
var vectorOne = document.createElementNS("http://www.w3.org/2000/svg", "svg");
vectorOne.classList.add( 'vector-one' );
vectorOne.setAttribute("height", "100");
@interplaydesign
interplaydesign / int-core-block-customizations.php
Created March 2, 2021 21:16
Block Customization Plugin 1
<?php
/**
* Plugin Name: Core Block Customizations
* This file is in your plugin folder and the folder and this file must have the same name
**/
function icbc_enqueue() {
wp_enqueue_script(
'icbc-script',
@interplaydesign
interplaydesign / template-functions.php
Created February 5, 2021 17:47
PART of template-functions.php dealing with customizing our excerpt
/**
* Changes excerpt length
* @param integer $length the number of characters to show
* @return integer the number of characters to show
*/
function awd2_excerpt_length($length) {
return 35;
}
add_filter( 'excerpt_length', 'awd2_excerpt_length' );
@interplaydesign
interplaydesign / content-archive.php
Created February 5, 2021 17:10
Custom content part to be directly called for archive pages
<?php
/**
* Used for post content in archive loop
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package awd2
*/
?>
@interplaydesign
interplaydesign / navigation.js
Created January 26, 2021 20:18
Clickable submenu navigations
/**
* File navigation.js.
*
* Handles toggling the navigation menu for small screens and enables TAB key
* navigation support for dropdown menus.
*/
( function() {
const siteNavigation = document.getElementById( 'site-navigation' );
// Return early if the navigation don't exist.