Skip to content

Instantly share code, notes, and snippets.

View DanielSantoro's full-sized avatar

Danny Santoro DanielSantoro

View GitHub Profile
@DanielSantoro
DanielSantoro / generator.php
Created May 4, 2020 18:10
Random Generator - Pulls from CSV
<?php
<div class="generator">
<span class="generator-output">
<?php
$sep=","; // separator
$project=file("https://example.com/csv/array.csv");
$project_row=rand(0,count($project)-1);
$project_data=explode($sep,$project[$project_row]);
$project_num = count ($project_data);
@DanielSantoro
DanielSantoro / example.txt
Created June 6, 2019 01:57
Redirect to subfolder
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?twigandolivephotography.com$
RewriteCond %{REQUEST_URI} !^/site/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site/$1
RewriteCond %{HTTP_HOST} ^(www.)?twigandolivephotography.com$
RewriteRule ^(/)?$ site/index.html [L]
@DanielSantoro
DanielSantoro / rewrite.txt
Created October 24, 2018 14:08
Apache Rewrite - Special Characters
# Trying to rewrite:
# https://www.plm.automation.siemens.com/en/about_us/success/case_study.cfm?Component=232169&ComponentTemplate=1481
# to
# https://www.plm.automation.siemens.com/global/en/our-story/customers/wkidea/16678/
#
RewriteCond %{QUERY_STRING} (^|&)Component=232169($|&)
RewriteCond %{QUERY_STRING} (^|&)ComponentTemplate=1481($|&)
RewriteRule ^en/about_us/success/case_study\.cfm$ /global/en/our-story/customers/wkidea/16678/? [L,R=301]
/* This would be added to the element, which in this case is .example-banner */
.example-banner {
background: #50c1c1; /* Old browsers, defaults to solid blue */
background: -moz-linear-gradient(left, #50c1c1 0%, #109cc5 100%); /* FireFox v3.6-15 */
background: -webkit-linear-gradient(left, #50c1c1 0%,#109cc5 100%); /* Chrome v0-25, Safari v5.1-6 */
background: linear-gradient(to right, #50c1c1 0%,#109cc5 100%); /* W3C, IE v10+, FireFox v16+, Chrome v26+, Opera v12+, Safari v7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#50c1c1', endColorstr='#109cc5',GradientType=1 ); /* IE v6-9 */
}
@DanielSantoro
DanielSantoro / form-header.html
Created September 13, 2018 12:41
Form Header
<form id="CreateCommon" name="CreateCommon" action="DigitalExchangeCreateUserCommon" method="post">
@DanielSantoro
DanielSantoro / functions.php
Created February 19, 2018 17:07
Add Theme Support for Thumbnail Regeneration
<?php // Don't include this line
add_theme_support( 'woocommerce', array(
'thumbnail_image_width' => 150,
'single_image_width' => 322,
) );
@DanielSantoro
DanielSantoro / functions.php
Created December 18, 2017 18:03
Add CSS to Admin side
<?php
add_action('admin_head', 'custom_admin_css');
function custom_admin_css() {
echo '<style>
#the-list tr.status-wc-cancelled {
background-color: #FCACAC;
}
#the-list tr.status-wc-completed {
@DanielSantoro
DanielSantoro / functions.php
Created December 12, 2017 17:23
Change Variable Product price to only display minimum price
<?php // DO NOT COPY THIS LINE - START COPYING AT LINE 3 AND BELOW
/**
* Change Variable Product price range to only display minimum price
*/
function variable_price_display_change( $price, $product ) {
$min_price_regular = $product->get_variation_regular_price( 'min', true );
$min_price_sale = $product->get_variation_sale_price( 'min', true );
$max_price = $product->get_variation_price( 'max', true );
@DanielSantoro
DanielSantoro / functions.php
Last active December 12, 2017 17:25
Change Variable Price from Range to "From:"
<?php //Do not insert this line
/**
* Change Variable Product price range to "From:"
*/
function variable_price_display_change( $price, $product ) {
$prefix = sprintf('%s: ', __('From'));
$min_price_regular = $product->get_variation_regular_price( 'min', true );
@DanielSantoro
DanielSantoro / functions.php
Last active December 5, 2017 15:42
Redirect Thank You Page
<?php
/**
* Redirects Thank You page after checkout in WooCommerce
*/
add_action( 'template_redirect', 'wc_redirect_post_checkout' );
function wc_redirect_post_checkout() {
global $wp;