Skip to content

Instantly share code, notes, and snippets.

View daniloparrajr's full-sized avatar
🏃‍♂️
Onward to good things!

Danilo Parra Jr daniloparrajr

🏃‍♂️
Onward to good things!
View GitHub Profile
.carousel-fade {
.carousel-inner {
.item {
transition-property: opacity;
}
.item,
.active.left,
.active.right {
opacity: 0;
::-webkit-input-placeholder { /* WebKit, Blink, Edge */
color:#fff;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #fff;
opacity: 1;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #fff;
opacity: 1;
/*--------------------------
* Simple Parallax script
*
* Usage: just add data-parallax="scroll" to the the element you want to have parallax effect
* make sure that the element has background-image and height dimension set.
* Example: <div data-parallax="scroll" style="background-image: url("path/to/img"); height: 300px;"></div>
--------------------------*/
var parallaxSection = document.querySelectorAll('[data-parallax="scroll"]');
//Set default style for the parallax element
parallaxSection.forEach(function(el,index,array) {
@daniloparrajr
daniloparrajr / carousel-fade.css
Created October 12, 2017 14:03
Boostrap Carousel 3.3x fade
@daniloparrajr
daniloparrajr / functions.php
Last active May 26, 2020 12:20
WordPress Google Fonts functions
<?php
/**
* Register custom fonts. Allow Translator to toggle google fonts on and off.
*/
function theme_slug_fonts_url() {
$fonts_url = '';
/*
* Translators: If there are characters in your language that are not
* supported by Sample Font and Sample Font, translate this to 'off'. Do not translate
* into your own language.
// Add Variation Custom fields
//Display Fields in admin on product edit screen
add_action( 'woocommerce_product_after_variable_attributes', 'woo_variable_fields', 10, 3 );
//Save variation fields values
add_action( 'woocommerce_save_product_variation', 'save_variation_fields', 10, 2 );
// Create new fields for variations
function woo_variable_fields( $loop, $variation_data, $variation ) {
@daniloparrajr
daniloparrajr / show-hide-select-option
Created December 7, 2017 01:56
show and hide select tag option depending on filter
var $selectTag = $('#selectTag');
var $selectOptions = $selectTag.find('option');
var $selectOptionsDetach = $('#selectTag option').detach();
// Only show the select option with the class of .option-filter-class
$selectTag.empty().append( $selectOptionsDetach.filter('.option-filter-class') );
@daniloparrajr
daniloparrajr / active-plugin.php
Created January 31, 2018 09:01
Check if plugin is active on theme
<?php
if ( in_array( {plugin/path/main-file.php}, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
// Your code here.
}
@daniloparrajr
daniloparrajr / shortcode.php
Created January 31, 2018 09:07
Adds new custom element to WPB Page builder
<?php
/**
* Shortcode Description here
*
* @param [array] $atts shortcode attributes.
* @param [string] $content shortcod contents.
* @return [string] html code of the shortcode.
*/
function prefix_shortcode_name_func( $atts, $content = null ) {
global $wpdb;
@daniloparrajr
daniloparrajr / functions.php
Created February 12, 2018 02:49
Woocommerce Remove logout confirmation
/**
* Bypass logout confirmation.
*/
function wc_bypass_logout_confirmation() {
global $wp;
if ( isset( $wp->query_vars['customer-logout'] ) ) {
wp_redirect( str_replace( '&amp;', '&', wp_logout_url( wc_get_page_permalink( 'myaccount' ) ) ) );
exit;
}