Skip to content

Instantly share code, notes, and snippets.

@wpflames
wpflames / app.js
Last active November 30, 2020 11:47
AJAX request for a TXT file - Write text in a specific div
var btn = document.getElementById('button');
btn.addEventListener('click', loadText);
function loadText(){
//Create XHR Object
var xhr = new XMLHttpRequest();
//OPEN - type, url/file, async
@wpflames
wpflames / app.js
Created November 30, 2020 17:56
AJAX request for JSON file (local) - Single
var btn1 = document.getElementById('button1');
btn1.addEventListener('click', loadUser);
// REQUEST SINGLE USER'S DATA
function loadUser(){
var xhr = new XMLHttpRequest();
xhr.open('GET', 'assets/json/user.json', true);
xhr.onload = function(){
@wpflames
wpflames / app.js
Created November 30, 2020 17:58
AJAX request for JSON file (local) - Array
var btn2 = document.getElementById('button2');
btn2.addEventListener('click', loadUsers);
//REQUEST ALL USERS DATA
function loadUsers(){
var xhr = new XMLHttpRequest();
xhr.open('GET', 'assets/json/users.json', true);
xhr.onload = function(){
@wpflames
wpflames / functions.php
Created January 13, 2021 09:36
Remove Storefront Page Title
<?php
// =========================================================================
// REMOVE STOREFRONT PAGE TITLE
// =========================================================================
function remove_storefront_actions() {
// SINGLE POST
// =================================
remove_action( 'storefront_single_post', 'storefront_post_header', 10);
@wpflames
wpflames / functions.php
Created January 14, 2021 17:20
Facebook Likebox to Genesis
<?php
// =========================================================================
// FACEBOOK SDK
// =========================================================================
function add_facebook_sdk(){
include('lib/facebook-sdk.php');
}
add_action('genesis_before', 'add_facebook_sdk');
// =========================================================================
@wpflames
wpflames / functions.php
Last active January 17, 2021 14:12
Featured image
<?php
// =========================================================================
// CUSTOM IMAGE SIZE
// =========================================================================
add_image_size( 'grid-img', 700, 368, true );
// =========================================================================
// FEATURED IMAGE INSIDE THE LOOP
// =========================================================================
@wpflames
wpflames / functions.php
Last active January 20, 2021 06:17
Remove sidebar from checkout page in Storefront
<?php
// =========================================================================
// REMOVE STOREFRONT SIDEBAR FROM PRODUCT, CART AND CHECKOUT PAGE
// =========================================================================
function remove_storefront_sidebar() {
if( is_checkout() || is_cart() || is_product()) {
remove_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 );
add_filter( 'body_class', function( $classes ) {
return array_merge( $classes, array( 'page-template-template-fullwidth page-template-template-fullwidth-php ' ) );
@wpflames
wpflames / functions.php
Created January 25, 2021 13:36
Hide Storefront Homepage Title
<?php
// =========================================================================
// HIDE STOREFRONT HOMEPAGE TITLE
// =========================================================================
function storefront_remove_title_from_home_homepage_template() {
if ( is_front_page() ) remove_action( 'storefront_page', 'storefront_page_header', 10 );
}
add_action( 'wp', 'storefront_remove_title_from_home_homepage_template' );
@wpflames
wpflames / style.scss
Created January 25, 2021 17:07
Sticky footer in Storefront
/* Sticky Footer
/************************************/
.site {
display:flex;
flex-direction:column;
min-height:100vh;
}
.site-content {
flex:1;
width: 100%;
@wpflames
wpflames / social.html
Created January 25, 2021 17:55
Social Icons
<ul class="social">
<li>
<a href="">
<svg data-icon="facebook" height="30" aria-hidden="true" focusable="false" data-prefix="fab" class="fa-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M400 32H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h137.25V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.27c-30.81 0-40.42 19.12-40.42 38.73V256h68.78l-11 71.69h-57.78V480H400a48 48 0 0 0 48-48V80a48 48 0 0 0-48-48z"></path></svg>
</a>
</li>
<li>
<a href="">
<svg data-icon="instagram" height="30" aria-hidden="true" focusable="false" data-prefix="fab" class="fa-instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74