View index.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') ) { |
View jd-check-theme-activity.php
<?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. |
View jd-check-plugin-activity.php
<?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. |
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(); |
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 |
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' |