Skip to content

Instantly share code, notes, and snippets.

MrJoshFisher / Addto.phtml
Last active Aug 29, 2015
Magneto Disable Shopping Cart With Attribute
View Addto.phtml
//Checks if the "Disable Add to Cart" variable is set to 'Yes':
if(($_product->getAttributeText('no_sample_button')) == "Yes"){
//If set to Yes, tell PHP what to output:
} else {
View class_fb_backlink_checker.php
MrJoshFisher / Show RRP Price & Sale Price In Cart
Created Jul 17, 2017
Shows the RRP Price / Sale Price on the cart page in the table.
View Show RRP Price & Sale Price In Cart
add_filter( 'woocommerce_cart_item_price', 'bbloomer_change_cart_table_price_display', 30, 3 );
function bbloomer_change_cart_table_price_display( $price, $values, $cart_item_key ) {
$slashed_price = $values['data']->get_price_html();
$is_on_sale = $values['data']->is_on_sale();
if ( $is_on_sale ) {
$price = $slashed_price;
return $price;
MrJoshFisher / functions.php
Last active Dec 12, 2020
#WordPress Compression PHP - FLHM_HTML_Compression
View functions.php
class FLHM_HTML_Compression{
protected $flhm_compress_css = true;
protected $flhm_compress_js = true;
protected $flhm_info_comment = true;
protected $flhm_remove_comments = true;
protected $html;
public function __construct($html){
if (!empty($html)){
MrJoshFisher /
Created Dec 12, 2020
[Bash Foreach] #bash
for f in $FILES
echo $f
ffmpeg -i "$f" "${f%%.*}.mp3"
MrJoshFisher /
Created Dec 12, 2020
[Beautiful Soup] #bs4
# Ratings Scraper
# Watches the house price on screetons.
from bs4 import BeautifulSoup
from datetime import datetime
import requests
import re
MrJoshFisher /
Created Dec 12, 2020
[Selenium] #selenium
import os
import urllib
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from import Options
chrome_options = Options()
MrJoshFisher / index.php
Created Dec 12, 2020
[ukvehicledata] UK Vehicle Data PHP Curl Example
View index.php
$curl = curl_init();
$ApiKey = "<APIKEY>";
$postedcarreg = '<CARREG>';
$carreg = $postedcarreg;
$datatype = "VehicleData";
$url = "";
$url = sprintf($url, $datatype , $carreg, $ApiKey); // Syntax: sprintf($url, "PackageName", "VRM", ApiKey);
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
MrJoshFisher / functions.php
Created Dec 12, 2020
[WordPress Post Type] #WordPress Post Type
View functions.php
function testimonial_post_type() {
// Labels
$labels = array(
'name' => _x("Testimonials", "post type general name"),
'singular_name' => _x("Testimonial", "post type singular name"),
'menu_name' => 'Testimonials',
'add_new' => _x("Add New", "testimonial item"),
'add_new_item' => __("Add New Testimonial"),
'edit_item' => __("Edit Testimonial"),
MrJoshFisher / .htacess
Created Dec 12, 2020
[Rewrite URLS to File] #htaccess
View .htacess
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"
RewriteRule ^page-1$ page.php?area=1
RewriteRule ^page-2$ page.php?area=1