Skip to content

Instantly share code, notes, and snippets.

View MaruscaGabriel's full-sized avatar

Marusca Gabriel MaruscaGabriel

View GitHub Profile
@SJ-James
SJ-James / functions.php
Created January 3, 2018 11:39
Clear Local Storage Button For Divi
<?php
function ClearLocalCacheButton() { ?>
// Create Button
<a href="#" onclick="ClearLocalCache()" class="et-pb-layout-buttons et-pb-layout-buttons-cache" title="Clear Cache">
<span>Clear Cache</span>
</a>
<script type="text/javascript">
// Move Button to Divi Tabs
jQuery(window).load(function(){
@luizbills
luizbills / example.php
Created May 18, 2017 13:07
Google Tag Manager in Elementor Canvas
// please, replace the GTM-XXXX
add_action( 'wp_head', 'custom_add_google_tag_manager_head', 0 );
function custom_add_google_tag_manager_head () {
?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXX');</script>
@MaruscaGabriel
MaruscaGabriel / code.js
Last active November 5, 2021 01:42
DIVI theme JavaScript code snippets
//Open external links into new tab
<script type="text/javascript">
jQuery('a').filter(function () {
return this.hostname != window.location.hostname;
}).attr('target', '_blank');
</script>
//Adding Fly-in Animations To Any Divi Section, Row and Module
//thanks to Gino Quiroz : https://quiroz.co/adding-fly-in-animations-to-any-divi-module/
//Below are the CSS Class groups for each animation.
  1. Add class always-visitable to parent items you want to be visitable;

  2. Add this js code after the row if ( $(this).is(top_level_link) ) { :

if ($(this).parent().hasClass('always-visitable')) {
  $('<a class="hover-link"></div>')
    .attr('href', $(this).attr('href'))
    .on('click', function(e){ e.stopPropagation(); })
 .appendTo($(this));
@MaruscaGabriel
MaruscaGabriel / style.css
Last active April 5, 2017 17:00
DIVI theme CSS code snippets by https://marusca.design
/* hide top header on scroll by Geno Quiroz */
#top-header {
z-index: 9;}
#main-header{
transition: 0.5s;
-moz-transition: 0.5s;
-webkit-transition: 0.5s;}
#main-header.et-fixed-header {
top: 0 !important;}
@MaruscaGabriel
MaruscaGabriel / Hooks
Last active August 29, 2015 14:14
Genesis Post hooks 2.0 and Legacy
<?php
// HTML5 Hooks
add_action( 'genesis_entry_header', 'genesis_do_post_format_image', 4 );
add_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
add_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
add_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action( 'genesis_entry_header', 'genesis_post_info', 12 );
add_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
add_action( 'genesis_entry_content', 'genesis_do_post_content' );