Skip to content

Instantly share code, notes, and snippets.

View hans2103's full-sized avatar
🏠
Working from home

Hans Kuijpers hans2103

🏠
Working from home
View GitHub Profile
@hans2103
hans2103 / price.phtml M1.7
Last active December 17, 2015 15:59
Implementation of structured data itemprop=price on app/design/frontend/<your_package>/<your_theme>/template/catalog/product/price.phtml - Magento 1.7.0.2 - http://schema.org/Offer- more information: http://www.byte.nl/blog/magento-rich-snippets-made-easy/
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
<?php
/*
Author: Hans2103
credit: Jim Westergren, Jeedo Aquino & Flynsarmy
File: index-with-redis.php
Updated: 2013-05-27
This is a redis caching system for Wordpress based on Redis connection using PHPRedis.
https://github.com/nicolasff/phpredis
@hans2103
hans2103 / rediscacheinvalidation.php
Last active August 1, 2018 04:20
Script to invalidate Redis cache in Wordpress after adding new blog posts and such. To be used with https://gist.github.com/hans2103/5657621 where you already defined the connection information to Redis.
<?php
/*
Redis Cache invalidation
Author: Flynsarmy and modified by Hans2103
This is a Redis Cache invalidation script for Wordpress.
http://www.flynsarmy.com/2013/03/how-to-drastically-speed-up-wordpress-with-redis/
defined the connection credentials in wp-config.php
Add this piece of code to your theme functions.php or...
when using Roots theme add this as a file to the lib directory and call it from functions.php
@hans2103
hans2103 / robots.txt
Last active December 7, 2016 23:40
Magento robots.txt as published on our Byte blog Magento Robots.txt [http://www.byte.nl/blog/magento-robots-txt/]
# $Id: robots.txt,v magento-specific 2010/28/01 18:24:19 goba Exp $
# Edited: 2014/10/30 by Byte.nl
#
# robots.txt
#
# This file is to prevent the crawling and indexing of certain parts
# of your site by web crawlers and spiders run by sites like Yahoo!
# and Google. By telling these “robots” where not to go on your site,
# you save bandwidth and server resources.
#
@hans2103
hans2103 / dynamical-set-radio-button-in-RSForm
Created July 22, 2013 10:40
This piece of code can be used in Joomla extension RSForms! Pro. This piece of code will dynamical check a radio button depending on the last part of the URL you visit. Place this snippet in the field "items" of a Form Field type = "Radio Group". Example according to this snippet: visit URL http://example.com/path/to/last/element/product1 and it…
//<code>
$url = $_SERVER["REQUEST_URI"];
$tokens = explode('/', strtok($url, '?'));
$last_element = end(array_values($tokens));
$le = $last_element;
switch ($le) {
case 'product1':
$items = "item1[c]\nitem2\nitem3\nitem4\nitem5";
break;
@hans2103
hans2103 / agenda.php
Created July 24, 2013 09:42
Joomla layout override for menu item type = Category Blog. I'm using com_content as an event calendar showing the items grouped by month and by day. It's a copy from blog.php and on line 47 the override starts. A new array has been created to be able to group the items. (Thanks to @yireo for helping me with the creation of the new array) Using t…
<?php
/**
* @package Joomla.Site
* @subpackage com_content
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// no direct access
defined('_JEXEC') or die;
@hans2103
hans2103 / bundle-price.phtml M1.7
Last active December 23, 2015 04:09
Implementation of structured data itemprop=price on app/design/frontend/<your_package>/<your_theme>/template/bundle/catalog/product/price.phtml - Magento 1.7.0.2 - http://schema.org/Offer - more information: http://www.byte.nl/blog/magento-rich-snippets-made-easy/
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@hans2103
hans2103 / noindex.xml
Created October 21, 2013 10:45
Reduce Magento resources using meta tag robots. Copy to your version of local.xml
<!--
SET META ROBOTS
-->
<!--
Search pages
-->
<catalogsearch_result_index>
<reference name="head">
<action method="setRobots"><meta>NOINDEX,NOFOLLOW</meta></action>
</reference>
@hans2103
hans2103 / price.phtml M1.8
Last active December 29, 2015 02:49
Implementation of structured data itemprop=price on app/design/frontend/<your_package>/<your_theme>/template/catalog/product/price.phtml - Magento 1.8.0.0 - http://schema.org/Offer - more information: http://www.byte.nl/blog/magento-rich-snippets-made-easy/
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@hans2103
hans2103 / bundle-price.phtml M1.8
Last active December 29, 2015 07:49
Implementation of structured data itemprop=price on app/design/frontend/<your_package>/<your_theme>/template/bundle/catalog/product/price.phtml - Magento 1.8.1.0 - http://schema.org/Offer - more information: http://www.byte.nl/blog/magento-rich-snippets-made-easy/
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php