Skip to content

Instantly share code, notes, and snippets.

☕️
Coffee is for Committers!

Joseph Dickson josephdickson

☕️
Coffee is for Committers!
Block or report user

Report or block josephdickson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View WordPress: Display post title, post thumbnail, and post excerpt
<?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 Apr 29, 2019
Restirct WordPress post or page to logged in users
View post-page-user-log-in-required-twentynineteen
<?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 Oct 18, 2018
Add to functions.php to customize font size options
View functions-example.php
<?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'
You can’t perform that action at this time.