Skip to content

Instantly share code, notes, and snippets.

Avatar
🐌
Exploring the code is like life itself.

Ion Iacob ioniacob

🐌
Exploring the code is like life itself.
View GitHub Profile
View Simple-Backbone-WordPress-Example.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Simple Backbone WordPress Example</title>
<link rel="stylesheet" href="base.css">
</head>
<body>
<ul id="post-list"></ul>
@ioniacob
ioniacob / ViewController.swift
Created Feb 7, 2018 — forked from nicktesla2011/ViewController.swift
WKWebView View Controller for Xcode 9.0/Swift 4/iOS11
View ViewController.swift
//
// ViewController.swift
// Honk
//
// Created by Nick Gressle on 9/23/17.
// Copyright © 2017 nick gressle illustrations llc. All rights reserved.
//
import UIKit
import WebKit
@ioniacob
ioniacob / woocommerce-optimize-scripts.php
Created Feb 4, 2018 — forked from DevinWalker/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
View woocommerce-optimize-scripts.php
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@ioniacob
ioniacob / gist:c7dd4254292c18506aee05704419d6d8
Created Nov 11, 2016 — forked from corsonr/gist:7839908
Automatically add product to cart on visit - WooCommerce
View gist:c7dd4254292c18506aee05704419d6d8
/*
* Add item to cart on visit
*/
function add_product_to_cart() {
if ( ! is_admin() ) {
global $woocommerce;
$product_id = 64;
$found = false;
//check if product already in cart
if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) {
@ioniacob
ioniacob / gist:9d767cff4553767948d15cfda9da6189
Created Oct 22, 2016 — forked from growdev/gist:4074021
WooCommerce - Remove the "Related Products" section from a template by removing the related posts query arguments.
View gist:9d767cff4553767948d15cfda9da6189
<?php
/*
* wc_remove_related_products
*
* Clear the query arguments for related products so none show.
* Add this code to your theme functions.php file.
*/
function wc_remove_related_products( $args ) {
return array();
}
View custom-my-account-endpoint.php
<?php
class My_Custom_My_Account_Endpoint {
/**
* Custom endpoint name.
*
* @var string
*/
public static $endpoint = 'my-custom-endpoint';
@ioniacob
ioniacob / functions.php
Created Oct 18, 2016 — forked from kloon/functions.php
WooCommerce 2.1 Add confirm password field on My Account register form
View functions.php
<?php
// Add the code below to your theme's functions.php file to add a confirm password field on the register form under My Accounts.
add_filter('woocommerce_registration_errors', 'registration_errors_validation', 10,3);
function registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) {
global $woocommerce;
extract( $_POST );
if ( strcmp( $password, $password2 ) !== 0 ) {
return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) );
}
@ioniacob
ioniacob / gist:e1d558fc8308849dc3defe47cbb653fb
Created Oct 18, 2016 — forked from kloon/gist:2376300
WooCommerce Automatically add product to cart on site visit
View gist:e1d558fc8308849dc3defe47cbb653fb
/*
* goes in theme functions.php or a custom plugin
**/
// add item to cart on visit
add_action( 'template_redirect', 'add_product_to_cart' );
function add_product_to_cart() {
if ( ! is_admin() ) {
$product_id = 64;
$found = false;
//check if product already in cart
@ioniacob
ioniacob / gist:1badc5718549786e7f6de77a3fbb99cf
Created Oct 18, 2016 — forked from woogist/gist:5934881
Automatically add product to cart on visit depending on cart total value
View gist:1badc5718549786e7f6de77a3fbb99cf
/*
* goes in theme functions.php or a custom plugin
**/
// add item to cart on visit depending on cart total value
add_action( 'init', 'add_product_to_cart' );
function add_product_to_cart() {
if ( ! is_admin() ) {
global $woocommerce;
$product_id = 2831;
$found = false;
@ioniacob
ioniacob / Add user to list after click on link
Created Sep 29, 2016 — forked from evrpress/Add user to list after click on link
Assigns a subscriber to a certain list if a certain link has been clicked
View Add user to list after click on link