Skip to content

Instantly share code, notes, and snippets.

@christianhanvey
christianhanvey / modx-snippets.php
Last active June 14, 2023 13:02
Useful snippets for MODX Revo
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
@elidickinson
elidickinson / max_width_email.html
Created May 6, 2013 15:10
Email Template trick: max-width with outlook
<!--[if mso]>
<center>
<table><tr><td width="580">
<![endif]-->
<div style="max-width:580px; margin:0 auto;">
<p>This text will be centered and constrained to 580 pixels even on Outlook which does not support max-width CSS</p>
</div>
<!--[if mso]>
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active April 2, 2024 02:45
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@AgelxNash
AgelxNash / plugin.LoadElement.php
Last active February 8, 2022 03:39
[MODX Evolution] Плагин загрузки элементов (чанков и сниппетов) из файлов
<?php
/**
* LoadElement
*
* Загрузка элементов из файлов
*
* @version 2.0.0
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
* @category plugin
* @author Agel Nash <modx@agel-nash.ru>
@nick2687
nick2687 / getPageFeed.php
Last active April 10, 2018 17:07
Simple modx snippet that will pull facebook page feed data and display it using a chunk
<?php
// Facebook App id & secret
$fb_app_id = isset($fb_app_id) ? $fb_app_id : NULL;
$fb_app_secret = isset($fb_app_secret) ? $fb_app_secret : NULL;
$access_token = $fb_app_id . '|' . $fb_app_secret;
// Other options
$page_id = isset($page_id) ? $page_id : NULL ;
$chunk = isset($chunk) ? $chunk : 'getPageFeedTpl' ;
@em-piguet
em-piguet / article2collections.sql
Created March 30, 2016 09:59
How to convert an MODX articles container to a MODX collections container...
# switch ArticlesContainer -> CollectionContainer
# the res. ID I want to migrate is 11
UPDATE `modx_site_content` SET `class_key` = replace(class_key, 'ArticlesContainer', 'CollectionContainer') WHERE id=11;
# switch class_key to go back to default document view for children
UPDATE `modx_site_content` SET `class_key` = replace(class_key, 'Article', 'modDocument') WHERE parent=11;
# Change template 49 -> 57
@CarsonBain
CarsonBain / shopify-line-item-props.md
Last active June 12, 2023 21:24
Adding Line Item Properties for Personalization to your Shopify Site

Adding line item properties for personalization to your Shopify site

For some products in your store, you may want to capture other form-like information from the customer such as custom monogram/engraving text or a choice of colour in which inventory doesn't need to be kept. These fields are called line item properties and can be used to allow customers to make choices or add information about a product.

This post will take you through how to add line item properties to a new product page template, as well as how to make the names of these new properties customizable by adding them as Theme Settings. By the end of this post, you will have a product page with custom required inputs for colour and an optional monogram that will look something like this:

Creating an alternate product page template