Skip to content

Instantly share code, notes, and snippets.

@bigin
bigin / init_itemmanager.php
Last active October 20, 2017 10:29
Init ItemManager
// Get instance of the ItemManager class
$imanager = imanager();
$category = $imanager->getCategory('slug=my-category-slug');
// or
$category = $imanager->getCategory('name=My Category Name');
// or
$category = $imanager->getCategory('position=2');
// etc
$categoryMapper = $imanager->getCategoryMapper();
@bigin
bigin / catalog.php
Last active February 12, 2017 16:05
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Basic catalog skeleton :: Categories</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="<?php get_theme_url(); ?>/css/normalize.css">
<link rel="stylesheet" href="<?php get_theme_url(); ?>/css/skeleton.css">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Basic catalog skeleton :: Products</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="<?php get_theme_url(); ?>/css/normalize.css">
<?php
/**
* setlocale — Set locale information (numeric formatting information)
*
* Change that depending on your country
*
*/
setlocale(LC_MONETARY, 'de_DE');
@bigin
bigin / 0_reuse_code.js
Created August 16, 2016 08:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 template</title>
<link rel="stylesheet" href="<?php get_theme_url(); ?>/css/styles.css">
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<div id="main-wrapper">
<h1>[[page_title]]</h1>
<div class="content-wrapper">
<div class="content">
[[page_content]]
</div>
</div>
<div class="sidebar">
[[page_sidebar]]
</div>
<?php
/**
* Renders the current page content involving the HTML
* markup defined in the chunk field.
*
* NOTE: If you have multiple categories with different
* fields, you'll need to extend the function accordingly.
* Or create a separate rendering function for each category.
*
* @param $slug - The page slug that should be rendered