Skip to content

Instantly share code, notes, and snippets.

View josephdickson's full-sized avatar
Coffee is for Committers!

Joseph Dickson josephdickson

Coffee is for Committers!
View GitHub Profile
@josephdickson
josephdickson / token.patch
Last active July 15, 2022 21:12
yearonly token patch
diff --git a/yearonly.module b/yearonly.module
index c3ad6f3..bc9bc33 100644
--- a/yearonly.module
+++ b/yearonly.module
@@ -28,3 +28,26 @@ function yearonly_help($route_name, RouteMatchInterface $route_match) {
return $output;
}
}
+
+/**
@josephdickson
josephdickson / info_patch.patch
Created July 1, 2022 18:14
Update current_content.info.yml to support Drupal 8+
diff --git a/current_content.info b/current_content.info
deleted file mode 100755
index ebafa1f..0000000
--- a/current_content.info
+++ /dev/null
@@ -1,6 +0,0 @@
-name = Current content
-description = A module that lists links to content created within the last week.
-
-core = 7.x
@josephdickson
josephdickson / index.php
Created November 5, 2019 22:55
WP dashboard notification sample for functions.php
// Place admin message about the Carousel Video and Carousel categories
function pz_carousel_admin_notice() {
if ( is_admin() ) {
if ( in_category('Carousel Video') ) {
$class = 'video-carousel-notice notice notice-info is-dismissible';
$message = __( 'Video Carousel posts are ordered by most recently updated to least. They display on the homepage', 'sample-text-domain' );
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}
if ( in_category('Carousel') ) {
<?php
/**
* @package jd-check-theme-activity
* @version 1.0
*/
/*
Plugin Name: Check Theme Activity
Plugin URI: https://joseph-dickson.com
Description: Dashboard widgets that display which themes are active.
@josephdickson
josephdickson / jd-check-plugin-activity.php
Last active August 12, 2019 22:17
WordPress Dashboard Widgets display active plugins on a site
<?php
/**
* @package jd-check-plugin-activity
* @version 1.0
*/
/*
Plugin Name: Check Plugin Activity
Plugin URI: https://joseph-dickson.com
Description: Dashboard widgets that display which plugins are active.
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
echo '<article>';
echo '<a href="' . get_permalink() . '">';
the_title( '<h2 class="entry-title">','</h2>' );
if (has_post_thumbnail() ) {
// get thumbnail id for use later
$thumbnail_id = get_post_thumbnail_id();
@josephdickson
josephdickson / post-page-user-log-in-required-twentynineteen
Last active April 29, 2019 17:34
Restirct WordPress post or page to logged in users
<?php
/**
* Single post and page template for restricting the title and content unless the user is logged in
* Sources:
* https://www.wpbeginner.com/wp-themes/create-custom-single-post-templates-for-specific-posts-or-sections-in-wordpress/
* https://codex.wordpress.org/Conditional_Tags
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package WordPress
@josephdickson
josephdickson / functions-example.php
Created October 18, 2018 22:10
Add to functions.php to customize font size options
<?php
add_action( 'wp_enqueue_scripts', 'twenty_seventeen_gutenberg_enqueue_styles' );
// Font size options
function mytheme_setup_theme_supported_features() {
add_theme_support( 'editor-font-sizes', array(
array(
'name' => __( 'extra small', 'themeLangDomain' ),
'shortName' => __( 'xs', 'themeLangDomain' ),
'size' => 10,
'slug' => 'extrasmall'