Skip to content

Instantly share code, notes, and snippets.

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

masiorama

🏠
Working from home
View GitHub Profile
@masiorama
masiorama / craft-cms-entries-by-category-group.twig
Created February 9, 2016 17:21
Craft CMS: Getting entries grouped by category in order of the category type drag & drop order.
{# Get the categories related to my "entrySection" entries in structure order #}
{% set entries = craft.entries.section('entrySection') %}
{% set relatedCats = craft.categories.relatedTo(entries) %}
{# Loop the categories #}
{% for category in relatedCats %}
{{ category.title }}
{# Get and loop through entries related to this cat #}
@masiorama
masiorama / gist:5126058
Created March 9, 2013 22:32 — forked from donovan-duplessis/gist:3245252
HTML: load js from CDN with local fallback
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write("<script src='js/libs/jquery-1.7.2.min.js'>\x3C/script>")</script>
@masiorama
masiorama / wp-query-ref.php
Created January 7, 2013 14:21 — forked from luetkemj/wp-query-ref.php
PHP: WP query reference
<?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(