Skip to content

Instantly share code, notes, and snippets.

@diggeddy
diggeddy / woo-cart-count-shortcode.php
Last active Oct 18, 2021
GP Woocommerce Cart Count Shortcode
View woo-cart-count-shortcode.php
function db_custom_cart_count() {
if ( ! class_exists( 'WooCommerce' ) ) {
return;
}
if ( ! isset( WC()->cart ) ) {
return;
}
@diggeddy
diggeddy / custom-loop-shortcode-gpp.php
Last active Oct 3, 2021
Custom Loop Shortcode for displaying a GPP Content Template
View custom-loop-shortcode-gpp.php
<?php
function db_custom_loop_shortcode($atts, $content = null) {
global $post;
// Set query args
$args = array(
'post_type' => 'post',
'posts_per_page' => '3',
'post__not_in' => array( $post->ID ), // don't display current post
);
// Optional arguments for setting category term relationship on single post
@diggeddy
diggeddy / Elementor - Check Radio button by default
Created Jan 2, 2018
Make a Elementor form radio button checked by default
View Elementor - Check Radio button by default
/*---- JavaScript Check radio button ------*/
/*---- change ElementID to match the ------*/
<script type="text/javascript">
window.onload = function check() {
document.getElementById("form-field-LABEL-#").checked = true;
}
</script>
@diggeddy
diggeddy / Register Custom Taxonomy for Element Cotnrols
Last active Sep 1, 2021
Add custom taxonomy specifically for GP Element Display Rules
View Register Custom Taxonomy for Element Cotnrols
<?php
/**
* Generate custom taxonomy for Element Display Rules
*
* Custom Taxonomy titled Element Controls on Posts and Pages
* Add your own Element Control Terms
* used solely for setting Element Display Rules
*/
function element_control_custom_tax() {
@diggeddy
diggeddy / castos-mega-menu-sprites.php
Last active Aug 29, 2021
Castos Mega Menu Builder with SVG Sprites
View castos-mega-menu-sprites.php
<?php
/**
* Castos Mega Menu Options page
* Purpose: store location of SVG Sprite and display preview of sprite symbols
* Retrieve sprite URL options with:
* $castos_mega_menu_options = get_option( 'castos_mega_menu_option_name' ); // Array of All Options
* $svg_sprite_url_0 = $castos_mega_menu_options['svg_sprite_url_0']; // SVG Sprite URL
*/
class CastosMegaMenu {
private $castos_mega_menu_options;
@diggeddy
diggeddy / castos-options.php
Last active Aug 27, 2021
Castos Options Page Example
View castos-options.php
<?php
// Options page for Castots Mega menu icons
class CastosMegaMenu {
private $castos_mega_menu_options;
public function __construct() {
add_action( 'admin_menu', array( $this, 'castos_mega_menu_add_plugin_page' ) );
add_action( 'admin_init', array( $this, 'castos_mega_menu_page_init' ) );
}
@diggeddy
diggeddy / Elementor Price Table Align Height
Created Nov 17, 2018
Force same height on all pricing tables in a row and push footer to bottom
View Elementor Price Table Align Height
.elementor-widget-price-table, .elementor-widget-price-table>div, .elementor-price-table {
height: 100%;
}
.elementor-price-table {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
@diggeddy
diggeddy / price-table-toggle.js
Last active Aug 17, 2021
Castos Monthly Annual Price Table Toggle JS
View price-table-toggle.js
/* Get Our Elements */
const starterPrice = document.querySelector('.starter-price');
const starterUom = document.querySelector('.starter-uom');
const growthPrice = document.querySelector('.growth-price');
const growthUom = document.querySelector('.growth-uom');
const proPrice = document.querySelector('.pro-price');
const proUom = document.querySelector('.pro-uom');
const btnMonthly = document.querySelector('.btn-monthly');
const btnAnnual = document.querySelector('.btn-annual');
const planDescription = document.querySelector('.plan-description');
@diggeddy
diggeddy / Elementor - Portfolio Filter Bar Hacks
Created Dec 22, 2017
Change the All filter title and re-order the filter bar
View Elementor - Portfolio Filter Bar Hacks
/* Elementor Portfolio Filter Bar Hacks */
/* Hack 1 - Change or hide the 'All' filter */
/* Hide the Elements visibility */
.elementor-portfolio__filters li:nth-child(1) {
visibility: hidden;
}
/* Add a different title in place of ALL */
@diggeddy
diggeddy / avery.html
Last active Jul 16, 2021
AveryHomePageHTML
View avery.html
<!-- wp:generateblocks/container {"uniqueId":"9d00a292","containerWidth":640,"paddingTop":"120","paddingRight":"20","paddingBottom":"180","paddingLeft":"20","paddingTopMobile":"100","paddingRightMobile":"20","paddingBottomMobile":"160","paddingLeftMobile":"20","backgroundColorOpacity":0.19,"gradient":true,"gradientDirection":270,"gradientColorOne":"#f1c1d2","gradientColorOneOpacity":1,"gradientColorStopOne":0,"gradientColorTwo":"#f4ddf8","gradientColorTwoOpacity":1,"gradientColorStopTwo":100,"bgImage":{"id":2583,"image":{"height":800,"width":1200,"url":"https://gpsites.co/avery/wp-content/uploads/sites/56/avery-1200x800.jpg","orientation":"landscape"}},"bgOptions":{"overlay":false,"position":"left top","size":"cover","repeat":"no-repeat","attachment":"","selector":"pseudo-element","opacity":0.7},"isDynamic":true} -->
<!-- wp:generateblocks/headline {"uniqueId":"0d1cf1d8","element":"h1","alignment":"center","backgroundColor":"","backgroundColorOpacity":0.2,"textColor":"#72727f","borderColor":"","borderColorOpa