Skip to content

Instantly share code, notes, and snippets.

View philgyford's full-sized avatar

Phil Gyford philgyford

View GitHub Profile
@philgyford
philgyford / article.html
Created March 15, 2019 16:17
Example of how to add a form to every instance of a type of Wagtail CMS Page, without having to manually build the page for each new page in the Admin
{% extends "base.html" %}
{% block content %}
<p>(Article content here.)</p>
<p>Send us your thoughts:</p>
<form action="{% pageurl page %}" method="POST">
{% csrf_token %}
@philgyford
philgyford / functions.php
Last active September 4, 2019 07:18
Sparkling WordPress theme, child
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
$parent_style = 'sparkling-style'; // This is 'sparkling-style' for the sparkling theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
@philgyford
philgyford / list-custom-taxonomy-widget.php
Last active November 28, 2020 15:42
A modified version of the WordPress List Custom Taxonomy Widget plugin, to enable limiting the number of items shown
<?php
/**
* Plugin Name: List Custom Taxonomy Widget
* Plugin URI: http://celloexpressions.com/plugins/list-custom-taxonomy-widget
* Description: Widget that displays category listings for custom post types (custom taxonomies).
* Version: 4.1
* Author: Nick Halsey
* Author URI: http://celloexpressions.com/
* Tags: custom taxonomy, custom tax, widget, sidebar, category, categories, taxonomy, custom category, custom categories, post types, custom post types, custom post type categories
* License: GPL
@philgyford
philgyford / admin.py
Created August 4, 2022 09:47
A quick Django blog app.
from ckeditor.widgets import CKEditorWidget
from django import forms
from django.contrib import admin
from django.db import models
from django.utils import timezone
from .models import Post
class PostAdminForm(forms.ModelForm):