Skip to content

Instantly share code, notes, and snippets.

View Firestorm-Graphics's full-sized avatar

Firestorm Graphics Firestorm-Graphics

View GitHub Profile
@Firestorm-Graphics
Firestorm-Graphics / functions.php
Created August 21, 2017 07:56 — forked from yojance/functions.php
Removing a Product From The Cart Programatically In WooCommerce
<?php
add_action( 'template_redirect', 'remove_product_from_cart' );
function remove_product_from_cart() {
// Run only in the Cart or Checkout Page
if( is_cart() || is_checkout() ) {
// Set the product ID to remove
$prod_to_remove = 56;
// Cycle through each product in the cart
foreach( WC()->cart->cart_contents as $prod_in_cart ) {
@Firestorm-Graphics
Firestorm-Graphics / Autoloader.php
Last active February 6, 2021 22:46 — forked from Nilpo/Autoloader.php
A simple recursive PHP autoloader using the RecursiveDirectoryIterator.
<?php
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Rob Dunham
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
@Firestorm-Graphics
Firestorm-Graphics / example.html
Last active August 7, 2016 20:18 — forked from kylebarrow/example.html
Prevent links in standalone web apps opening Mobile Safari
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* plugin.js
*
* Copyright, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
<?php
add_theme_support('menus');
/*
http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus(array(
'top-bar-l' => 'Left Top Bar', // registers the menu in the WordPress admin menu editor
'top-bar-r' => 'Right Top Bar'
));
@Firestorm-Graphics
Firestorm-Graphics / gist:2959626
Created June 20, 2012 12:17 — forked from retlehs/gist:2785401
Display YouTube thumbnail from embed URL
<?php
/**
* Display a thumbnail from YouTube based off the embed code saved in the
* video post format metabox used by the CF Post Formats plugin
*
* @link https://github.com/crowdfavorite/wp-post-formats
* @link http://stackoverflow.com/a/6382259
*/
global $post;
@Firestorm-Graphics
Firestorm-Graphics / sidebar_select.php
Created June 11, 2012 21:53 — forked from c3mdigital/sidebar_select.php
Sidebar Select Meta Box for cmb_meta_boxes
<?php
/**
* Adds a new sidebar_select field type to CMB Metaboxes
*
* Builds the select box from all registered sidebars.
* Use in themes to create per page or post layout options without having to create new templates
*
* @see https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress.git
*
*/
@Firestorm-Graphics
Firestorm-Graphics / EmptyWidget.php
Created June 8, 2012 01:22 — forked from jonathonbyrdziak/CustomWidgetFile.php
Plugin code to create a single widget in wordpress.
<?php
/**
* @package RedRokk
* @version 1.0.0
*
* Plugin Name: Empty Widget
* Description: Single Widget Class handles all of the widget responsibility, all that you need to do is create the html. Just use Find/Replace on the Empty_Widget keyword to rebrand this class for your needs.
* Author: RedRokk Interactive Media
* Version: 1.0.0
* Author URI: http://www.redrokk.com
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(