Skip to content

Instantly share code, notes, and snippets.

View KittenCodes's full-sized avatar

Phe Ledwell KittenCodes

View GitHub Profile
@KittenCodes
KittenCodes / A How To.txt
Created June 10, 2024 07:58
Modern Events Calendar with Oxygen Builder
Set up the Single Event template:
- Go to Oxygen > Templates and create a template applied to Singular > mec-events
- Copy the JSON from "single-event.json" and paste it into the +JSON box on the template
- You can then edit the template in Oxygen and move the items around as needed
Set up the Events Archive template:
- Go to Oxygen > Templates and create a template applied to Archive > Post Types > Events
- Copy the JSON from "event-archive.json" and paste it into the +JSON box on the template
@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;
<?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 / polylang_condition.php
Last active November 25, 2024 06:15
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',
@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">
@KittenCodes
KittenCodes / event_condition.php
Last active January 22, 2022 20:18
Formation PRH Event Condition
<?php
function my_check_published_posts($type) {
$post_id = get_the_ID();
$acf_relationship_field = get_field('associations_formations_enseignants_et_evenements', $post_id);
if (empty($acf_relationship_field)) {
return "false";
@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 / skip-spans.js
Last active June 29, 2021 19:13
Table of Contents - Skip Spans
jQuery(document).ready( function() {
// If we're in the builder, return and don't execute.
if( window.angular ) { return; }
// Skip spans
$("span").parent().attr("toc-skip", "1");
@KittenCodes
KittenCodes / close-modal-on-scroll.js
Created June 13, 2021 19:59
Close Modal when page scrolls
jQuery(document).ready(function() {
jQuery('a[href^="#"]').click(function() {
// smooth scroll
jQuery('html, body').animate({
scrollTop: $($.attr(this, 'href')).offset().top
}, 500);
// close modal
@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%;