Skip to content

Instantly share code, notes, and snippets.

View KittenCodes's full-sized avatar

Phe Simmonds KittenCodes

View GitHub Profile
@KittenCodes
KittenCodes / framework.css
Last active May 7, 2024 18:22
Basic CSS Grid Framework
/* these root values can be adjusted. You can then use them in Oxygen like this: var(-gap-xs) */
:root {
/* Gap */
--gap-xs: 4px;
--gap-s: 8px;
--gap-m: 16px;
--gap-l: 32px;
--gap-xl: 64px;
@KittenCodes
KittenCodes / polylang_condition.php
Last active October 4, 2023 00:02
Language Conditions for Oxygen
<?php
if( function_exists('oxygen_vsb_register_condition') && function_exists('pll_languages_list') ) {
$lang_list = pll_languages_list();
oxygen_vsb_register_condition(
//Condition Name
'Locale',
<?php
// Get the terms for the current post, using the Director taxonomy
$post_terms = get_the_terms( get_the_ID(), 'director' );
// If there are terms
if ($post_terms) {
// Create an empty array to add links to
$terms_list = array();
@KittenCodes
KittenCodes / code_Block_Above_Repeater_CSS.css
Last active March 22, 2023 19:00
Get images from ACF gallery in a Oxygen Repeater when the datasource is an ACF Repeater and add a lightbox to the Gallery
/*
* Add this to the CSS tab of the Code Block ABOVE the Repeater:
*/
.thumbnail img {
box-sizing: border-box;
border: 1px solid #ddd;
padding: 2px;
margin: 0 1% 15px 0;
width: 32.6667%;
@KittenCodes
KittenCodes / tippy.js
Created September 19, 2020 07:32
Tippy JavaScript
document.addEventListener("DOMContentLoaded", function() {
tippy('[data-tippy-content]', {
animation: 'shift-away',
});
})
@KittenCodes
KittenCodes / tippy.html
Created September 19, 2020 07:31
Tippy PHP & HTML
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script src="https://unpkg.com/tippy.js@6"></script>
<link
rel="stylesheet"
href="https://unpkg.com/tippy.js@6/animations/shift-away.css"
/>
@KittenCodes
KittenCodes / animate-waypoints.css
Last active February 11, 2023 06:16
jQuery for using Animate CSS & Waypoints JS with Oxygen
/* Add this to a stylesheet via Manage > Stylesheets in the top right of the builder */
.wp-embed-responsive .cssAnimate {
opacity: 0;
}
@KittenCodes
KittenCodes / updatestockprice.md
Last active January 30, 2023 06:39
Update WooCommerce Price & Stock levels with WP All Import

Update WooCommerce price & stock levels with WP All Import

You will need an import file that contains the new stock value, price information and the variation SKU. For this process to work correctly, your products will need to have unique SKUs.

  1. Create an "Existing Items" import to WooCommerce Products: https://d.pr/i/c5daMc
  2. On Step 3 of the import process, leave the Product Type set to Simple, add the new price information to the General tab (https://d.pr/i/P6XQhC) and the new stock value to the Inventory tab: https://d.pr/i/iN9S5t
  3. On Step 4 of the import process, select to match on the custom field _sku and add the SKU element from your import file: https://d.pr/i/7EwWTl
  4. Also on Step 4, select to update the custom fields _price, _regular_price, _sale_price, _stock and _manage_stock only: https://d.pr/i/c1iZm7
@KittenCodes
KittenCodes / shapeDividerHeight.js
Created September 5, 2021 06:58
Change the height of Oxygen's Shape Dividers on scroll
var ready = (callback) => {
if (document.readyState != 'loading') callback();
else document.addEventListener('DOMContentLoaded', callback);
}
ready ( () => {
if (window.angular) { return; }
calcHeight();
})
@KittenCodes
KittenCodes / wooco_parent_cats.php
Created February 4, 2022 19:12
PHP to show WooCo Parent Categories only
<?php
$terms = get_terms(['taxonomy' => 'product_cat', 'hide_empty' => false, 'parent' => 0]);
if ($terms)
{ ?>
<div id="-woo-product-categories-3-137" class="oxy-woo-product-categories oxy-woo-element">
<div class="woocommerce columns-4">
<ul class="products columns-4">